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
Diff: DevicePLCS.h
- Revision:
- 166:c3c0b8a90d81
- Parent:
- 161:efd949e8d536
- Child:
- 167:bedc0a9d559a
--- a/DevicePLCS.h Fri May 20 14:03:58 2016 +0000
+++ b/DevicePLCS.h Sun May 22 18:59:20 2016 +0000
@@ -1,15 +1,105 @@
#ifndef __DEVICE_PLCS_H__
#define __DEVICE_PLCS_H__
-//Path length control amplifier (DAC - amplifier - control unit - drive) typedefs
-typedef struct _DevicePathLengthControlAmplifierSettings {
- uint32_t reference; //Reference voltage
- uint32_t gain; //Amplifier gain
-} DevicePathLengthControlAmplifierSettings;
+//Path length control system sequencer typedefs
+typedef struct _DevicePLCSSequencerSettings {
+ uint8_t enabled; //Enable sequence generation
+ uint8_t voltage; //Modulate voltage output
+ uint8_t io; //Modulate GPIO pin
+ uint32_t sequence[64]; //Generator sequence
+} DevicePLCSSequencerSettings;
+
+typedef struct _DevicePLCSSequencerState {
+ uint8_t enabled; //Enable sequence generation
+ uint8_t counter; //Sequence counter: sequence position = device.measurement.counter + device.measurement.length * device.plcs.sequencer.counter
+ uint8_t voltage; //Modulate voltage output
+ uint8_t io; //Modulate GPIO pin
+} DevicePLCSSequencerState;
+
+typedef struct _DevicePLCSSequencer {
+ DevicePLCSSequencerSettings settings;
+ DevicePLCSSequencerState state;
+} DevicePLCSSequencer;
+
+//Path length control system input ( = ADC - low pass filter - code - voltage) typedefs
+typedef struct _DevicePLCSInput {
+ int32_t voltage;
+ int32_t sum;
+ int32_t counter;
+ int32_t average;
+} DevicePLCSInput;
+
+//Path length control system phase detector typedefs
+typedef struct _DevicePLCSPhaseDetectorSettings {
+ uint8_t enabled; //Enable phase detector output
+ uint8_t input; //Take ISACS input as feedback
+ uint8_t output; //Take ISACS output as feedback
+ uint8_t sequencer; //Take sequencer as reference (and ISACS amplitude/output as feedback)
+ uint8_t delta; //Take delta as reference (and ISACS amplitude/output delta as feedback)
+ uint8_t delay; //Phase detector sequence delay
+} DevicePLCSPhaseDetectorSettings;
+
+typedef struct _DevicePLCSPhaseDetectorState {
+ uint8_t enabled; //Enable phase detector output
+ uint8_t input; //Take ISACS amplitude as feedback
+ uint8_t output; //Take ISACS output as feedback
+ uint8_t sequencer; //Take sequencer as reference (and ISACS amplitude as feedback)
+ uint8_t delta; //Take PLCS output delta as reference (and ISACS amplitude/output delta as feedback)
+ uint8_t delay; //Phase detector sequence delay
+ uint32_t phase; //Phase detector output
+} DevicePLCSPhaseDetectorState;
-typedef struct _DevicePathLengthControlAmplifier {
- DevicePathLengthControlAmplifierSettings settings;
-} DevicePathLengthControlAmplifier;
+typedef struct _DevicePLCSPhaseDetector {
+ DevicePLCSPhaseDetectorSettings settings;
+ DevicePLCSPhaseDetectorState state;
+} DevicePLCSPhaseDetector;
+
+//Path length control system output ( = DAC + amplifier + control unit + heater/piezo) typedefs
+typedef struct _DevicePLCSOutputInterpolatorSettings {
+ uint32_t points; //Number of actual control points (up to 16)
+ int32_t voltage[16]; //Output voltage control points in signed 16.16 fixed point format
+ int32_t code[16]; //DAC code control points
+} DevicePLCSOutputInterpolatorSettings;
+
+typedef struct _DevicePLCSOutputInterpolator {
+ DevicePLCSOutputInterpolatorSettings settings;
+} DevicePLCSSOutputInterpolator;
+
+typedef struct _DevicePLCSOutputStartSettings {
+ int32_t voltage; //Output voltage in signed 16.16 fixed point format
+} DevicePLCSOutputStartSettings;
+
+typedef struct _DevicePLCSOutputStart {
+ DevicePLCSOutputStartSettings settings;
+} DevicePLCSOutputStart;
+
+typedef struct _DevicePLCSOutputResetSettings {
+ int32_t voltage; //Output voltage in signed 16.16 fixed point format
+} DevicePLCSOutputResetSettings;
+
+typedef struct _DevicePLCSOutputReset {
+ DevicePLCSOutputResetSettings settings;
+} DevicePLCSOutputReset;
+
+typedef struct _DevicePLCSOutputSettings {
+ uint8_t enabled; //Enable DAC output
+ //DevicePLCSOutputInterpolatorSettings interpolator;
+ //DevicePLCSOutputConditionSettings start;
+ //DevicePLCSOutputConditionSettings reset;
+} DevicePLCSOutputSettings;
+
+typedef struct _DevicePLCSOutputState {
+ uint8_t enabled; //Enable DAC output
+ uint32_t voltage; //Voltage output
+} DevicePLCSOutputState;
+
+typedef struct _DevicePLCSOutput {
+ DevicePLCSOutputSettings settings;
+ DevicePLCSOutputState state;
+ DevicePLCSSOutputInterpolator interpolator;
+ DevicePLCSOutputStart start;
+ DevicePLCSOutputReset reset;
+} DevicePLCSOutput;
//Path length control reset typedefs
typedef struct _DevicePathLengthControlResetDelaySettings {
@@ -42,20 +132,6 @@
DevicePathLengthControlResetState state;
} DevicePathLengthControlReset;
-//Path length control system modulator typedefs
-typedef struct _DevicePathLengthControlModulatorSettings {
- uint8_t enabled;
-} DevicePathLengthControlModulatorSettings;
-
-typedef struct _DevicePathLengthControlModulatorState {
- uint8_t enabled;
-} DevicePathLengthControlModulatorState;
-
-typedef struct _DevicePathLengthControlModulator {
- DevicePathLengthControlModulatorSettings settings;
- DevicePathLengthControlModulatorState state;
-} DevicePathLengthControlModulator;
-
//Path length control system regulator typedefs
typedef struct _DevicePathLengthControlRegulatorSettings {
uint8_t enabled;
@@ -76,13 +152,15 @@
} DevicePathLengthControlRegulator;
//Path length control system typedefs
-// Output signal ADC: device.controller.SSP.ADC[4]
+// Information signal amplitude ADC: device.controller.SSP.ADC[4]
// Path length control system DAC: device.controller.SSP.DAC[1]
typedef struct _DevicePathLengthControlSystem {
- DevicePathLengthControlModulator modulator;
- DevicePathLengthControlAmplifier amplifier;
+ DevicePLCSSequencer sequencer;
+ DevicePLCSInput input;
+ DevicePLCSPhaseDetector detector;
+ DevicePathLengthControlRegulator regulator;
+ DevicePLCSOutput output;
DevicePathLengthControlReset reset;
- DevicePathLengthControlRegulator regulator;
} DevicePathLengthControlSystem;
//Path length control system functions
@@ -90,4 +168,6 @@
void InitPathLengthControlSystem(void);
void StartPathLengthControlSystem(void);
+void plcsProcess(void);
+
#endif /* __DEVICE_PLCS_H__ */
\ No newline at end of file
