Hubo Library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Functions
Digital output support

Functions

bool HuboLib::Set_DO_Channels (unsigned char value)
 Requests the background thread to update all 8 bits of the digital output to the value specified. More...
 
bool HuboLib::Set_Slave_DO_Channels (int slaveNo, unsigned char value)
 Requests the background thread to update all 8 bits of the digital output to the value specified for a given slave. More...
 
bool HuboLib::Set_DO_Channel (int channel, bool bValue)
 Requests the background thread to set one of the digital outputs to the value specified. More...
 
bool HuboLib::Set_Slave_DO_Channel (int slaveNo, int channel, bool bValue)
 Requests the background thread to set one of the digital outputs to the value specified for a given slave. More...
 
bool HuboLib::Get_DO_Channels (unsigned char &value)
 Retrieves the requested digital output value from the output buffer. More...
 
bool HuboLib::Get_Slave_DO_Channels (int slaveNo, unsigned char &value)
 Retrieves the requested digital output value from the output buffer for a given slave. More...
 
bool HuboLib::Readback_DO_Channels (unsigned char &value)
 Reads back the digital output latchs of the IO expander. More...
 
bool HuboLib::Readback_Slave_DO_Channels (int slaveNo, unsigned char &value)
 Reads back the digital output latchs of the IO expander for a given slave. More...
 

Detailed Description

Function Documentation

bool HuboLib::Get_DO_Channels ( unsigned char &  value)

Retrieves the requested digital output value from the output buffer.

This function retrieves the value of the current output buffer. The output buffer gets modified by calls to Set_DO_Channel() and Set_DO_Channels().
Both functions - Get_DO_Channels() and Readback_DO_Channels() - can be used to verify whether an output request via Set_DO_Channel() or Set_DO_Channels() has already been performed by the IO expander. As long as the output has not been written, the values returned by Get_DO_Channels() and Readback_DO_Channels() differ.

Parameters
valueThe bit mask representing the state of the digital output buffer.
Returns
Since a call to this function will access the internal buffers, a call will always return true as long as the IO expander is present and has properly been initialized.
See also
Readback_DO_Channels(), Set_DO_Channels(), Set_DO_Channel(), Get_Slave_DO_Channels()
For an example on how to read and write individual digital outputs refer to the demo DigitalOutput2.cpp.
bool HuboLib::Get_Slave_DO_Channels ( int  slaveNo,
unsigned char &  value 
)

Retrieves the requested digital output value from the output buffer for a given slave.

This function behaves like Get_DO_Channels() but works on a slave as specified.

Parameters
slaveNoThe slave index in the list of slave addresses as specified by g_I2CConfig.m_MCP23017SlaveDeviceAddressList.
valueThe bit mask representing the state of the digital output buffer.
Returns
Since a call to this function will access the internal buffers, a call will always return true as long as the slave is present and has properly been initialized.
See also
Get_DO_Channels, Readback_Slave_DO_Channels(), Set_Slave_DO_Channel()
For an example on how to read and write individual digital outputs refer to the demo DigitalSlaveOutput1.cpp.
bool HuboLib::Readback_DO_Channels ( unsigned char &  value)

Reads back the digital output latchs of the IO expander.

The output latches of the IO expander chip are frequently read back during each cycle time tick of the background thread. This function retrieves these buffered output latch values of the IO expander.
Both functions - Get_DO_Channels() and Readback_DO_Channels() - can be used to verify whether an output request via Set_DO_Channel() or Set_DO_Channels() has already been performed by the IO expander. As long as the output has not been written, the values returned by Get_DO_Channels() and Readback_DO_Channels() differ.

Parameters
valueThe bit mask representing the buffered state of the IO expanders digital output latchs.
Returns
Since a call to this function will access the internal buffers, a call will always return true as long as the IO expander is present and has properly been initialized.
See also
Get_DO_Channels(), Set_DO_Channels(), Set_DO_Channel(), Readback_Slave_DO_Channels()
For an example on how to read back the IO expanders output latches refer to the demo DigitalOutput2.cpp.
bool HuboLib::Readback_Slave_DO_Channels ( int  slaveNo,
unsigned char &  value 
)

