stm32f10x_can.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. /**
  2. ******************************************************************************
  3. * @file stm32f10x_can.h
  4. * @author MCD Application Team
  5. * @version V3.3.0
  6. * @date 04/16/2010
  7. * @brief This file contains all the functions prototypes for the CAN firmware
  8. * library.
  9. ******************************************************************************
  10. * @copy
  11. *
  12. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  13. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  14. * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  15. * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  16. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  17. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  18. *
  19. * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
  20. */
  21. /* Define to prevent recursive inclusion -------------------------------------*/
  22. #ifndef __STM32F10x_CAN_H
  23. #define __STM32F10x_CAN_H
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. /* Includes ------------------------------------------------------------------*/
  28. #include "stm32f10x.h"
  29. /** @addtogroup STM32F10x_StdPeriph_Driver
  30. * @{
  31. */
  32. /** @addtogroup CAN
  33. * @{
  34. */
  35. /** @defgroup CAN_Exported_Types
  36. * @{
  37. */
  38. #define IS_CAN_ALL_PERIPH(PERIPH) (((PERIPH) == CAN1) || \
  39. ((PERIPH) == CAN2))
  40. /**
  41. * @brief CAN init structure definition
  42. */
  43. typedef struct
  44. {
  45. uint16_t CAN_Prescaler; /*!< Specifies the length of a time quantum. It ranges from 1 to 1024. */
  46. uint8_t CAN_Mode; /*!< Specifies the CAN operating mode.
  47. This parameter can be a value of @ref CAN_operating_mode */
  48. uint8_t CAN_SJW; /*!< Specifies the maximum number of time quanta the CAN hardware
  49. is allowed to lengthen or shorten a bit to perform resynchronization.
  50. This parameter can be a value of @ref CAN_synchronisation_jump_width */
  51. uint8_t CAN_BS1; /*!< Specifies the number of time quanta in Bit Segment 1.
  52. This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_1 */
  53. uint8_t CAN_BS2; /*!< Specifies the number of time quanta in Bit Segment 2.
  54. This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_2 */
  55. FunctionalState CAN_TTCM; /*!< Enable or disable the time triggered communication mode.
  56. This parameter can be set either to ENABLE or DISABLE. */
  57. FunctionalState CAN_ABOM; /*!< Enable or disable the automatic bus-off management.
  58. This parameter can be set either to ENABLE or DISABLE. */
  59. FunctionalState CAN_AWUM; /*!< Enable or disable the automatic wake-up mode.
  60. This parameter can be set either to ENABLE or DISABLE. */
  61. FunctionalState CAN_NART; /*!< Enable or disable the no-automatic retransmission mode.
  62. This parameter can be set either to ENABLE or DISABLE. */
  63. FunctionalState CAN_RFLM; /*!< Enable or disable the Receive FIFO Locked mode.
  64. This parameter can be set either to ENABLE or DISABLE. */
  65. FunctionalState CAN_TXFP; /*!< Enable or disable the transmit FIFO priority.
  66. This parameter can be set either to ENABLE or DISABLE. */
  67. } CAN_InitTypeDef;
  68. /**
  69. * @brief CAN filter init structure definition
  70. */
  71. typedef struct
  72. {
  73. uint16_t CAN_FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bit
  74. configuration, first one for a 16-bit configuration).
  75. This parameter can be a value between 0x0000 and 0xFFFF */
  76. uint16_t CAN_FilterIdLow; /*!< Specifies the filter identification number (LSBs for a 32-bit
  77. configuration, second one for a 16-bit configuration).
  78. This parameter can be a value between 0x0000 and 0xFFFF */
  79. uint16_t CAN_FilterMaskIdHigh; /*!< Specifies the filter mask number or identification number,
  80. according to the mode (MSBs for a 32-bit configuration,
  81. first one for a 16-bit configuration).
  82. This parameter can be a value between 0x0000 and 0xFFFF */
  83. uint16_t CAN_FilterMaskIdLow; /*!< Specifies the filter mask number or identification number,
  84. according to the mode (LSBs for a 32-bit configuration,
  85. second one for a 16-bit configuration).
  86. This parameter can be a value between 0x0000 and 0xFFFF */
  87. uint16_t CAN_FilterFIFOAssignment; /*!< Specifies the FIFO (0 or 1) which will be assigned to the filter.
  88. This parameter can be a value of @ref CAN_filter_FIFO */
  89. uint8_t CAN_FilterNumber; /*!< Specifies the filter which will be initialized. It ranges from 0 to 13. */
  90. uint8_t CAN_FilterMode; /*!< Specifies the filter mode to be initialized.
  91. This parameter can be a value of @ref CAN_filter_mode */
  92. uint8_t CAN_FilterScale; /*!< Specifies the filter scale.
  93. This parameter can be a value of @ref CAN_filter_scale */
  94. FunctionalState CAN_FilterActivation; /*!< Enable or disable the filter.
  95. This parameter can be set either to ENABLE or DISABLE. */
  96. } CAN_FilterInitTypeDef;
  97. /**
  98. * @brief CAN Tx message structure definition
  99. */
  100. typedef struct
  101. {
  102. uint32_t StdId; /*!< Specifies the standard identifier.
  103. This parameter can be a value between 0 to 0x7FF. */
  104. uint32_t ExtId; /*!< Specifies the extended identifier.
  105. This parameter can be a value between 0 to 0x1FFFFFFF. */
  106. uint8_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted.
  107. This parameter can be a value of @ref CAN_identifier_type */
  108. uint8_t RTR; /*!< Specifies the type of frame for the message that will be transmitted.
  109. This parameter can be a value of @ref CAN_remote_transmission_request */
  110. uint8_t DLC; /*!< Specifies the length of the frame that will be transmitted.
  111. This parameter can be a value between 0 to 8 */
  112. uint8_t Data[8]; /*!< Contains the data to be transmitted. It ranges from 0 to 0xFF. */
  113. } CanTxMsg;
  114. /**
  115. * @brief CAN Rx message structure definition
  116. */
  117. typedef struct
  118. {
  119. uint32_t StdId; /*!< Specifies the standard identifier.
  120. This parameter can be a value between 0 to 0x7FF. */
  121. uint32_t ExtId; /*!< Specifies the extended identifier.
  122. This parameter can be a value between 0 to 0x1FFFFFFF. */
  123. uint8_t IDE; /*!< Specifies the type of identifier for the message that will be received.
  124. This parameter can be a value of @ref CAN_identifier_type */
  125. uint8_t RTR; /*!< Specifies the type of frame for the received message.
  126. This parameter can be a value of @ref CAN_remote_transmission_request */
  127. uint8_t DLC; /*!< Specifies the length of the frame that will be received.
  128. This parameter can be a value between 0 to 8 */
  129. uint8_t Data[8]; /*!< Contains the data to be received. It ranges from 0 to 0xFF. */
  130. uint8_t FMI; /*!< Specifies the index of the filter the message stored in the mailbox passes through.
  131. This parameter can be a value between 0 to 0xFF */
  132. } CanRxMsg;
  133. /**
  134. * @}
  135. */
  136. /** @defgroup CAN_Exported_Constants
  137. * @{
  138. */
  139. /** @defgroup CAN_sleep_constants
  140. * @{
  141. */
  142. #define CANINITFAILED ((uint8_t)0x00) /*!< CAN initialization failed */
  143. #define CANINITOK ((uint8_t)0x01) /*!< CAN initialization failed */
  144. /**
  145. * @}
  146. */
  147. /** @defgroup CAN_operating_mode
  148. * @{
  149. */
  150. #define CAN_Mode_Normal ((uint8_t)0x00) /*!< normal mode */
  151. #define CAN_Mode_LoopBack ((uint8_t)0x01) /*!< loopback mode */
  152. #define CAN_Mode_Silent ((uint8_t)0x02) /*!< silent mode */
  153. #define CAN_Mode_Silent_LoopBack ((uint8_t)0x03) /*!< loopback combined with silent mode */
  154. #define IS_CAN_MODE(MODE) (((MODE) == CAN_Mode_Normal) || ((MODE) == CAN_Mode_LoopBack)|| \
  155. ((MODE) == CAN_Mode_Silent) || ((MODE) == CAN_Mode_Silent_LoopBack))
  156. /**
  157. * @}
  158. */
  159. /** @defgroup CAN_synchronisation_jump_width
  160. * @{
  161. */
  162. #define CAN_SJW_1tq ((uint8_t)0x00) /*!< 1 time quantum */
  163. #define CAN_SJW_2tq ((uint8_t)0x01) /*!< 2 time quantum */
  164. #define CAN_SJW_3tq ((uint8_t)0x02) /*!< 3 time quantum */
  165. #define CAN_SJW_4tq ((uint8_t)0x03) /*!< 4 time quantum */
  166. #define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1tq) || ((SJW) == CAN_SJW_2tq)|| \
  167. ((SJW) == CAN_SJW_3tq) || ((SJW) == CAN_SJW_4tq))
  168. /**
  169. * @}
  170. */
  171. /** @defgroup CAN_time_quantum_in_bit_segment_1
  172. * @{
  173. */
  174. #define CAN_BS1_1tq ((uint8_t)0x00) /*!< 1 time quantum */
  175. #define CAN_BS1_2tq ((uint8_t)0x01) /*!< 2 time quantum */
  176. #define CAN_BS1_3tq ((uint8_t)0x02) /*!< 3 time quantum */
  177. #define CAN_BS1_4tq ((uint8_t)0x03) /*!< 4 time quantum */
  178. #define CAN_BS1_5tq ((uint8_t)0x04) /*!< 5 time quantum */
  179. #define CAN_BS1_6tq ((uint8_t)0x05) /*!< 6 time quantum */
  180. #define CAN_BS1_7tq ((uint8_t)0x06) /*!< 7 time quantum */
  181. #define CAN_BS1_8tq ((uint8_t)0x07) /*!< 8 time quantum */
  182. #define CAN_BS1_9tq ((uint8_t)0x08) /*!< 9 time quantum */
  183. #define CAN_BS1_10tq ((uint8_t)0x09) /*!< 10 time quantum */
  184. #define CAN_BS1_11tq ((uint8_t)0x0A) /*!< 11 time quantum */
  185. #define CAN_BS1_12tq ((uint8_t)0x0B) /*!< 12 time quantum */
  186. #define CAN_BS1_13tq ((uint8_t)0x0C) /*!< 13 time quantum */
  187. #define CAN_BS1_14tq ((uint8_t)0x0D) /*!< 14 time quantum */
  188. #define CAN_BS1_15tq ((uint8_t)0x0E) /*!< 15 time quantum */
  189. #define CAN_BS1_16tq ((uint8_t)0x0F) /*!< 16 time quantum */
  190. #define IS_CAN_BS1(BS1) ((BS1) <= CAN_BS1_16tq)
  191. /**
  192. * @}
  193. */
  194. /** @defgroup CAN_time_quantum_in_bit_segment_2
  195. * @{
  196. */
  197. #define CAN_BS2_1tq ((uint8_t)0x00) /*!< 1 time quantum */
  198. #define CAN_BS2_2tq ((uint8_t)0x01) /*!< 2 time quantum */
  199. #define CAN_BS2_3tq ((uint8_t)0x02) /*!< 3 time quantum */
  200. #define CAN_BS2_4tq ((uint8_t)0x03) /*!< 4 time quantum */
  201. #define CAN_BS2_5tq ((uint8_t)0x04) /*!< 5 time quantum */
  202. #define CAN_BS2_6tq ((uint8_t)0x05) /*!< 6 time quantum */
  203. #define CAN_BS2_7tq ((uint8_t)0x06) /*!< 7 time quantum */
  204. #define CAN_BS2_8tq ((uint8_t)0x07) /*!< 8 time quantum */
  205. #define IS_CAN_BS2(BS2) ((BS2) <= CAN_BS2_8tq)
  206. /**
  207. * @}
  208. */
  209. /** @defgroup CAN_clock_prescaler
  210. * @{
  211. */
  212. #define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1) && ((PRESCALER) <= 1024))
  213. /**
  214. * @}
  215. */
  216. /** @defgroup CAN_filter_number
  217. * @{
  218. */
  219. #ifndef STM32F10X_CL
  220. #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 13)
  221. #else
  222. #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 27)
  223. #endif /* STM32F10X_CL */
  224. /**
  225. * @}
  226. */
  227. /** @defgroup CAN_filter_mode
  228. * @{
  229. */
  230. #define CAN_FilterMode_IdMask ((uint8_t)0x00) /*!< id/mask mode */
  231. #define CAN_FilterMode_IdList ((uint8_t)0x01) /*!< identifier list mode */
  232. #define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FilterMode_IdMask) || \
  233. ((MODE) == CAN_FilterMode_IdList))
  234. /**
  235. * @}
  236. */
  237. /** @defgroup CAN_filter_scale
  238. * @{
  239. */
  240. #define CAN_FilterScale_16bit ((uint8_t)0x00) /*!< Two 16-bit filters */
  241. #define CAN_FilterScale_32bit ((uint8_t)0x01) /*!< One 32-bit filter */
  242. #define IS_CAN_FILTER_SCALE(SCALE) (((SCALE) == CAN_FilterScale_16bit) || \
  243. ((SCALE) == CAN_FilterScale_32bit))
  244. /**
  245. * @}
  246. */
  247. /** @defgroup CAN_filter_FIFO
  248. * @{
  249. */
  250. #define CAN_FilterFIFO0 ((uint8_t)0x00) /*!< Filter FIFO 0 assignment for filter x */
  251. #define CAN_FilterFIFO1 ((uint8_t)0x01) /*!< Filter FIFO 1 assignment for filter x */
  252. #define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FilterFIFO0) || \
  253. ((FIFO) == CAN_FilterFIFO1))
  254. /**
  255. * @}
  256. */
  257. /** @defgroup Start_bank_filter_for_slave_CAN
  258. * @{
  259. */
  260. #define IS_CAN_BANKNUMBER(BANKNUMBER) (((BANKNUMBER) >= 1) && ((BANKNUMBER) <= 27))
  261. /**
  262. * @}
  263. */
  264. /** @defgroup CAN_Tx
  265. * @{
  266. */
  267. #define IS_CAN_TRANSMITMAILBOX(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= ((uint8_t)0x02))
  268. #define IS_CAN_STDID(STDID) ((STDID) <= ((uint32_t)0x7FF))
  269. #define IS_CAN_EXTID(EXTID) ((EXTID) <= ((uint32_t)0x1FFFFFFF))
  270. #define IS_CAN_DLC(DLC) ((DLC) <= ((uint8_t)0x08))
  271. /**
  272. * @}
  273. */
  274. /** @defgroup CAN_identifier_type
  275. * @{
  276. */
  277. #define CAN_ID_STD ((uint32_t)0x00000000) /*!< Standard Id */
  278. #define CAN_ID_EXT ((uint32_t)0x00000004) /*!< Extended Id */
  279. #define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_ID_STD) || ((IDTYPE) == CAN_ID_EXT))
  280. /**
  281. * @}
  282. */
  283. /** @defgroup CAN_remote_transmission_request
  284. * @{
  285. */
  286. #define CAN_RTR_DATA ((uint32_t)0x00000000) /*!< Data frame */
  287. #define CAN_RTR_REMOTE ((uint32_t)0x00000002) /*!< Remote frame */
  288. #define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_DATA) || ((RTR) == CAN_RTR_REMOTE))
  289. /**
  290. * @}
  291. */
  292. /** @defgroup CAN_transmit_constants
  293. * @{
  294. */
  295. #define CANTXFAILED ((uint8_t)0x00) /*!< CAN transmission failed */
  296. #define CANTXOK ((uint8_t)0x01) /*!< CAN transmission succeeded */
  297. #define CANTXPENDING ((uint8_t)0x02) /*!< CAN transmission pending */
  298. #define CAN_NO_MB ((uint8_t)0x04) /*!< CAN cell did not provide an empty mailbox */
  299. /**
  300. * @}
  301. */
  302. /** @defgroup CAN_receive_FIFO_number_constants
  303. * @{
  304. */
  305. #define CAN_FIFO0 ((uint8_t)0x00) /*!< CAN FIFO0 used to receive */
  306. #define CAN_FIFO1 ((uint8_t)0x01) /*!< CAN FIFO1 used to receive */
  307. #define IS_CAN_FIFO(FIFO) (((FIFO) == CAN_FIFO0) || ((FIFO) == CAN_FIFO1))
  308. /**
  309. * @}
  310. */
  311. /** @defgroup CAN_sleep_constants
  312. * @{
  313. */
  314. #define CANSLEEPFAILED ((uint8_t)0x00) /*!< CAN did not enter the sleep mode */
  315. #define CANSLEEPOK ((uint8_t)0x01) /*!< CAN entered the sleep mode */
  316. /**
  317. * @}
  318. */
  319. /** @defgroup CAN_wake_up_constants
  320. * @{
  321. */
  322. #define CANWAKEUPFAILED ((uint8_t)0x00) /*!< CAN did not leave the sleep mode */
  323. #define CANWAKEUPOK ((uint8_t)0x01) /*!< CAN leaved the sleep mode */
  324. /**
  325. * @}
  326. */
  327. /** @defgroup CAN_flags
  328. * @{
  329. */
  330. #define CAN_FLAG_EWG ((uint32_t)0x00000001) /*!< Error Warning Flag */
  331. #define CAN_FLAG_EPV ((uint32_t)0x00000002) /*!< Error Passive Flag */
  332. #define CAN_FLAG_BOF ((uint32_t)0x00000004) /*!< Bus-Off Flag */
  333. #define IS_CAN_FLAG(FLAG) (((FLAG) == CAN_FLAG_EWG) || ((FLAG) == CAN_FLAG_EPV) ||\
  334. ((FLAG) == CAN_FLAG_BOF))
  335. /**
  336. * @}
  337. */
  338. /** @defgroup CAN_interrupts
  339. * @{
  340. */
  341. #define CAN_IT_RQCP0 ((uint32_t)0x00000005) /*!< Request completed mailbox 0 */
  342. #define CAN_IT_RQCP1 ((uint32_t)0x00000006) /*!< Request completed mailbox 1 */
  343. #define CAN_IT_RQCP2 ((uint32_t)0x00000007) /*!< Request completed mailbox 2 */
  344. #define CAN_IT_TME ((uint32_t)0x00000001) /*!< Transmit mailbox empty */
  345. #define CAN_IT_FMP0 ((uint32_t)0x00000002) /*!< FIFO 0 message pending */
  346. #define CAN_IT_FF0 ((uint32_t)0x00000004) /*!< FIFO 0 full */
  347. #define CAN_IT_FOV0 ((uint32_t)0x00000008) /*!< FIFO 0 overrun */
  348. #define CAN_IT_FMP1 ((uint32_t)0x00000010) /*!< FIFO 1 message pending */
  349. #define CAN_IT_FF1 ((uint32_t)0x00000020) /*!< FIFO 1 full */
  350. #define CAN_IT_FOV1 ((uint32_t)0x00000040) /*!< FIFO 1 overrun */
  351. #define CAN_IT_EWG ((uint32_t)0x00000100) /*!< Error warning */
  352. #define CAN_IT_EPV ((uint32_t)0x00000200) /*!< Error passive */
  353. #define CAN_IT_BOF ((uint32_t)0x00000400) /*!< Bus-off */
  354. #define CAN_IT_LEC ((uint32_t)0x00000800) /*!< Last error code */
  355. #define CAN_IT_ERR ((uint32_t)0x00008000) /*!< Error */
  356. #define CAN_IT_WKU ((uint32_t)0x00010000) /*!< Wake-up */
  357. #define CAN_IT_SLK ((uint32_t)0x00020000) /*!< Sleep */
  358. #define IS_CAN_ITConfig(IT) (((IT) == CAN_IT_TME) || ((IT) == CAN_IT_FMP0) ||\
  359. ((IT) == CAN_IT_FF0) || ((IT) == CAN_IT_FOV0) ||\
  360. ((IT) == CAN_IT_FMP1) || ((IT) == CAN_IT_FF1) ||\
  361. ((IT) == CAN_IT_FOV1) || ((IT) == CAN_IT_EWG) ||\
  362. ((IT) == CAN_IT_EPV) || ((IT) == CAN_IT_BOF) ||\
  363. ((IT) == CAN_IT_LEC) || ((IT) == CAN_IT_ERR) ||\
  364. ((IT) == CAN_IT_WKU) || ((IT) == CAN_IT_SLK))
  365. #define IS_CAN_ITStatus(IT) (((IT) == CAN_IT_RQCP0) || ((IT) == CAN_IT_RQCP1) ||\
  366. ((IT) == CAN_IT_RQCP2) || ((IT) == CAN_IT_FF0) ||\
  367. ((IT) == CAN_IT_FOV0) || ((IT) == CAN_IT_FF1) ||\
  368. ((IT) == CAN_IT_FOV1) || ((IT) == CAN_IT_EWG) ||\
  369. ((IT) == CAN_IT_EPV) || ((IT) == CAN_IT_BOF) ||\
  370. ((IT) == CAN_IT_WKU) || ((IT) == CAN_IT_SLK))
  371. /**
  372. * @}
  373. */
  374. /**
  375. * @}
  376. */
  377. /** @defgroup CAN_Exported_Macros
  378. * @{
  379. */
  380. /**
  381. * @}
  382. */
  383. /** @defgroup CAN_Exported_Functions
  384. * @{
  385. */
  386. void CAN_DeInit(CAN_TypeDef* CANx);
  387. uint8_t CAN_Init(CAN_TypeDef* CANx, CAN_InitTypeDef* CAN_InitStruct);
  388. void CAN_FilterInit(CAN_FilterInitTypeDef* CAN_FilterInitStruct);
  389. void CAN_StructInit(CAN_InitTypeDef* CAN_InitStruct);
  390. void CAN_SlaveStartBank(uint8_t CAN_BankNumber);
  391. void CAN_ITConfig(CAN_TypeDef* CANx, uint32_t CAN_IT, FunctionalState NewState);
  392. uint8_t CAN_Transmit(CAN_TypeDef* CANx, CanTxMsg* TxMessage);
  393. uint8_t CAN_TransmitStatus(CAN_TypeDef* CANx, uint8_t TransmitMailbox);
  394. void CAN_CancelTransmit(CAN_TypeDef* CANx, uint8_t Mailbox);
  395. void CAN_FIFORelease(CAN_TypeDef* CANx, uint8_t FIFONumber);
  396. uint8_t CAN_MessagePending(CAN_TypeDef* CANx, uint8_t FIFONumber);
  397. void CAN_Receive(CAN_TypeDef* CANx, uint8_t FIFONumber, CanRxMsg* RxMessage);
  398. void CAN_DBGFreeze(CAN_TypeDef* CANx, FunctionalState NewState);
  399. uint8_t CAN_Sleep(CAN_TypeDef* CANx);
  400. uint8_t CAN_WakeUp(CAN_TypeDef* CANx);
  401. FlagStatus CAN_GetFlagStatus(CAN_TypeDef* CANx, uint32_t CAN_FLAG);
  402. void CAN_ClearFlag(CAN_TypeDef* CANx, uint32_t CAN_FLAG);
  403. ITStatus CAN_GetITStatus(CAN_TypeDef* CANx, uint32_t CAN_IT);
  404. void CAN_ClearITPendingBit(CAN_TypeDef* CANx, uint32_t CAN_IT);
  405. #ifdef __cplusplus
  406. }
  407. #endif
  408. #endif /* __STM32F10x_CAN_H */
  409. /**
  410. * @}
  411. */
  412. /**
  413. * @}
  414. */
  415. /**
  416. * @}
  417. */
  418. /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/