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 EXPAND15_REG_INPUT_PORT_0 0x00
74#define EXPAND15_REG_INPUT_PORT_1 0x01
75#define EXPAND15_REG_OUTPUT_PORT_0 0x02
76#define EXPAND15_REG_OUTPUT_PORT_1 0x03
77#define EXPAND15_REG_POLARITY_INVERSION_0 0x04
78#define EXPAND15_REG_POLARITY_INVERSION_1 0x05
79#define EXPAND15_REG_CONFIGURATION_0 0x06
80#define EXPAND15_REG_CONFIGURATION_1 0x07
81#define EXPAND15_REG_OUTPUT_DRV_STRENGTH_0_0 0x40
82#define EXPAND15_REG_OUTPUT_DRV_STRENGTH_0_1 0x41
83#define EXPAND15_REG_OUTPUT_DRV_STRENGTH_1_0 0x42
84#define EXPAND15_REG_OUTPUT_DRV_STRENGTH_1_1 0x43
85#define EXPAND15_REG_INPUT_LATCH_0 0x44
86#define EXPAND15_REG_INPUT_LATCH_1 0x45
87#define EXPAND15_REG_PULL_UP_DOWN_EN_0 0x46
88#define EXPAND15_REG_PULL_UP_DOWN_EN_1 0x47
89#define EXPAND15_REG_PULL_UP_DOWN_SELECT_0 0x48
90#define EXPAND15_REG_PULL_UP_DOWN_SELECT_1 0x49
91#define EXPAND15_REG_INTERRUPT_MASK_0 0x4A
92#define EXPAND15_REG_INTERRUPT_MASK_1 0x4B
93#define EXPAND15_REG_INTERRUPT_STATUS_0 0x4C
94#define EXPAND15_REG_INTERRUPT_STATUS_1 0x4D
95#define EXPAND15_REG_OUTPUT_PORT_CFG 0x4F
114#define EXPAND15_PIN_00_MASK 0x01
115#define EXPAND15_PIN_01_MASK 0x02
116#define EXPAND15_PIN_02_MASK 0x04
117#define EXPAND15_PIN_03_MASK 0x08
118#define EXPAND15_PIN_04_MASK 0x10
119#define EXPAND15_PIN_05_MASK 0x20
120#define EXPAND15_PIN_06_MASK 0x40
121#define EXPAND15_PIN_07_MASK 0x80
122#define EXPAND15_PIN_10_MASK 0x01
123#define EXPAND15_PIN_11_MASK 0x02
124#define EXPAND15_PIN_12_MASK 0x04
125#define EXPAND15_PIN_13_MASK 0x08
126#define EXPAND15_PIN_14_MASK 0x10
127#define EXPAND15_PIN_15_MASK 0x20
128#define EXPAND15_PIN_16_MASK 0x40
129#define EXPAND15_PIN_17_MASK 0x80
135#define EXPAND15_PORT_0 0x00
136#define EXPAND15_PORT_1 0x01
142#define EXPAND15_OUTPUT_STRENGTH_FULL 0x03
143#define EXPAND15_OUTPUT_STRENGTH_3_QUARTERS 0x02
144#define EXPAND15_OUTPUT_STRENGTH_HALF 0x01
145#define EXPAND15_OUTPUT_STRENGTH_1_QUARTER 0x00
151#define EXPAND15_PORT_PUSH_PULL 0x00
152#define EXPAND15_PORT_OPEN_DRAIN 0x01
158#define EXPAND15_ALL_PINS_ON 0xFF
159#define EXPAND15_ALL_PINS_OFF 0x00
166#define EXPAND15_DEVICE_ADDRESS_GND 0x20
167#define EXPAND15_DEVICE_ADDRESS_VCC 0x21
185#define EXPAND15_MAP_MIKROBUS( cfg, mikrobus ) \
186 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
187 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
188 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
189 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
expand15_return_value_t
Expand 15 Click return value data.
Definition expand15.h:236
@ EXPAND15_OK
Definition expand15.h:237
@ EXPAND15_ERROR
Definition expand15.h:238
err_t expand15_set_int_mask(expand15_t *ctx, uint8_t port, uint8_t int_config)
Expand 15 set interrupt mask function.
err_t expand15_get_pull_up_down(expand15_t *ctx, uint8_t port, uint8_t *pin_config)
Expand 15 get pull up/down function.
err_t expand15_set_out_pin_state(expand15_t *ctx, uint8_t port, uint8_t pin_state)
Expand 15 set output pin state function.
err_t expand15_get_en_pull_up_down(expand15_t *ctx, uint8_t port, uint8_t *port_config)
Expand 15 get enable pull up/down function.
err_t expand15_default_cfg(expand15_t *ctx)
Expand 15 default configuration function.
err_t expand15_set_pin_as_in(expand15_t *ctx, uint8_t port, uint8_t pin_config)
Expand 15 set pin as input function.
err_t expand15_get_int_status(expand15_t *ctx, uint8_t port, uint8_t *int_status)
Expand 15 get interrupt status function.
uint8_t expand15_get_int_pin_state(expand15_t *ctx)
Expand 15 get interrupt function.
err_t expand15_set_out_port_config(expand15_t *ctx, uint8_t port0_cfg, uint8_t port1_cfg)
Expand 15 set output port configuration function.
err_t expand15_generic_read(expand15_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Expand 15 I2C reading function.
err_t expand15_generic_write(expand15_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Expand 15 I2C writing function.
err_t expand15_get_int_mask(expand15_t *ctx, uint8_t port, uint8_t *int_config)
Expand 15 get interrupt mask function.
err_t expand15_get_pin_config(expand15_t *ctx, uint8_t port, uint8_t *pin_config)
Expand 15 get pin configuration function.
err_t expand15_set_pull_up_down(expand15_t *ctx, uint8_t port, uint8_t pin_config)
Expand 15 set pull up/down function.
err_t expand15_get_out_level(expand15_t *ctx, uint8_t port, uint16_t *pin_output_level)
Expand 15 get output level function.
err_t expand15_get_in_pin_state(expand15_t *ctx, uint8_t port, uint8_t *pin_state)
Expand 15 get input pin state function.
err_t expand15_get_in_pin_polarity(expand15_t *ctx, uint8_t port, uint8_t *pin_polarity)
Expand 15 get input pin polarity function.
err_t expand15_get_out_port_config(expand15_t *ctx, uint8_t *port0_cfg, uint8_t *port1_cfg)
Expand 15 get output port configuration function.
err_t expand15_set_out_pin_strength(expand15_t *ctx, uint8_t port, uint8_t pin, uint8_t strength)
Expand 15 set pin output strength function.
err_t expand15_set_en_pull_up_down(expand15_t *ctx, uint8_t port, uint8_t port_config)
Expand 15 set enable pull up/down function.
err_t expand15_get_out_pin_state(expand15_t *ctx, uint8_t port, uint8_t *pin_state)
Expand 15 get output pin state function.
void expand15_cfg_setup(expand15_cfg_t *cfg)
Expand 15 configuration object setup function.
err_t expand15_set_in_pin_polarity(expand15_t *ctx, uint8_t port, uint8_t pin_polarity)
Expand 15 set input pin polarity function.
void expand15_hw_reset(expand15_t *ctx)
Expand 15 hardware reset function.
err_t expand15_set_out_level(expand15_t *ctx, uint8_t port, uint16_t pin_output_level)
Expand 15 set output level function.
err_t expand15_init(expand15_t *ctx, expand15_cfg_t *cfg)
Expand 15 initialization function.
err_t expand15_set_pin_as_out(expand15_t *ctx, uint8_t port, uint8_t pin_config)
Expand 15 set pin as output function.
Expand 15 Click configuration object.
Definition expand15.h:219
uint32_t i2c_speed
Definition expand15.h:226
pin_name_t scl
Definition expand15.h:220
pin_name_t int_pin
Definition expand15.h:224
pin_name_t sda
Definition expand15.h:221
pin_name_t rst
Definition expand15.h:223
uint8_t i2c_address
Definition expand15.h:227
Expand 15 Click context object.
Definition expand15.h:199
digital_in_t int_pin
Definition expand15.h:204
i2c_master_t i2c
Definition expand15.h:207
digital_out_t rst
Definition expand15.h:201
uint8_t slave_address
Definition expand15.h:210