firmware
IEM Firmware Documentation
Loading...
Searching...
No Matches
can.c File Reference

Application-specific parts of the CAN RX/TX tasks. More...

#include "can.h"
#include "can_1.h"
#include "can_2.h"
#include "can_3.h"
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "rtos.h"
#include "main.h"
#include "types.h"
#include "can_rtos.h"
#include "FreeRTOS.h"
#include "queue.h"
Include dependency graph for can.c:

Macros

#define CAN_1_RX_LOCATION   FDCAN_RX_FIFO0
#define CAN_3_RX_LOCATION   FDCAN_RX_FIFO1
#define DEBUG_ID_FILTER   0x0A0
#define DEBUG_ID_MASK   0x7F0
#define APPS_SAS_ID_FILTER   0x18FFAA80
#define APPS_SAS_ID_MASK   0xFFFFFFFC

Functions

static void can_1_rx_handler (CAN_Msg_t *rx_msg_ptr)
 Processes incoming CAN 1 messages and notifies tasks.
static void can_3_rx_handler (CAN_Msg_t *rx_msg_ptr)
 Processes incoming CAN 3 messages and notifies tasks, then forwards the received message to CAN 2 for logging.
static void setup_hardware_filters ()
 Configures FDCAN hardware filters. Call before HAL_FDCAN_Start!!
void safety_can_init ()
 Initializes CAN transmit and receive tasks for each bus.

Detailed Description

Application-specific parts of the CAN RX/TX tasks.

Author
Jamie Pruett :)
Version
0.1
Date
2025-01-15

Macro Definition Documentation

◆ APPS_SAS_ID_FILTER

#define APPS_SAS_ID_FILTER   0x18FFAA80

◆ APPS_SAS_ID_MASK

#define APPS_SAS_ID_MASK   0xFFFFFFFC

◆ CAN_1_RX_LOCATION

#define CAN_1_RX_LOCATION   FDCAN_RX_FIFO0

◆ CAN_3_RX_LOCATION

#define CAN_3_RX_LOCATION   FDCAN_RX_FIFO1

◆ DEBUG_ID_FILTER

#define DEBUG_ID_FILTER   0x0A0

◆ DEBUG_ID_MASK

#define DEBUG_ID_MASK   0x7F0

Function Documentation

◆ can_1_rx_handler()

void can_1_rx_handler ( CAN_Msg_t * rx_msg_ptr)
static

Processes incoming CAN 1 messages and notifies tasks.

Passed to the CAN 1 receive task from the can_rtos library in Called when a new message is received on CAN 1 rx_msg_ptr Received CAN 1 message

Here is the caller graph for this function:

◆ can_3_rx_handler()

void can_3_rx_handler ( CAN_Msg_t * rx_msg_ptr)
static

Processes incoming CAN 3 messages and notifies tasks, then forwards the received message to CAN 2 for logging.

Passed to the CAN 3 receive task from the can_rtos library in Called when a new message is received on CAN 3 rx_msg_ptr Received CAN 3 message

Here is the call graph for this function:
Here is the caller graph for this function:

◆ safety_can_init()

void safety_can_init ( void )

Initializes CAN transmit and receive tasks for each bus.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_hardware_filters()

void setup_hardware_filters ( void )
static

Configures FDCAN hardware filters. Call before HAL_FDCAN_Start!!

Here is the caller graph for this function: