i2cmux6 2.0.0.0
main.c File Reference

I2CMUX6 Click example. More...

#include "board.h"
#include "log.h"
#include "i2cmux6.h"

Macros

#define DEVICE0_NAME   "6DOF IMU 11 click"
 
#define DEVICE0_POSITION   I2CMUX6_CHANNEL_1
 
#define DEVICE0_SLAVE_ADDRESS   0x0E
 
#define DEVICE0_REG_ID   0x00
 
#define DEVICE0_ID   0x2D
 
#define DEVICE1_NAME   "Compass 3 click"
 
#define DEVICE1_POSITION   I2CMUX6_CHANNEL_4
 
#define DEVICE1_SLAVE_ADDRESS   0x30
 
#define DEVICE1_REG_ID   0x2F
 
#define DEVICE1_ID   0x0C
 

Functions

void application_init (void)
 
void application_task (void)
 
int main (void)
 

Detailed Description

I2CMUX6 Click example.

Description

This example demonstrates the use of I2C MUX 6 click board by reading the device ID of a 6DOF IMU 11 and Compass 3 click boards connected to the channels 1 and 4 respectfully.

The demo application is composed of two sections :

Application Init

Initializes the driver and logger.

Application Task

Reads the device ID of the connected click boards. Channel 1 : 6DOF IMU 11 click [slave address: 0x0E; reg: 0x00; id: 0x2D], Channel 4 : Compass 3 click [slave address: 0x30; reg: 0x2F; id: 0x0C]. All data is being logged on the USB UART where you can check the device ID.

Note
Make sure to provide 3v3 power supply on VCC-I2C pin.
Author
Stefan Filipovic

Macro Definition Documentation

◆ DEVICE0_ID

#define DEVICE0_ID   0x2D

◆ DEVICE0_NAME

#define DEVICE0_NAME   "6DOF IMU 11 click"

◆ DEVICE0_POSITION

#define DEVICE0_POSITION   I2CMUX6_CHANNEL_1

◆ DEVICE0_REG_ID

#define DEVICE0_REG_ID   0x00

◆ DEVICE0_SLAVE_ADDRESS

#define DEVICE0_SLAVE_ADDRESS   0x0E

◆ DEVICE1_ID

#define DEVICE1_ID   0x0C

◆ DEVICE1_NAME

#define DEVICE1_NAME   "Compass 3 click"

◆ DEVICE1_POSITION

#define DEVICE1_POSITION   I2CMUX6_CHANNEL_4

◆ DEVICE1_REG_ID

#define DEVICE1_REG_ID   0x2F

◆ DEVICE1_SLAVE_ADDRESS

#define DEVICE1_SLAVE_ADDRESS   0x30

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< Click config object.

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )