123

Dependencies:   mbed

Fork of LG by igor Apu

Committer:
Kovalev_D
Date:
Wed Oct 19 10:55:05 2016 +0000
Revision:
197:7a05523bf588
Parent:
173:7f938afb0447
modul

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Diletant 173:7f938afb0447 1 #ifndef __DEVICE_SEQUENCER_H__
Diletant 173:7f938afb0447 2 #define __DEVICE_SEQUENCER_H__
Diletant 173:7f938afb0447 3
Diletant 173:7f938afb0447 4 //Sampler typedefs
Diletant 173:7f938afb0447 5 typedef struct _DeviceSequencerSamplerSettings {
Diletant 173:7f938afb0447 6 uint8_t enabled; //Enable sequence generation
Diletant 173:7f938afb0447 7 uint32_t amplitude; //Generator analog output amplitude - volts in 16.16 format
Diletant 173:7f938afb0447 8 int32_t sequence[64]; //Generator sequence - dimensionless units -1...+1 in 16.16 format
Diletant 173:7f938afb0447 9 uint8_t position[2]; //Sequence position
Diletant 173:7f938afb0447 10 } DeviceSequencerSamplerSettings;
Diletant 173:7f938afb0447 11
Diletant 173:7f938afb0447 12 typedef struct _DeviceSequencerSamplerState {
Diletant 173:7f938afb0447 13 uint8_t enabled; //Enable sequence generation
Diletant 173:7f938afb0447 14 uint32_t amplitude; //Generator analog output amplitude - volts in 16.16 format
Diletant 173:7f938afb0447 15 uint8_t position[2]; //Sequence position
Diletant 173:7f938afb0447 16 uint32_t sample[2]; //Sequencer analog output = sequence[]: current/delayed - dimensionless units -1...+1 in 16.16 format
Diletant 173:7f938afb0447 17 uint32_t voltage; //Sequencer analog output = sequence[] * amplitude - volts in 16.16 format
Diletant 173:7f938afb0447 18 } DeviceSequencerSamplerState;
Diletant 173:7f938afb0447 19
Diletant 173:7f938afb0447 20 typedef struct _DeviceSequencerSampler {
Diletant 173:7f938afb0447 21 DeviceSequencerSamplerSettings settings;
Diletant 173:7f938afb0447 22 DeviceSequencerSamplerState state;
Diletant 173:7f938afb0447 23 } DeviceSequencerSampler;
Diletant 173:7f938afb0447 24
Diletant 173:7f938afb0447 25 //Analog output typedefs
Diletant 173:7f938afb0447 26 typedef struct _DeviceSequencerAnalogOutputTransferFunction {
Diletant 173:7f938afb0447 27 uint32_t points; //Number of actual control points (up to 16)
Diletant 173:7f938afb0447 28 int32_t voltage[16]; //Output voltage control points in signed 16.16 fixed point format
Diletant 173:7f938afb0447 29 int32_t code[16]; //DAC code control points
Diletant 173:7f938afb0447 30 } DeviceSequencerAnalogOutputTransferFunction;
Diletant 173:7f938afb0447 31
Diletant 173:7f938afb0447 32 typedef struct _DeviceSequencerAnalogOutputSettings {
Diletant 173:7f938afb0447 33 uint8_t enabled; //Enable analog output
Diletant 173:7f938afb0447 34 DeviceSequencerAnalogOutputTransferFunction transfer;
Diletant 173:7f938afb0447 35 } DeviceSequencerAnalogOutputSettings;
Diletant 173:7f938afb0447 36
Diletant 173:7f938afb0447 37 typedef struct _DeviceSequencerAnalogOutputState {
Diletant 173:7f938afb0447 38 uint8_t enabled; //Enable analog output
Diletant 173:7f938afb0447 39 uint32_t voltage; //Sequencer analog output = sequence[] * amplitude - volts in 16.16 format
Diletant 173:7f938afb0447 40 } DeviceSequencerAnalogOutputState;
Diletant 173:7f938afb0447 41
Diletant 173:7f938afb0447 42 typedef struct _DeviceSequencerAnalogOutput {
Diletant 173:7f938afb0447 43 DeviceSequencerAnalogOutputSettings settings;
Diletant 173:7f938afb0447 44 DeviceSequencerAnalogOutputState state;
Diletant 173:7f938afb0447 45 } DeviceSequencerAnalogOutput;
Diletant 173:7f938afb0447 46
Diletant 173:7f938afb0447 47 //Logic output typedefs
Diletant 173:7f938afb0447 48 typedef struct _DeviceSequencerLogicOutputSettings {
Diletant 173:7f938afb0447 49 uint8_t enabled; //Enable logic (GPIO pin) output
Diletant 173:7f938afb0447 50 } DeviceSequencerLogicOutputSettings;
Diletant 173:7f938afb0447 51
Diletant 173:7f938afb0447 52 typedef struct _DeviceSequencerLogicOutputState {
Diletant 173:7f938afb0447 53 uint8_t enabled; //Enable logic (GPIO pin) output
Diletant 173:7f938afb0447 54 uint32_t level; //Sequencer logic output - 0/1
Diletant 173:7f938afb0447 55 } DeviceSequencerLogicOutputState;
Diletant 173:7f938afb0447 56
Diletant 173:7f938afb0447 57 typedef struct _DeviceSequencerLogicOutput {
Diletant 173:7f938afb0447 58 DeviceSequencerLogicOutputSettings settings;
Diletant 173:7f938afb0447 59 DeviceSequencerLogicOutputState state;
Diletant 173:7f938afb0447 60 } DeviceSequencerLogicOutput;
Diletant 173:7f938afb0447 61
Diletant 173:7f938afb0447 62 typedef struct _DeviceSequencerOutput {
Diletant 173:7f938afb0447 63 DeviceSequencerLogicOutput logic;
Diletant 173:7f938afb0447 64 DeviceSequencerAnalogOutput analog;
Diletant 173:7f938afb0447 65 } DeviceSequencerOutput;
Diletant 173:7f938afb0447 66
Diletant 173:7f938afb0447 67 //Sequencer typedefs
Diletant 173:7f938afb0447 68 typedef struct _DeviceSequencerOutputTransferFunction {
Diletant 173:7f938afb0447 69 uint32_t points; //Number of actual control points (up to 16)
Diletant 173:7f938afb0447 70 int32_t voltage[16]; //Output voltage control points in signed 16.16 fixed point format
Diletant 173:7f938afb0447 71 int32_t code[16]; //DAC code control points
Diletant 173:7f938afb0447 72 } DeviceSequencerOutputTransferFunction;
Diletant 173:7f938afb0447 73
Diletant 173:7f938afb0447 74 typedef struct _DeviceSequencerSettings {
Diletant 173:7f938afb0447 75 uint8_t enabled; //Enable sequence generation
Diletant 173:7f938afb0447 76 uint8_t analog; //Modulate analog (voltage) output
Diletant 173:7f938afb0447 77 uint8_t logic; //Modulate logic (GPIO pin) output
Diletant 173:7f938afb0447 78 int32_t amplitude; //Generator analog output amplitude - volts in 16.16 format
Diletant 173:7f938afb0447 79 int32_t sequence[64]; //Generator sequence - dimensionless units -1...+1 in 16.16 format
Diletant 173:7f938afb0447 80 uint8_t position[2]; //Sequence position
Diletant 173:7f938afb0447 81 DeviceSequencerOutputTransferFunction transfer;
Diletant 173:7f938afb0447 82 } DeviceSequencerSettings;
Diletant 173:7f938afb0447 83
Diletant 173:7f938afb0447 84 typedef struct _DeviceSequencerState {
Diletant 173:7f938afb0447 85 uint8_t enabled; //Enable sequence generation
Diletant 173:7f938afb0447 86 uint8_t analog; //Modulate analog (voltage) output
Diletant 173:7f938afb0447 87 uint8_t logic; //Modulate logic (GPIO pin) output
Diletant 173:7f938afb0447 88 uint32_t amplitude; //Generator analog output amplitude - volts in 16.16 format
Diletant 173:7f938afb0447 89 uint8_t position[2]; //Sequence position
Diletant 173:7f938afb0447 90 uint32_t sample[2]; //Sequencer analog output = sequence[]: current/delayed - dimensionless units -1...+1 in 16.16 format
Diletant 173:7f938afb0447 91 uint32_t voltage; //Sequencer analog output = sequence[] * amplitude - volts in 16.16 format
Diletant 173:7f938afb0447 92 } DeviceSequencerState;
Diletant 173:7f938afb0447 93
Diletant 173:7f938afb0447 94 typedef struct _DeviceSequencer {
Diletant 173:7f938afb0447 95 //DeviceSequencerSettings settings;
Diletant 173:7f938afb0447 96 //DeviceSequencerState state;
Diletant 173:7f938afb0447 97
Diletant 173:7f938afb0447 98 DeviceSequencerSampler sampler;
Diletant 173:7f938afb0447 99 DeviceSequencerOutput output;
Diletant 173:7f938afb0447 100 } DeviceSequencer;
Diletant 173:7f938afb0447 101
Diletant 173:7f938afb0447 102 void InitSequencerDefaultSettings(void);
Diletant 173:7f938afb0447 103 void InitSequencerState(void);
Diletant 173:7f938afb0447 104 void DeviceStartSequencer(void);
Diletant 173:7f938afb0447 105
Diletant 173:7f938afb0447 106 void sequencerProcess(void);
Diletant 173:7f938afb0447 107
Diletant 173:7f938afb0447 108 #endif /* __DEVICE_SEQUENCER_H__ */