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