Go to the documentation of this file.
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 EXPAND11_REG_INPUT_PORT 0x00
74 #define EXPAND11_REG_OUTPUT_PORT 0x01
75 #define EXPAND11_REG_POLARITY_INV 0x02
76 #define EXPAND11_REG_CONFIG 0x03
77 #define EXPAND11_REG_SPECIAL_FUNC 0x50
95 #define EXPAND11_NO_PIN_MASK 0x00
96 #define EXPAND11_PIN_0_MASK 0x01
97 #define EXPAND11_PIN_1_MASK 0x02
98 #define EXPAND11_PIN_2_MASK 0x04
99 #define EXPAND11_PIN_3_MASK 0x08
100 #define EXPAND11_ALL_PINS_MASK 0x0F
106 #define EXPAND11_OUTPUT_DIRECTION 0x00
107 #define EXPAND11_INPUT_DIRECTION 0x01
113 #define EXPAND11_POLARITY_NO_INV 0x00
114 #define EXPAND11_POLARITY_INV 0x01
120 #define EXPAND11_SPECIAL_FUNC_P3_AS_INT 0x80
121 #define EXPAND11_SPECIAL_FUNC_PU_DISABLED 0x40
127 #define EXPAND11_P3_AS_P3 0x00
128 #define EXPAND11_P3_AS_INT 0x01
135 #define EXPAND11_DEVICE_ADDRESS 0x41
153 #define EXPAND11_MAP_MIKROBUS( cfg, mikrobus ) \
154 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
155 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
156 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
void expand11_cfg_setup(expand11_cfg_t *cfg)
Expand 11 configuration object setup function.
pin_name_t scl
Definition: expand11.h:184
pin_name_t int_pin
Definition: expand11.h:187
err_t expand11_set_pin_direction(expand11_t *ctx, uint8_t direction, uint8_t pin_mask)
Expand 11 set pin direction function.
@ EXPAND11_OK
Definition: expand11.h:200
expand11_return_value_t
Expand 11 Click return value data.
Definition: expand11.h:199
uint8_t slave_address
Definition: expand11.h:174
err_t expand11_enable_pull_up(expand11_t *ctx)
Expand 11 enable pull up function.
i2c_master_t i2c
Definition: expand11.h:171
Expand 11 Click context object.
Definition: expand11.h:166
@ EXPAND11_ERROR
Definition: expand11.h:201
err_t expand11_init(expand11_t *ctx, expand11_cfg_t *cfg)
Expand 11 initialization function.
uint8_t expand11_get_int_pin(expand11_t *ctx)
Expand 11 get int pin function.
err_t expand11_set_p3_function(expand11_t *ctx, uint8_t p3_func)
Expand 11 set p3 function function.
digital_in_t int_pin
Definition: expand11.h:168
err_t expand11_default_cfg(expand11_t *ctx)
Expand 11 default configuration function.
pin_name_t sda
Definition: expand11.h:185
err_t expand11_read_register(expand11_t *ctx, uint8_t reg, uint8_t *data_out)
Expand 11 read register function.
err_t expand11_set_pin_polarity(expand11_t *ctx, uint8_t polarity, uint8_t pin_mask)
Expand 11 set pin polarity function.
err_t expand11_set_all_pins_direction(expand11_t *ctx, uint8_t direction)
Expand 11 set all pins direction function.
uint8_t i2c_address
Definition: expand11.h:190
err_t expand11_set_pin_value(expand11_t *ctx, uint8_t clr_mask, uint8_t set_mask)
Expand 11 set pin value function.
err_t expand11_write_register(expand11_t *ctx, uint8_t reg, uint8_t data_in)
Expand 11 write register function.
err_t expand11_set_all_pins_value(expand11_t *ctx, uint8_t set_mask)
Expand 11 set all pins value function.
uint32_t i2c_speed
Definition: expand11.h:189
err_t expand11_disable_pull_up(expand11_t *ctx)
Expand 11 disable pull up function.
err_t expand11_set_all_pins_polarity(expand11_t *ctx, uint8_t polarity)
Expand 11 set all pins polarity function.
Expand 11 Click configuration object.
Definition: expand11.h:183
err_t expand11_read_port_value(expand11_t *ctx, uint8_t *data_out)
Expand 11 read port value function.