Firmware SDK
|
Driver for HARDWARIO Relay Module. More...
Typedefs | |
typedef struct twr_module_relay_t | twr_module_relay_t |
HARDWARIO Relay Module instance. | |
Enumerations | |
enum | twr_module_relay_state_t { TWR_MODULE_RELAY_STATE_UNKNOWN = -1 , TWR_MODULE_RELAY_STATE_FALSE = 0 , TWR_MODULE_RELAY_STATE_TRUE = 1 } |
Reported relay states. More... | |
Functions | |
bool | twr_module_relay_init (twr_module_relay_t *self, uint8_t i2c_address) |
Initialize HARDWARIO Relay Module. More... | |
void | twr_module_relay_set_state (twr_module_relay_t *self, bool state) |
Set relay to specified state. More... | |
twr_module_relay_state_t | twr_module_relay_get_state (twr_module_relay_t *self) |
Get current relay state. More... | |
void | twr_module_relay_pulse (twr_module_relay_t *self, bool direction, twr_tick_t duration) |
Generate pulse to specified state for given duration. More... | |
void | twr_module_relay_toggle (twr_module_relay_t *self) |
Toggle relay to opposite state. More... | |
Driver for HARDWARIO Relay Module.
Reported relay states.
Enumerator | |
---|---|
TWR_MODULE_RELAY_STATE_UNKNOWN | State is unknown. |
TWR_MODULE_RELAY_STATE_FALSE | State is false. |
TWR_MODULE_RELAY_STATE_TRUE | State is true. |
Definition at line 36 of file twr_module_relay.h.
twr_module_relay_state_t twr_module_relay_get_state | ( | twr_module_relay_t * | self | ) |
Get current relay state.
[in] | self | Instance |
Definition at line 221 of file twr_module_relay.c.
bool twr_module_relay_init | ( | twr_module_relay_t * | self, |
uint8_t | i2c_address | ||
) |
Initialize HARDWARIO Relay Module.
[in] | self | Instance |
Definition at line 28 of file twr_module_relay.c.
void twr_module_relay_pulse | ( | twr_module_relay_t * | self, |
bool | direction, | ||
twr_tick_t | duration | ||
) |
Generate pulse to specified state for given duration.
[in] | self | Instance |
[in] | direction | Desired pulse state |
[in] | duration | Desired pulse duration |
Definition at line 211 of file twr_module_relay.c.
void twr_module_relay_set_state | ( | twr_module_relay_t * | self, |
bool | state | ||
) |
Set relay to specified state.
[in] | self | Instance |
[in] | state | Desired relay state |
Definition at line 190 of file twr_module_relay.c.
Referenced by twr_module_relay_toggle().
void twr_module_relay_toggle | ( | twr_module_relay_t * | self | ) |
Toggle relay to opposite state.
[in] | self | Instance |
Definition at line 199 of file twr_module_relay.c.