AFBR-S50 API Reference Manual v1.5.6
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
Loading...
Searching...
No Matches

CAN interface for the AFBR-S50 Reference Board CAN application. More...

Collaboration diagram for CAN API interface:

Macros

#define CAN_MAILBOX_ID_TRANSMIT   CAN_MAILBOX_ID_0
 
#define CAN_FRAME_TRANSMIT_DATA_BYTES   (8U)
 

Enumerations

enum  argus_can_frame_id_t {
  CAN_FRAME_ID_START = 8 ,
  CAN_FRAME_ID_STOP = 9 ,
  CAN_FRAME_ID_1D = 28
}
 

Functions

void CAN_Init (void)
 Initializes the CAN API module.
 
void CAN_Deinit (void)
 Deinitializes the CAN module.
 
static void CAN_AwaitIdle (void)
 
static void CAN_Write (can_frame_t *const tx_frame)
 
void CAN_Transmit1D (argus_results_t const *res)
 Prints measurement results via CAN bus.
 
void CAN_HandleCommand (void)
 Handles incoming CAN commands by invoking the corresponding methods.
 
void can_callback (can_callback_args_t *p_args)
 CAN callback as defined in the "hal_data" module generated by the Renesas FSP Configuration.
 

Variables

static volatile bool is_can_tx_busy = false
 
static volatile uint32_t can_rx_remote_id = 0
 

Detailed Description

CAN interface for the AFBR-S50 Reference Board CAN application.



A simple CAN interface to demonstrate the basic usage of the CAN bus that comes with the AFBR-S50 Reference Board.

Macro Definition Documentation

◆ CAN_FRAME_TRANSMIT_DATA_BYTES

#define CAN_FRAME_TRANSMIT_DATA_BYTES   (8U)

Data length for TX frames.

◆ CAN_MAILBOX_ID_TRANSMIT

#define CAN_MAILBOX_ID_TRANSMIT   CAN_MAILBOX_ID_0

The used mail box number

Enumeration Type Documentation

◆ argus_can_frame_id_t

CAN Data Frame ID definition.

Enumerator
CAN_FRAME_ID_START 

Remote Frame ID for starting measurements

CAN_FRAME_ID_STOP 

Remote Frame ID for stopping measurements

CAN_FRAME_ID_1D 

1D Data Frame ID

Function Documentation

◆ CAN_AwaitIdle()

static void CAN_AwaitIdle ( void  )
static

◆ can_callback()

void can_callback ( can_callback_args_t *  p_args)

CAN callback as defined in the "hal_data" module generated by the Renesas FSP Configuration.


Parameters
p_argsThe callback arguments provided by HAL.

◆ CAN_Deinit()

void CAN_Deinit ( void  )

Deinitializes the CAN module.


◆ CAN_HandleCommand()

void CAN_HandleCommand ( void  )

Handles incoming CAN commands by invoking the corresponding methods.


Checks the incomming data queue and handles/invokes commands accordingly.

Note that this function must be called from thread level (not from interrupt service routines) in order to be executed correctly.

◆ CAN_Init()

void CAN_Init ( void  )

Initializes the CAN API module.


◆ CAN_Transmit1D()

void CAN_Transmit1D ( argus_results_t const *  res)

Prints measurement results via CAN bus.


Prints 1D measurement data via CAN-bus as data frame with ID 28.

     The following values are included in the CAN data frame payload:

     - 0..2: 1D Range [mm] (24bit, unsigned, MSB first)
     - 3..4: 1D Amplitude [LSB] (16-bit, unsigned, MSB first)
     - 5: Signal Quality [%] (8-bit, 0%-100% )
     - 6-7: Status (16-bit, signed, MSB first, see #status_t for details)
     .
Parameters
resA pointer to the latest measurement results structure.

◆ CAN_Write()

static void CAN_Write ( can_frame_t *const  tx_frame)
static

Variable Documentation

◆ can_rx_remote_id

volatile uint32_t can_rx_remote_id = 0
static

CAN remote frame if received but not handled.

◆ is_can_tx_busy

volatile bool is_can_tx_busy = false
static

CAN transmission busy status.