42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
66#define I2CMUX_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST )
76#define I2CMUX_RETVAL uint8_t
79#define I2CMUX_INIT_ERROR 0xFF
86#define I2CMUX_I2C_SLAVE_ADDRESS_0 0x70
87#define I2CMUX_I2C_SLAVE_ADDRESS_1 0x71
88#define I2CMUX_I2C_SLAVE_ADDRESS_2 0x72
89#define I2CMUX_I2C_SLAVE_ADDRESS_3 0x73
90#define I2CMUX_I2C_SLAVE_ADDRESS_4 0x74
91#define I2CMUX_I2C_SLAVE_ADDRESS_5 0x75
92#define I2CMUX_I2C_SLAVE_ADDRESS_6 0x76
93#define I2CMUX_I2C_SLAVE_ADDRESS_7 0x77
100#define I2CMUX_CMD_NO_CH 0x00
101#define I2CMUX_CMD_SET_CH_0 0x01
102#define I2CMUX_CMD_SET_CH_1 0x02
103#define I2CMUX_CMD_SET_CH_2 0x04
104#define I2CMUX_CMD_SET_CH_3 0x08
#define I2CMUX_RETVAL
Definition i2cmux.h:76
I2CMUX_RETVAL i2cmux_init(i2cmux_t *ctx, i2cmux_cfg_t *cfg)
Initialization function.
void i2cmux_write_cmd(i2cmux_t *ctx, uint8_t tx_data)
Write command function.
void i2cmux_generic_read(i2cmux_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void i2cmux_set_channel(i2cmux_t *ctx, uint8_t channel, uint8_t ch_slave_address)
Set channel function.
void i2cmux_cfg_setup(i2cmux_cfg_t *cfg)
Config Object Initialization function.
void i2cmux_generic_write(i2cmux_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void i2cmux_hw_reset(i2cmux_t *ctx)
Hardware reset function.
uint8_t i2cmux_read_cmd(i2cmux_t *ctx)
Read command function.
Click configuration structure definition.
Definition i2cmux.h:137
uint32_t i2c_speed
Definition i2cmux.h:149
pin_name_t scl
Definition i2cmux.h:140
pin_name_t sda
Definition i2cmux.h:141
pin_name_t rst
Definition i2cmux.h:145
uint8_t i2c_address
Definition i2cmux.h:150
Click ctx object definition.
Definition i2cmux.h:118
i2c_master_t i2c
Definition i2cmux.h:125
digital_out_t rst
Definition i2cmux.h:121
uint8_t slave_address
Definition i2cmux.h:129