123
Fork of LG by
DeviceISACS.h@173:7f938afb0447, 2016-06-19 (annotated)
- Committer:
- Diletant
- Date:
- Sun Jun 19 03:54:35 2016 +0000
- Revision:
- 173:7f938afb0447
- Parent:
- 167:bedc0a9d559a
- Child:
- 177:672ef279c8e0
Device&... update. Not final!!!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Diletant | 161:efd949e8d536 | 1 | #ifndef __DEVICE_ISACS_H__ |
Diletant | 161:efd949e8d536 | 2 | #define __DEVICE_ISACS_H__ |
Diletant | 161:efd949e8d536 | 3 | |
Diletant | 161:efd949e8d536 | 4 | #include "DeviceISACSPotentiometers.h" |
Diletant | 161:efd949e8d536 | 5 | |
Diletant | 161:efd949e8d536 | 6 | //Information signal amplitude control system |
Diletant | 161:efd949e8d536 | 7 | // input(photodetector - amplifier - potentiometers - amplitude detector - ADC - low pass filter - code - voltage) |
Diletant | 161:efd949e8d536 | 8 | // regulator |
Diletant | 161:efd949e8d536 | 9 | // output(voltage - code - DAC - Amplifier - control unit - hfo) |
Diletant | 161:efd949e8d536 | 10 | |
Diletant | 166:c3c0b8a90d81 | 11 | //Information signal amplitude control system input ( = ADC - low pass filter - code - voltage) typedefs |
Diletant | 167:bedc0a9d559a | 12 | typedef struct _DeviceISACSInputTransferFunction { |
Diletant | 166:c3c0b8a90d81 | 13 | uint32_t points; //Number of actual control points (up to 16) |
Diletant | 166:c3c0b8a90d81 | 14 | int32_t voltage[16]; //Output voltage control points in signed 16.16 fixed point format |
Diletant | 166:c3c0b8a90d81 | 15 | int32_t code[16]; //DAC code control points |
Diletant | 167:bedc0a9d559a | 16 | } DeviceISACSInputTransferFunction; |
Diletant | 166:c3c0b8a90d81 | 17 | |
Diletant | 167:bedc0a9d559a | 18 | typedef struct _DeviceISACSInputSettings { |
Diletant | 167:bedc0a9d559a | 19 | DeviceISACSInputTransferFunction transfer; |
Diletant | 167:bedc0a9d559a | 20 | } DeviceISACSInputSettings; |
Diletant | 167:bedc0a9d559a | 21 | |
Diletant | 167:bedc0a9d559a | 22 | typedef struct _DeviceISACSInputState { |
Diletant | 167:bedc0a9d559a | 23 | int32_t voltage; |
Diletant | 167:bedc0a9d559a | 24 | int32_t sum; |
Diletant | 167:bedc0a9d559a | 25 | int32_t average; |
Diletant | 167:bedc0a9d559a | 26 | } DeviceISACSInputState; |
Diletant | 167:bedc0a9d559a | 27 | |
Diletant | 167:bedc0a9d559a | 28 | typedef struct _DeviceISACSInput { |
Diletant | 167:bedc0a9d559a | 29 | DeviceISACSInputSettings settings; |
Diletant | 167:bedc0a9d559a | 30 | DeviceISACSInputState state; |
Diletant | 166:c3c0b8a90d81 | 31 | } DeviceISACSInput; |
Diletant | 166:c3c0b8a90d81 | 32 | |
Diletant | 161:efd949e8d536 | 33 | //Information signal amplitude control system output ( = DAC + amplifier + control unit + hfo) typedefs |
Diletant | 167:bedc0a9d559a | 34 | typedef struct _DeviceISACSOutputTransferFunction { |
Diletant | 173:7f938afb0447 | 35 | uint32_t points; //Number of actual control points (up to 16) |
Diletant | 166:c3c0b8a90d81 | 36 | int32_t voltage[16]; //Output voltage control points in signed 16.16 fixed point format |
Diletant | 166:c3c0b8a90d81 | 37 | int32_t code[16]; //DAC code control points |
Diletant | 167:bedc0a9d559a | 38 | } DeviceISACSOutputTransferFunction; |
Diletant | 166:c3c0b8a90d81 | 39 | |
Diletant | 167:bedc0a9d559a | 40 | typedef struct _DeviceISACSOutputStart { |
Diletant | 173:7f938afb0447 | 41 | uint32_t voltage; //Output voltage |
Diletant | 167:bedc0a9d559a | 42 | } DeviceISACSOutputStart; |
Diletant | 166:c3c0b8a90d81 | 43 | |
Diletant | 167:bedc0a9d559a | 44 | typedef struct _DeviceISACSOutputReset { |
Diletant | 173:7f938afb0447 | 45 | uint32_t voltage; //Output voltage |
Diletant | 167:bedc0a9d559a | 46 | } DeviceISACSOutputReset; |
Diletant | 166:c3c0b8a90d81 | 47 | |
Diletant | 166:c3c0b8a90d81 | 48 | typedef struct _DeviceISACSOutputSettings { |
Diletant | 167:bedc0a9d559a | 49 | DeviceISACSOutputTransferFunction transfer; |
Diletant | 167:bedc0a9d559a | 50 | DeviceISACSOutputStart start; |
Diletant | 167:bedc0a9d559a | 51 | DeviceISACSOutputReset reset; |
Diletant | 161:efd949e8d536 | 52 | } DeviceISACSOutputSettings; |
Diletant | 166:c3c0b8a90d81 | 53 | |
Diletant | 167:bedc0a9d559a | 54 | typedef struct _DeviceISACSOutputState { |
Diletant | 173:7f938afb0447 | 55 | int32_t voltage; //Output value - constant for measurement cycle |
Diletant | 167:bedc0a9d559a | 56 | } DeviceISACSOutputState; |
Diletant | 161:efd949e8d536 | 57 | |
Diletant | 161:efd949e8d536 | 58 | typedef struct _DeviceISACSOutput { |
Diletant | 167:bedc0a9d559a | 59 | DeviceISACSOutputSettings settings; |
Diletant | 167:bedc0a9d559a | 60 | DeviceISACSOutputState state; |
Diletant | 161:efd949e8d536 | 61 | } DeviceISACSOutput; |
Diletant | 161:efd949e8d536 | 62 | |
Diletant | 161:efd949e8d536 | 63 | //Information signal amplitude control system regulator typedefs |
Diletant | 161:efd949e8d536 | 64 | typedef struct _DeviceISACSRegulatorConditionSettings { |
Diletant | 166:c3c0b8a90d81 | 65 | uint8_t enabled; |
Diletant | 173:7f938afb0447 | 66 | uint32_t reference; //signed 16.16 format reference voltage |
Diletant | 173:7f938afb0447 | 67 | uint32_t scale; //signed 16.16 format regulator scale factor |
Diletant | 161:efd949e8d536 | 68 | } DeviceISACSRegulatorConditionSettings; |
Diletant | 161:efd949e8d536 | 69 | |
Diletant | 161:efd949e8d536 | 70 | typedef struct _DeviceISACSRegulatorSettings { |
Diletant | 161:efd949e8d536 | 71 | DeviceISACSRegulatorConditionSettings start; //settings for PLCS system in start condition |
Diletant | 161:efd949e8d536 | 72 | DeviceISACSRegulatorConditionSettings regular; //settings for PLCS system in normal condition |
Diletant | 161:efd949e8d536 | 73 | DeviceISACSRegulatorConditionSettings reset; //settings for PLCS system in reset condition |
Diletant | 161:efd949e8d536 | 74 | } DeviceISACSRegulatorSettings; |
Diletant | 161:efd949e8d536 | 75 | |
Diletant | 161:efd949e8d536 | 76 | typedef struct _DeviceISACSRegulatorState { |
Diletant | 161:efd949e8d536 | 77 | uint8_t enabled; |
Diletant | 161:efd949e8d536 | 78 | uint32_t reference; //signed 16.16 format reference voltage |
Diletant | 161:efd949e8d536 | 79 | uint32_t scale; //signed 16.16 format regulator scale factor |
Diletant | 161:efd949e8d536 | 80 | uint32_t error; //signed 16.16 format regulator error |
Diletant | 161:efd949e8d536 | 81 | } DeviceISACSRegulatorState; |
Diletant | 161:efd949e8d536 | 82 | |
Diletant | 161:efd949e8d536 | 83 | typedef struct _DeviceISACSRegulator { |
Diletant | 161:efd949e8d536 | 84 | DeviceISACSRegulatorSettings settings; |
Diletant | 161:efd949e8d536 | 85 | DeviceISACSRegulatorState state; |
Diletant | 161:efd949e8d536 | 86 | } DeviceISACSRegulator; |
Diletant | 161:efd949e8d536 | 87 | |
Diletant | 161:efd949e8d536 | 88 | //Information signal amplitude control system typedefs |
Diletant | 166:c3c0b8a90d81 | 89 | // Information signal amplitude ADC: device.controller.SSP.ADC[4] |
Diletant | 161:efd949e8d536 | 90 | // Information signal amplitude control system DAC: device.controller.SSP.DAC[0] |
Diletant | 161:efd949e8d536 | 91 | typedef struct _DeviceISACS { |
Diletant | 161:efd949e8d536 | 92 | DeviceISACSPotentiometers potentiometers; |
Diletant | 161:efd949e8d536 | 93 | //DeviceISASAmplifier amplifier; |
Diletant | 166:c3c0b8a90d81 | 94 | DeviceISACSInput input; |
Diletant | 166:c3c0b8a90d81 | 95 | DeviceISACSRegulator regulator; |
Diletant | 161:efd949e8d536 | 96 | DeviceISACSOutput output; |
Diletant | 161:efd949e8d536 | 97 | } DeviceISACS; |
Diletant | 161:efd949e8d536 | 98 | |
Diletant | 161:efd949e8d536 | 99 | //Information signal amplitude stabilizer functions |
Diletant | 167:bedc0a9d559a | 100 | void InitISACSOutputDefaultSettings(void); |
Diletant | 167:bedc0a9d559a | 101 | void InitISACSOutputState(void); |
Diletant | 167:bedc0a9d559a | 102 | void DeviceStartISACSOutput(void); |
Diletant | 161:efd949e8d536 | 103 | |
Diletant | 167:bedc0a9d559a | 104 | void InitISACSRegulatorDefaultSettings(void); |
Diletant | 167:bedc0a9d559a | 105 | void InitISACSRegulatorState(void); |
Diletant | 167:bedc0a9d559a | 106 | void DeviceStartISACSRegulator(void); |
Diletant | 161:efd949e8d536 | 107 | |
Diletant | 167:bedc0a9d559a | 108 | void InitISACSDefaultSettings(void); |
Diletant | 167:bedc0a9d559a | 109 | void InitISACSState(void); |
Diletant | 167:bedc0a9d559a | 110 | void DeviceStartISACS(void); |
Diletant | 161:efd949e8d536 | 111 | |
Diletant | 166:c3c0b8a90d81 | 112 | void isacsProcess(void); |
Diletant | 166:c3c0b8a90d81 | 113 | |
Diletant | 161:efd949e8d536 | 114 | #endif /* __DEVICE_ISACS_H__ */ |