uarttoi2c 2.1.0.0
main.c File Reference

UART to I2C Click Example. More...

#include "board.h"
#include "log.h"
#include "uarttoi2c.h"

Macros

#define DEVICE_NAME   "3D Hall 11 click"
 
#define DEVICE_SLAVE_ADDRESS   0x35
 
#define DEVICE_REG_ID   0x0D
 
#define DEVICE_ID   0x01
 

Functions

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

Detailed Description

UART to I2C Click Example.

Description

This example demonstrates the use of USB to I2C click board by reading the device ID of a 3D Hall 11 click board connected to the I2C port and controlling the GPIO pins.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default config which resets the device and sets the GPIO pins 0-3 as push-pull output and others as input. After that, reads and displays the chip firmware version.

Application Task

Reads the device ID of a 3D Hall 11 click board connected to the I2C port, toggles the output pins and displays the GPIO port state. The results will be displayed on the USB UART approximately once per second.

Author
Stefan Filipovic

Macro Definition Documentation

◆ DEVICE_ID

#define DEVICE_ID   0x01

◆ DEVICE_NAME

#define DEVICE_NAME   "3D Hall 11 click"

◆ DEVICE_REG_ID

#define DEVICE_REG_ID   0x0D

◆ DEVICE_SLAVE_ADDRESS

#define DEVICE_SLAVE_ADDRESS   0x35

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 )