Firmware SDK
twr_onewire_relay.h
1 #ifndef _TWR_ONEWIRE_RELAY_H
2 #define _TWR_ONEWIRE_RELAY_H
3 
4 #include <twr_onewire.h>
5 
6 #define TWR_ONEWIRE_RELAY_FAMILY_CODE 0x29
7 
11 
12 typedef enum
13 {
14  TWR_ONEWIRE_RELAY_CHANNEL_Q1 = 0,
15  TWR_ONEWIRE_RELAY_CHANNEL_Q2 = 1,
16  TWR_ONEWIRE_RELAY_CHANNEL_Q3 = 2,
17  TWR_ONEWIRE_RELAY_CHANNEL_Q4 = 3,
18  TWR_ONEWIRE_RELAY_CHANNEL_Q5 = 4,
19  TWR_ONEWIRE_RELAY_CHANNEL_Q6 = 5,
20  TWR_ONEWIRE_RELAY_CHANNEL_Q7 = 6,
21  TWR_ONEWIRE_RELAY_CHANNEL_Q8 = 7
22 
23 } twr_onewire_relay_channel_t;
24 
26 
27 typedef struct
28 {
29  uint64_t _device_number;
30  twr_onewire_t *_onewire;
31  uint8_t _state;
32  bool _state_valid;
33 
35 
41 
42 bool twr_onewire_relay_init(twr_onewire_relay_t *self, twr_onewire_t *onewire, uint64_t device_number);
43 
50 
51 bool twr_onewire_relay_set_state(twr_onewire_relay_t *self, twr_onewire_relay_channel_t relay_channel, bool state);
52 
59 
60 bool twr_onewire_relay_get_state(twr_onewire_relay_t *self, twr_onewire_relay_channel_t relay_channel, bool *state);
61 
63 
64 #endif // _TWR_ONEWIRE_RELAY_H
bool twr_onewire_relay_set_state(twr_onewire_relay_t *self, twr_onewire_relay_channel_t relay_channel, bool state)
Set relay to specified state.
bool twr_onewire_relay_get_state(twr_onewire_relay_t *self, twr_onewire_relay_channel_t relay_channel, bool *state)
Get current relay state.
bool twr_onewire_relay_init(twr_onewire_relay_t *self, twr_onewire_t *onewire, uint64_t device_number)
Initialize relay.
struct twr_onewire_t twr_onewire_t
1-Wire instance
Definition: twr_onewire.h:14
HARDWARIO 1-wire relay instance.