39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_one_wire.h"
73#define EXPAND3_CMD_READ_PIO_REGISTERS 0xF0
74#define EXPAND3_CMD_CHANNEL_ACCESS_READ 0xF5
75#define EXPAND3_CMD_CHANNEL_ACCESS_WRITE 0x5A
76#define EXPAND3_CMD_WRITE_CONDITIONAL 0xCC
77#define EXPAND3_CMD_RESET_ACTIVITY_LATCHES 0xC3
83#define EXPAND3_REG_PIO_LOGIC 0x0088
84#define EXPAND3_REG_PIO_OUT_LATCH 0x0089
85#define EXPAND3_REG_PIO_ACTIVITY_LATCH 0x008A
86#define EXPAND3_REG_CHANNEL_MASK 0x008B
87#define EXPAND3_REG_CHANNEL_POLARITY 0x008C
88#define EXPAND3_REG_CONTROL 0x008D
106#define EXPAND3_STATUS_VCCP 0x80
107#define EXPAND3_CONTROL_PORL 0x08
108#define EXPAND3_CONTROL_ROS 0x04
109#define EXPAND3_CONTROL_CT 0x02
110#define EXPAND3_CONTROL_PLS 0x01
111#define EXPAND3_CONTROL_DEFAULT 0x00
112#define EXPAND3_MASK_DEFAULT 0x00
113#define EXPAND3_POLARITY_DEFAULT 0x00
119#define EXPAND3_CONFIRMATION_BYTE 0xAA
125#define EXPAND3_PIN_0 0x01
126#define EXPAND3_PIN_1 0x02
127#define EXPAND3_PIN_2 0x04
128#define EXPAND3_PIN_3 0x08
129#define EXPAND3_PIN_4 0x10
130#define EXPAND3_PIN_5 0x20
131#define EXPAND3_PIN_6 0x40
132#define EXPAND3_PIN_7 0x80
138#define EXPAND3_FAMILY_CODE 0x29
144#define EXPAND3_ADDRESS_0 0x00
145#define EXPAND3_ADDRESS_ALL 0xFF
163#define EXPAND3_MAP_MIKROBUS( cfg, mikrobus ) \
164 cfg.ow0 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
165 cfg.ow1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
166 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST );
expand3_return_value_t
Expand 3 Click return value data.
Definition expand3.h:221
@ EXPAND3_OK
Definition expand3.h:222
@ EXPAND3_ERROR
Definition expand3.h:223
expand3_gpio_sel_t
Expand 3 Click gpio selector.
Definition expand3.h:176
@ EXPAND3_GPIO_OW0
Definition expand3.h:177
@ EXPAND3_GPIO_OW1
Definition expand3.h:178
void expand3_cfg_setup(expand3_cfg_t *cfg)
Expand 3 configuration object setup function.
err_t expand3_reset_activity(expand3_t *ctx)
Expand 3 reset activity function.
err_t expand3_select_device(expand3_t *ctx)
Expand 3 select device function.
err_t expand3_write_mask(expand3_t *ctx, uint8_t mask)
Expand 3 write mask function.
err_t expand3_write_polarity(expand3_t *ctx, uint8_t polarity)
Expand 3 write polarity function.
err_t expand3_read_state(expand3_t *ctx, uint8_t *state)
Expand 3 read state function.
err_t expand3_read_register(expand3_t *ctx, uint16_t reg, uint8_t *data_out)
Expand 3 read register function.
err_t expand3_write_register(expand3_t *ctx, uint16_t reg, uint8_t data_in)
Expand 3 write register function.
err_t expand3_write_control(expand3_t *ctx, uint8_t control)
Expand 3 write control function.
err_t expand3_check_communication(expand3_t *ctx)
Expand 3 check communication function.
err_t expand3_read_activity(expand3_t *ctx, uint8_t *activity)
Expand 3 read activity function.
err_t expand3_read_control(expand3_t *ctx, uint8_t *control)
Expand 3 read control function.
void expand3_gpio_selection(expand3_cfg_t *cfg, expand3_gpio_sel_t gpio_sel)
Expand 3 driver interface setup function.
void expand3_reset_device(expand3_t *ctx)
Expand 3 reset device function.
err_t expand3_default_cfg(expand3_t *ctx)
Expand 3 default configuration function.
err_t expand3_init(expand3_t *ctx, expand3_cfg_t *cfg)
Expand 3 initialization function.
err_t expand3_read_current_state(expand3_t *ctx, uint8_t *curr_state)
Expand 3 read current state function.
err_t expand3_write_state(expand3_t *ctx, uint8_t state)
Expand 3 write state function.
err_t expand3_read_last_state(expand3_t *ctx, uint8_t *last_state)
Expand 3 read last state function.
void expand3_set_rst_pin(expand3_t *ctx, uint8_t state)
Expand 3 set rst pin function.
Expand 3 Click configuration object.
Definition expand3.h:204
pin_name_t ow0
Definition expand3.h:206
pin_name_t rst
Definition expand3.h:210
expand3_gpio_sel_t gpio_sel
Definition expand3.h:212
pin_name_t ow1
Definition expand3.h:207
Expand 3 Click context object.
Definition expand3.h:187
one_wire_rom_address_t rom_addr
Definition expand3.h:194
digital_out_t rst
Definition expand3.h:189
uint8_t address
Definition expand3.h:195
one_wire_t ow
Definition expand3.h:192