PER Firmware
Loading...
Searching...
No Matches
can.h File Reference
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_TX_TIMEOUT   (5000U)
 
#define PHAL_CAN_INIT_TIMEOUT   (5000U)
 
#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_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)
 

Enumerations

enum  PHAL_FDCAN_BaudRate_t : uint32_t { FDCAN_BAUD_250K = 250000U , FDCAN_BAUD_500K = 500000U , FDCAN_BAUD_1M = 1000000U }
 Supported baud rates for PER F4 CAN HAL. More...
 

Functions

bool PHAL_initCAN (CAN_TypeDef *bus, bool test_mode, uint32_t bit_rate)
 Initilize CAN peripheral to bit_rate.
 
bool PHAL_deinitCAN (CAN_TypeDef *bus)
 
bool PHAL_txCANMessage (CanMsgTypeDef_t *msg, uint8_t mbx)
 Find an empty TX mailbox and transmit a CAN message if one is found. Function will block until sucessful transmission of message until a specified timeout.
 
bool PHAL_txMailboxFree (CAN_TypeDef *bus, uint8_t mbx)
 
void PHAL_txCANAbort (CAN_TypeDef *bus, uint8_t mbx)
 
bool PHAL_rxCANMessage (CAN_TypeDef *bus, uint8_t fifo, CanMsgTypeDef_t *msg)
 
bool PHAL_anyTxMailboxFree (CAN_TypeDef *bus)
 
bool PHAL_getFreeTxMailbox (CAN_TypeDef *bus, uint8_t *mbx)
 
void PHAL_CAN_rxCallback (CanMsgTypeDef_t *msg)
 
void PHAL_CAN_txCallback (CAN_TypeDef *can)
 

Detailed Description

Author
Adam Busch (busch.nosp@m.8@pu.nosp@m.rdue..nosp@m.edu)
Version
0.1
Date
2021-03-20

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_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_INIT_TIMEOUT

#define PHAL_CAN_INIT_TIMEOUT   (5000U)

◆ PHAL_CAN_TX_TIMEOUT

#define PHAL_CAN_TX_TIMEOUT   (5000U)

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_anyTxMailboxFree()

bool PHAL_anyTxMailboxFree ( CAN_TypeDef * bus)

◆ PHAL_CAN_rxCallback()

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

◆ PHAL_CAN_txCallback()

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

◆ PHAL_deinitCAN()

bool PHAL_deinitCAN ( CAN_TypeDef * bus)

◆ PHAL_getFreeTxMailbox()

bool PHAL_getFreeTxMailbox ( CAN_TypeDef * bus,
uint8_t * mbx )

◆ PHAL_initCAN()

bool PHAL_initCAN ( CAN_TypeDef * bus,
bool test_mode,
uint32_t bit_rate )

Initilize CAN peripheral to bit_rate.

Parameters
test_modeInitilize CAN peripheral for self test mode
bit_rateBit rate in bps (i.e. 500000)
Returns
true Peripheral sucessfully initalized
false Peripheral stalled during initilization
Here is the caller graph for this function:

◆ PHAL_rxCANMessage()

bool PHAL_rxCANMessage ( CAN_TypeDef * bus,
uint8_t fifo,
CanMsgTypeDef_t * msg )
Here is the caller graph for this function:

◆ PHAL_txCANAbort()

void PHAL_txCANAbort ( CAN_TypeDef * bus,
uint8_t mbx )

◆ PHAL_txCANMessage()

bool PHAL_txCANMessage ( CanMsgTypeDef_t * msg,
uint8_t mbx )

Find an empty TX mailbox and transmit a CAN message if one is found. Function will block until sucessful transmission of message until a specified timeout.

Parameters
canCAN peripheral to transmit with
msgIdMessage ID
Returns
true Sucessful TX of message.
false Unable to find empty message or transmit took too long.

◆ PHAL_txMailboxFree()

bool PHAL_txMailboxFree ( CAN_TypeDef * bus,
uint8_t mbx )