123

Dependencies:   mbed

Fork of LG by igor Apu

DeviceDither.h

Committer:
Diletant
Date:
2016-05-03
Revision:
149:abbf7663d27d
Child:
156:e68ee0bcdcda

File content as of revision 149:abbf7663d27d:

#ifndef __DEVICE_DITHER_H__
#define __DEVICE_DITHER_H__

typedef struct _DeviceDitherSettings {
  uint32_t rise;
  uint32_t fall;
  uint8_t enabled;                  //dither on/off
  uint8_t oscillationFrequencyLoop;
  uint8_t outputFrequencyLoop;
} DeviceDitherSettings;

typedef struct _DeviceDitherState {
  uint32_t inPeriodCounter;         //low resolution counter - 32 counts per period, zeroed every dither period
  uint32_t counter100kHz;           //high (10 mks)resolution counter, zeroed at each dither half period
  uint32_t rise;                    //rising edge position in high resolution ticks
  uint32_t fall;                    //falling edge position in high resolution ticks
  uint8_t enabled;                  //dither on/off
  uint8_t pin1;                     //pin 1 state
  uint8_t pin2;                     //pin 2 state
  uint8_t oscillationFrequencyLoop;
  uint8_t outputFrequencyLoop;
} DeviceDitherState;

typedef struct _DeviceDither {
  DeviceDitherSettings settings;
  DeviceDitherState state;
} DeviceDither;

void InitDitherWithDefaults(void);
void InitDither(void);
void StartDither(void);
void DitherCycle(void);

#endif  /* __DEVICE_DITHER_H__ */