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
- Committer:
- Diletant
- Date:
- 2016-05-22
- Revision:
- 166:c3c0b8a90d81
- Parent:
- 161:efd949e8d536
- Child:
- 167:bedc0a9d559a
File content as of revision 166:c3c0b8a90d81:
#ifndef __DEVICE_PLCS_H__
#define __DEVICE_PLCS_H__
//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 _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 {
uint32_t center; //reset delay in mks for normal conditions
uint32_t slope; //signed 16.16 format output voltage reset level correction per correction interval
} DevicePathLengthControlResetDelaySettings;
typedef struct _DevicePathLengthControlResetLevelSettings {
uint32_t center; //signed 16.16 format output voltage reset level
uint32_t slope; //signed 16.16 format output voltage reset level correction per correction interval
} DevicePathLengthControlResetLevelSettings;
typedef struct _DevicePathLengthControlResetConditionSettings {
DevicePathLengthControlResetDelaySettings delay;
DevicePathLengthControlResetLevelSettings level;
} DevicePathLengthControlResetConditionSettings;
typedef struct _DevicePathLengthControlResetSettings {
DevicePathLengthControlResetConditionSettings cooling;
DevicePathLengthControlResetConditionSettings heating;
} DevicePathLengthControlResetSettings;
typedef struct _DevicePathLengthControlResetState {
uint32_t delay; //reset delay in mks
uint32_t level; //signed 16.16 format output voltage reset level
} DevicePathLengthControlResetState;
typedef struct _DevicePathLengthControlReset {
DevicePathLengthControlResetSettings settings;
DevicePathLengthControlResetState state;
} DevicePathLengthControlReset;
//Path length control system regulator typedefs
typedef struct _DevicePathLengthControlRegulatorSettings {
uint8_t enabled;
uint32_t reference; //signed 16.16 format reference voltage
uint32_t scale; //signed 16.16 format regulator scale factor
} DevicePathLengthControlRegulatorSettings;
typedef struct _DevicePathLengthControlRegulatorState {
uint8_t enabled;
uint32_t reference; //signed 16.16 format reference voltage
uint32_t scale; //signed 16.16 format regulator scale factor
uint32_t error; //signed 16.16 format regulator error
} DevicePathLengthControlRegulatorState;
typedef struct _DevicePathLengthControlRegulator {
DevicePathLengthControlRegulatorSettings settings;
DevicePathLengthControlRegulatorState state;
} DevicePathLengthControlRegulator;
//Path length control system typedefs
// Information signal amplitude ADC: device.controller.SSP.ADC[4]
// Path length control system DAC: device.controller.SSP.DAC[1]
typedef struct _DevicePathLengthControlSystem {
DevicePLCSSequencer sequencer;
DevicePLCSInput input;
DevicePLCSPhaseDetector detector;
DevicePathLengthControlRegulator regulator;
DevicePLCSOutput output;
DevicePathLengthControlReset reset;
} DevicePathLengthControlSystem;
//Path length control system functions
void InitPathLengthControlSystemWithDefaults(void);
void InitPathLengthControlSystem(void);
void StartPathLengthControlSystem(void);
void plcsProcess(void);
#endif /* __DEVICE_PLCS_H__ */
