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 EXPAND12_REG_NOP 0x00
74#define EXPAND12_REG_CONFIG 0x04
75#define EXPAND12_REG_TRANSITION_DETECT_MASK 0x06
76#define EXPAND12_REG_RESERVED 0x07
77#define EXPAND12_REG_CONFIG_P7_4 0x09
78#define EXPAND12_REG_CONFIG_P11_8 0x0A
79#define EXPAND12_REG_CONFIG_P15_12 0x0B
80#define EXPAND12_REG_CONFIG_P19_16 0x0C
81#define EXPAND12_REG_CONFIG_P23_20 0x0D
82#define EXPAND12_REG_CONFIG_P27_24 0x0E
83#define EXPAND12_REG_CONFIG_P31_28 0x0F
84#define EXPAND12_REG_P0 0x20
85#define EXPAND12_REG_P1 0x21
86#define EXPAND12_REG_P2 0x22
87#define EXPAND12_REG_P3 0x23
88#define EXPAND12_REG_P4 0x24
89#define EXPAND12_REG_P5 0x25
90#define EXPAND12_REG_P6 0x26
91#define EXPAND12_REG_P7 0x27
92#define EXPAND12_REG_P8 0x28
93#define EXPAND12_REG_P9 0x29
94#define EXPAND12_REG_P10 0x2A
95#define EXPAND12_REG_P11 0x2B
96#define EXPAND12_REG_P12 0x2C
97#define EXPAND12_REG_P13 0x2D
98#define EXPAND12_REG_P14 0x2E
99#define EXPAND12_REG_P15 0x2F
100#define EXPAND12_REG_P16 0x30
101#define EXPAND12_REG_P17 0x31
102#define EXPAND12_REG_P18 0x32
103#define EXPAND12_REG_P19 0x33
104#define EXPAND12_REG_P20 0x34
105#define EXPAND12_REG_P21 0x35
106#define EXPAND12_REG_P22 0x36
107#define EXPAND12_REG_P23 0x37
108#define EXPAND12_REG_P24 0x38
109#define EXPAND12_REG_P25 0x39
110#define EXPAND12_REG_P26 0x3A
111#define EXPAND12_REG_P27 0x3B
112#define EXPAND12_REG_P28 0x3C
113#define EXPAND12_REG_P29 0x3D
114#define EXPAND12_REG_P30 0x3E
115#define EXPAND12_REG_P31 0x3F
116#define EXPAND12_REG_P4_7 0x40
117#define EXPAND12_REG_P4_8 0x41
118#define EXPAND12_REG_P4_9 0x42
119#define EXPAND12_REG_P4_10 0x43
120#define EXPAND12_REG_P4_11 0x44
121#define EXPAND12_REG_P5_12 0x45
122#define EXPAND12_REG_P6_13 0x46
123#define EXPAND12_REG_P7_14 0x47
124#define EXPAND12_REG_P8_15 0x48
125#define EXPAND12_REG_P9_16 0x49
126#define EXPAND12_REG_P10_17 0x4A
127#define EXPAND12_REG_P11_18 0x4B
128#define EXPAND12_REG_P12_19 0x4C
129#define EXPAND12_REG_P13_20 0x4D
130#define EXPAND12_REG_P14_21 0x4E
131#define EXPAND12_REG_P15_22 0x4F
132#define EXPAND12_REG_P16_23 0x50
133#define EXPAND12_REG_P17_24 0x51
134#define EXPAND12_REG_P18_25 0x52
135#define EXPAND12_REG_P19_26 0x53
136#define EXPAND12_REG_P20_27 0x54
137#define EXPAND12_REG_P21_28 0x55
138#define EXPAND12_REG_P22_29 0x56
139#define EXPAND12_REG_P23_30 0x57
140#define EXPAND12_REG_P24_31 0x58
141#define EXPAND12_REG_P25_31 0x59
142#define EXPAND12_REG_P26_31 0x5A
143#define EXPAND12_REG_P27_31 0x5B
144#define EXPAND12_REG_P28_31 0x5C
145#define EXPAND12_REG_P29_31 0x5D
146#define EXPAND12_REG_P30_31 0x5E
147#define EXPAND12_REG_P31_ONLY 0x5F
165#define EXPAND12_PIN_4 0x00
166#define EXPAND12_PIN_5 0x01
167#define EXPAND12_PIN_6 0x02
168#define EXPAND12_PIN_7 0x03
169#define EXPAND12_PIN_8 0x04
170#define EXPAND12_PIN_9 0x05
171#define EXPAND12_PIN_10 0x06
172#define EXPAND12_PIN_11 0x07
173#define EXPAND12_PIN_12 0x08
174#define EXPAND12_PIN_13 0x09
175#define EXPAND12_PIN_14 0x0A
176#define EXPAND12_PIN_15 0x0B
177#define EXPAND12_PIN_16 0x0C
178#define EXPAND12_PIN_17 0x0D
179#define EXPAND12_PIN_18 0x0E
180#define EXPAND12_PIN_19 0x0F
181#define EXPAND12_PIN_20 0x10
182#define EXPAND12_PIN_21 0x11
183#define EXPAND12_PIN_22 0x12
184#define EXPAND12_PIN_23 0x13
185#define EXPAND12_PIN_24 0x14
186#define EXPAND12_PIN_25 0x15
187#define EXPAND12_PIN_26 0x16
188#define EXPAND12_PIN_27 0x17
189#define EXPAND12_PIN_28 0x18
190#define EXPAND12_PIN_29 0x19
191#define EXPAND12_PIN_30 0x1A
192#define EXPAND12_PIN_31 0x1B
193#define EXPAND12_ALL_PINS 0xFF
194#define EXPAND12_NO_PINS 0x00
195#define EXPAND12_PORT_4_7 0x00
196#define EXPAND12_PORT_8_15 0x01
197#define EXPAND12_PORT_16_23 0x02
198#define EXPAND12_PORT_24_31 0x03
204#define EXPAND12_DIR_OUTPUT 0x01
205#define EXPAND12_DIR_INPUT 0x02
206#define EXPAND12_DIR_INPUT_WITH_PULLUP 0x03
212#define EXPAND12_OPMODE_SHUTDOWN 0x00
213#define EXPAND12_OPMODE_NORMAL 0x01
219#define EXPAND12_PIN_LOW_LEVEL 0x00
220#define EXPAND12_PIN_HIGH_LEVEL 0x01
227#define EXPAND12_SET_DEV_ADDR_A1A0_00 0x40
228#define EXPAND12_SET_DEV_ADDR_A1A0_01 0x41
229#define EXPAND12_SET_DEV_ADDR_A1A0_10 0x44
230#define EXPAND12_SET_DEV_ADDR_A1A0_11 0x45
248#define EXPAND12_MAP_MIKROBUS( cfg, mikrobus ) \
249 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
250 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
expand12_return_value_t
Expand 12 Click return value data.
Definition expand12.h:288
@ EXPAND12_ERROR
Definition expand12.h:290
@ EXPAND12_OK
Definition expand12.h:289
err_t expand12_read_pin_value(expand12_t *ctx, uint8_t pin, uint8_t *pin_value)
Expand 12 read pin value function.
err_t expand12_read_all_pins_value(expand12_t *ctx, uint32_t *pins_value)
Expand 12 read all pins value function.
err_t expand12_init(expand12_t *ctx, expand12_cfg_t *cfg)
Expand 12 initialization function.
err_t expand12_write_register(expand12_t *ctx, uint8_t reg, uint8_t data_in)
Expand 12 write register function.
err_t expand12_set_pin_value(expand12_t *ctx, uint8_t pin, uint8_t pin_value)
Expand 12 set pin value function.
err_t expand12_set_port_value(expand12_t *ctx, uint8_t port, uint8_t clr_mask, uint8_t set_mask)
Expand 12 set port value function.
err_t expand12_generic_write(expand12_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
Expand 12 I2C writing function.
err_t expand12_set_port_direction(expand12_t *ctx, uint8_t port, uint8_t direction)
Expand 12 set port direction function.
err_t expand12_read_register(expand12_t *ctx, uint8_t reg, uint8_t *data_out)
Expand 12 read register function.
err_t expand12_set_all_pins_value(expand12_t *ctx, uint8_t pin_value)
Expand 12 set all pins value function.
err_t expand12_set_operating_mode(expand12_t *ctx, uint8_t state)
Expand 12 set operating mode function.
err_t expand12_default_cfg(expand12_t *ctx)
Expand 12 default configuration function.
err_t expand12_set_all_pins_direction(expand12_t *ctx, uint8_t direction)
Expand 12 set all pins direction function.
err_t expand12_read_port_value(expand12_t *ctx, uint8_t port, uint8_t *port_value)
Expand 12 read port value function.
err_t expand12_set_pin_direction(expand12_t *ctx, uint8_t pin, uint8_t direction)
Expand 12 set pin direction function.
err_t expand12_generic_read(expand12_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
Expand 12 I2C reading function.
void expand12_cfg_setup(expand12_cfg_t *cfg)
Expand 12 configuration object setup function.
Expand 12 Click configuration object.
Definition expand12.h:274
uint32_t i2c_speed
Definition expand12.h:278
pin_name_t scl
Definition expand12.h:275
pin_name_t sda
Definition expand12.h:276
uint8_t i2c_address
Definition expand12.h:279
Expand 12 Click context object.
Definition expand12.h:260
i2c_master_t i2c
Definition expand12.h:262
uint8_t slave_address
Definition expand12.h:265