Go to the documentation of this file.
28 #ifndef C1WIRESWITCH_H
29 #define C1WIRESWITCH_H
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_one_wire.h"
69 #define C1WIRESWITCH_CMD_WRITE_SCRATCHPAD 0x5A
70 #define C1WIRESWITCH_CMD_READ_SCRATCHPAD 0xF5
72 #define C1WIRESWITCH_CMD_WRITE_PIO 0x5A
73 #define C1WIRESWITCH_CMD_READ_PIO 0xF5
79 #define C1WIRESWITCH_PIOB_STATE_MASK 0x04
80 #define C1WIRESWITCH_PIOA_STATE_MASK 0x01
81 #define C1WIRESWITCH_PIOB_LATCH_STATE_MASK 0x08
82 #define C1WIRESWITCH_PIOA_LATCH_STATE_MASK 0x02
88 #define C1WIRESWITCH_PIOA_HIGH 0x01
89 #define C1WIRESWITCH_PIOA_LOW 0x00
90 #define C1WIRESWITCH_PIOB_HIGH 0x04
91 #define C1WIRESWITCH_PIOB_LOW 0x00
93 #define C1WIRESWITCH_PIOB_ON 0x02
94 #define C1WIRESWITCH_PIOB_OFF 0x00
95 #define C1WIRESWITCH_PIOA_ON 0x00
96 #define C1WIRESWITCH_PIOA_OFF 0x01
98 #define C1WIRESWITCH_PIOB_LATCH_LOW 0x00
99 #define C1WIRESWITCH_PIOB_LATCH_HIGH 0x08
100 #define C1WIRESWITCH_PIOA_LATCH_LOW 0x00
101 #define C1WIRESWITCH_PIOA_LATCH_HIGH 0x02
119 #define C1WIRESWITCH_FAMILY_CODE 0x3A
125 #define C1WIRESWITCH_ADDRESS 0x33
126 #define C1WIRESWITCH_ADDRESS_ALL 0xFF
144 #define C1WIRESWITCH_MAP_MIKROBUS( cfg, mikrobus ) \
145 cfg.gp0 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
146 cfg.gp1 = MIKROBUS( mikrobus, MIKROBUS_AN );
388 #endif // C1WIRESWITCH_H
err_t c1wireswitch_init(c1wireswitch_t *ctx, c1wireswitch_cfg_t *cfg)
1-Wire Switch initialization function.
err_t c1wireswitch_check_communication(c1wireswitch_t *ctx)
1-Wire Switch check communication function.
err_t c1wireswitch_get_pio_state(c1wireswitch_t *ctx, uint8_t *pio_a, uint8_t *pio_b)
1-Wire Switch read specific programmable I/O state function.
err_t c1wireswitch_read_pio(c1wireswitch_t *ctx, uint8_t *state)
1-Wire Switch read programmable I/O state function.
one_wire_t ow
Definition: c1wireswitch.h:169
pin_name_t gp1
Definition: c1wireswitch.h:184
pin_name_t gp0
Definition: c1wireswitch.h:183
err_t c1wireswitch_read_scratchpad(c1wireswitch_t *ctx, uint8_t *scratchpad, uint8_t scratchpad_len)
1-Wire Switch read scratchpad function.
void c1wireswitch_cfg_setup(c1wireswitch_cfg_t *cfg)
1-Wire Switch configuration object setup function.
one_wire_rom_address_t rom_addr
Definition: c1wireswitch.h:171
err_t c1wireswitch_set_pio_state(c1wireswitch_t *ctx, uint8_t pio_a, uint8_t pio_b)
1-Wire Switch write specific programmable I/O state function.
void c1wireswitch_gpio_selection(c1wireswitch_cfg_t *cfg, c1wireswitch_gpio_sel_t gpio_sel)
1-Wire Switch driver interface setup function.
@ C1WIRESWITCH_GPIO_0
Definition: c1wireswitch.h:157
@ C1WIRESWITCH_GPIO_1
Definition: c1wireswitch.h:158
err_t c1wireswitch_select_device(c1wireswitch_t *ctx)
1-Wire Switch select device function.
err_t c1wireswitch_get_pio_latch_state(c1wireswitch_t *ctx, uint8_t *pio_a_latch, uint8_t *pio_b_latch)
1-Wire Switch read programmable I/O latch state function.
1-Wire Switch Click context object.
Definition: c1wireswitch.h:167
c1wireswitch_return_value_t
1-Wire Switch Click return value data.
Definition: c1wireswitch.h:195
c1wireswitch_gpio_sel_t
1-Wire Switch Click gpio selector.
Definition: c1wireswitch.h:156
err_t c1wireswitch_write_scratchpad(c1wireswitch_t *ctx, uint8_t *scratchpad, uint8_t scratchpad_len)
1-Wire Switch write scratchpad function.
@ C1WIRESWITCH_ERROR
Definition: c1wireswitch.h:197
@ C1WIRESWITCH_OK
Definition: c1wireswitch.h:196
err_t c1wireswitch_write_pio(c1wireswitch_t *ctx, uint8_t state)
1-Wire Switch write programmable I/O state function.
uint8_t address
Definition: c1wireswitch.h:172
c1wireswitch_gpio_sel_t gpio_sel
Definition: c1wireswitch.h:186
1-Wire Switch Click configuration object.
Definition: c1wireswitch.h:181
err_t c1wireswitch_default_cfg(c1wireswitch_t *ctx)
1-Wire Switch default configuration function.