MG32F157 Standard Peripherals Firmware Library
Macros | Functions
mg32f157_can.c File Reference

This file provides all the I2C firmware functions. More...

#include "mg32f157_can.h"
#include "mg32f157_rcc.h"

Macros

#define CAN_BTR_MASK   (0xFFFFUL << 16)
 
#define CAN_IDType_Mask   (0x01UL << 7)
 
#define CAN_FrameType_Mask   (0x01UL << 6)
 
#define CAN_FrameFormat_Mask   (0x01UL << 5)
 
#define CAN_BitRateSwitch_Mask   (0x01UL << 4)
 
#define CAN_ErrorState_Mask_Std   (0x01UL << 19)
 
#define CAN_ErrorState_Mask_Ext   (0x01UL << 1)
 
#define CAN_DataLength_Mask   (0x0FUL << 0)
 

Functions

void CAN_DeInit (CAN_TypeDef *CANx)
 Deinitializes the CAN peripheral registers to their default reset values. More...
 
void CAN_Init (CAN_TypeDef *CANx, CAN_InitTypeDef *CAN_InitStruct)
 Initializes the CAN peripheral according to the specified parameters in the CAN_InitStruct. More...
 
void CANFD_Init (CAN_TypeDef *CANx, CANFD_InitTypeDef *CANFD_InitStruct)
 Initializes the CAN peripheral to FD Mode according to the specified parameters in the CAN_InitStruct. More...
 
void CAN_FilterInit (CAN_TypeDef *CANx, CAN_FilterInitTypeDef *CAN_FilterInitStruct)
 Initializes the CAN peripheral according to the specified. parameters in the CAN_FilterInitTypeDef. More...
 
void CAN_StructInit (CAN_InitTypeDef *CAN_InitStruct)
 Fills each CAN_InitStruct member with its default value. More...
 
void CANFD_StructInit (CANFD_InitTypeDef *CANFD_InitStruct)
 Fills each CANFD_InitTypeDef member with its default value. More...
 
void CAN_FilterStructInit (CAN_FilterInitTypeDef *CAN_FilterInitStruct)
 Fills each CANFD_InitStruct member with its default value. More...
 
void CAN_Reset (CAN_TypeDef *CANx, FunctionalState NewState)
 Set peripheral CAN to reset mode. More...
 
void CAN_SendCmd (CAN_TypeDef *CANx, uint32_t CAN_Cmd)
 Use peripheral CAN to send the transmission command. More...
 
void CAN_Transmit (CAN_TypeDef *CANx, CAN_Msg *Message, uint32_t AutoRetransmissionEnable)
 Initiates the transmission of a message in class mode. More...
 
void CAN_Receive (CAN_TypeDef *CANx, CAN_Msg *Message)
 Receives a message in class mode. More...
 
void CANFD_Transmit (CAN_TypeDef *CANx, CANFD_Msg *Message, uint32_t AutoRetransmissionEnable)
 Initiates the transmission of a message in FD mode. More...
 
void CANFD_Receive (CAN_TypeDef *CANx, CANFD_Msg *Message)
 Receives a message in FD mode. More...
 
void CAN_ITConfig (CAN_TypeDef *CANx, uint32_t CAN_IT, FunctionalState NewState)
 Enables or disables the specified CANx interrupts. More...
 
FlagStatus CAN_GetITStatus (CAN_TypeDef *CANx, uint32_t CAN_Flag)
 Checks whether the specified CAN flag is set or not. More...
 
void CAN_ClearITPendingBit (CAN_TypeDef *CANx, uint32_t CAN_Flag)
 Clears the CAN's pending flags. More...
 
FlagStatus CAN_GetFlagStatus (CAN_TypeDef *CANx, uint32_t CAN_Status)
 Checks whether the specified CAN status flag is set or not. More...
 
uint8_t CAN_GetArbitrationLosePosition (CAN_TypeDef *CANx)
 Checks CAN arbitrations lost capture position. More...
 
uint8_t CANFD_GetArbitrationErrorCount (CAN_TypeDef *CANx)
 Checks CAN arbitrations error count. More...
 
uint8_t CANFD_GetDataErrorCount (CAN_TypeDef *CANx)
 Checks CAN data error count. More...
 
FlagStatus CANFD_GetStatus (CAN_TypeDef *CANx, uint32_t CANFD_Status)
 Checks CAN FD running status. More...
 
FlagStatus CANFD_GetError (CAN_TypeDef *CANx, uint32_t CANFD_Error)
 Checks CAN FD error. More...
 
uint8_t CANFD_GetSecondarySamplePosition (CAN_TypeDef *CANx)
 Checks CAN FD Secondary Sample Position. More...
 
uint8_t CAN_GetMessageCount (CAN_TypeDef *CANx)
 Get CAN number of framed in the rxbuf. More...
 
uint8_t CAN_GetTransmitErrorCount (CAN_TypeDef *CANx)
 Get CAN Transmit Error Count. More...
 
uint8_t CAN_GetReceiveErrorCount (CAN_TypeDef *CANx)
 Get CAN Receive Error Count. More...
 

Detailed Description

This file provides all the I2C firmware functions.

Author
MegawinTech Application Team
Version
V0.0.4
Date
16-June-2023