canfd6 2.0.0.0
main.c File Reference

CANFD6 Click example. More...

#include "board.h"
#include "log.h"
#include "canfd6.h"

Macros

#define DEMO_APP_TRANSMITTER
 
#define CANFD6_FIRST_MSG   0
 
#define CANFD6_SECOND_MSG   1
 

Functions

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

Detailed Description

CANFD6 Click example.

Description

This application presents the capabilities of the CAN FD 6 click board. The board can be used both as a receiver and a transmitter. Use def directive to define the receive or transmit app.

The demo application is composed of two sections :

Application Init

The app starts by initializing the UART LOG and SPI drivers. The default cfg function performs the mandatory settings of the device. The user's default configuration can be modified ( for more information about device configuration, check the datasheet ). Additionally, the app writes two messages to the FIFO buffer and sends them if the transmit buffer content event is triggered.

Application Task

Depending on the defined app option, the application task performs the following procedure. If the transmitter is preferred, the application task triggers the transmit buffer contents event of the first message and, later on, the second message. On the other hand, the receiver waits for the CAN FD interrupt, where the payload is read along with the header ID.

Author
Stefan Nikolic

Macro Definition Documentation

◆ CANFD6_FIRST_MSG

#define CANFD6_FIRST_MSG   0

◆ CANFD6_SECOND_MSG

#define CANFD6_SECOND_MSG   1

◆ DEMO_APP_TRANSMITTER

#define DEMO_APP_TRANSMITTER

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 )