STM32F1 Standard Peripheral bibliotheek  1.0
ST Microelectronics bibliotheek documentatie voor de STM32F1 Standard Peripheral Library
 All Data Structures Files Functions Variables Enumerations Groups
stm32f10x_can.c File Reference

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

#include "stm32f10x_can.h"
#include "stm32f10x_rcc.h"

Macros

#define MCR_INRQ   ((uint32_t)0x00000001) /* Initialization request */
 
#define MCR_SLEEP   ((uint32_t)0x00000002) /* Sleep mode request */
 
#define MCR_TXFP   ((uint32_t)0x00000004) /* Transmit FIFO priority */
 
#define MCR_RFLM   ((uint32_t)0x00000008) /* Receive FIFO locked mode */
 
#define MCR_NART   ((uint32_t)0x00000010) /* No automatic retransmission */
 
#define MCR_AWUM   ((uint32_t)0x00000020) /* Automatic wake up mode */
 
#define MCR_ABOM   ((uint32_t)0x00000040) /* Automatic bus-off management */
 
#define MCR_TTCM   ((uint32_t)0x00000080) /* time triggered communication */
 
#define MCR_RESET   ((uint32_t)0x00008000) /* time triggered communication */
 
#define MCR_DBF   ((uint32_t)0x00010000) /* software master reset */
 
#define MSR_INAK   ((uint32_t)0x00000001) /* Initialization acknowledge */
 
#define MSR_WKUI   ((uint32_t)0x00000008) /* Wake-up interrupt */
 
#define MSR_SLAKI   ((uint32_t)0x00000010) /* Sleep acknowledge interrupt */
 
#define TSR_RQCP0   ((uint32_t)0x00000001) /* Request completed mailbox0 */
 
#define TSR_TXOK0   ((uint32_t)0x00000002) /* Transmission OK of mailbox0 */
 
#define TSR_ABRQ0   ((uint32_t)0x00000080) /* Abort request for mailbox0 */
 
#define TSR_RQCP1   ((uint32_t)0x00000100) /* Request completed mailbox1 */
 
#define TSR_TXOK1   ((uint32_t)0x00000200) /* Transmission OK of mailbox1 */
 
#define TSR_ABRQ1   ((uint32_t)0x00008000) /* Abort request for mailbox1 */
 
#define TSR_RQCP2   ((uint32_t)0x00010000) /* Request completed mailbox2 */
 
#define TSR_TXOK2   ((uint32_t)0x00020000) /* Transmission OK of mailbox2 */
 
#define TSR_ABRQ2   ((uint32_t)0x00800000) /* Abort request for mailbox2 */
 
#define TSR_TME0   ((uint32_t)0x04000000) /* Transmit mailbox 0 empty */
 
#define TSR_TME1   ((uint32_t)0x08000000) /* Transmit mailbox 1 empty */
 
#define TSR_TME2   ((uint32_t)0x10000000) /* Transmit mailbox 2 empty */
 
#define RF0R_FULL0   ((uint32_t)0x00000008) /* FIFO 0 full */
 
#define RF0R_FOVR0   ((uint32_t)0x00000010) /* FIFO 0 overrun */
 
#define RF0R_RFOM0   ((uint32_t)0x00000020) /* Release FIFO 0 output mailbox */
 
#define RF1R_FULL1   ((uint32_t)0x00000008) /* FIFO 1 full */
 
#define RF1R_FOVR1   ((uint32_t)0x00000010) /* FIFO 1 overrun */
 
#define RF1R_RFOM1   ((uint32_t)0x00000020) /* Release FIFO 1 output mailbox */
 
#define ESR_EWGF   ((uint32_t)0x00000001) /* Error warning flag */
 
#define ESR_EPVF   ((uint32_t)0x00000002) /* Error passive flag */
 
#define ESR_BOFF   ((uint32_t)0x00000004) /* Bus-off flag */
 
#define TMIDxR_TXRQ   ((uint32_t)0x00000001) /* Transmit mailbox request */
 
#define FMR_FINIT   ((uint32_t)0x00000001) /* Filter init mode */
 
#define INAK_TimeOut   ((uint32_t)0x0000FFFF)
 
#define SLAK_TimeOut   ((uint32_t)0x0000FFFF)
 

Functions

void CAN_DeInit (CAN_TypeDef *CANx)
 Deinitializes the CAN peripheral registers to their default reset values. More...
 
uint8_t CAN_Init (CAN_TypeDef *CANx, CAN_InitTypeDef *CAN_InitStruct)
 Initializes the CAN peripheral according to the specified parameters in the CAN_InitStruct. More...
 
void CAN_FilterInit (CAN_FilterInitTypeDef *CAN_FilterInitStruct)
 Initializes the CAN peripheral according to the specified parameters in the CAN_FilterInitStruct. More...
 
void CAN_StructInit (CAN_InitTypeDef *CAN_InitStruct)
 Fills each CAN_InitStruct member with its default value. More...
 
void CAN_SlaveStartBank (uint8_t CAN_BankNumber)
 Select the start bank filter for slave CAN. More...
 
void CAN_ITConfig (CAN_TypeDef *CANx, uint32_t CAN_IT, FunctionalState NewState)
 Enables or disables the specified CAN interrupts. More...
 
uint8_t CAN_Transmit (CAN_TypeDef *CANx, CanTxMsg *TxMessage)
 Initiates the transmission of a message. More...
 
uint8_t CAN_TransmitStatus (CAN_TypeDef *CANx, uint8_t TransmitMailbox)
 Checks the transmission of a message. More...
 
void CAN_CancelTransmit (CAN_TypeDef *CANx, uint8_t Mailbox)
 Cancels a transmit request. More...
 
void CAN_FIFORelease (CAN_TypeDef *CANx, uint8_t FIFONumber)
 Releases a FIFO. More...
 
uint8_t CAN_MessagePending (CAN_TypeDef *CANx, uint8_t FIFONumber)
 Returns the number of pending messages. More...
 
void CAN_Receive (CAN_TypeDef *CANx, uint8_t FIFONumber, CanRxMsg *RxMessage)
 Receives a message. More...
 
void CAN_DBGFreeze (CAN_TypeDef *CANx, FunctionalState NewState)
 Enables or disables the DBG Freeze for CAN. More...
 
uint8_t CAN_Sleep (CAN_TypeDef *CANx)
 Enters the low power mode. More...
 
uint8_t CAN_WakeUp (CAN_TypeDef *CANx)
 Wakes the CAN up. More...
 
FlagStatus CAN_GetFlagStatus (CAN_TypeDef *CANx, uint32_t CAN_FLAG)
 Checks whether the specified CAN flag is set or not. More...
 
void CAN_ClearFlag (CAN_TypeDef *CANx, uint32_t CAN_FLAG)
 Clears the CAN's pending flags. More...
 
ITStatus CAN_GetITStatus (CAN_TypeDef *CANx, uint32_t CAN_IT)
 Checks whether the specified CAN interrupt has occurred or not. More...
 
void CAN_ClearITPendingBit (CAN_TypeDef *CANx, uint32_t CAN_IT)
 Clears the CAN’s interrupt pending bits. More...
 

Detailed Description

This file provides all the CAN firmware functions.

Author
MCD Application Team
Version
V3.3.0
Date
04/16/2010

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

© COPYRIGHT 2010 STMicroelectronics