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 EXPAND10_REG_INPUT_P0 0x00
74#define EXPAND10_REG_INPUT_P1 0x01
75#define EXPAND10_REG_INPUT_P2 0x02
76#define EXPAND10_REG_OUTPUT_P0 0x04
77#define EXPAND10_REG_OUTPUT_P1 0x05
78#define EXPAND10_REG_OUTPUT_P2 0x06
79#define EXPAND10_REG_POLARITY_INV_P0 0x08
80#define EXPAND10_REG_POLARITY_INV_P1 0x09
81#define EXPAND10_REG_POLARITY_INV_P2 0x0A
82#define EXPAND10_REG_CONFIG_P0 0x0C
83#define EXPAND10_REG_CONFIG_P1 0x0D
84#define EXPAND10_REG_CONFIG_P2 0x0E
85#define EXPAND10_REG_OUTPUT_DRIVE_P0A 0x40
86#define EXPAND10_REG_OUTPUT_DRIVE_P0B 0x41
87#define EXPAND10_REG_OUTPUT_DRIVE_P1A 0x42
88#define EXPAND10_REG_OUTPUT_DRIVE_P1B 0x43
89#define EXPAND10_REG_OUTPUT_DRIVE_P2A 0x44
90#define EXPAND10_REG_OUTPUT_DRIVE_P2B 0x45
91#define EXPAND10_REG_INPUT_LAT_P0 0x48
92#define EXPAND10_REG_INPUT_LAT_P1 0x49
93#define EXPAND10_REG_INPUT_LAT_P2 0x4A
94#define EXPAND10_REG_PULL_ENABLE_P0 0x4C
95#define EXPAND10_REG_PULL_ENABLE_P1 0x4D
96#define EXPAND10_REG_PULL_ENABLE_P2 0x4E
97#define EXPAND10_REG_PULL_SELECTION_P0 0x50
98#define EXPAND10_REG_PULL_SELECTION_P1 0x51
99#define EXPAND10_REG_PULL_SELECTION_P2 0x52
100#define EXPAND10_REG_INT_MASK_P0 0x54
101#define EXPAND10_REG_INT_MASK_P1 0x55
102#define EXPAND10_REG_INT_MASK_P2 0x56
103#define EXPAND10_REG_INT_STATUS_P0 0x58
104#define EXPAND10_REG_INT_STATUS_P1 0x59
105#define EXPAND10_REG_INT_STATUS_P2 0x5A
106#define EXPAND10_REG_OUTPUT_PORT_CONFIG 0x5C
107#define EXPAND10_REG_INT_EDGE_P0A 0x60
108#define EXPAND10_REG_INT_EDGE_P0B 0x61
109#define EXPAND10_REG_INT_EDGE_P1A 0x62
110#define EXPAND10_REG_INT_EDGE_P1B 0x63
111#define EXPAND10_REG_INT_EDGE_P2A 0x64
112#define EXPAND10_REG_INT_EDGE_P2B 0x65
113#define EXPAND10_REG_INT_CLEAR_P0 0x68
114#define EXPAND10_REG_INT_CLEAR_P1 0x69
115#define EXPAND10_REG_INT_CLEAR_P2 0x6A
116#define EXPAND10_REG_INPUT_STATUS_P0 0x6C
117#define EXPAND10_REG_INPUT_STATUS_P1 0x6D
118#define EXPAND10_REG_INPUT_STATUS_P2 0x6E
119#define EXPAND10_REG_PIN_OUTPUT_P0_CONFIG 0x70
120#define EXPAND10_REG_PIN_OUTPUT_P1_CONFIG 0x71
121#define EXPAND10_REG_PIN_OUTPUT_P2_CONFIG 0x72
122#define EXPAND10_REG_SWITCH_DEBOUNCE_EN_0 0x74
123#define EXPAND10_REG_SWITCH_DEBOUNCE_EN_1 0x75
124#define EXPAND10_REG_SWITCH_DEBOUNCE_CNT 0x76
142#define EXPAND10_NO_PIN_MASK 0x00
143#define EXPAND10_PIN_0_MASK 0x01
144#define EXPAND10_PIN_1_MASK 0x02
145#define EXPAND10_PIN_2_MASK 0x04
146#define EXPAND10_PIN_3_MASK 0x08
147#define EXPAND10_PIN_4_MASK 0x10
148#define EXPAND10_PIN_5_MASK 0x20
149#define EXPAND10_PIN_6_MASK 0x40
150#define EXPAND10_PIN_7_MASK 0x80
151#define EXPAND10_ALL_PINS_MASK 0xFF
157#define EXPAND10_PORT_0 0x00
158#define EXPAND10_PORT_1 0x01
159#define EXPAND10_PORT_2 0x02
165#define EXPAND10_OUTPUT_DIRECTION 0x00
166#define EXPAND10_INPUT_DIRECTION 0x01
172#define EXPAND10_PIN_LOW_LEVEL 0x00
173#define EXPAND10_PIN_HIGH_LEVEL 0x01
179#define EXPAND10_AUTO_INCREMENT_BIT 0x80
185#define EXPAND10_DEVICE_ID 0x000830
191#define EXPAND10_SOFTWARE_RESET 0x06
197#define EXPAND10_GEN_CALL_ADDR 0x00
198#define EXPAND10_DEV_ID_ADDR 0x7C
205#define EXPAND10_SET_DEV_ADDR_0 0x22
206#define EXPAND10_SET_DEV_ADDR_1 0x23
224#define EXPAND10_MAP_MIKROBUS( cfg, mikrobus ) \
225 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
226 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
227 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
228 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
expand10_return_value_t
Expand 10 Click return value data.
Definition expand10.h:275
@ EXPAND10_ERROR
Definition expand10.h:277
@ EXPAND10_OK
Definition expand10.h:276
err_t expand10_set_pin_value(expand10_t *ctx, uint8_t port, uint8_t clr_mask, uint8_t set_mask)
Expand 10 set pin value function.
void expand10_set_rst_pin(expand10_t *ctx, uint8_t logic_level)
Expand 10 set RST pin function.
void expand10_cfg_setup(expand10_cfg_t *cfg)
Expand 10 configuration object setup function.
err_t expand10_write_register(expand10_t *ctx, uint8_t reg, uint8_t data_in)
Expand 10 write register function.
err_t expand10_set_all_pins_direction(expand10_t *ctx, uint8_t direction)
Expand 10 set all pins direction function.
err_t expand10_generic_write(expand10_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
Expand 10 I2C writing function.
err_t expand10_check_device_id(expand10_t *ctx)
Expand 10 check device ID function.
err_t expand10_set_pin_direction(expand10_t *ctx, uint8_t direction, uint8_t port, uint8_t pin_mask)
Expand 10 set pin direction function.
err_t expand10_init(expand10_t *ctx, expand10_cfg_t *cfg)
Expand 10 initialization function.
uint8_t expand10_get_int_pin(expand10_t *ctx)
Expand 10 get INT pin function.
err_t expand10_read_register(expand10_t *ctx, uint8_t reg, uint8_t *data_out)
Expand 10 read register function.
err_t expand10_software_reset(expand10_t *ctx)
Expand 10 software reset function.
err_t expand10_read_port_value(expand10_t *ctx, uint8_t port, uint8_t *data_out)
Expand 10 read port value function.
err_t expand10_generic_read(expand10_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
Expand 10 I2C reading function.
err_t expand10_default_cfg(expand10_t *ctx)
Expand 10 default configuration function.
err_t expand10_set_all_pins_value(expand10_t *ctx, uint8_t set_mask)
Expand 10 set all pins value function.
Expand 10 Click configuration object.
Definition expand10.h:258
uint32_t i2c_speed
Definition expand10.h:265
pin_name_t scl
Definition expand10.h:259
pin_name_t int_pin
Definition expand10.h:263
pin_name_t sda
Definition expand10.h:260
pin_name_t rst
Definition expand10.h:262
uint8_t i2c_address
Definition expand10.h:266
Expand 10 Click context object.
Definition expand10.h:238
digital_in_t int_pin
Definition expand10.h:243
i2c_master_t i2c
Definition expand10.h:246
digital_out_t rst
Definition expand10.h:240
uint8_t slave_address
Definition expand10.h:249