i2cmux 2.0.0.0
|
I2C MUX Click is an quad bidirectional translating I2C and SMBus switch with reset function, intended for applications with I2C slave address conflicts (multiple, identical temp sensors). It features a quad bidirectional translating switch controlled via the I2C bus, labeled as TCA9546A from Texas Instruments. Click has three address jumpers, allowing up to eight TCA9546A devices on the same bus. I2C MUX click allows voltage translation between 1.8V, 2.5V, 3.3V, and 5V buses, and also supports hot insertion.
We provide a library for the I2cMux Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.
This library contains API for I2cMux Click driver.
- Initialization function.void i2cmux_cfg_setup ( i2cmux_cfg_t *cfg );
I2CMUX_RETVAL i2cmux_init ( i2cmux_t *ctx, i2cmux_cfg_t *cfg );
- This function sets channel of the I2C MUX click board.void i2cmux_hw_reset ( i2cmux_t *ctx );
void i2cmux_set_channel ( i2cmux_t *ctx, uint8_t channel, uint8_t ch_slave_address );
void i2cmux_generic_read ( i2cmux_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
This example demonstrates the use of I2C MUX Click board.
The demo application is composed of two sections :
Initalizes the driver, preforms hardware reset, then enables channel 0 and makes an initial log.
Reads the device ID of a Spectrometer click (dev ID: 0x24) and displays it on the USB UART each second.
The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.
Other mikroE Libraries used in the example:
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.