STM8S/A Standard Peripherals Drivers
|
Functions | |
void | CAN_CancelTransmit (CAN_TransmitMailBox_TypeDef CAN_TransmitMailbox) |
Cancels a transmit request. | |
void | CAN_ClearFlag (CAN_FLAG_TypeDef CAN_Flag) |
Clears the CAN's pending flags. | |
void | CAN_ClearITPendingBit (CAN_IT_TypeDef CAN_IT) |
Clears the CAN�s interrupt pending bits. | |
void | CAN_DeInit (void) |
Deinitializes the CAN peripheral registers to their default reset values. | |
void | CAN_FIFORelease (void) |
Releases the CAN FIFO. | |
void | CAN_FilterInit (CAN_FilterNumber_TypeDef CAN_FilterNumber, FunctionalState CAN_FilterActivation, CAN_FilterMode_TypeDef CAN_FilterMode, CAN_FilterScale_TypeDef CAN_FilterScale, uint8_t CAN_FilterID1, uint8_t CAN_FilterID2, uint8_t CAN_FilterID3, uint8_t CAN_FilterID4, uint8_t CAN_FilterIDMask1, uint8_t CAN_FilterIDMask2, uint8_t CAN_FilterIDMask3, uint8_t CAN_FilterIDMask4) |
Initializes the CAN peripheral Filter according to the specified parameters. | |
FlagStatus | CAN_GetFlagStatus (CAN_FLAG_TypeDef CAN_Flag) |
Checks whether the specified CAN flag is set or not. | |
ITStatus | CAN_GetITStatus (CAN_IT_TypeDef CAN_IT) |
Checks whether the specified CAN interrupt has occurred or not. | |
CAN_ErrorCode_TypeDef | CAN_GetLastErrorCode (void) |
Gets the Last Error Code. | |
uint16_t | CAN_GetMessageTimeStamp (void) |
Returns the Received time stamp. | |
uint8_t | CAN_GetReceivedData (uint8_t CAN_DataIndex) |
Gets the CAN Data of the received message. | |
uint8_t | CAN_GetReceivedDLC (void) |
Gets the CAN DLC of the received message. | |
uint8_t | CAN_GetReceivedFMI (void) |
Gets the CAN FMI of the received message. | |
uint32_t | CAN_GetReceivedId (void) |
Gets the CAN Id of the received message. | |
CAN_Id_TypeDef | CAN_GetReceivedIDE (void) |
Gets the CAN IDE of the received message. | |
CAN_RTR_TypeDef | CAN_GetReceivedRTR (void) |
Gets the CAN RTR of the received message. | |
CAN_Page_TypeDef | CAN_GetSelectedPage (void) |
Gets the selected registers page. | |
CAN_InitStatus_TypeDef | CAN_Init (CAN_MasterCtrl_TypeDef CAN_MasterCtrl, CAN_Mode_TypeDef CAN_Mode, CAN_SynJumpWidth_TypeDef CAN_SynJumpWidth, CAN_BitSeg1_TypeDef CAN_BitSeg1, CAN_BitSeg2_TypeDef CAN_BitSeg2, uint8_t CAN_Prescaler) |
Initializes the CAN peripheral according to the specified parameters. | |
void | CAN_ITConfig (CAN_IT_TypeDef CAN_IT, FunctionalState NewState) |
Enables or disables the specified CAN interrupts. | |
CAN_NbrPendingMessage_TypeDef | CAN_MessagePending (void) |
Returns the number of pending messages. | |
CAN_ModeStatus_TypeDef | CAN_OperatingModeRequest (CAN_OperatingMode_TypeDef CAN_OperatingMode) |
Select the CAN Operation mode. | |
void | CAN_Receive (void) |
Receives a message which contains CAN Id, IDE, RTR DLC, data and FMI number. | |
void | CAN_SelectPage (CAN_Page_TypeDef CAN_Page) |
Sets the registers page to be selected. | |
CAN_Sleep_TypeDef | CAN_Sleep (void) |
Enters the Sleep low power mode. | |
void | CAN_ST7CompatibilityCmd (CAN_ST7Compatibility_TypeDef CAN_ST7Compatibility) |
Enables or Disables the ST7 CAN Compatibility. | |
CAN_TxStatus_TypeDef | CAN_Transmit (uint32_t CAN_Id, CAN_Id_TypeDef CAN_IDE, CAN_RTR_TypeDef CAN_RTR, uint8_t CAN_DLC, uint8_t *CAN_Data) |
Initiates the transmission of a message. | |
CAN_TxStatus_TypeDef | CAN_TransmitStatus (CAN_TransmitMailBox_TypeDef CAN_TransmitMailbox) |
Checks the transmission of a message. | |
void | CAN_TTComModeCmd (FunctionalState NewState) |
Enables or disables the CAN Time TriggerOperation communication mode. | |
CAN_WakeUp_TypeDef | CAN_WakeUp (void) |
Wakes the CAN up. | |
static ITStatus | CheckITStatus (uint8_t CAN_Reg, uint8_t It_Bit) |
Checks whether the CAN interrupt has occurred or not. |
Function Documentation
void CAN_CancelTransmit | ( | CAN_TransmitMailBox_TypeDef | CAN_TransmitMailbox | ) |
Cancels a transmit request.
Definition at line 724 of file stm8s_can.c.
References CAN_GetSelectedPage(), CAN_MCSR_ABRQ, CAN_SelectPage(), and IS_CAN_TRANSMITMAILBOX_OK.
void CAN_ClearFlag | ( | CAN_FLAG_TypeDef | CAN_Flag | ) |
Clears the CAN's pending flags.
Definition at line 1077 of file stm8s_can.c.
References CAN_GetSelectedPage(), CAN_Page_Config, CAN_SelectPage(), IS_CAN_FLAG_CLEAR_OK, and RESET.
void CAN_ClearITPendingBit | ( | CAN_IT_TypeDef | CAN_IT | ) |
Clears the CAN�s interrupt pending bits.
Definition at line 1348 of file stm8s_can.c.
References CAN_ESR_RESET_VALUE, CAN_GetSelectedPage(), CAN_IT_BOF, CAN_IT_EPV, CAN_IT_ERR, CAN_IT_EWG, CAN_IT_FF, CAN_IT_FOV, CAN_IT_LEC, CAN_IT_TME, CAN_IT_WKU, CAN_MSR_ERRI, CAN_MSR_WKUI, CAN_Page_Config, CAN_RFR_FOVR, CAN_RFR_FULL, CAN_SelectPage(), CAN_TSR_RQCP012, and IS_CAN_IT_PENDING_BIT_OK.
void CAN_DeInit | ( | void | ) |
Deinitializes the CAN peripheral registers to their default reset values.
Definition at line 62 of file stm8s_can.c.
References CAN_BTR1_RESET_VALUE, CAN_BTR2_RESET_VALUE, CAN_DGR_RESET_VALUE, CAN_EIER_RESET_VALUE, CAN_ESR_RESET_VALUE, CAN_FCR_RESET_VALUE, CAN_FMR1_RESET_VALUE, CAN_FMR2_RESET_VALUE, CAN_IER_RESET_VALUE, CAN_MCR_INRQ, CAN_MCR_RESET_VALUE, CAN_MDLC_RESET_VALUE, CAN_MSR_RESET_VALUE, CAN_OperatingMode_Initialization, CAN_OperatingMode_Normal, CAN_OperatingModeRequest(), CAN_Page_Config, CAN_Page_RxFifo, CAN_Page_TxMailBox0, CAN_Page_TxMailBox1, CAN_Page_TxMailBox2, CAN_PSR_RESET_VALUE, CAN_RFR_RESET_VALUE, and CAN_TSR_RESET_VALUE.
void CAN_FIFORelease | ( | void | ) |
Releases the CAN FIFO.
Definition at line 742 of file stm8s_can.c.
References CAN_RFR_RFOM.
Referenced by CAN_Receive().
void CAN_FilterInit | ( | CAN_FilterNumber_TypeDef | CAN_FilterNumber, |
FunctionalState | CAN_FilterActivation, | ||
CAN_FilterMode_TypeDef | CAN_FilterMode, | ||
CAN_FilterScale_TypeDef | CAN_FilterScale, | ||
uint8_t | CAN_FilterID1, | ||
uint8_t | CAN_FilterID2, | ||
uint8_t | CAN_FilterID3, | ||
uint8_t | CAN_FilterID4, | ||
uint8_t | CAN_FilterIDMask1, | ||
uint8_t | CAN_FilterIDMask2, | ||
uint8_t | CAN_FilterIDMask3, | ||
uint8_t | CAN_FilterIDMask4 | ||
) |
Initializes the CAN peripheral Filter according to the specified parameters.
Definition at line 194 of file stm8s_can.c.
References CAN_FCR1_FSC00, CAN_FCR1_FSC01, CAN_FilterMode_IdList, CAN_FilterMode_IdList_IdMask, CAN_FilterMode_IdMask, CAN_FilterNumber_0, CAN_FilterNumber_1, CAN_FilterNumber_2, CAN_FilterNumber_3, CAN_FilterNumber_4, CAN_FilterScale_16_8Bit, CAN_FilterScale_16Bit, CAN_FilterScale_32Bit, CAN_FilterScale_8Bit, CAN_GetSelectedPage(), CAN_IDLIST_IDMASK_MASK, CAN_IDMASK_IDLIST_MASK, CAN_OperatingMode_Initialization, CAN_OperatingMode_Normal, CAN_OperatingModeRequest(), CAN_Page_Config, CAN_Page_Filter01, CAN_Page_Filter23, CAN_Page_Filter45, CAN_SelectPage(), DISABLE, IS_CAN_FILTER_MODE_OK, IS_CAN_FILTER_NUMBER_OK, IS_CAN_FILTER_SCALE_OK, and IS_FUNCTIONALSTATE_OK.
FlagStatus CAN_GetFlagStatus | ( | CAN_FLAG_TypeDef | CAN_Flag | ) |
Checks whether the specified CAN flag is set or not.
Definition at line 1119 of file stm8s_can.c.
References CAN_GetSelectedPage(), CAN_Page_Config, CAN_SelectPage(), IS_CAN_FLAG_STATUS_OK, RESET, and SET.
ITStatus CAN_GetITStatus | ( | CAN_IT_TypeDef | CAN_IT | ) |
Checks whether the specified CAN interrupt has occurred or not.
Definition at line 1203 of file stm8s_can.c.
References CAN_EIER_BOFIE, CAN_EIER_EPVIE, CAN_EIER_ERRIE, CAN_EIER_EWGIE, CAN_EIER_LECIE, CAN_ESR_BOFF, CAN_ESR_EPVF, CAN_ESR_EWGF, CAN_ESR_LEC, CAN_GetSelectedPage(), CAN_IER_FFIE, CAN_IER_FMPIE, CAN_IER_FOVIE, CAN_IER_TMEIE, CAN_IER_WKUIE, CAN_IT_BOF, CAN_IT_EPV, CAN_IT_ERR, CAN_IT_EWG, CAN_IT_FF, CAN_IT_FMP, CAN_IT_FOV, CAN_IT_LEC, CAN_IT_TME, CAN_IT_WKU, CAN_MSR_WKUI, CAN_Page_Config, CAN_RFR_FMP01, CAN_RFR_FOVR, CAN_RFR_FULL, CAN_SelectPage(), CAN_TSR_RQCP012, CheckITStatus(), IS_CAN_IT_STATUS_OK, and RESET.
CAN_ErrorCode_TypeDef CAN_GetLastErrorCode | ( | void | ) |
Gets the Last Error Code.
Definition at line 1051 of file stm8s_can.c.
References CAN_ErrorCode_NoErr, CAN_ESR_LEC, CAN_GetSelectedPage(), CAN_Page_Config, and CAN_SelectPage().
uint16_t CAN_GetMessageTimeStamp | ( | void | ) |
Returns the Received time stamp.
Definition at line 902 of file stm8s_can.c.
References CAN_GetSelectedPage(), CAN_Page_RxFifo, and CAN_SelectPage().
Gets the CAN Data of the received message.
Definition at line 878 of file stm8s_can.c.
References _Data, and IS_CAN_DLC_OK.
uint8_t CAN_GetReceivedDLC | ( | void | ) |
Gets the CAN DLC of the received message.
Definition at line 864 of file stm8s_can.c.
References _DLC.
uint8_t CAN_GetReceivedFMI | ( | void | ) |
Gets the CAN FMI of the received message.
Definition at line 892 of file stm8s_can.c.
References _FMI.
uint32_t CAN_GetReceivedId | ( | void | ) |
Gets the CAN Id of the received message.
Definition at line 825 of file stm8s_can.c.
References _Id.
CAN_Id_TypeDef CAN_GetReceivedIDE | ( | void | ) |
Gets the CAN IDE of the received message.
Definition at line 838 of file stm8s_can.c.
References _IDE.
CAN_RTR_TypeDef CAN_GetReceivedRTR | ( | void | ) |
Gets the CAN RTR of the received message.
Definition at line 851 of file stm8s_can.c.
References _RTR.
CAN_Page_TypeDef CAN_GetSelectedPage | ( | void | ) |
Gets the selected registers page.
Definition at line 1407 of file stm8s_can.c.
Referenced by CAN_CancelTransmit(), CAN_ClearFlag(), CAN_ClearITPendingBit(), CAN_FilterInit(), CAN_GetFlagStatus(), CAN_GetITStatus(), CAN_GetLastErrorCode(), CAN_GetMessageTimeStamp(), CAN_Init(), CAN_ITConfig(), CAN_Receive(), CAN_Transmit(), and CAN_TTComModeCmd().
CAN_InitStatus_TypeDef CAN_Init | ( | CAN_MasterCtrl_TypeDef | CAN_MasterCtrl, |
CAN_Mode_TypeDef | CAN_Mode, | ||
CAN_SynJumpWidth_TypeDef | CAN_SynJumpWidth, | ||
CAN_BitSeg1_TypeDef | CAN_BitSeg1, | ||
CAN_BitSeg2_TypeDef | CAN_BitSeg2, | ||
uint8_t | CAN_Prescaler | ||
) |
Initializes the CAN peripheral according to the specified parameters.
Definition at line 106 of file stm8s_can.c.
References CAN_ACKNOWLEDGE_TIMEOUT, CAN_GetSelectedPage(), CAN_InitStatus_Failed, CAN_InitStatus_Success, CAN_MCR_INRQ, CAN_MSR_INAK, CAN_Page_Config, CAN_SelectPage(), IS_CAN_BITSEG1_OK, IS_CAN_BITSEG2_OK, IS_CAN_MASTERCTRL_OK, IS_CAN_MODE_OK, IS_CAN_PRESCALER_OK, and IS_CAN_SYNJUMPWIDTH_OK.
void CAN_ITConfig | ( | CAN_IT_TypeDef | CAN_IT, |
FunctionalState | NewState | ||
) |
Enables or disables the specified CAN interrupts.
Definition at line 487 of file stm8s_can.c.
References CAN_GetSelectedPage(), CAN_Page_Config, CAN_SelectPage(), DISABLE, IS_CAN_IT_CONFIG_OK, and IS_FUNCTIONALSTATE_OK.
CAN_NbrPendingMessage_TypeDef CAN_MessagePending | ( | void | ) |
Returns the number of pending messages.
Definition at line 752 of file stm8s_can.c.
References CAN_NbrPendingMessage_0, and CAN_RFR_FMP01.
CAN_ModeStatus_TypeDef CAN_OperatingModeRequest | ( | CAN_OperatingMode_TypeDef | CAN_OperatingMode | ) |
Select the CAN Operation mode.
Definition at line 974 of file stm8s_can.c.
References CAN_ACKNOWLEDGE_TIMEOUT, CAN_MCR_INRQ, CAN_MCR_SLEEP, CAN_MODE_MASK, CAN_ModeStatus_Failed, CAN_ModeStatus_Success, CAN_MSR_INAK, CAN_MSR_SLAK, CAN_OperatingMode_Initialization, CAN_OperatingMode_Normal, CAN_OperatingMode_Sleep, and IS_CAN_OPERATINGMODE_OK.
Referenced by CAN_DeInit(), and CAN_FilterInit().
void CAN_Receive | ( | void | ) |
Receives a message which contains CAN Id, IDE, RTR DLC, data and FMI number.
In order to get these data, use CAN_GetReceivedId(), CAN_GetReceivedIDE(), CAN_GetReceivedRTR(), CAN_GetReceivedDLC(), CAN_GetReceivedFMI() and CAN_GetReceivedData() functions.
Definition at line 767 of file stm8s_can.c.
References _Data, _DLC, _FMI, _Id, _IDE, _RTR, CAN_EXTID_SIZE, CAN_FIFORelease(), CAN_GetSelectedPage(), CAN_Id_Extended, CAN_Id_Standard, CAN_Page_RxFifo, CAN_SelectPage(), and CAN_STDID_SIZE.
void CAN_SelectPage | ( | CAN_Page_TypeDef | CAN_Page | ) |
Sets the registers page to be selected.
Definition at line 1417 of file stm8s_can.c.
Referenced by CAN_CancelTransmit(), CAN_ClearFlag(), CAN_ClearITPendingBit(), CAN_FilterInit(), CAN_GetFlagStatus(), CAN_GetITStatus(), CAN_GetLastErrorCode(), CAN_GetMessageTimeStamp(), CAN_Init(), CAN_ITConfig(), CAN_Receive(), CAN_Transmit(), and CAN_TTComModeCmd().
CAN_Sleep_TypeDef CAN_Sleep | ( | void | ) |
Enters the Sleep low power mode.
Definition at line 924 of file stm8s_can.c.
References CAN_MCR_INRQ, CAN_MCR_SLEEP, CAN_MSR_INAK, CAN_MSR_SLAK, CAN_Sleep_Failed, and CAN_Sleep_Ok.
void CAN_ST7CompatibilityCmd | ( | CAN_ST7Compatibility_TypeDef | CAN_ST7Compatibility | ) |
Enables or Disables the ST7 CAN Compatibility.
if the ST7 compatibility is Enabled, CAN provides only 2 mailboxes. if the ST7 compatibility is Disabled, CAN provides 3 mailboxes.
Definition at line 525 of file stm8s_can.c.
References CAN_DGR_TXM2E, and IS_CAN_ST7_COMPATIBILITY_OK.
CAN_TxStatus_TypeDef CAN_Transmit | ( | uint32_t | CAN_Id, |
CAN_Id_TypeDef | CAN_IDE, | ||
CAN_RTR_TypeDef | CAN_RTR, | ||
uint8_t | CAN_DLC, | ||
uint8_t * | CAN_Data | ||
) |
Initiates the transmission of a message.
Definition at line 587 of file stm8s_can.c.
References CAN_EXTID_SIZE, CAN_GetSelectedPage(), CAN_Id_Standard, CAN_MCSR_TXRQ, CAN_SelectPage(), CAN_STDID_SIZE, CAN_TPR_TME0, CAN_TPR_TME1, CAN_TPR_TME2, CAN_TxStatus_MailBox0Ok, CAN_TxStatus_MailBox1Ok, CAN_TxStatus_MailBox2Ok, CAN_TxStatus_NoMailBox, IS_CAN_DLC_OK, IS_CAN_EXTID_OK, IS_CAN_IDTYPE_OK, IS_CAN_RTR_OK, and IS_CAN_STDID_OK.
CAN_TxStatus_TypeDef CAN_TransmitStatus | ( | CAN_TransmitMailBox_TypeDef | CAN_TransmitMailbox | ) |
Checks the transmission of a message.
Definition at line 672 of file stm8s_can.c.
References CAN_TPR_TME0, CAN_TPR_TME1, CAN_TPR_TME2, CAN_TransmitMailBox_0, CAN_TransmitMailBox_1, CAN_TransmitMailBox_2, CAN_TSR_RQCP0, CAN_TSR_RQCP1, CAN_TSR_RQCP2, CAN_TSR_TXOK0, CAN_TSR_TXOK1, CAN_TSR_TXOK2, CAN_TxStatus_Failed, CAN_TxStatus_MailBoxEmpty, CAN_TxStatus_Ok, CAN_TxStatus_Pending, and IS_CAN_TRANSMITMAILBOX_OK.
void CAN_TTComModeCmd | ( | FunctionalState | NewState | ) |
Enables or disables the CAN Time TriggerOperation communication mode.
Definition at line 541 of file stm8s_can.c.
References CAN_GetSelectedPage(), CAN_MCR_TTCM, CAN_MDLCR_TGT, CAN_Page_RxFifo, CAN_Page_TxMailBox0, CAN_Page_TxMailBox1, CAN_Page_TxMailBox2, CAN_SelectPage(), DISABLE, and IS_FUNCTIONALSTATE_OK.
CAN_WakeUp_TypeDef CAN_WakeUp | ( | void | ) |
Wakes the CAN up.
Definition at line 947 of file stm8s_can.c.
References CAN_MCR_SLEEP, CAN_MSR_SLAK, CAN_WakeUp_Failed, and CAN_WakeUp_Ok.
Checks whether the CAN interrupt has occurred or not.
Definition at line 1428 of file stm8s_can.c.
Referenced by CAN_GetITStatus().