Utility class for managing Acromag xt12XX digital I/O channels. More...
#include <xtChannels.hpp>
Public Member Functions | |
xtChannels () | |
c'tor More... | |
int | setInputOnly (size_t chNo) |
Set a channel to be input only. More... | |
int | setChannel (size_t chNo) |
Set a channel to true. More... | |
int | clearChannel (size_t chNo) |
Set a channel to false. More... | |
int | clearAll () |
Clear all channels. More... | |
int | setRegisters (uint16_t registers[numRegisters]) |
Set registers based on current channel states. More... | |
int | readRegisters (uint16_t registers[numRegisters]) |
Read channel states from the registers. More... | |
int | channel (size_t chNo) |
Gets the current state of a channel. More... | |
Static Public Attributes | |
static constexpr int | numChannels = _numChannels |
The number of channels controlled by the device. More... | |
static constexpr int | numRegisters = _numChannels/4 |
The number of registers needed for the number of channels. More... | |
Protected Attributes | |
bool | m_channels [numChannels] |
The state of the channels. More... | |
bool | m_inputOnly [numChannels] |
Control which channels can not be set to output. More... | |
Utility class for managing Acromag xt12XX digital I/O channels.
Reads and writes input "registers" (uint16_t) for modbus protocol.
_numChannels | is the number of channels controlled by this device. |
Definition at line 22 of file xtChannels.hpp.
xtChannels< numChannels >::xtChannels |
int xtChannels< numChannels >::channel | ( | size_t | chNo | ) |
Gets the current state of a channel.
[in] | chNo | the channel to retrieve |
Definition at line 193 of file xtChannels.hpp.
Referenced by MagAOX::app::xt1121Ctrl::channelSetCallback(), MagAOX::app::xt1121Ctrl::getState(), and xtChannels_test::SCENARIO().
int xtChannels< numChannels >::clearAll |
Clear all channels.
Definition at line 146 of file xtChannels.hpp.
Referenced by xtChannels_test::SCENARIO().
int xtChannels< numChannels >::clearChannel | ( | size_t | chNo | ) |
Set a channel to false.
[in] | chNo | the channel to clear |
Definition at line 136 of file xtChannels.hpp.
Referenced by MagAOX::app::xt1121Ctrl::channelSetCallback().
int xtChannels< numChannels >::readRegisters | ( | uint16_t | registers[numRegisters] | ) |
Read channel states from the registers.
This changes m_channels as they are read.
[in] | registers | the array of registers to read |
Definition at line 178 of file xtChannels.hpp.
Referenced by MagAOX::app::xt1121Ctrl::getState(), and xtChannels_test::SCENARIO().
int xtChannels< numChannels >::setChannel | ( | size_t | chNo | ) |
Set a channel to true.
[in] | chNo | the channel to set |
Definition at line 110 of file xtChannels.hpp.
Referenced by MagAOX::app::xt1121Ctrl::channelSetCallback(), and xtChannels_test::SCENARIO().
int xtChannels< numChannels >::setInputOnly | ( | size_t | chNo | ) |
Set a channel to be input only.
A channel which is input only will not be sent as an output to the device regardless of its state in m_channels.
[in] | chNo | the channel to set to input only |
Definition at line 126 of file xtChannels.hpp.
Referenced by MagAOX::app::xt1121Ctrl::loadConfig(), and xtChannels_test::SCENARIO().
int xtChannels< numChannels >::setRegisters | ( | uint16_t | registers[numRegisters] | ) |
Set registers based on current channel states.
Respects input only settings.
[out] | registers | the array of registers to set |
Definition at line 154 of file xtChannels.hpp.
Referenced by MagAOX::app::xt1121Ctrl::channelSetCallback(), and xtChannels_test::SCENARIO().
|
protected |
The state of the channels.
Definition at line 29 of file xtChannels.hpp.
|
protected |
Control which channels can not be set to output.
Definition at line 31 of file xtChannels.hpp.
|
staticconstexpr |
The number of channels controlled by the device.
Definition at line 24 of file xtChannels.hpp.
|
staticconstexpr |
The number of registers needed for the number of channels.
Definition at line 26 of file xtChannels.hpp.
Referenced by MagAOX::app::xt1121Ctrl::channelSetCallback(), and MagAOX::app::xt1121Ctrl::getState().