Hubo Library
|
Typedefs | |
typedef void(* | HuboLib::T_pfn_DIChangedCallback) (unsigned char changedDigitalInputValues, unsigned char digitalInputValues) |
Prototype definition of the callback function beeing called whenever a change of any of the digital inputs is detected. More... | |
Functions | |
bool | HuboLib::Get_DI_Channels (unsigned char &value) |
Retrieves the value of all digital inputs. More... | |
bool | HuboLib::Get_DI_Channels_Raw (unsigned char &values) |
Retrieves the unbuffered values of all digital inputs (of the Hubo master module). More... | |
bool | HuboLib::Get_Slave_DI_Channels (int slaveNo, unsigned char &value) |
Retrieves the value of all digital inputs. More... | |
bool | HuboLib::Get_DI_Channel (int channel, bool &bValue) |
Retrieves the value of one digital input. More... | |
bool | HuboLib::Get_Slave_DI_Channel (int slaveNo, int channel, bool &bValue) |
Retrieves the value of one digital input for a given slave. More... | |
bool | HuboLib::Register_DIChangedCallback (T_pfn_DIChangedCallback pFnDIChangedCallback) |
Register a callback to be called whenever one or more of the digital inputs have changed. More... | |
bool | HuboLib::Unregister_DIChangedCallback (T_pfn_DIChangedCallback pFnDIChangedCallback) |
Unregister a callback previouly registered by a call to Register_DIChangedCallback(). More... | |
typedef void(* HuboLib::T_pfn_DIChangedCallback) (unsigned char changedDigitalInputValues, unsigned char digitalInputValues) |
Prototype definition of the callback function beeing called whenever a change of any of the digital inputs is detected.
Registering a callback routine provides a way to an application to get notified whenever the background thread detects the changing of an digital input. This can be usefull to an application that does not want to poll for changes on the digital inputs but use the background threads cycle time for detection instead. The callback is executed after inputs and outputs have been processed by the background thread but prior to calls to the callbacks for the cycle tick and the channel delay.
Just like the cycle tick callback this function is also called by the background thread - thus all timing considerations also apply to this callback function.
changedDigitalInputValues | The bit mask indicating a changed input via the bit set. |
digitalInputValues | The current state of the digital inputs. |
bool HuboLib::Get_DI_Channel | ( | int | channel, |
bool & | bValue | ||
) |
Retrieves the value of one digital input.
This function returns the buffered value of the last latched digital inputs.
channel | The digital input channel to retrieve the state from. Valid ranges are 0 through 7. |
bValue | If the channel is being set bValue is true, otherwise false. |
bool HuboLib::Get_DI_Channels | ( | unsigned char & | value | ) |
Retrieves the value of all digital inputs.
This function returns the buffered value of the last latched digital inputs.
value | The bit mask representing the current state of the digital inputs. |
bool HuboLib::Get_DI_Channels_Raw | ( | unsigned char & | values | ) |
Retrieves the unbuffered values of all digital inputs (of the Hubo master module).
While this function requires a proper initialization by a call to Initialize() it does not require any further operations. It does not provide a check for correct initialization but directly accesses the hardware without storing the results in the buffers associated with the digital inputs. The function should be used in cases where very fast access to digital input values is required (up to 2kHz) which cannot be achieved by further decreasing of the cycle time. This can be handy when trying to follow (or capture) a signal once a certain condition is met. However, remember that the background thread runs at a very high priority likely to prevent the rest of the system from running. So make sure your callback routine is taking this into account.
value | The bit mask representing the current state of the digital inputs. |
bool HuboLib::Get_Slave_DI_Channel | ( | int | slaveNo, |
int | channel, | ||
bool & | bValue | ||
) |
Retrieves the value of one digital input for a given slave.
This function behaves like Get_DI_Channel() but works on a slave as specified.
slaveNo | The slave index in the list of slave addresses as specified by g_I2CConfig.m_MCP23017SlaveDeviceAddressList. |
channel | The digital input channel to retrieve the state from. Valid ranges are 0 through 7. |
bValue | If the channel is being set bValue is true, otherwise false. |
bool HuboLib::Get_Slave_DI_Channels | ( | int | slaveNo, |
unsigned char & | value | ||
) |
Retrieves the value of all digital inputs.
This function returns the buffered value of the last latched digital inputs for a given slave. This function behaves like Get_DI_Channels() but works on a slave as specified.
slaveNo | The slave index in the list of slave addresses as specified by g_I2CConfig.m_MCP23017SlaveDeviceAddressList. |
value | The bit mask representing the current state of the digital inputs. |
bool HuboLib::Register_DIChangedCallback | ( | T_pfn_DIChangedCallback | pFnDIChangedCallback | ) |
Register a callback to be called whenever one or more of the digital inputs have changed.
This function is used to register a callback routine that is called whenever one or more of the digital inputs have changed during the last cycle time. The callback routine receives information on the bit mask the input changes as well as the current state of the inputs.
Unregistration is performed by Unregister_DIChangedCallback().
pFnDIChangedCallback | Pointer to the callback function to be called whenever one or more digital inputs have changed their state. Function pointers are not chained. Passing 0 as an argument disables the callback. |
bool HuboLib::Unregister_DIChangedCallback | ( | T_pfn_DIChangedCallback | pFnDIChangedCallback | ) |
Unregister a callback previouly registered by a call to Register_DIChangedCallback().
This function is used to unregister a single callback routine previously added. If pFnDIChangedCallback is 0 then the call will unregister all callback routines.
pFnDIChangedCallback | Pointer to the callback to be unregistered from the list of callback functions or 0 if all callback functions are to be removed from the list. |