16#include <avr/eeprom.h>
117#if defined DDS_USER_DEFINED_WAVEFORMS_ENABLED && defined DDS_SUBSYSTEM_ENABLED
121 typedef struct DevSettingsUserDDSWaveformEEPROMLayout
125 }DevSettingsUserDDSWaveformEEPROMLayout_t;
138 #ifdef PS_SUBSYSTEM_ENABLED
141 #ifdef DDS_SUBSYSTEM_ENABLED
145 #ifdef MEASURE_SUBSYSTEM_ENABLED
209 #if defined DDS_USER_DEFINED_WAVEFORMS_ENABLED && defined DDS_SUBSYSTEM_ENABLED
211 void SaveSettingsDDSUserWaveforms();
214 void LoadSettingsDDSUserWaveforms();
Containing the base class for all channels.
Containing different defines for device configuration.
#define DDS_QUANTIZER_BITS
Number of bits that are used to index into the look up tables.
Definition Configuration.h:54
#define NUM_CHANNELS
Number of channels (this is the sum of NUM_PS_CHANNELS, NUM_DDS_CHANNELS and NUM_MEASURE_CHANNELS)
Definition Configuration.h:78
Containing an implementation for a direct digital synthesis channel.
enum SignalForms SignalForms_t
Available DDS signal forms.
Containing an implementation for a digital multimeter channel.
enum DeviceControlStates DeviceControlStates_t
Available device control states.
DevicePowerUpOutputEnabledStates
Available device power up output states.
Definition Device.h:46
@ DEV_POWERUP_OUTPUTS_ON
Switch on all outputs on power up.
Definition Device.h:49
@ NUM_DEV_POWERUP_ELEMENTS
The last element is used to determine the number of elements in the enumeration.
Definition Device.h:50
@ DEV_POWERUP_OUTPUTS_OFF
Switch off all outputs on power up.
Definition Device.h:47
@ DEV_POWERUP_OUTPUTS_LASTSTATE
Switch all outputs to their last saved states on power up.
Definition Device.h:48
enum DevicePowerUpOutputEnabledStates DevicePowerUpOutputEnabledStates_t
Available device power up output states.
struct DevSettingsEEPROMLayout DevSettingsEEPROMLayout_t
Structure used internally to store to / read from EEPROM (except user waveforms and calibration facto...
struct DeviceCalibrationFactors DeviceCalibrationFactors_t
Structure containing all device calibration factors.
struct DeviceVoltagesStruct DeviceVoltages_t
Structure containing all device ATX voltages.
DeviceControlStates
Available device control states.
Definition Device.h:33
@ DEV_CTRL_LOCAL
Device is in local state.
Definition Device.h:34
@ DEV_CTRL_REMOTE
Device is in remote state.
Definition Device.h:35
@ NUM_DEV_CTRL_ELEMENTS
The last element is used to determine the number of elements in the enumeration.
Definition Device.h:37
@ DEV_CTRL_RWLOCK
Device is in RW lock state.
Definition Device.h:36
Containing an implementation for a power supply channel.
enum PsRegulationModes PsRegulationModes_t
Available power supply regulation modes.
Containing a class and functions for screen handling.
Channel base class.
Definition Channel.h:36
Direct digital synthesis channel.
Definition DDS_Channel.h:43
Digital multimeter channel.
Definition DMM_Channel.h:21
Class holding all relevant sub system objects and settings.
Definition Device.h:133
UserInputHandlerClass UserInputHandler
UserInputHandler object used for key and Usart enqueueing and dequeueing.
Definition Device.h:160
DeviceClass()
Constructor of the DeviceClass.
Definition Device.cpp:27
DDS_Channel DdsChannel1
DDS channel object 1.
Definition Device.h:142
DevicePowerUpOutputEnabledStates_t PowerOnOutputsState
Power up output state (state of all outputs on power up)
Definition Device.h:153
uint16_t TimeCounter_KeyPolling_ms
Variable used for measuring the time to the next key polling.
Definition Device.h:163
Channel * Channels[NUM_CHANNELS]
Array with pointers to all channel objects above.
Definition Device.h:149
void UpdateControlStateOnUserInput()
Update the device control state after an user input occurs (only changes to LOC if it was REM)
Definition Device.cpp:181
uint16_t TimeCounter_AutoSave_ms
Variable used for measuring the time to the next auto save.
Definition Device.h:164
uint8_t SelectedScpiChannelIndex
Index of the channel selected by the "INSTrument[:SELect]" SCPI command.
Definition Device.h:151
void ReportCalibrationFactors()
Write all calibration factor values to the serial output.
Definition Device.cpp:200
void LoadSettings()
Load all settings (except user waveforms and calibration factors) from the EEPROM.
Definition Device.cpp:292
DeviceControlStates_t DeviceControlState
Control state of the device (LOC, REM, RWL)
Definition Device.h:155
uint16_t TimeCounter_PowerSupplyChannelRegulation_ms
Variable used for measuring the time to the next power supply regulation loop.
Definition Device.h:165
DDS_Channel DdsChannel2
DDS channel object 2.
Definition Device.h:143
ScreenManagerClass ScreenManager
Object for all screen drawing related stuff.
Definition Device.h:161
void DeviceTimerTickISR()
This method is called periodically by the device timer ISR and runs in the ISR context.
Definition Device.cpp:130
DMM_Channel DmmChannel2
DMM channel object 2.
Definition Device.h:147
void SetDeviceControlState(DeviceControlStates_t controlState)
Set the device control state to the given value.
Definition Device.cpp:170
DMM_Channel DmmChannel1
DMM channel object 1.
Definition Device.h:146
bool IsUserInputLocked()
Check if the user input is locked (device control state is not LOC).
Definition Device.cpp:176
void SaveSettings()
Save all settings (except user waveforms and calibration factors) to the EEPROM.
Definition Device.cpp:229
void InitDeviceTimer()
Initialize the device timer.
Definition Device.cpp:121
void ResetDeviceCalibration()
Reset all calibration settings and save them to the EEPROM.
Definition Device.cpp:403
DeviceCalibrationFactors_t CalibrationFactors
Loaded calibration factors used for device operation.
Definition Device.h:158
PS_Channel PsChannel
Power supply channel object.
Definition Device.h:139
void SetSettingsChanged(bool settingsChanged)
Change the value of the _settingsChanged variable and update the settings changed indicator (star in ...
Definition Device.cpp:194
void DeviceMainLoop()
This method is called from the main() loop continuously.
Definition Device.cpp:88
DeviceVoltages_t DeviceVoltages
Measured device ATX voltages.
Definition Device.h:157
void ResetDevice()
Reset all settings (except user waveforms and calibration factors) and save them to the EEPROM.
Definition Device.cpp:366
void LoadSettingsCalibrationFactors()
Load the calibration factors from the EEPROM.
Definition Device.cpp:345
void Init()
Initialize all sub systems of the device.
Definition Device.cpp:57
void CoerceCalibrationFactors()
Coerce all calibration factors to valid values if neccessary.
Definition Device.cpp:214
bool _settingsChanged
Variable used to keep track if all settings are changed (true if no unsaved settings exist; otherwise...
Definition Device.h:135
void SaveSettingsCalibrationFactors()
Save the calibration factors from the EEPROM.
Definition Device.cpp:272
Power supply channel Class.
Definition PS_Channel.h:61
Class that is used to control the screen.
Definition ScreenManager.h:133
Containing defines and functions for basic SPI initialization and handling.
Structure used internally to store to / read from EEPROM (except user waveforms and calibration facto...
Definition Device.h:85
uint8_t PS_OvpLevel
Power supply channel over voltage protection level.
Definition Device.h:88
bool PS_Enabled
Power supply channel output enabled.
Definition Device.h:87
float DDS1_Frequency
DDS channel 1 frequency.
Definition Device.h:99
PsRegulationModes_t PS_RegulationMode
Power supply channel regulation mode.
Definition Device.h:97
float DDS2_Amplitude
DDS channel 2 amplitude.
Definition Device.h:108
SignalForms_t DDS2_SignalForm
DDS channel 2 signal form.
Definition Device.h:107
float DDS1_PWM_Value
DDS channel 1 PWM value (only used for PWM SignalForm)
Definition Device.h:104
bool DDS1_Enabled
DDS channel 1 output enabled.
Definition Device.h:103
float PS_OvpDelay
Power supply channel over voltage protection delay.
Definition Device.h:90
float PS_OppLevel
Power supply channel over power protection level.
Definition Device.h:94
float DDS2_Frequency
DDS channel 2 frequency.
Definition Device.h:106
float DDS1_Offset
DDS channel 1 offset.
Definition Device.h:102
float PS_Voltage
Power supply channel voltage.
Definition Device.h:86
bool DDS2_Enabled
DDS channel 2 output enabled.
Definition Device.h:110
float PS_OppDelay
Power supply channel over power protection delay.
Definition Device.h:96
SignalForms_t DDS1_SignalForm
DDS channel 1 signal form.
Definition Device.h:100
DevicePowerUpOutputEnabledStates_t PowerOnOutputsState
Power up output state (state of all outputs on power up)
Definition Device.h:113
bool PS_OppState
Power supply channel over power protection state.
Definition Device.h:95
float DDS2_Offset
DDS channel 2 offset.
Definition Device.h:109
bool PS_OcpState
Power supply channel over current protection state.
Definition Device.h:92
float PS_OcpDelay
Power supply channel over current protection delay.
Definition Device.h:93
float DDS2_PWM_Value
DDS channel 2 PWM value (only used for PWM SignalForm)
Definition Device.h:111
float DDS1_Amplitude
DDS channel 1 amplitude.
Definition Device.h:101
bool PS_OvpState
Power supply channel over voltage protection state.
Definition Device.h:89
float PS_OcpLevel
Power supply channel over current protection level.
Definition Device.h:91
Structure containing all device calibration factors.
Definition Device.h:67
float Cal_PS_CURR_OFFSET
Correction factor for the PS_CURR offset measurement.
Definition Device.h:75
float Cal_PS_VOLT
Correction factor for the PS_VOLT measurement.
Definition Device.h:73
float Cal_RefVoltage
AVR VCC reference voltage in V.
Definition Device.h:68
float Cal_DMM2
Correction factor for the DMM2 measurement.
Definition Device.h:72
float Cal_ATX_5V
Correction factor for the ATX 5V measurement.
Definition Device.h:69
float Cal_DMM1
Correction factor for the DMM1 measurement.
Definition Device.h:71
float Cal_ATX_3V3
Correction factor for the ATX 3V3 measurement.
Definition Device.h:70
float Cal_PS_CURR
Correction factor for the PS_CURR measurement.
Definition Device.h:74
float Cal_DDS_FREQ
Correction factor for the DDS frequency setting.
Definition Device.h:76
bool Cal_Valid
If true, the calibration factors above are valid.
Definition Device.h:78
Structure containing all device ATX voltages.
Definition Device.h:58
float ATX_3V3
Voltage of the 3.3V ATX line.
Definition Device.h:59
float ATX_5V
Voltage of the 5V ATX line.
Definition Device.h:60