Skip to content

Commit

Permalink
M2kHardwareTriggerImpl: expose missing overloads
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Stanea <[email protected]>
  • Loading branch information
Adrian-Stanea committed Aug 30, 2024
1 parent 209056a commit 71ae6ee
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
22 changes: 19 additions & 3 deletions include/libm2k/m2khardwaretrigger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,36 @@ class LIBM2K_API M2kHardwareTrigger

/**
* @brief Get the trigger condition for the digital trigger on a specific channel
* @param chnIdx the required channel
* @return the trigger condition
* @param chnIdx The index of the required channel
* @return The trigger condition
*/
virtual M2K_TRIGGER_CONDITION_DIGITAL getDigitalCondition(unsigned int chnIdx) = 0;


/**
* @brief Get the trigger condition for the digital trigger on a specific channel
* @param chnIdx An enumerator corresponding to the index of the required channel
* @return The trigger condition
*/
virtual M2K_TRIGGER_CONDITION_DIGITAL getDigitalCondition(libm2k::digital::DIO_CHANNEL chnIdx) = 0;


/**
* @brief Set the trigger condition for the digital trigger on a specific channel
* @param chnIdx the required channel
* @param chnIdx The index of the required channel
* @param cond the specific trigger condition
*/
virtual void setDigitalCondition(unsigned int chnIdx, M2K_TRIGGER_CONDITION_DIGITAL cond) = 0;


/**
* @brief Set the trigger condition for the digital trigger on a specific channel
* @param chnIdx An enumerator corresponding to the index of the required channel
* @param cond the specific trigger condition
*/
virtual void setDigitalCondition(libm2k::digital::DIO_CHANNEL chnIdx, M2K_TRIGGER_CONDITION_DIGITAL cond) = 0;



/**
* @brief Get the mode for the analog trigger on a specific channel
Expand Down
16 changes: 8 additions & 8 deletions src/m2khardwaretrigger_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ void M2kHardwareTriggerImpl::setAnalogCondition(unsigned int chnIdx, M2K_TRIGGER
}


M2K_TRIGGER_CONDITION_DIGITAL M2kHardwareTriggerImpl::getDigitalCondition(DIO_CHANNEL chn)
M2K_TRIGGER_CONDITION_DIGITAL M2kHardwareTriggerImpl::getDigitalCondition(DIO_CHANNEL chnIdx)
{
std::string trigger_val = m_digital_trigger_device->getStringValue(chn, "trigger", false);
std::string trigger_val = m_digital_trigger_device->getStringValue(chnIdx, "trigger", false);
std::vector<std::string> available_digital_conditions = getAvailableDigitalConditions();

auto it = std::find(available_digital_conditions.begin(),
Expand All @@ -288,21 +288,21 @@ M2K_TRIGGER_CONDITION_DIGITAL M2kHardwareTriggerImpl::getDigitalCondition(DIO_CH
(it - available_digital_conditions.begin());
}

M2K_TRIGGER_CONDITION_DIGITAL M2kHardwareTriggerImpl::getDigitalCondition(unsigned int chn)
M2K_TRIGGER_CONDITION_DIGITAL M2kHardwareTriggerImpl::getDigitalCondition(unsigned int chnIdx)
{
DIO_CHANNEL idx = static_cast<DIO_CHANNEL>(chn);
DIO_CHANNEL idx = static_cast<DIO_CHANNEL>(chnIdx);
return getDigitalCondition(idx);
}

void M2kHardwareTriggerImpl::setDigitalCondition(DIO_CHANNEL chn, M2K_TRIGGER_CONDITION_DIGITAL cond)
void M2kHardwareTriggerImpl::setDigitalCondition(DIO_CHANNEL chnIdx, M2K_TRIGGER_CONDITION_DIGITAL cond)
{
std::string trigger_val = getAvailableDigitalConditions()[cond];
m_digital_trigger_device->setStringValue(chn, "trigger", trigger_val, false);
m_digital_trigger_device->setStringValue(chnIdx, "trigger", trigger_val, false);
}

void M2kHardwareTriggerImpl::setDigitalCondition(unsigned int chn, M2K_TRIGGER_CONDITION_DIGITAL cond)
void M2kHardwareTriggerImpl::setDigitalCondition(unsigned int chnIdx, M2K_TRIGGER_CONDITION_DIGITAL cond)
{
DIO_CHANNEL idx = static_cast<DIO_CHANNEL>(chn);
DIO_CHANNEL idx = static_cast<DIO_CHANNEL>(chnIdx);
setDigitalCondition(idx, cond);
}

Expand Down
7 changes: 2 additions & 5 deletions src/m2khardwaretrigger_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ class M2kHardwareTriggerImpl : public M2kHardwareTrigger
void setAnalogCondition(unsigned int chnIdx, M2K_TRIGGER_CONDITION_ANALOG cond) override;

M2K_TRIGGER_CONDITION_DIGITAL getDigitalCondition(unsigned int chnIdx) override;
M2K_TRIGGER_CONDITION_DIGITAL getDigitalCondition(DIO_CHANNEL chnIdx) override;
void setDigitalCondition(unsigned int chnIdx, M2K_TRIGGER_CONDITION_DIGITAL cond) override;
void setDigitalCondition(DIO_CHANNEL chnIdx, M2K_TRIGGER_CONDITION_DIGITAL cond) override;

M2K_TRIGGER_MODE getAnalogMode(unsigned int chnIdx) override;
void setAnalogMode(unsigned int chnIdx, M2K_TRIGGER_MODE mode) override;
Expand Down Expand Up @@ -102,11 +104,6 @@ class M2kHardwareTriggerImpl : public M2kHardwareTrigger
bool hasExternalTriggerOut() const;
bool hasCrossInstrumentTrigger() const;


M2K_TRIGGER_CONDITION_DIGITAL getDigitalCondition(DIO_CHANNEL chn);
void setDigitalCondition(DIO_CHANNEL chn, M2K_TRIGGER_CONDITION_DIGITAL cond);


void setAnalogOutTriggerSource(M2K_TRIGGER_SOURCE_OUT src) override;
M2K_TRIGGER_SOURCE_OUT getAnalogOutTriggerSource() const override;

Expand Down

0 comments on commit 71ae6ee

Please sign in to comment.