123
Fork of LG by
Device.h
- Committer:
- Diletant
- Date:
- 2016-05-09
- Revision:
- 156:e68ee0bcdcda
- Parent:
- 149:abbf7663d27d
- Child:
- 161:efd949e8d536
File content as of revision 156:e68ee0bcdcda:
#ifndef __DEVICE_H__ #define __DEVICE_H__ #define DEV_BOARD_HAOYU #ifdef DEV_BOARD_HAOYU #warning "Program config: development board!!!" #endif #include "LPC17xx.h" #include "system_LPC17xx.h" #include "DeviceController.h" #include "DeviceSettings.h" #include "DeviceDAC.h" #include "DeviceProtocol.h" //#include "DeviceTimers.h" //#include "DeviceServicePort.h" //#include "DeviceHostPort.h" #include "DeviceCounters.h" #include "DeviceLightUp.h" #include "DevicePhotoDetector.h" #include "DeviceDither.h" #include "DevicePLCS.h" typedef enum _DeviceLatchMode { DeviceLatch10kHz, //internal latch by pulses 10 kHz (power on default mode) DeviceLatchMeander, //internal latch by signed meander pulses (not used?) DeviceLatchRS422, //external latch by RS422 request DeviceLatchPin //external latch by hardware pin request } DeviceLatchMode; typedef enum _DeviceLatchFormat { DeviceLatchFormatDeltaPS, //latch data in DELTA_PS response format DeviceLatchFormatDeltaBINS, //latch data in DELTA_BINS response format DeviceLatchFormatDeltaSF //latch data in DELTA_SF response format } DeviceLatchFormat; typedef struct _DeviceLatchState { uint8_t ready; DeviceLatchMode mode; //latch source DeviceLatchFormat format; //data to latch uint8_t reset; //set to reset counters on each latch (default), clear to keep (DELTA_SF) } DeviceLatchState; typedef enum _DeviceCountingSource { DeviceCountingSourceReference, //Accumulate pulses using reference +/- counters as source DeviceCountingSourceDither, //Accumulate pulses using dither counters as source } DeviceCountingSource; typedef struct _DeviceHFOState { uint8_t loop; //Output signal amplitude loop switch: 1 - on/0 - off } DeviceHFOState; typedef struct _DeviceReceiverState { } DeviceReceiverState; typedef struct _DeviceTransmitterState { uint8_t position; //Output buffer transmission position } DeviceTransmitterState; typedef struct _Host { DeviceReceiverState receiver; DeviceTransmitterState transmitter; DeviceProtocolDecoder decoder; DeviceProtocolEncoder encoder; DeviceRequest request; DeviceResponse response; } Host; typedef struct _Service { char buffer[512]; DeviceReceiverState receiver; DeviceTransmitterState transmitter; } Service; typedef struct _DeviceMeasurementCycle { uint32_t length; //Measurement cycle length uint32_t counter; //Measurement cycle counter } DeviceMeasurementCycle; typedef struct _DeviceRegularCycle { uint32_t event1Hz; uint32_t event500Hz; uint32_t event1K; uint32_t event10K; uint32_t event100K; uint32_t time100K; uint32_t time10K; uint32_t time1K; uint32_t time500Hz; uint32_t time1Hz; } DeviceRegularCycle; typedef struct _DeviceDitherRegulator { uint8_t oscillationFrequencyLoop; uint8_t outputFrequencyLoop; } DeviceDitherRegulator; typedef struct _Device { //Settings DeviceSettings settings; //Measurement cycle DeviceMeasurementCycle measurement; //Control cycle DeviceRegularCycle regular; //Controller DeviceController controller; //Peripherals Host host; //Host communication asynchronous serial port Service service; //Service communication asynchronous serial port DeviceDAC dac; //DAC of hfo & plcs //Counting DeviceLatchState latch; DeviceCounters counters; //Units DevicePhotoDetector detector; DeviceLightUp lightUp; DeviceDither dither; DevicePathLengthControlSystem plcs; //Regulators DeviceHFOState hfo; DeviceDitherRegulator ditherRegulator; } Device; typedef struct _HashParam { uint32_t hash; void * ref; uint32_t size; } HashParam; #define HASH_PARAM_COUNT 29 typedef struct _HashFunc { uint32_t hash; void * ref; uint32_t resultSize; uint32_t paramCount; } HashFunc; #define HASH_FUNC_COUNT 3 void InitDevice(void); void DeviceStart(void); void DeviceInitAllWithDefaults(void); void DeviceInitAll(void); void DeviceRegularEvent1Hz(void); void DeviceRegularEvent500Hz(void); void DeviceRegularEvent1KHz(void); void DeviceRegularEvent10KHz(void); void DeviceRegularEvent100KHz(void); void DeviceMeasurementInterruptHandler(void); void DeviceRegularInterruptHandler(void); #endif /* __DEVICE_H__ */