Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_onewire_relay.h
1 #ifndef _BC_ONEWIRE_RELAY_H
2 #define _BC_ONEWIRE_RELAY_H
3 
4 #include <bc_onewire.h>
5 
6 #define BC_ONEWIRE_RELAY_FAMILY_CODE 0x29
7 
11 
12 typedef enum
13 {
14  BC_ONEWIRE_RELAY_CHANNEL_Q1 = 0,
15  BC_ONEWIRE_RELAY_CHANNEL_Q2 = 1,
16  BC_ONEWIRE_RELAY_CHANNEL_Q3 = 2,
17  BC_ONEWIRE_RELAY_CHANNEL_Q4 = 3,
18  BC_ONEWIRE_RELAY_CHANNEL_Q5 = 4,
19  BC_ONEWIRE_RELAY_CHANNEL_Q6 = 5,
20  BC_ONEWIRE_RELAY_CHANNEL_Q7 = 6,
21  BC_ONEWIRE_RELAY_CHANNEL_Q8 = 7
22 
23 } bc_onewire_relay_channel_t;
24 
26 
27 typedef struct
28 {
29  uint64_t _device_number;
30  bc_gpio_channel_t _channel;
31  uint8_t _state;
32  bool _state_valid;
33 
35 
40 
41 bool bc_onewire_relay_init(bc_onewire_relay_t *self, bc_gpio_channel_t channel, uint64_t device_number);
42 
49 
50 bool bc_onewire_relay_set_state(bc_onewire_relay_t *self, bc_onewire_relay_channel_t relay_channel, bool state);
51 
58 
59 bool bc_onewire_relay_get_state(bc_onewire_relay_t *self, bc_onewire_relay_channel_t relay_channel, bool *state);
60 
62 
63 #endif // _BC_ONEWIRE_RELAY_H
bool bc_onewire_relay_init(bc_onewire_relay_t *self, bc_gpio_channel_t channel, uint64_t device_number)
Initialize relay.
bool bc_onewire_relay_get_state(bc_onewire_relay_t *self, bc_onewire_relay_channel_t relay_channel, bool *state)
Get current relay state.
bc_gpio_channel_t
GPIO channels.
Definition: bc_gpio.h:12
bool bc_onewire_relay_set_state(bc_onewire_relay_t *self, bc_onewire_relay_channel_t relay_channel, bool state)
Set relay to specified state.
BigClown 1-wire relay instance.