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_i2c_master.h"
73#define EXPAND16_REG_DEV_ID_AND_CTRL 0x01
74#define EXPAND16_REG_IO_DIRECTION 0x03
75#define EXPAND16_REG_OUTPUT_STATE 0x05
76#define EXPAND16_REG_OUTPUT_HIGH_Z 0x07
77#define EXPAND16_REG_INPUT_DEF_STATE 0x09
78#define EXPAND16_REG_PULL_ENABLE 0x0B
79#define EXPAND16_REG_PULL_DOWN_UP 0x0D
80#define EXPAND16_REG_INPUT_STATE 0x0F
81#define EXPAND16_REG_INTERRUPT_MASK 0x11
82#define EXPAND16_REG_INTERRUPT_STATUS 0x13
100#define EXPAND16_PIN_MASK_NONE 0x00
101#define EXPAND16_PIN_MASK_GPIO_0 0x01
102#define EXPAND16_PIN_MASK_GPIO_1 0x02
103#define EXPAND16_PIN_MASK_GPIO_2 0x04
104#define EXPAND16_PIN_MASK_GPIO_3 0x08
105#define EXPAND16_PIN_MASK_GPIO_4 0x10
106#define EXPAND16_PIN_MASK_GPIO_5 0x20
107#define EXPAND16_PIN_MASK_GPIO_6 0x40
108#define EXPAND16_PIN_MASK_GPIO_7 0x80
109#define EXPAND16_PIN_MASK_ALL 0xFF
115#define EXPAND16_SW_RESET_CMD 0x01
121#define EXPAND16_DEVICE_ID 0xA0
122#define EXPAND16_DEVICE_ID_MASK 0xE0
128#define EXPAND16_PIN_STATE_HIGH 0x01
129#define EXPAND16_PIN_STATE_LOW 0x00
136#define EXPAND16_DEVICE_ADDRESS_GND 0x43
137#define EXPAND16_DEVICE_ADDRESS_VCC 0x44
155#define EXPAND16_MAP_MIKROBUS( cfg, mikrobus ) \
156 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
157 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
158 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
159 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
expand16_return_value_t
Expand 16 Click return value data.
Definition expand16.h:206
@ EXPAND16_OK
Definition expand16.h:207
@ EXPAND16_ERROR
Definition expand16.h:208
err_t expand16_init(expand16_t *ctx, expand16_cfg_t *cfg)
Expand 16 initialization function.
void expand16_set_rst_pin(expand16_t *ctx, uint8_t pin_state)
Expand 16 set RST pin state function.
err_t expand16_set_output_state(expand16_t *ctx, uint8_t clr_mask, uint8_t set_mask)
Expand 16 set output pins state function.
void expand16_cfg_setup(expand16_cfg_t *cfg)
Expand 16 configuration object setup function.
uint8_t expand16_get_int_pin(expand16_t *ctx)
Expand 16 get INT pin function.
void expand16_hw_reset(expand16_t *ctx)
Expand 16 Hardware reset function.
err_t expand16_generic_write(expand16_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Expand 16 I2C writing function.
err_t expand16_set_io_dir(expand16_t *ctx, uint8_t input_pins, uint8_t output_pins)
Expand 16 set pin input or output direction function.
err_t expand16_read_reg(expand16_t *ctx, uint8_t reg, uint8_t *data_out)
Expand 16 register read function.
err_t expand16_default_cfg(expand16_t *ctx)
Expand 16 default configuration function.
err_t expand16_generic_read(expand16_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Expand 16 I2C reading function.
err_t expand16_write_reg(expand16_t *ctx, uint8_t reg, uint8_t data_in)
Expand 16 register write function.
Expand 16 Click configuration object.
Definition expand16.h:189
uint32_t i2c_speed
Definition expand16.h:196
pin_name_t scl
Definition expand16.h:190
pin_name_t int_pin
Definition expand16.h:194
pin_name_t sda
Definition expand16.h:191
pin_name_t rst
Definition expand16.h:193
uint8_t i2c_address
Definition expand16.h:197
Expand 16 Click context object.
Definition expand16.h:169
digital_in_t int_pin
Definition expand16.h:174
i2c_master_t i2c
Definition expand16.h:177
digital_out_t rst
Definition expand16.h:171
uint8_t slave_address
Definition expand16.h:180