libraries / Mitov / Mitov_BinaryGenerators.hon commit Added link to project report (97a3ba0)
   1////////////////////////////////////////////////////////////////////////////////
   2//                                                                            //
   3//     This software is supplied under the terms of a license agreement or    //
   4//     nondisclosure agreement with Mitov Software and may not be copied      //
   5//     or disclosed except in accordance with the terms of that agreement.    //
   6//         Copyright(c) 2002-2016 Mitov Software. All Rights Reserved.        //
   7//                                                                            //
   8////////////////////////////////////////////////////////////////////////////////
   9
  10#ifndef _MITOV_BINARY_GENERATORS_h
  11#define _MITOV_BINARY_GENERATORS_h
  12
  13#include <Mitov.h>
  14
  15namespace Mitov
  16{
  17        class PulseGenerator : public Mitov::CommonGenerator
  18        {
  19                typedef Mitov::CommonGenerator inherited;
  20
  21        public:
  22                bool    InitialValue = false;
  23
  24        protected:
  25                virtual void CalculateFields() override
  26                {
  27                        FPeriod = ( (( 1 / ( Frequency * 2 )) * 1000000 ) + 0.5 ); // 2 times one for each switch
  28                }
  29
  30        protected:
  31                virtual void Clock() override
  32                {
  33                        InitialValue = !InitialValue;
  34                        OutputPin.Notify( &InitialValue );
  35                }
  36                
  37                virtual void SystemInit() override
  38                {
  39                        inherited::SystemInit();
  40
  41                        OutputPin.Notify( &InitialValue );
  42                }
  43
  44        };
  45//---------------------------------------------------------------------------
  46}
  47
  48#endif