i2ctocan 2.0.0.0
main.c File Reference

I2cToCan Click example. More...

#include "board.h"
#include "log.h"
#include "i2ctocan.h"

Macros

#define I2CTOCAN_VAV_PRESS_DEV_ADDR   0x5C
 
#define I2CTOCAN_VAV_PRESS_CMD_START_PRESSURE_CONVERSION   0x21
 
#define I2CTOCAN_VAV_PRESS_PRESS_SCALE_FACTOR   1200
 
#define I2CTOCAN_VAV_PRESS_TEMP_SCALE_FACTOR   72
 
#define I2CTOCAN_VAV_PRESS_READOUT_AT_KNOWN_TEMPERATURE   105
 
#define I2CTOCAN_VAV_PRESS_KNOWN_TEMPERATURE_C   23.1
 

Functions

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

Detailed Description

I2cToCan Click example.

Description

This library contains API for the I2C to CAN click driver. This demo application shows an example of an I2C CAN click wired to the VAV Press click for reading differential pressure and temperature measurement.

The demo application is composed of two sections :

Application Init

Initialization of I2C module and log UART. After driver initialization and default settings, the app set VAV Press click I2C slave address ( 0x5C ) and enable device.

Application Task

This is an example that shows the use of an I2C to CAN click boardâ„¢. Logs pressure difference [ Pa ] and temperature [ degree Celsius ] values of the VAV Press click wired to the I2C to CAN click boardâ„¢.
Results are being sent to the Usart Terminal where you can track their changes.

Note
void get_dif_press_and_temp ( void ) - Get differential pressure and temperature function.
Author
Nenad Filipovic

Macro Definition Documentation

◆ I2CTOCAN_VAV_PRESS_CMD_START_PRESSURE_CONVERSION

#define I2CTOCAN_VAV_PRESS_CMD_START_PRESSURE_CONVERSION   0x21

◆ I2CTOCAN_VAV_PRESS_DEV_ADDR

#define I2CTOCAN_VAV_PRESS_DEV_ADDR   0x5C

◆ I2CTOCAN_VAV_PRESS_KNOWN_TEMPERATURE_C

#define I2CTOCAN_VAV_PRESS_KNOWN_TEMPERATURE_C   23.1

◆ I2CTOCAN_VAV_PRESS_PRESS_SCALE_FACTOR

#define I2CTOCAN_VAV_PRESS_PRESS_SCALE_FACTOR   1200

◆ I2CTOCAN_VAV_PRESS_READOUT_AT_KNOWN_TEMPERATURE

#define I2CTOCAN_VAV_PRESS_READOUT_AT_KNOWN_TEMPERATURE   105

◆ I2CTOCAN_VAV_PRESS_TEMP_SCALE_FACTOR

#define I2CTOCAN_VAV_PRESS_TEMP_SCALE_FACTOR   72

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 )

◆ get_dif_press_and_temp()

void get_dif_press_and_temp ( void )

◆ main()

int main ( void )