We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2020-03-27
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: I2C
Downloaded: 2633 times
Not followed.
License: MIT license
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.
Do you want to subscribe in order to receive notifications regarding "I2C MUX click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "I2C MUX click" changes.
Do you want to report abuse regarding "I2C MUX click".
Library Description
The library covers all the necessary functions to control I2C MUX click board.
Key functions:
void i2cmux_hw_reset ( void )
- Hardware reset function.void i2cmux_set_channel ( uint8_t channel, uint8_t ch_slave_address )
- Set channel function.void i2cmux_generic_read ( uint8_t reg, uint8_t *p_rx_data, uint8_t n_bytes )
- Generic read data function.Examples description
The application is composed of three sections :
void application_task ( )
{
// SET CHANNEL 0: 6DOF IMU 9 click
i2cmux_set_channel( I2CMUX_CMD_SET_CH_0, 0x69 );
Delay_ms( 100 );
i2cmux_generic_read( 0x75, &rx_data, 1 );
mikrobus_logWrite( " CH-0 : ID = 0x", _LOG_TEXT );
display_log( );
// SET CHANNEL 1: RTC 10 click
i2cmux_set_channel( I2CMUX_CMD_SET_CH_1, 0x68 );
Delay_ms( 100 );
i2cmux_generic_read( 0x0F, &rx_data, 1 );
mikrobus_logWrite( " CH-1 : ST = 0x", _LOG_TEXT );
display_log( );
// SET CHANNEL 2: Altitude click
i2cmux_set_channel( I2CMUX_CMD_SET_CH_2, 0x60 );
Delay_ms( 100 );
i2cmux_generic_read( 0x0C, &rx_data, 1 );
mikrobus_logWrite( " CH-2 : ID = 0x", _LOG_TEXT );
display_log( );
// SET CHANNEL 3: Temp & Hum click
i2cmux_set_channel( I2CMUX_CMD_SET_CH_3, 0x5F );
Delay_ms( 100 );
i2cmux_generic_read( 0x0F, &rx_data, 1 );
mikrobus_logWrite( " CH-3 : ID = 0x", _LOG_TEXT );
display_log( );
mikrobus_logWrite( "------------------", _LOG_LINE );
Delay_ms( 2000 );
}
void display_log ( void )
- Display log function.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.