Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
59 #define EXPAND11_REG_INPUT_PORT 0x00
60 #define EXPAND11_REG_OUTPUT_PORT 0x01
61 #define EXPAND11_REG_POLARITY_INV 0x02
62 #define EXPAND11_REG_CONFIG 0x03
63 #define EXPAND11_REG_SPECIAL_FUNC 0x50
81 #define EXPAND11_NO_PIN_MASK 0x00
82 #define EXPAND11_PIN_0_MASK 0x01
83 #define EXPAND11_PIN_1_MASK 0x02
84 #define EXPAND11_PIN_2_MASK 0x04
85 #define EXPAND11_PIN_3_MASK 0x08
86 #define EXPAND11_ALL_PINS_MASK 0x0F
92 #define EXPAND11_OUTPUT_DIRECTION 0x00
93 #define EXPAND11_INPUT_DIRECTION 0x01
99 #define EXPAND11_POLARITY_NO_INV 0x00
100 #define EXPAND11_POLARITY_INV 0x01
106 #define EXPAND11_SPECIAL_FUNC_P3_AS_INT 0x80
107 #define EXPAND11_SPECIAL_FUNC_PU_DISABLED 0x40
113 #define EXPAND11_P3_AS_P3 0x00
114 #define EXPAND11_P3_AS_INT 0x01
121 #define EXPAND11_DEVICE_ADDRESS 0x41
139 #define EXPAND11_MAP_MIKROBUS( cfg, mikrobus ) \
140 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
141 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
142 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:170
pin_name_t int_pin
Definition: expand11.h:173
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:186
expand11_return_value_t
Expand 11 Click return value data.
Definition: expand11.h:185
uint8_t slave_address
Definition: expand11.h:160
err_t expand11_enable_pull_up(expand11_t *ctx)
Expand 11 enable pull up function.
i2c_master_t i2c
Definition: expand11.h:157
Expand 11 Click context object.
Definition: expand11.h:152
@ EXPAND11_ERROR
Definition: expand11.h:187
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:154
err_t expand11_default_cfg(expand11_t *ctx)
Expand 11 default configuration function.
pin_name_t sda
Definition: expand11.h:171
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:176
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:175
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:169
err_t expand11_read_port_value(expand11_t *ctx, uint8_t *data_out)
Expand 11 read port value function.