diff --git a/openhantek/src/hantek/controlindexes.h b/openhantek/src/hantek/controlindexes.h new file mode 100644 index 0000000..4550865 --- /dev/null +++ b/openhantek/src/hantek/controlindexes.h @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#pragma once + +namespace Hantek { + +////////////////////////////////////////////////////////////////////////////// +/// \enum ControlIndex +/// \brief The array indices for the waiting control commands. +enum ControlIndex { + // CONTROLINDEX_VALUE, + // CONTROLINDEX_GETSPEED, + // CONTROLINDEX_BEGINCOMMAND, + CONTROLINDEX_SETOFFSET, + CONTROLINDEX_SETRELAYS, + CONTROLINDEX_SETVOLTDIV_CH1, + CONTROLINDEX_SETVOLTDIV_CH2, + CONTROLINDEX_SETTIMEDIV, + CONTROLINDEX_ACQUIIRE_HARD_DATA, + CONTROLINDEX_COUNT +}; + +} diff --git a/openhantek/src/hantek/controlsettings.h b/openhantek/src/hantek/controlsettings.h new file mode 100644 index 0000000..a53d273 --- /dev/null +++ b/openhantek/src/hantek/controlsettings.h @@ -0,0 +1,63 @@ +#pragma once + +#include "definitions.h" + +namespace Hantek { + +class ControlSamplerateLimits; + +////////////////////////////////////////////////////////////////////////////// +/// \struct ControlSettingsSamplerateTarget hantek/control.h +/// \brief Stores the target samplerate settings of the device. +struct ControlSettingsSamplerateTarget { + double samplerate; ///< The target samplerate set via setSamplerate + double duration; ///< The target record time set via setRecordTime + bool samplerateSet; ///< true means samplerate was set last, false duration +}; + +////////////////////////////////////////////////////////////////////////////// +/// \struct ControlSettingsSamplerate hantek/control.h +/// \brief Stores the current samplerate settings of the device. +struct ControlSettingsSamplerate { + ControlSettingsSamplerateTarget target; ///< The target samplerate values + ControlSamplerateLimits *limits; ///< The samplerate limits + unsigned int downsampler; ///< The variable downsampling factor + double current; ///< The current samplerate +}; + +////////////////////////////////////////////////////////////////////////////// +/// \struct ControlSettingsTrigger hantek/control.h +/// \brief Stores the current trigger settings of the device. +struct ControlSettingsTrigger { + double level[HANTEK_CHANNELS]; ///< The trigger level for each channel in V + double position; ///< The current pretrigger position + unsigned int point; ///< The trigger position in Hantek coding + Dso::TriggerMode mode; ///< The trigger mode + Dso::Slope slope; ///< The trigger slope + bool special; ///< true, if the trigger source is special + unsigned int source; ///< The trigger source +}; + +////////////////////////////////////////////////////////////////////////////// +/// \struct ControlSettingsVoltage hantek/control.h +/// \brief Stores the current amplification settings of the device. +struct ControlSettingsVoltage { + double offset; ///< The screen offset for each channel + double offsetReal; ///< The real offset for each channel (Due to quantization) + unsigned gain; ///< The gain id + bool used; ///< true, if the channel is used +}; + +////////////////////////////////////////////////////////////////////////////// +/// \struct ControlSettings hantek/control.h +/// \brief Stores the current settings of the device. +struct ControlSettings { + ControlSettingsSamplerate samplerate; ///< The samplerate settings + ControlSettingsVoltage voltage[HANTEK_CHANNELS]; ///< The amplification settings + ControlSettingsTrigger trigger; ///< The trigger settings + unsigned int recordLengthId; ///< The id in the record length array + unsigned short int usedChannels; ///< Number of activated channels +}; + +} + diff --git a/openhantek/src/hantek/stateStructs.h b/openhantek/src/hantek/controlspecification.h index c053731..bc7d1b3 100644 --- a/openhantek/src/hantek/stateStructs.h +++ b/openhantek/src/hantek/controlspecification.h @@ -8,33 +8,6 @@ namespace Hantek { ////////////////////////////////////////////////////////////////////////////// -/// \enum ControlIndex hantek/control.h -/// \brief The array indices for the waiting control commands. -enum ControlIndex { - // CONTROLINDEX_VALUE, - // CONTROLINDEX_GETSPEED, - // CONTROLINDEX_BEGINCOMMAND, - CONTROLINDEX_SETOFFSET, - CONTROLINDEX_SETRELAYS, - CONTROLINDEX_SETVOLTDIV_CH1, - CONTROLINDEX_SETVOLTDIV_CH2, - CONTROLINDEX_SETTIMEDIV, - CONTROLINDEX_ACQUIIRE_HARD_DATA, - CONTROLINDEX_COUNT -}; - -////////////////////////////////////////////////////////////////////////////// -/// \enum RollState hantek/types.h -/// \brief The states of the roll cycle (Since capture state isn't valid). -enum RollState { - ROLL_STARTSAMPLING = 0, ///< Start sampling - ROLL_ENABLETRIGGER = 1, ///< Enable triggering - ROLL_FORCETRIGGER = 2, ///< Force triggering - ROLL_GETDATA = 3, ///< Request sample data - ROLL_COUNT -}; - -////////////////////////////////////////////////////////////////////////////// /// \struct ControlSpecificationCommandsBulk hantek/control.h /// \brief Stores the bulk command codes used for this device. struct ControlSpecificationCommandsBulk { @@ -123,56 +96,5 @@ struct ControlSpecification { bool supportsCouplingRelays = true; }; -////////////////////////////////////////////////////////////////////////////// -/// \struct ControlSettingsSamplerateTarget hantek/control.h -/// \brief Stores the target samplerate settings of the device. -struct ControlSettingsSamplerateTarget { - double samplerate; ///< The target samplerate set via setSamplerate - double duration; ///< The target record time set via setRecordTime - bool samplerateSet; ///< true means samplerate was set last, false duration -}; - -////////////////////////////////////////////////////////////////////////////// -/// \struct ControlSettingsSamplerate hantek/control.h -/// \brief Stores the current samplerate settings of the device. -struct ControlSettingsSamplerate { - ControlSettingsSamplerateTarget target; ///< The target samplerate values - ControlSamplerateLimits *limits; ///< The samplerate limits - unsigned int downsampler; ///< The variable downsampling factor - double current; ///< The current samplerate -}; - -////////////////////////////////////////////////////////////////////////////// -/// \struct ControlSettingsTrigger hantek/control.h -/// \brief Stores the current trigger settings of the device. -struct ControlSettingsTrigger { - double level[HANTEK_CHANNELS]; ///< The trigger level for each channel in V - double position; ///< The current pretrigger position - unsigned int point; ///< The trigger position in Hantek coding - Dso::TriggerMode mode; ///< The trigger mode - Dso::Slope slope; ///< The trigger slope - bool special; ///< true, if the trigger source is special - unsigned int source; ///< The trigger source -}; - -////////////////////////////////////////////////////////////////////////////// -/// \struct ControlSettingsVoltage hantek/control.h -/// \brief Stores the current amplification settings of the device. -struct ControlSettingsVoltage { - unsigned gain; ///< The gain id - double offset; ///< The screen offset for each channel - double offsetReal; ///< The real offset for each channel (Due to quantization) - bool used; ///< true, if the channel is used -}; - -////////////////////////////////////////////////////////////////////////////// -/// \struct ControlSettings hantek/control.h -/// \brief Stores the current settings of the device. -struct ControlSettings { - ControlSettingsSamplerate samplerate; ///< The samplerate settings - ControlSettingsVoltage voltage[HANTEK_CHANNELS]; ///< The amplification settings - ControlSettingsTrigger trigger; ///< The trigger settings - unsigned int recordLengthId; ///< The id in the record length array - unsigned short int usedChannels; ///< Number of activated channels -}; } + diff --git a/openhantek/src/hantek/hantekdsocontrol.h b/openhantek/src/hantek/hantekdsocontrol.h index 45ca4d9..d588f2c 100644 --- a/openhantek/src/hantek/hantekdsocontrol.h +++ b/openhantek/src/hantek/hantekdsocontrol.h @@ -5,7 +5,10 @@ #include "bulkStructs.h" #include "controlStructs.h" #include "dsosamples.h" -#include "stateStructs.h" +#include "states.h" +#include "controlspecification.h" +#include "controlsettings.h" +#include "controlindexes.h" #include "utils/dataarray.h" #include "utils/printutils.h" diff --git a/openhantek/src/hantek/states.h b/openhantek/src/hantek/states.h new file mode 100644 index 0000000..53255a7 --- /dev/null +++ b/openhantek/src/hantek/states.h @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#pragma once + +namespace Hantek { + +////////////////////////////////////////////////////////////////////////////// +/// \enum RollState +/// \brief The states of the roll cycle (Since capture state isn't valid). +enum RollState { + ROLL_STARTSAMPLING = 0, ///< Start sampling + ROLL_ENABLETRIGGER = 1, ///< Enable triggering + ROLL_FORCETRIGGER = 2, ///< Force triggering + ROLL_GETDATA = 3, ///< Request sample data + ROLL_COUNT +}; + +}