123

Dependencies:   mbed

Fork of LG by igor Apu

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?

UserRevisionLine numberNew 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 166:c3c0b8a90d81 12 typedef struct _DeviceISACSInputInterpolatorSettings {
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 166:c3c0b8a90d81 16 } DeviceISACSInputInterpolatorSettings;
Diletant 166:c3c0b8a90d81 17
Diletant 166:c3c0b8a90d81 18 typedef struct _DeviceISACSInputInterpolator {
Diletant 166:c3c0b8a90d81 19 DeviceISACSInputInterpolatorSettings settings;
Diletant 166:c3c0b8a90d81 20 } DeviceISACSInputInterpolator;
Diletant 166:c3c0b8a90d81 21
Diletant 166:c3c0b8a90d81 22 typedef struct _DeviceISACSInput {
Diletant 166:c3c0b8a90d81 23 int32_t voltage;
Diletant 166:c3c0b8a90d81 24 int32_t sum;
Diletant 166:c3c0b8a90d81 25 int32_t average;
Diletant 166:c3c0b8a90d81 26 DeviceISACSInputInterpolator interpolator;
Diletant 166:c3c0b8a90d81 27 //DeviceISACSFilter filter;
Diletant 166:c3c0b8a90d81 28 } DeviceISACSInput;
Diletant 166:c3c0b8a90d81 29
Diletant 161:efd949e8d536 30 //Information signal amplitude control system output ( = DAC + amplifier + control unit + hfo) typedefs
Diletant 166:c3c0b8a90d81 31 typedef struct _DeviceISACSOutputInterpolatorSettings {
Diletant 161:efd949e8d536 32 uint32_t points; //Number of actual control points (up to 16)
Diletant 166:c3c0b8a90d81 33 int32_t voltage[16]; //Output voltage control points in signed 16.16 fixed point format
Diletant 166:c3c0b8a90d81 34 int32_t code[16]; //DAC code control points
Diletant 166:c3c0b8a90d81 35 } DeviceISACSOutputInterpolatorSettings;
Diletant 166:c3c0b8a90d81 36
Diletant 166:c3c0b8a90d81 37 typedef struct _DeviceISACSOutputInterpolator {
Diletant 166:c3c0b8a90d81 38 DeviceISACSOutputInterpolatorSettings settings;
Diletant 166:c3c0b8a90d81 39 } DeviceISACSOutputInterpolator;
Diletant 166:c3c0b8a90d81 40
Diletant 166:c3c0b8a90d81 41 /*
Diletant 166:c3c0b8a90d81 42 typedef struct _DeviceISACSOutputConditionSettings {
Diletant 166:c3c0b8a90d81 43 int32_t voltage; //Output voltage in signed 16.16 fixed point format
Diletant 166:c3c0b8a90d81 44 } DeviceISACSOutputConditionSettings;
Diletant 166:c3c0b8a90d81 45
Diletant 166:c3c0b8a90d81 46 typedef struct _DeviceISACSOutputSettings {
Diletant 166:c3c0b8a90d81 47 DeviceISACSOutputInterpolatorSettings interpolator;
Diletant 166:c3c0b8a90d81 48 DeviceISACSOutputConditionSettings start;
Diletant 166:c3c0b8a90d81 49 DeviceISACSOutputConditionSettings reset;
Diletant 161:efd949e8d536 50 } DeviceISACSOutputSettings;
Diletant 166:c3c0b8a90d81 51 */
Diletant 161:efd949e8d536 52
Diletant 166:c3c0b8a90d81 53 typedef struct _DeviceISACSOutputStartSettings {
Diletant 161:efd949e8d536 54 uint32_t voltage; //Output voltage
Diletant 166:c3c0b8a90d81 55 } DeviceISACSOutputStartSettings;
Diletant 166:c3c0b8a90d81 56
Diletant 166:c3c0b8a90d81 57 typedef struct _DeviceISACSOutputStart {
Diletant 166:c3c0b8a90d81 58 DeviceISACSOutputStartSettings settings;
Diletant 166:c3c0b8a90d81 59 } DeviceISACSOutputStart;
Diletant 166:c3c0b8a90d81 60
Diletant 166:c3c0b8a90d81 61 typedef struct _DeviceISACSOutputResetSettings {
Diletant 166:c3c0b8a90d81 62 uint32_t voltage; //Output voltage
Diletant 166:c3c0b8a90d81 63 } DeviceISACSOutputResetSettings;
Diletant 166:c3c0b8a90d81 64
Diletant 166:c3c0b8a90d81 65 typedef struct _DeviceISACSOutputReset {
Diletant 166:c3c0b8a90d81 66 DeviceISACSOutputResetSettings settings;
Diletant 166:c3c0b8a90d81 67 } DeviceISACSOutputReset;
Diletant 161:efd949e8d536 68
Diletant 161:efd949e8d536 69 typedef struct _DeviceISACSOutput {
Diletant 166:c3c0b8a90d81 70 int32_t voltage; //Output value - constant for measurement cycle
Diletant 166:c3c0b8a90d81 71 DeviceISACSOutputInterpolator interpolator;
Diletant 166:c3c0b8a90d81 72 DeviceISACSOutputStart start;
Diletant 166:c3c0b8a90d81 73 DeviceISACSOutputReset reset;
Diletant 161:efd949e8d536 74 } DeviceISACSOutput;
Diletant 161:efd949e8d536 75
Diletant 161:efd949e8d536 76 //Information signal amplitude control system regulator typedefs
Diletant 161:efd949e8d536 77 typedef struct _DeviceISACSRegulatorConditionSettings {
Diletant 166:c3c0b8a90d81 78 uint8_t enabled;
Diletant 161:efd949e8d536 79 uint32_t reference; //signed 16.16 format reference voltage
Diletant 161:efd949e8d536 80 uint32_t scale; //signed 16.16 format regulator scale factor
Diletant 161:efd949e8d536 81 } DeviceISACSRegulatorConditionSettings;
Diletant 161:efd949e8d536 82
Diletant 161:efd949e8d536 83 typedef struct _DeviceISACSRegulatorSettings {
Diletant 161:efd949e8d536 84 DeviceISACSRegulatorConditionSettings start; //settings for PLCS system in start condition
Diletant 161:efd949e8d536 85 DeviceISACSRegulatorConditionSettings regular; //settings for PLCS system in normal condition
Diletant 161:efd949e8d536 86 DeviceISACSRegulatorConditionSettings reset; //settings for PLCS system in reset condition
Diletant 161:efd949e8d536 87 } DeviceISACSRegulatorSettings;
Diletant 161:efd949e8d536 88
Diletant 161:efd949e8d536 89 typedef struct _DeviceISACSRegulatorState {
Diletant 161:efd949e8d536 90 uint8_t enabled;
Diletant 161:efd949e8d536 91 uint32_t reference; //signed 16.16 format reference voltage
Diletant 161:efd949e8d536 92 uint32_t scale; //signed 16.16 format regulator scale factor
Diletant 161:efd949e8d536 93 uint32_t error; //signed 16.16 format regulator error
Diletant 161:efd949e8d536 94 } DeviceISACSRegulatorState;
Diletant 161:efd949e8d536 95
Diletant 161:efd949e8d536 96 typedef struct _DeviceISACSRegulator {
Diletant 161:efd949e8d536 97 DeviceISACSRegulatorSettings settings;
Diletant 161:efd949e8d536 98 DeviceISACSRegulatorState state;
Diletant 161:efd949e8d536 99 } DeviceISACSRegulator;
Diletant 161:efd949e8d536 100
Diletant 161:efd949e8d536 101 //Information signal amplitude control system typedefs
Diletant 166:c3c0b8a90d81 102 // Information signal amplitude ADC: device.controller.SSP.ADC[4]
Diletant 161:efd949e8d536 103 // Information signal amplitude control system DAC: device.controller.SSP.DAC[0]
Diletant 161:efd949e8d536 104 typedef struct _DeviceISACS {
Diletant 161:efd949e8d536 105 DeviceISACSPotentiometers potentiometers;
Diletant 161:efd949e8d536 106 //DeviceISASAmplifier amplifier;
Diletant 166:c3c0b8a90d81 107 DeviceISACSInput input;
Diletant 166:c3c0b8a90d81 108 DeviceISACSRegulator regulator;
Diletant 161:efd949e8d536 109 DeviceISACSOutput output;
Diletant 161:efd949e8d536 110 } DeviceISACS;
Diletant 161:efd949e8d536 111
Diletant 161:efd949e8d536 112 //Information signal amplitude stabilizer functions
Diletant 161:efd949e8d536 113 void InitISACSPotentiometersWithDefaults(void);
Diletant 161:efd949e8d536 114 void InitISACSPotentiometers(void);
Diletant 161:efd949e8d536 115
Diletant 161:efd949e8d536 116 void InitISACSOutputWithDefaults(void);
Diletant 161:efd949e8d536 117 void InitISACSOutput(void);
Diletant 161:efd949e8d536 118
Diletant 161:efd949e8d536 119 void InitISACSRegulatorWithDefaults(void);
Diletant 161:efd949e8d536 120 void InitISACSRegulator(void);
Diletant 161:efd949e8d536 121
Diletant 161:efd949e8d536 122 void InitISACSWithDefaults(void);
Diletant 161:efd949e8d536 123 void InitISACS(void);
Diletant 161:efd949e8d536 124 void StartISACS(void);
Diletant 161:efd949e8d536 125
Diletant 166:c3c0b8a90d81 126 void isacsProcess(void);
Diletant 166:c3c0b8a90d81 127
Diletant 161:efd949e8d536 128 #endif /* __DEVICE_ISACS_H__ */