Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of LGstaandart by
DevicePLCS.h@166:c3c0b8a90d81, 2016-05-22 (annotated)
- Committer:
- Diletant
- Date:
- Sun May 22 18:59:20 2016 +0000
- Revision:
- 166:c3c0b8a90d81
- Parent:
- 161:efd949e8d536
- Child:
- 167:bedc0a9d559a
Device & ... update. Not final!!!
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Diletant | 149:abbf7663d27d | 1 | #ifndef __DEVICE_PLCS_H__ |
| Diletant | 149:abbf7663d27d | 2 | #define __DEVICE_PLCS_H__ |
| Diletant | 149:abbf7663d27d | 3 | |
| Diletant | 166:c3c0b8a90d81 | 4 | //Path length control system sequencer typedefs |
| Diletant | 166:c3c0b8a90d81 | 5 | typedef struct _DevicePLCSSequencerSettings { |
| Diletant | 166:c3c0b8a90d81 | 6 | uint8_t enabled; //Enable sequence generation |
| Diletant | 166:c3c0b8a90d81 | 7 | uint8_t voltage; //Modulate voltage output |
| Diletant | 166:c3c0b8a90d81 | 8 | uint8_t io; //Modulate GPIO pin |
| Diletant | 166:c3c0b8a90d81 | 9 | uint32_t sequence[64]; //Generator sequence |
| Diletant | 166:c3c0b8a90d81 | 10 | } DevicePLCSSequencerSettings; |
| Diletant | 166:c3c0b8a90d81 | 11 | |
| Diletant | 166:c3c0b8a90d81 | 12 | typedef struct _DevicePLCSSequencerState { |
| Diletant | 166:c3c0b8a90d81 | 13 | uint8_t enabled; //Enable sequence generation |
| Diletant | 166:c3c0b8a90d81 | 14 | uint8_t counter; //Sequence counter: sequence position = device.measurement.counter + device.measurement.length * device.plcs.sequencer.counter |
| Diletant | 166:c3c0b8a90d81 | 15 | uint8_t voltage; //Modulate voltage output |
| Diletant | 166:c3c0b8a90d81 | 16 | uint8_t io; //Modulate GPIO pin |
| Diletant | 166:c3c0b8a90d81 | 17 | } DevicePLCSSequencerState; |
| Diletant | 166:c3c0b8a90d81 | 18 | |
| Diletant | 166:c3c0b8a90d81 | 19 | typedef struct _DevicePLCSSequencer { |
| Diletant | 166:c3c0b8a90d81 | 20 | DevicePLCSSequencerSettings settings; |
| Diletant | 166:c3c0b8a90d81 | 21 | DevicePLCSSequencerState state; |
| Diletant | 166:c3c0b8a90d81 | 22 | } DevicePLCSSequencer; |
| Diletant | 166:c3c0b8a90d81 | 23 | |
| Diletant | 166:c3c0b8a90d81 | 24 | //Path length control system input ( = ADC - low pass filter - code - voltage) typedefs |
| Diletant | 166:c3c0b8a90d81 | 25 | typedef struct _DevicePLCSInput { |
| Diletant | 166:c3c0b8a90d81 | 26 | int32_t voltage; |
| Diletant | 166:c3c0b8a90d81 | 27 | int32_t sum; |
| Diletant | 166:c3c0b8a90d81 | 28 | int32_t counter; |
| Diletant | 166:c3c0b8a90d81 | 29 | int32_t average; |
| Diletant | 166:c3c0b8a90d81 | 30 | } DevicePLCSInput; |
| Diletant | 166:c3c0b8a90d81 | 31 | |
| Diletant | 166:c3c0b8a90d81 | 32 | //Path length control system phase detector typedefs |
| Diletant | 166:c3c0b8a90d81 | 33 | typedef struct _DevicePLCSPhaseDetectorSettings { |
| Diletant | 166:c3c0b8a90d81 | 34 | uint8_t enabled; //Enable phase detector output |
| Diletant | 166:c3c0b8a90d81 | 35 | uint8_t input; //Take ISACS input as feedback |
| Diletant | 166:c3c0b8a90d81 | 36 | uint8_t output; //Take ISACS output as feedback |
| Diletant | 166:c3c0b8a90d81 | 37 | uint8_t sequencer; //Take sequencer as reference (and ISACS amplitude/output as feedback) |
| Diletant | 166:c3c0b8a90d81 | 38 | uint8_t delta; //Take delta as reference (and ISACS amplitude/output delta as feedback) |
| Diletant | 166:c3c0b8a90d81 | 39 | uint8_t delay; //Phase detector sequence delay |
| Diletant | 166:c3c0b8a90d81 | 40 | } DevicePLCSPhaseDetectorSettings; |
| Diletant | 166:c3c0b8a90d81 | 41 | |
| Diletant | 166:c3c0b8a90d81 | 42 | typedef struct _DevicePLCSPhaseDetectorState { |
| Diletant | 166:c3c0b8a90d81 | 43 | uint8_t enabled; //Enable phase detector output |
| Diletant | 166:c3c0b8a90d81 | 44 | uint8_t input; //Take ISACS amplitude as feedback |
| Diletant | 166:c3c0b8a90d81 | 45 | uint8_t output; //Take ISACS output as feedback |
| Diletant | 166:c3c0b8a90d81 | 46 | uint8_t sequencer; //Take sequencer as reference (and ISACS amplitude as feedback) |
| Diletant | 166:c3c0b8a90d81 | 47 | uint8_t delta; //Take PLCS output delta as reference (and ISACS amplitude/output delta as feedback) |
| Diletant | 166:c3c0b8a90d81 | 48 | uint8_t delay; //Phase detector sequence delay |
| Diletant | 166:c3c0b8a90d81 | 49 | uint32_t phase; //Phase detector output |
| Diletant | 166:c3c0b8a90d81 | 50 | } DevicePLCSPhaseDetectorState; |
| Diletant | 156:e68ee0bcdcda | 51 | |
| Diletant | 166:c3c0b8a90d81 | 52 | typedef struct _DevicePLCSPhaseDetector { |
| Diletant | 166:c3c0b8a90d81 | 53 | DevicePLCSPhaseDetectorSettings settings; |
| Diletant | 166:c3c0b8a90d81 | 54 | DevicePLCSPhaseDetectorState state; |
| Diletant | 166:c3c0b8a90d81 | 55 | } DevicePLCSPhaseDetector; |
| Diletant | 166:c3c0b8a90d81 | 56 | |
| Diletant | 166:c3c0b8a90d81 | 57 | //Path length control system output ( = DAC + amplifier + control unit + heater/piezo) typedefs |
| Diletant | 166:c3c0b8a90d81 | 58 | typedef struct _DevicePLCSOutputInterpolatorSettings { |
| Diletant | 166:c3c0b8a90d81 | 59 | uint32_t points; //Number of actual control points (up to 16) |
| Diletant | 166:c3c0b8a90d81 | 60 | int32_t voltage[16]; //Output voltage control points in signed 16.16 fixed point format |
| Diletant | 166:c3c0b8a90d81 | 61 | int32_t code[16]; //DAC code control points |
| Diletant | 166:c3c0b8a90d81 | 62 | } DevicePLCSOutputInterpolatorSettings; |
| Diletant | 166:c3c0b8a90d81 | 63 | |
| Diletant | 166:c3c0b8a90d81 | 64 | typedef struct _DevicePLCSOutputInterpolator { |
| Diletant | 166:c3c0b8a90d81 | 65 | DevicePLCSOutputInterpolatorSettings settings; |
| Diletant | 166:c3c0b8a90d81 | 66 | } DevicePLCSSOutputInterpolator; |
| Diletant | 166:c3c0b8a90d81 | 67 | |
| Diletant | 166:c3c0b8a90d81 | 68 | typedef struct _DevicePLCSOutputStartSettings { |
| Diletant | 166:c3c0b8a90d81 | 69 | int32_t voltage; //Output voltage in signed 16.16 fixed point format |
| Diletant | 166:c3c0b8a90d81 | 70 | } DevicePLCSOutputStartSettings; |
| Diletant | 166:c3c0b8a90d81 | 71 | |
| Diletant | 166:c3c0b8a90d81 | 72 | typedef struct _DevicePLCSOutputStart { |
| Diletant | 166:c3c0b8a90d81 | 73 | DevicePLCSOutputStartSettings settings; |
| Diletant | 166:c3c0b8a90d81 | 74 | } DevicePLCSOutputStart; |
| Diletant | 166:c3c0b8a90d81 | 75 | |
| Diletant | 166:c3c0b8a90d81 | 76 | typedef struct _DevicePLCSOutputResetSettings { |
| Diletant | 166:c3c0b8a90d81 | 77 | int32_t voltage; //Output voltage in signed 16.16 fixed point format |
| Diletant | 166:c3c0b8a90d81 | 78 | } DevicePLCSOutputResetSettings; |
| Diletant | 166:c3c0b8a90d81 | 79 | |
| Diletant | 166:c3c0b8a90d81 | 80 | typedef struct _DevicePLCSOutputReset { |
| Diletant | 166:c3c0b8a90d81 | 81 | DevicePLCSOutputResetSettings settings; |
| Diletant | 166:c3c0b8a90d81 | 82 | } DevicePLCSOutputReset; |
| Diletant | 166:c3c0b8a90d81 | 83 | |
| Diletant | 166:c3c0b8a90d81 | 84 | typedef struct _DevicePLCSOutputSettings { |
| Diletant | 166:c3c0b8a90d81 | 85 | uint8_t enabled; //Enable DAC output |
| Diletant | 166:c3c0b8a90d81 | 86 | //DevicePLCSOutputInterpolatorSettings interpolator; |
| Diletant | 166:c3c0b8a90d81 | 87 | //DevicePLCSOutputConditionSettings start; |
| Diletant | 166:c3c0b8a90d81 | 88 | //DevicePLCSOutputConditionSettings reset; |
| Diletant | 166:c3c0b8a90d81 | 89 | } DevicePLCSOutputSettings; |
| Diletant | 166:c3c0b8a90d81 | 90 | |
| Diletant | 166:c3c0b8a90d81 | 91 | typedef struct _DevicePLCSOutputState { |
| Diletant | 166:c3c0b8a90d81 | 92 | uint8_t enabled; //Enable DAC output |
| Diletant | 166:c3c0b8a90d81 | 93 | uint32_t voltage; //Voltage output |
| Diletant | 166:c3c0b8a90d81 | 94 | } DevicePLCSOutputState; |
| Diletant | 166:c3c0b8a90d81 | 95 | |
| Diletant | 166:c3c0b8a90d81 | 96 | typedef struct _DevicePLCSOutput { |
| Diletant | 166:c3c0b8a90d81 | 97 | DevicePLCSOutputSettings settings; |
| Diletant | 166:c3c0b8a90d81 | 98 | DevicePLCSOutputState state; |
| Diletant | 166:c3c0b8a90d81 | 99 | DevicePLCSSOutputInterpolator interpolator; |
| Diletant | 166:c3c0b8a90d81 | 100 | DevicePLCSOutputStart start; |
| Diletant | 166:c3c0b8a90d81 | 101 | DevicePLCSOutputReset reset; |
| Diletant | 166:c3c0b8a90d81 | 102 | } DevicePLCSOutput; |
| Diletant | 156:e68ee0bcdcda | 103 | |
| Diletant | 161:efd949e8d536 | 104 | //Path length control reset typedefs |
| Diletant | 161:efd949e8d536 | 105 | typedef struct _DevicePathLengthControlResetDelaySettings { |
| Diletant | 161:efd949e8d536 | 106 | uint32_t center; //reset delay in mks for normal conditions |
| Diletant | 161:efd949e8d536 | 107 | uint32_t slope; //signed 16.16 format output voltage reset level correction per correction interval |
| Diletant | 161:efd949e8d536 | 108 | } DevicePathLengthControlResetDelaySettings; |
| Diletant | 161:efd949e8d536 | 109 | |
| Diletant | 161:efd949e8d536 | 110 | typedef struct _DevicePathLengthControlResetLevelSettings { |
| Diletant | 161:efd949e8d536 | 111 | uint32_t center; //signed 16.16 format output voltage reset level |
| Diletant | 161:efd949e8d536 | 112 | uint32_t slope; //signed 16.16 format output voltage reset level correction per correction interval |
| Diletant | 161:efd949e8d536 | 113 | } DevicePathLengthControlResetLevelSettings; |
| Diletant | 161:efd949e8d536 | 114 | |
| Diletant | 161:efd949e8d536 | 115 | typedef struct _DevicePathLengthControlResetConditionSettings { |
| Diletant | 161:efd949e8d536 | 116 | DevicePathLengthControlResetDelaySettings delay; |
| Diletant | 161:efd949e8d536 | 117 | DevicePathLengthControlResetLevelSettings level; |
| Diletant | 161:efd949e8d536 | 118 | } DevicePathLengthControlResetConditionSettings; |
| Diletant | 161:efd949e8d536 | 119 | |
| Diletant | 161:efd949e8d536 | 120 | typedef struct _DevicePathLengthControlResetSettings { |
| Diletant | 161:efd949e8d536 | 121 | DevicePathLengthControlResetConditionSettings cooling; |
| Diletant | 161:efd949e8d536 | 122 | DevicePathLengthControlResetConditionSettings heating; |
| Diletant | 161:efd949e8d536 | 123 | } DevicePathLengthControlResetSettings; |
| Diletant | 161:efd949e8d536 | 124 | |
| Diletant | 161:efd949e8d536 | 125 | typedef struct _DevicePathLengthControlResetState { |
| Diletant | 161:efd949e8d536 | 126 | uint32_t delay; //reset delay in mks |
| Diletant | 161:efd949e8d536 | 127 | uint32_t level; //signed 16.16 format output voltage reset level |
| Diletant | 161:efd949e8d536 | 128 | } DevicePathLengthControlResetState; |
| Diletant | 161:efd949e8d536 | 129 | |
| Diletant | 161:efd949e8d536 | 130 | typedef struct _DevicePathLengthControlReset { |
| Diletant | 161:efd949e8d536 | 131 | DevicePathLengthControlResetSettings settings; |
| Diletant | 161:efd949e8d536 | 132 | DevicePathLengthControlResetState state; |
| Diletant | 161:efd949e8d536 | 133 | } DevicePathLengthControlReset; |
| Diletant | 161:efd949e8d536 | 134 | |
| Diletant | 161:efd949e8d536 | 135 | //Path length control system regulator typedefs |
| Diletant | 161:efd949e8d536 | 136 | typedef struct _DevicePathLengthControlRegulatorSettings { |
| Diletant | 161:efd949e8d536 | 137 | uint8_t enabled; |
| Diletant | 161:efd949e8d536 | 138 | uint32_t reference; //signed 16.16 format reference voltage |
| Diletant | 161:efd949e8d536 | 139 | uint32_t scale; //signed 16.16 format regulator scale factor |
| Diletant | 161:efd949e8d536 | 140 | } DevicePathLengthControlRegulatorSettings; |
| Diletant | 149:abbf7663d27d | 141 | |
| Diletant | 161:efd949e8d536 | 142 | typedef struct _DevicePathLengthControlRegulatorState { |
| Diletant | 161:efd949e8d536 | 143 | uint8_t enabled; |
| Diletant | 161:efd949e8d536 | 144 | uint32_t reference; //signed 16.16 format reference voltage |
| Diletant | 161:efd949e8d536 | 145 | uint32_t scale; //signed 16.16 format regulator scale factor |
| Diletant | 161:efd949e8d536 | 146 | uint32_t error; //signed 16.16 format regulator error |
| Diletant | 161:efd949e8d536 | 147 | } DevicePathLengthControlRegulatorState; |
| Diletant | 161:efd949e8d536 | 148 | |
| Diletant | 161:efd949e8d536 | 149 | typedef struct _DevicePathLengthControlRegulator { |
| Diletant | 161:efd949e8d536 | 150 | DevicePathLengthControlRegulatorSettings settings; |
| Diletant | 161:efd949e8d536 | 151 | DevicePathLengthControlRegulatorState state; |
| Diletant | 161:efd949e8d536 | 152 | } DevicePathLengthControlRegulator; |
| Diletant | 161:efd949e8d536 | 153 | |
| Diletant | 161:efd949e8d536 | 154 | //Path length control system typedefs |
| Diletant | 166:c3c0b8a90d81 | 155 | // Information signal amplitude ADC: device.controller.SSP.ADC[4] |
| Diletant | 161:efd949e8d536 | 156 | // Path length control system DAC: device.controller.SSP.DAC[1] |
| Diletant | 149:abbf7663d27d | 157 | typedef struct _DevicePathLengthControlSystem { |
| Diletant | 166:c3c0b8a90d81 | 158 | DevicePLCSSequencer sequencer; |
| Diletant | 166:c3c0b8a90d81 | 159 | DevicePLCSInput input; |
| Diletant | 166:c3c0b8a90d81 | 160 | DevicePLCSPhaseDetector detector; |
| Diletant | 166:c3c0b8a90d81 | 161 | DevicePathLengthControlRegulator regulator; |
| Diletant | 166:c3c0b8a90d81 | 162 | DevicePLCSOutput output; |
| Diletant | 161:efd949e8d536 | 163 | DevicePathLengthControlReset reset; |
| Diletant | 149:abbf7663d27d | 164 | } DevicePathLengthControlSystem; |
| Diletant | 149:abbf7663d27d | 165 | |
| Diletant | 161:efd949e8d536 | 166 | //Path length control system functions |
| Diletant | 149:abbf7663d27d | 167 | void InitPathLengthControlSystemWithDefaults(void); |
| Diletant | 149:abbf7663d27d | 168 | void InitPathLengthControlSystem(void); |
| Diletant | 149:abbf7663d27d | 169 | void StartPathLengthControlSystem(void); |
| Diletant | 149:abbf7663d27d | 170 | |
| Diletant | 166:c3c0b8a90d81 | 171 | void plcsProcess(void); |
| Diletant | 166:c3c0b8a90d81 | 172 | |
| Diletant | 149:abbf7663d27d | 173 | #endif /* __DEVICE_PLCS_H__ */ |
