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 EXPAND14_REG_INPUT_PORT_0 0x00
74#define EXPAND14_REG_INPUT_PORT_1 0x01
75#define EXPAND14_REG_OUTPUT_PORT_0 0x02
76#define EXPAND14_REG_OUTPUT_PORT_1 0x03
77#define EXPAND14_REG_POLARITY_INV_PORT_0 0x04
78#define EXPAND14_REG_POLARITY_INV_PORT_1 0x05
79#define EXPAND14_REG_CONFIG_PORT_0 0x06
80#define EXPAND14_REG_CONFIG_PORT_1 0x07
98#define EXPAND14_NO_PIN_MASK 0x00
99#define EXPAND14_PIN_0_MASK 0x01
100#define EXPAND14_PIN_1_MASK 0x02
101#define EXPAND14_PIN_2_MASK 0x04
102#define EXPAND14_PIN_3_MASK 0x08
103#define EXPAND14_PIN_4_MASK 0x10
104#define EXPAND14_PIN_5_MASK 0x20
105#define EXPAND14_PIN_6_MASK 0x40
106#define EXPAND14_PIN_7_MASK 0x80
107#define EXPAND14_ALL_PINS_MASK 0xFF
113#define EXPAND14_PORT_0 0x00
114#define EXPAND14_PORT_1 0x01
120#define EXPAND14_OUTPUT_DIRECTION 0x00
121#define EXPAND14_INPUT_DIRECTION 0x01
127#define EXPAND14_PIN_LOW_LEVEL 0x00
128#define EXPAND14_PIN_HIGH_LEVEL 0x01
135#define EXPAND14_DEVICE_ADDRESS_A2A1A0_000 0x20
136#define EXPAND14_DEVICE_ADDRESS_A2A1A0_001 0x21
137#define EXPAND14_DEVICE_ADDRESS_A2A1A0_010 0x22
138#define EXPAND14_DEVICE_ADDRESS_A2A1A0_011 0x23
139#define EXPAND14_DEVICE_ADDRESS_A2A1A0_100 0x24
140#define EXPAND14_DEVICE_ADDRESS_A2A1A0_101 0x25
141#define EXPAND14_DEVICE_ADDRESS_A2A1A0_110 0x26
142#define EXPAND14_DEVICE_ADDRESS_A2A1A0_111 0x27
160#define EXPAND14_MAP_MIKROBUS( cfg, mikrobus ) \
161 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
162 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
163 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
expand14_return_value_t
Expand 14 Click return value data.
Definition expand14.h:206
@ EXPAND14_ERROR
Definition expand14.h:208
@ EXPAND14_OK
Definition expand14.h:207
err_t expand14_read_port_value(expand14_t *ctx, uint8_t port, uint8_t *data_out)
Expand 14 read port value function.
err_t expand14_write_register(expand14_t *ctx, uint8_t reg, uint8_t data_in)
Expand 14 write register function.
void expand14_cfg_setup(expand14_cfg_t *cfg)
Expand 14 configuration object setup function.
err_t expand14_read_register(expand14_t *ctx, uint8_t reg, uint8_t *data_out)
Expand 14 read register function.
err_t expand14_set_pin_value(expand14_t *ctx, uint8_t port, uint8_t clr_mask, uint8_t set_mask)
Expand 14 set pin value function.
err_t expand14_set_all_pins_direction(expand14_t *ctx, uint8_t direction)
Expand 14 set all pins direction function.
err_t expand14_generic_read(expand14_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Expand 14 I2C reading function.
err_t expand14_set_all_pins_value(expand14_t *ctx, uint8_t set_mask)
Expand 14 set all pins value function.
err_t expand14_init(expand14_t *ctx, expand14_cfg_t *cfg)
Expand 14 initialization function.
uint8_t expand14_get_int_pin(expand14_t *ctx)
Expand 14 get INT pin function.
err_t expand14_generic_write(expand14_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Expand 14 I2C writing function.
err_t expand14_default_cfg(expand14_t *ctx)
Expand 14 default configuration function.
err_t expand14_set_pin_direction(expand14_t *ctx, uint8_t direction, uint8_t port, uint8_t pin_mask)
Expand 14 set pin direction function.
Expand 14 Click configuration object.
Definition expand14.h:190
uint32_t i2c_speed
Definition expand14.h:196
pin_name_t scl
Definition expand14.h:191
pin_name_t int_pin
Definition expand14.h:194
pin_name_t sda
Definition expand14.h:192
uint8_t i2c_address
Definition expand14.h:197
Expand 14 Click context object.
Definition expand14.h:173
digital_in_t int_pin
Definition expand14.h:175
i2c_master_t i2c
Definition expand14.h:178
uint8_t slave_address
Definition expand14.h:181