PER Firmware
Loading...
Searching...
No Matches
can.h File Reference

F4 bxCAN public API. More...

#include "phal_F4/phal_F4.h"
Include dependency graph for can.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CanMsgTypeDef_t
 Classic CAN frame. More...
 

Macros

#define PHAL_CAN_16MHZ_1M   (0x033a0000)
 
#define PHAL_CAN_24MHZ_1M   (0x03270001)
 
#define PHAL_CAN_36MHZ_1M   (0x033c0001)
 
#define PHAL_CAN_42MHZ_1M   (0x034e0001)
 
#define PHAL_CAN_16MHZ_500K   (0x033a0001)
 
#define PHAL_CAN_24MHZ_500K   (0x033a0002)
 
#define PHAL_CAN_25MHZ_500K   (0x01160004)
 
#define PHAL_CAN_36MHZ_500K   (0x03270005)
 
#define PHAL_CAN_42MHZ_500K   (0x034e0003)
 
#define PHAL_CAN_16MHZ_250K   (0x003a0003)
 
#define PHAL_CAN_24MHZ_250K   (0x003a0005)
 
#define PHAL_CAN_36MHZ_250K   (0x003a0008)
 
#define PHAL_CAN_MAX_NUM_SID_FILTER   (28U)
 
#define PHAL_CAN_MAX_NUM_XID_FILTER   (8U)
 

Enumerations

enum  PHAL_FDCAN_BaudRate_t : uint32_t { FDCAN_BAUD_250K = 250'000U , FDCAN_BAUD_500K = 500'000U , FDCAN_BAUD_1M = 1'000'000U }
 Supported baud rates for PER F4 CAN HAL. More...
 

Functions

bool PHAL_CAN_init (CAN_TypeDef *bus, PHAL_FDCAN_BaudRate_t bit_rate)
 
bool PHAL_CAN_setFilters (CAN_TypeDef *bus, const uint32_t *sid_list, uint32_t num_sid, const uint32_t *xid_list, uint32_t num_xid)
 
bool PHAL_CAN_send (CanMsgTypeDef_t *msg)
 
bool PHAL_CAN_txFifoFree (const CAN_TypeDef *bus)
 
void PHAL_CAN_rxCallback (CanMsgTypeDef_t *msg)
 
void PHAL_CAN_txCallback (CAN_TypeDef *can)
 

Detailed Description

Macro Definition Documentation

◆ PHAL_CAN_16MHZ_1M

#define PHAL_CAN_16MHZ_1M   (0x033a0000)

◆ PHAL_CAN_16MHZ_250K

#define PHAL_CAN_16MHZ_250K   (0x003a0003)

◆ PHAL_CAN_16MHZ_500K

#define PHAL_CAN_16MHZ_500K   (0x033a0001)

◆ PHAL_CAN_24MHZ_1M

#define PHAL_CAN_24MHZ_1M   (0x03270001)

◆ PHAL_CAN_24MHZ_250K

#define PHAL_CAN_24MHZ_250K   (0x003a0005)

◆ PHAL_CAN_24MHZ_500K

#define PHAL_CAN_24MHZ_500K   (0x033a0002)

◆ PHAL_CAN_25MHZ_500K

#define PHAL_CAN_25MHZ_500K   (0x01160004)

◆ PHAL_CAN_36MHZ_1M

#define PHAL_CAN_36MHZ_1M   (0x033c0001)

◆ PHAL_CAN_36MHZ_250K

#define PHAL_CAN_36MHZ_250K   (0x003a0008)

◆ PHAL_CAN_36MHZ_500K

#define PHAL_CAN_36MHZ_500K   (0x03270005)

◆ PHAL_CAN_42MHZ_1M

#define PHAL_CAN_42MHZ_1M   (0x034e0001)

◆ PHAL_CAN_42MHZ_500K

#define PHAL_CAN_42MHZ_500K   (0x034e0003)

◆ PHAL_CAN_MAX_NUM_SID_FILTER

#define PHAL_CAN_MAX_NUM_SID_FILTER   (28U)

◆ PHAL_CAN_MAX_NUM_XID_FILTER

#define PHAL_CAN_MAX_NUM_XID_FILTER   (8U)

Enumeration Type Documentation

◆ PHAL_FDCAN_BaudRate_t

enum PHAL_FDCAN_BaudRate_t : uint32_t

Supported baud rates for PER F4 CAN HAL.

Enumerator
FDCAN_BAUD_250K 
FDCAN_BAUD_500K 
FDCAN_BAUD_1M 

Function Documentation

◆ PHAL_CAN_init()

bool PHAL_CAN_init ( CAN_TypeDef * bus,
PHAL_FDCAN_BaudRate_t bit_rate )

Initialize the bus with an accept-all FIFO0 filter, waiting for hardware acknowledgement. Bus must be CAN1, CAN2 or CAN3 (nullptr is rejected). Return false for an invalid bus or unsupported clock/baud combination, before changing hardware.

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

◆ PHAL_CAN_rxCallback()

void PHAL_CAN_rxCallback ( CanMsgTypeDef_t * msg)
extern
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PHAL_CAN_send()

bool PHAL_CAN_send ( CanMsgTypeDef_t * msg)

Queue a frame in any free mailbox; return false immediately if none is free.

Here is the call graph for this function:

◆ PHAL_CAN_setFilters()

bool PHAL_CAN_setFilters ( CAN_TypeDef * bus,
const uint32_t * sid_list,
uint32_t num_sid,
const uint32_t * xid_list,
uint32_t num_xid )

Replace this bus's filters. Empty lists accept all IDs; invalid input returns false.

Here is the call graph for this function:

◆ PHAL_CAN_txCallback()

void PHAL_CAN_txCallback ( CAN_TypeDef * can)
extern
Here is the caller graph for this function:

◆ PHAL_CAN_txFifoFree()

bool PHAL_CAN_txFifoFree ( const CAN_TypeDef * bus)

Return true if a mailbox is free; false for an invalid bus (including nullptr).

Here is the call graph for this function: