PER Firmware
Loading...
Searching...
No Matches
can.h File Reference
#include "common/phal_F4_F7/phal_F4_F7.h"

Go to the source code of this file.

Classes

struct  CanMsgTypeDef_t
 

Macros

#define PHAL_CAN_TX_TIMEOUT   (5000U)
 
#define PHAL_CAN_INIT_TIMEOUT   (5000U)
 
#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)
 

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)
 

Detailed Description

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

Function Documentation

◆ 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

◆ 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.