Reads back the digital output latchs of the IO expander for a given slave.

This function behaves like Readback_DO_Channels() but works on a slave as specified.

Parameters
slaveNoThe slave index in the list of slave addresses as specified by g_I2CConfig.m_MCP23017SlaveDeviceAddressList.
valueThe bit mask representing the buffered state of the IO expanders digital output latchs.
Returns
Since a call to this function will access the internal buffers, a call will always return true as long as the slave is present and has properly been initialized.
See also
Readback_DO_Channels, Get_Slave_DO_Channels(), Set_Slave_DO_Channels()
For an example on how to read back the IO expanders output latches refer to the demo DigitalSlaveOutput2.cpp.
bool HuboLib::Set_DO_Channel ( int  channel,
bool  bValue 
)

Requests the background thread to set one of the digital outputs to the value specified.

This function tells the background thread to set a dedicated digital output to the value specified during its next cycle time.

Parameters
channelThe digital output channel to be set. Valid ranges are 0 through 7.
bValueIf true then the output is set, otherwise it is reset.
Returns
Since a call to this function will access the internal buffers, a call will always return true as long as the IO expander is present, has properly been initialized and the channel value is within the allowed range of 0..7.
See also
Set_DO_Channels(), Set_Slave_DO_Channel()
For an example on how to write individual digital outputs refer to the demo DigitalOutput1.cpp.
bool HuboLib::Set_DO_Channels ( unsigned char  value)

Requests the background thread to update all 8 bits of the digital output to the value specified.

This function tells the background thread to transfer the values as specified to the IO expander during its next cycle time.

Parameters
valueThe bit mask representing the state of the digital outputs as to be set.
Returns
Since a call to this function will access the internal buffers, a call will always return true as long as the IO expander is present and has properly been initialized.
See also
Set_DO_Channel(), Set_Slave_DO_Channels()
For an example on how to write the digital outputs refer to the demos DigitalOutput1.cpp, DigitalOutput2.cpp and LoadTest.cpp.
bool HuboLib::Set_Slave_DO_Channel ( int  slaveNo,
int  channel,
bool  bValue 
)

Requests the background thread to set one of the digital outputs to the value specified for a given slave.

This function behaves like Set_DO_Channel() but works on a slave as specified.

Parameters
slaveNoThe slave index in the list of slave addresses as specified by g_I2CConfig.m_MCP23017SlaveDeviceAddressList.
channelThe digital output channel to be set. Valid ranges are 0 through 7.
bValueIf true then the output is set, otherwise it is reset.
Returns
Since a call to this function will access the internal buffers, a call will always return true as long as the slave is present, has properly been initialized and the channel value is within the allowed range of 0..7.
See also
Set_DO_Channel(), Set_Slave_DO_Channels()
For an example on how to write individual digital outputs refer to the demo DigitalSlaveOutput1.cpp.
bool HuboLib::Set_Slave_DO_Channels ( int  slaveNo,
unsigned char  value 
)

Requests the background thread to update all 8 bits of the digital output to the value specified for a given slave.

This function behaves like Set_DO_Channels() but works on a slave as specified.

Parameters
slaveNoThe slave index in the list of slave addresses as specified by g_I2CConfig.m_MCP23017SlaveDeviceAddressList.
valueThe bit mask representing the state of the digital outputs as to be set.
Returns
Since a call to this function will access the internal buffers, a call will always return true as long as the slave is present and has properly been initialized.
See also
Set_DO_Channels(), Set_Slave_DO_Channel()
For an example on how to write the digital outputs refer to the demos DigitalSlaveOutput1.cpp and DigitalSlaveOutput2.cpp.