123
Fork of LG by
Device.h@82:82d7073d36ef, 2016-03-21 (annotated)
- Committer:
- Diletant
- Date:
- Mon Mar 21 13:29:41 2016 +0000
- Revision:
- 82:82d7073d36ef
- Parent:
- 78:0ea9d02b7b46
- Child:
- 137:14a0c452cf32
Device&settings&protocol update. Not final!!!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Diletant | 74:f4d9c3403578 | 1 | #ifndef __DEVICE_H__ |
Diletant | 74:f4d9c3403578 | 2 | #define __DEVICE_H__ |
Diletant | 74:f4d9c3403578 | 3 | |
Diletant | 74:f4d9c3403578 | 4 | #include "DeviceSettings.h" |
Diletant | 74:f4d9c3403578 | 5 | #include "DeviceProtocol.h" |
Diletant | 78:0ea9d02b7b46 | 6 | #include "DeviceUART.h" |
Diletant | 74:f4d9c3403578 | 7 | |
Diletant | 74:f4d9c3403578 | 8 | typedef enum _DeviceLatchMode { |
Diletant | 82:82d7073d36ef | 9 | DeviceLatch10kHz, //internal latch by pulses 10 kHz (power on default mode) |
Diletant | 82:82d7073d36ef | 10 | DeviceLatchMeander, //internal latch by signed meander pulses (not used?) |
Diletant | 82:82d7073d36ef | 11 | DeviceLatchRS422, //external latch by RS422 request |
Diletant | 82:82d7073d36ef | 12 | DeviceLatchPin //external latch by hardware pin request |
Diletant | 74:f4d9c3403578 | 13 | } DeviceLatchMode; |
Diletant | 74:f4d9c3403578 | 14 | |
Diletant | 77:8d582faecf6b | 15 | typedef enum _DeviceLatchFormat { |
Diletant | 82:82d7073d36ef | 16 | DeviceLatchFormatDeltaPS, //latch data in DELTA_PS response format |
Diletant | 82:82d7073d36ef | 17 | DeviceLatchFormatDeltaBINS, //latch data in DELTA_BINS response format |
Diletant | 82:82d7073d36ef | 18 | DeviceLatchFormatDeltaSF //latch data in DELTA_SF response format |
Diletant | 77:8d582faecf6b | 19 | } DeviceLatchFormat; |
Diletant | 74:f4d9c3403578 | 20 | |
Diletant | 74:f4d9c3403578 | 21 | typedef struct _DeviceLatchState { |
Diletant | 82:82d7073d36ef | 22 | uint8_t ready; |
Diletant | 82:82d7073d36ef | 23 | DeviceLatchMode mode; //latch source |
Diletant | 82:82d7073d36ef | 24 | DeviceLatchFormat format; //data to latch |
Diletant | 82:82d7073d36ef | 25 | uint8_t reset; //set to reset counters on each latch (default), clear to keep (DELTA_SF) |
Diletant | 74:f4d9c3403578 | 26 | } DeviceLatchState; |
Diletant | 74:f4d9c3403578 | 27 | |
Diletant | 82:82d7073d36ef | 28 | typedef enum _DeviceCountingSource { |
Diletant | 82:82d7073d36ef | 29 | DeviceCountingSourceReference, //Accumulate pulses using reference +/- counters as source |
Diletant | 82:82d7073d36ef | 30 | DeviceCountingSourceDither, //Accumulate pulses using dither counters as source |
Diletant | 82:82d7073d36ef | 31 | } DeviceCountingSource; |
Diletant | 82:82d7073d36ef | 32 | |
Diletant | 74:f4d9c3403578 | 33 | typedef struct _DeviceCountersState { |
Diletant | 82:82d7073d36ef | 34 | DeviceCountingSource source; //Pulses source: reference/dither |
Diletant | 82:82d7073d36ef | 35 | uint8_t filter; //Moving average filter switch: 0 - off/1 - on |
Diletant | 74:f4d9c3403578 | 36 | } DeviceCountersState; |
Diletant | 74:f4d9c3403578 | 37 | |
Diletant | 77:8d582faecf6b | 38 | typedef struct _DevicePhotoDetectorState { |
Diletant | 77:8d582faecf6b | 39 | |
Diletant | 77:8d582faecf6b | 40 | } DevicePhotoDetectorState; |
Diletant | 77:8d582faecf6b | 41 | |
Diletant | 77:8d582faecf6b | 42 | typedef struct _DeviceLightUpState { |
Diletant | 77:8d582faecf6b | 43 | |
Diletant | 77:8d582faecf6b | 44 | } DeviceLightUpState; |
Diletant | 77:8d582faecf6b | 45 | |
Diletant | 77:8d582faecf6b | 46 | typedef struct _DeviceHFOState { |
Diletant | 82:82d7073d36ef | 47 | uint8_t loop; //Output signal amplitude loop switch: 1 - on/0 - off |
Diletant | 77:8d582faecf6b | 48 | } DeviceHFOState; |
Diletant | 77:8d582faecf6b | 49 | |
Diletant | 77:8d582faecf6b | 50 | typedef struct _DevicePLCSState { |
Diletant | 82:82d7073d36ef | 51 | uint8_t loop; //Path length control system loop switch: 1 - on/0 - off |
Diletant | 82:82d7073d36ef | 52 | uint8_t modulator; //Path length control system modulator switch: 1 - on/0 - off |
Diletant | 77:8d582faecf6b | 53 | } DevicePLCSState; |
Diletant | 77:8d582faecf6b | 54 | |
Diletant | 77:8d582faecf6b | 55 | typedef struct _DeviceDitherState { |
Diletant | 82:82d7073d36ef | 56 | uint8_t outputFrequencyLoop; //Output signal amplitude loop switch: 1 - on/0 - off |
Diletant | 82:82d7073d36ef | 57 | uint8_t oscillationFrequencyLoop; //Output signal amplitude loop switch: 1 - on/0 - off |
Diletant | 77:8d582faecf6b | 58 | } DeviceDitherState; |
Diletant | 77:8d582faecf6b | 59 | |
Diletant | 74:f4d9c3403578 | 60 | typedef struct _Device { |
Diletant | 77:8d582faecf6b | 61 | //Settings |
Diletant | 74:f4d9c3403578 | 62 | DeviceSettings settings; |
Diletant | 77:8d582faecf6b | 63 | //Communication |
Diletant | 78:0ea9d02b7b46 | 64 | DeviceUARTState uart; |
Diletant | 74:f4d9c3403578 | 65 | DeviceRequest request; |
Diletant | 74:f4d9c3403578 | 66 | DeviceResponse response; |
Diletant | 74:f4d9c3403578 | 67 | DeviceProtocolDecoder decoder; |
Diletant | 74:f4d9c3403578 | 68 | DeviceProtocolEncoder encoder; |
Diletant | 77:8d582faecf6b | 69 | //Counting |
Diletant | 77:8d582faecf6b | 70 | DeviceLatchState latch; |
Diletant | 74:f4d9c3403578 | 71 | DeviceCountersState counters; |
Diletant | 77:8d582faecf6b | 72 | //Regulators |
Diletant | 77:8d582faecf6b | 73 | DevicePhotoDetectorState detector; |
Diletant | 77:8d582faecf6b | 74 | DeviceLightUpState lightUp; |
Diletant | 77:8d582faecf6b | 75 | DeviceHFOState hfo; |
Diletant | 77:8d582faecf6b | 76 | DevicePLCSState plcs; |
Diletant | 77:8d582faecf6b | 77 | DeviceDitherState dither; |
Diletant | 74:f4d9c3403578 | 78 | } Device; |
Diletant | 74:f4d9c3403578 | 79 | |
Diletant | 74:f4d9c3403578 | 80 | #endif /* __DEVICE_H__ */ |