Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
TARGET_NUCLEO_F446RE/stm32f4xx_hal_can.h@114:252557024ec3, 2016-02-16 (annotated)
- Committer:
- Kojto
- Date:
- Tue Feb 16 14:28:01 2016 +0000
- Revision:
- 114:252557024ec3
- Parent:
- 110:165afa46840b
- Child:
- 122:f9eeca106725
Release 114 of the mbed library
Changes:
- Atmel SAM - warnings fixes
- B96B F446VE - hw control flow addition
- Remove of GCC CW which was not active
- Remove GCC CS, not released anymore - deprecated
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| Kojto | 106:ba1f97679dad | 1 | /** | 
| Kojto | 106:ba1f97679dad | 2 | ****************************************************************************** | 
| Kojto | 106:ba1f97679dad | 3 | * @file stm32f4xx_hal_can.h | 
| Kojto | 106:ba1f97679dad | 4 | * @author MCD Application Team | 
| Kojto | 110:165afa46840b | 5 | * @version V1.4.1 | 
| Kojto | 110:165afa46840b | 6 | * @date 09-October-2015 | 
| Kojto | 106:ba1f97679dad | 7 | * @brief Header file of CAN HAL module. | 
| Kojto | 106:ba1f97679dad | 8 | ****************************************************************************** | 
| Kojto | 106:ba1f97679dad | 9 | * @attention | 
| Kojto | 106:ba1f97679dad | 10 | * | 
| Kojto | 106:ba1f97679dad | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> | 
| Kojto | 106:ba1f97679dad | 12 | * | 
| Kojto | 106:ba1f97679dad | 13 | * Redistribution and use in source and binary forms, with or without modification, | 
| Kojto | 106:ba1f97679dad | 14 | * are permitted provided that the following conditions are met: | 
| Kojto | 106:ba1f97679dad | 15 | * 1. Redistributions of source code must retain the above copyright notice, | 
| Kojto | 106:ba1f97679dad | 16 | * this list of conditions and the following disclaimer. | 
| Kojto | 106:ba1f97679dad | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, | 
| Kojto | 106:ba1f97679dad | 18 | * this list of conditions and the following disclaimer in the documentation | 
| Kojto | 106:ba1f97679dad | 19 | * and/or other materials provided with the distribution. | 
| Kojto | 106:ba1f97679dad | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors | 
| Kojto | 106:ba1f97679dad | 21 | * may be used to endorse or promote products derived from this software | 
| Kojto | 106:ba1f97679dad | 22 | * without specific prior written permission. | 
| Kojto | 106:ba1f97679dad | 23 | * | 
| Kojto | 106:ba1f97679dad | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 
| Kojto | 106:ba1f97679dad | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 
| Kojto | 106:ba1f97679dad | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 
| Kojto | 106:ba1f97679dad | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | 
| Kojto | 106:ba1f97679dad | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 
| Kojto | 106:ba1f97679dad | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 
| Kojto | 106:ba1f97679dad | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 
| Kojto | 106:ba1f97679dad | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 
| Kojto | 106:ba1f97679dad | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
| Kojto | 106:ba1f97679dad | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
| Kojto | 106:ba1f97679dad | 34 | * | 
| Kojto | 106:ba1f97679dad | 35 | ****************************************************************************** | 
| Kojto | 106:ba1f97679dad | 36 | */ | 
| Kojto | 106:ba1f97679dad | 37 | |
| Kojto | 106:ba1f97679dad | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ | 
| Kojto | 106:ba1f97679dad | 39 | #ifndef __STM32F4xx_HAL_CAN_H | 
| Kojto | 106:ba1f97679dad | 40 | #define __STM32F4xx_HAL_CAN_H | 
| Kojto | 106:ba1f97679dad | 41 | |
| Kojto | 106:ba1f97679dad | 42 | #ifdef __cplusplus | 
| Kojto | 106:ba1f97679dad | 43 | extern "C" { | 
| Kojto | 106:ba1f97679dad | 44 | #endif | 
| Kojto | 106:ba1f97679dad | 45 | |
| Kojto | 106:ba1f97679dad | 46 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ | 
| Kojto | 106:ba1f97679dad | 47 | defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ | 
| Kojto | 110:165afa46840b | 48 | defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) | 
| Kojto | 106:ba1f97679dad | 49 | /* Includes ------------------------------------------------------------------*/ | 
| Kojto | 106:ba1f97679dad | 50 | #include "stm32f4xx_hal_def.h" | 
| Kojto | 106:ba1f97679dad | 51 | |
| Kojto | 106:ba1f97679dad | 52 | /** @addtogroup STM32F4xx_HAL_Driver | 
| Kojto | 106:ba1f97679dad | 53 | * @{ | 
| Kojto | 106:ba1f97679dad | 54 | */ | 
| Kojto | 106:ba1f97679dad | 55 | |
| Kojto | 106:ba1f97679dad | 56 | /** @addtogroup CAN | 
| Kojto | 106:ba1f97679dad | 57 | * @{ | 
| Kojto | 106:ba1f97679dad | 58 | */ | 
| Kojto | 106:ba1f97679dad | 59 | |
| Kojto | 106:ba1f97679dad | 60 | /* Exported types ------------------------------------------------------------*/ | 
| Kojto | 106:ba1f97679dad | 61 | /** @defgroup CAN_Exported_Types CAN Exported Types | 
| Kojto | 106:ba1f97679dad | 62 | * @{ | 
| Kojto | 106:ba1f97679dad | 63 | */ | 
| Kojto | 106:ba1f97679dad | 64 | |
| Kojto | 106:ba1f97679dad | 65 | /** | 
| Kojto | 106:ba1f97679dad | 66 | * @brief HAL State structures definition | 
| Kojto | 106:ba1f97679dad | 67 | */ | 
| Kojto | 106:ba1f97679dad | 68 | typedef enum | 
| Kojto | 106:ba1f97679dad | 69 | { | 
| Kojto | 106:ba1f97679dad | 70 | HAL_CAN_STATE_RESET = 0x00, /*!< CAN not yet initialized or disabled */ | 
| Kojto | 106:ba1f97679dad | 71 | HAL_CAN_STATE_READY = 0x01, /*!< CAN initialized and ready for use */ | 
| Kojto | 106:ba1f97679dad | 72 | HAL_CAN_STATE_BUSY = 0x02, /*!< CAN process is ongoing */ | 
| Kojto | 106:ba1f97679dad | 73 | HAL_CAN_STATE_BUSY_TX = 0x12, /*!< CAN process is ongoing */ | 
| Kojto | 106:ba1f97679dad | 74 | HAL_CAN_STATE_BUSY_RX = 0x22, /*!< CAN process is ongoing */ | 
| Kojto | 106:ba1f97679dad | 75 | HAL_CAN_STATE_BUSY_TX_RX = 0x32, /*!< CAN process is ongoing */ | 
| Kojto | 106:ba1f97679dad | 76 | HAL_CAN_STATE_TIMEOUT = 0x03, /*!< Timeout state */ | 
| Kojto | 106:ba1f97679dad | 77 | HAL_CAN_STATE_ERROR = 0x04 /*!< CAN error state */ | 
| Kojto | 106:ba1f97679dad | 78 | |
| Kojto | 106:ba1f97679dad | 79 | }HAL_CAN_StateTypeDef; | 
| Kojto | 106:ba1f97679dad | 80 | |
| Kojto | 106:ba1f97679dad | 81 | /** | 
| Kojto | 106:ba1f97679dad | 82 | * @brief CAN init structure definition | 
| Kojto | 106:ba1f97679dad | 83 | */ | 
| Kojto | 106:ba1f97679dad | 84 | typedef struct | 
| Kojto | 106:ba1f97679dad | 85 | { | 
| Kojto | 106:ba1f97679dad | 86 | uint32_t Prescaler; /*!< Specifies the length of a time quantum. | 
| Kojto | 106:ba1f97679dad | 87 | This parameter must be a number between Min_Data = 1 and Max_Data = 1024 */ | 
| Kojto | 106:ba1f97679dad | 88 | |
| Kojto | 106:ba1f97679dad | 89 | uint32_t Mode; /*!< Specifies the CAN operating mode. | 
| Kojto | 106:ba1f97679dad | 90 | This parameter can be a value of @ref CAN_operating_mode */ | 
| Kojto | 106:ba1f97679dad | 91 | |
| Kojto | 106:ba1f97679dad | 92 | uint32_t SJW; /*!< Specifies the maximum number of time quanta | 
| Kojto | 106:ba1f97679dad | 93 | the CAN hardware is allowed to lengthen or | 
| Kojto | 106:ba1f97679dad | 94 | shorten a bit to perform resynchronization. | 
| Kojto | 106:ba1f97679dad | 95 | This parameter can be a value of @ref CAN_synchronisation_jump_width */ | 
| Kojto | 106:ba1f97679dad | 96 | |
| Kojto | 106:ba1f97679dad | 97 | uint32_t BS1; /*!< Specifies the number of time quanta in Bit Segment 1. | 
| Kojto | 106:ba1f97679dad | 98 | This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_1 */ | 
| Kojto | 106:ba1f97679dad | 99 | |
| Kojto | 106:ba1f97679dad | 100 | uint32_t BS2; /*!< Specifies the number of time quanta in Bit Segment 2. | 
| Kojto | 106:ba1f97679dad | 101 | This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_2 */ | 
| Kojto | 106:ba1f97679dad | 102 | |
| Kojto | 106:ba1f97679dad | 103 | uint32_t TTCM; /*!< Enable or disable the time triggered communication mode. | 
| Kojto | 106:ba1f97679dad | 104 | This parameter can be set to ENABLE or DISABLE. */ | 
| Kojto | 106:ba1f97679dad | 105 | |
| Kojto | 106:ba1f97679dad | 106 | uint32_t ABOM; /*!< Enable or disable the automatic bus-off management. | 
| Kojto | 106:ba1f97679dad | 107 | This parameter can be set to ENABLE or DISABLE */ | 
| Kojto | 106:ba1f97679dad | 108 | |
| Kojto | 106:ba1f97679dad | 109 | uint32_t AWUM; /*!< Enable or disable the automatic wake-up mode. | 
| Kojto | 106:ba1f97679dad | 110 | This parameter can be set to ENABLE or DISABLE */ | 
| Kojto | 106:ba1f97679dad | 111 | |
| Kojto | 106:ba1f97679dad | 112 | uint32_t NART; /*!< Enable or disable the non-automatic retransmission mode. | 
| Kojto | 106:ba1f97679dad | 113 | This parameter can be set to ENABLE or DISABLE */ | 
| Kojto | 106:ba1f97679dad | 114 | |
| Kojto | 106:ba1f97679dad | 115 | uint32_t RFLM; /*!< Enable or disable the receive FIFO Locked mode. | 
| Kojto | 106:ba1f97679dad | 116 | This parameter can be set to ENABLE or DISABLE */ | 
| Kojto | 106:ba1f97679dad | 117 | |
| Kojto | 106:ba1f97679dad | 118 | uint32_t TXFP; /*!< Enable or disable the transmit FIFO priority. | 
| Kojto | 106:ba1f97679dad | 119 | This parameter can be set to ENABLE or DISABLE */ | 
| Kojto | 106:ba1f97679dad | 120 | }CAN_InitTypeDef; | 
| Kojto | 106:ba1f97679dad | 121 | |
| Kojto | 106:ba1f97679dad | 122 | /** | 
| Kojto | 106:ba1f97679dad | 123 | * @brief CAN filter configuration structure definition | 
| Kojto | 106:ba1f97679dad | 124 | */ | 
| Kojto | 106:ba1f97679dad | 125 | typedef struct | 
| Kojto | 106:ba1f97679dad | 126 | { | 
| Kojto | 106:ba1f97679dad | 127 | uint32_t FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bit | 
| Kojto | 106:ba1f97679dad | 128 | configuration, first one for a 16-bit configuration). | 
| Kojto | 106:ba1f97679dad | 129 | This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ | 
| Kojto | 106:ba1f97679dad | 130 | |
| Kojto | 106:ba1f97679dad | 131 | uint32_t FilterIdLow; /*!< Specifies the filter identification number (LSBs for a 32-bit | 
| Kojto | 106:ba1f97679dad | 132 | configuration, second one for a 16-bit configuration). | 
| Kojto | 106:ba1f97679dad | 133 | This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ | 
| Kojto | 106:ba1f97679dad | 134 | |
| Kojto | 106:ba1f97679dad | 135 | uint32_t FilterMaskIdHigh; /*!< Specifies the filter mask number or identification number, | 
| Kojto | 106:ba1f97679dad | 136 | according to the mode (MSBs for a 32-bit configuration, | 
| Kojto | 106:ba1f97679dad | 137 | first one for a 16-bit configuration). | 
| Kojto | 106:ba1f97679dad | 138 | This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ | 
| Kojto | 106:ba1f97679dad | 139 | |
| Kojto | 106:ba1f97679dad | 140 | uint32_t FilterMaskIdLow; /*!< Specifies the filter mask number or identification number, | 
| Kojto | 106:ba1f97679dad | 141 | according to the mode (LSBs for a 32-bit configuration, | 
| Kojto | 106:ba1f97679dad | 142 | second one for a 16-bit configuration). | 
| Kojto | 106:ba1f97679dad | 143 | This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ | 
| Kojto | 106:ba1f97679dad | 144 | |
| Kojto | 106:ba1f97679dad | 145 | uint32_t FilterFIFOAssignment; /*!< Specifies the FIFO (0 or 1) which will be assigned to the filter. | 
| Kojto | 106:ba1f97679dad | 146 | This parameter can be a value of @ref CAN_filter_FIFO */ | 
| Kojto | 106:ba1f97679dad | 147 | |
| Kojto | 106:ba1f97679dad | 148 | uint32_t FilterNumber; /*!< Specifies the filter which will be initialized. | 
| Kojto | 106:ba1f97679dad | 149 | This parameter must be a number between Min_Data = 0 and Max_Data = 27 */ | 
| Kojto | 106:ba1f97679dad | 150 | |
| Kojto | 106:ba1f97679dad | 151 | uint32_t FilterMode; /*!< Specifies the filter mode to be initialized. | 
| Kojto | 106:ba1f97679dad | 152 | This parameter can be a value of @ref CAN_filter_mode */ | 
| Kojto | 106:ba1f97679dad | 153 | |
| Kojto | 106:ba1f97679dad | 154 | uint32_t FilterScale; /*!< Specifies the filter scale. | 
| Kojto | 106:ba1f97679dad | 155 | This parameter can be a value of @ref CAN_filter_scale */ | 
| Kojto | 106:ba1f97679dad | 156 | |
| Kojto | 106:ba1f97679dad | 157 | uint32_t FilterActivation; /*!< Enable or disable the filter. | 
| Kojto | 106:ba1f97679dad | 158 | This parameter can be set to ENABLE or DISABLE. */ | 
| Kojto | 106:ba1f97679dad | 159 | |
| Kojto | 106:ba1f97679dad | 160 | uint32_t BankNumber; /*!< Select the start slave bank filter. | 
| Kojto | 106:ba1f97679dad | 161 | This parameter must be a number between Min_Data = 0 and Max_Data = 28 */ | 
| Kojto | 106:ba1f97679dad | 162 | |
| Kojto | 106:ba1f97679dad | 163 | }CAN_FilterConfTypeDef; | 
| Kojto | 106:ba1f97679dad | 164 | |
| Kojto | 106:ba1f97679dad | 165 | /** | 
| Kojto | 106:ba1f97679dad | 166 | * @brief CAN Tx message structure definition | 
| Kojto | 106:ba1f97679dad | 167 | */ | 
| Kojto | 106:ba1f97679dad | 168 | typedef struct | 
| Kojto | 106:ba1f97679dad | 169 | { | 
| Kojto | 106:ba1f97679dad | 170 | uint32_t StdId; /*!< Specifies the standard identifier. | 
| Kojto | 106:ba1f97679dad | 171 | This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF */ | 
| Kojto | 106:ba1f97679dad | 172 | |
| Kojto | 106:ba1f97679dad | 173 | uint32_t ExtId; /*!< Specifies the extended identifier. | 
| Kojto | 106:ba1f97679dad | 174 | This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF */ | 
| Kojto | 106:ba1f97679dad | 175 | |
| Kojto | 106:ba1f97679dad | 176 | uint32_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted. | 
| Kojto | 106:ba1f97679dad | 177 | This parameter can be a value of @ref CAN_Identifier_Type */ | 
| Kojto | 106:ba1f97679dad | 178 | |
| Kojto | 106:ba1f97679dad | 179 | uint32_t RTR; /*!< Specifies the type of frame for the message that will be transmitted. | 
| Kojto | 106:ba1f97679dad | 180 | This parameter can be a value of @ref CAN_remote_transmission_request */ | 
| Kojto | 106:ba1f97679dad | 181 | |
| Kojto | 106:ba1f97679dad | 182 | uint32_t DLC; /*!< Specifies the length of the frame that will be transmitted. | 
| Kojto | 106:ba1f97679dad | 183 | This parameter must be a number between Min_Data = 0 and Max_Data = 8 */ | 
| Kojto | 106:ba1f97679dad | 184 | |
| Kojto | 106:ba1f97679dad | 185 | uint8_t Data[8]; /*!< Contains the data to be transmitted. | 
| Kojto | 106:ba1f97679dad | 186 | This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF */ | 
| Kojto | 106:ba1f97679dad | 187 | |
| Kojto | 106:ba1f97679dad | 188 | }CanTxMsgTypeDef; | 
| Kojto | 106:ba1f97679dad | 189 | |
| Kojto | 106:ba1f97679dad | 190 | /** | 
| Kojto | 106:ba1f97679dad | 191 | * @brief CAN Rx message structure definition | 
| Kojto | 106:ba1f97679dad | 192 | */ | 
| Kojto | 106:ba1f97679dad | 193 | typedef struct | 
| Kojto | 106:ba1f97679dad | 194 | { | 
| Kojto | 106:ba1f97679dad | 195 | uint32_t StdId; /*!< Specifies the standard identifier. | 
| Kojto | 106:ba1f97679dad | 196 | This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF */ | 
| Kojto | 106:ba1f97679dad | 197 | |
| Kojto | 106:ba1f97679dad | 198 | uint32_t ExtId; /*!< Specifies the extended identifier. | 
| Kojto | 106:ba1f97679dad | 199 | This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF */ | 
| Kojto | 106:ba1f97679dad | 200 | |
| Kojto | 106:ba1f97679dad | 201 | uint32_t IDE; /*!< Specifies the type of identifier for the message that will be received. | 
| Kojto | 106:ba1f97679dad | 202 | This parameter can be a value of @ref CAN_Identifier_Type */ | 
| Kojto | 106:ba1f97679dad | 203 | |
| Kojto | 106:ba1f97679dad | 204 | uint32_t RTR; /*!< Specifies the type of frame for the received message. | 
| Kojto | 106:ba1f97679dad | 205 | This parameter can be a value of @ref CAN_remote_transmission_request */ | 
| Kojto | 106:ba1f97679dad | 206 | |
| Kojto | 106:ba1f97679dad | 207 | uint32_t DLC; /*!< Specifies the length of the frame that will be received. | 
| Kojto | 106:ba1f97679dad | 208 | This parameter must be a number between Min_Data = 0 and Max_Data = 8 */ | 
| Kojto | 106:ba1f97679dad | 209 | |
| Kojto | 106:ba1f97679dad | 210 | uint8_t Data[8]; /*!< Contains the data to be received. | 
| Kojto | 106:ba1f97679dad | 211 | This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF */ | 
| Kojto | 106:ba1f97679dad | 212 | |
| Kojto | 106:ba1f97679dad | 213 | uint32_t FMI; /*!< Specifies the index of the filter the message stored in the mailbox passes through. | 
| Kojto | 106:ba1f97679dad | 214 | This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF */ | 
| Kojto | 106:ba1f97679dad | 215 | |
| Kojto | 106:ba1f97679dad | 216 | uint32_t FIFONumber; /*!< Specifies the receive FIFO number. | 
| Kojto | 106:ba1f97679dad | 217 | This parameter can be CAN_FIFO0 or CAN_FIFO1 */ | 
| Kojto | 106:ba1f97679dad | 218 | |
| Kojto | 106:ba1f97679dad | 219 | }CanRxMsgTypeDef; | 
| Kojto | 106:ba1f97679dad | 220 | |
| Kojto | 106:ba1f97679dad | 221 | /** | 
| Kojto | 106:ba1f97679dad | 222 | * @brief CAN handle Structure definition | 
| Kojto | 106:ba1f97679dad | 223 | */ | 
| Kojto | 106:ba1f97679dad | 224 | typedef struct | 
| Kojto | 106:ba1f97679dad | 225 | { | 
| Kojto | 106:ba1f97679dad | 226 | CAN_TypeDef *Instance; /*!< Register base address */ | 
| Kojto | 106:ba1f97679dad | 227 | |
| Kojto | 106:ba1f97679dad | 228 | CAN_InitTypeDef Init; /*!< CAN required parameters */ | 
| Kojto | 106:ba1f97679dad | 229 | |
| Kojto | 106:ba1f97679dad | 230 | CanTxMsgTypeDef* pTxMsg; /*!< Pointer to transmit structure */ | 
| Kojto | 106:ba1f97679dad | 231 | |
| Kojto | 106:ba1f97679dad | 232 | CanRxMsgTypeDef* pRxMsg; /*!< Pointer to reception structure */ | 
| Kojto | 106:ba1f97679dad | 233 | |
| Kojto | 106:ba1f97679dad | 234 | __IO HAL_CAN_StateTypeDef State; /*!< CAN communication state */ | 
| Kojto | 106:ba1f97679dad | 235 | |
| Kojto | 106:ba1f97679dad | 236 | HAL_LockTypeDef Lock; /*!< CAN locking object */ | 
| Kojto | 106:ba1f97679dad | 237 | |
| Kojto | 106:ba1f97679dad | 238 | __IO uint32_t ErrorCode; /*!< CAN Error code */ | 
| Kojto | 106:ba1f97679dad | 239 | |
| Kojto | 106:ba1f97679dad | 240 | }CAN_HandleTypeDef; | 
| Kojto | 106:ba1f97679dad | 241 | |
| Kojto | 106:ba1f97679dad | 242 | /** | 
| Kojto | 106:ba1f97679dad | 243 | * @} | 
| Kojto | 106:ba1f97679dad | 244 | */ | 
| Kojto | 106:ba1f97679dad | 245 | |
| Kojto | 106:ba1f97679dad | 246 | /* Exported constants --------------------------------------------------------*/ | 
| Kojto | 106:ba1f97679dad | 247 | /** @defgroup CAN_Exported_Constants CAN Exported Constants | 
| Kojto | 106:ba1f97679dad | 248 | * @{ | 
| Kojto | 106:ba1f97679dad | 249 | */ | 
| Kojto | 106:ba1f97679dad | 250 | |
| Kojto | 106:ba1f97679dad | 251 | /** @defgroup HAL_CAN_Error_Code HAL CAN Error Code | 
| Kojto | 106:ba1f97679dad | 252 | * @{ | 
| Kojto | 106:ba1f97679dad | 253 | */ | 
| Kojto | 106:ba1f97679dad | 254 | #define HAL_CAN_ERROR_NONE 0x00 /*!< No error */ | 
| Kojto | 106:ba1f97679dad | 255 | #define HAL_CAN_ERROR_EWG 0x01 /*!< EWG error */ | 
| Kojto | 106:ba1f97679dad | 256 | #define HAL_CAN_ERROR_EPV 0x02 /*!< EPV error */ | 
| Kojto | 106:ba1f97679dad | 257 | #define HAL_CAN_ERROR_BOF 0x04 /*!< BOF error */ | 
| Kojto | 106:ba1f97679dad | 258 | #define HAL_CAN_ERROR_STF 0x08 /*!< Stuff error */ | 
| Kojto | 106:ba1f97679dad | 259 | #define HAL_CAN_ERROR_FOR 0x10 /*!< Form error */ | 
| Kojto | 106:ba1f97679dad | 260 | #define HAL_CAN_ERROR_ACK 0x20 /*!< Acknowledgment error */ | 
| Kojto | 106:ba1f97679dad | 261 | #define HAL_CAN_ERROR_BR 0x40 /*!< Bit recessive */ | 
| Kojto | 106:ba1f97679dad | 262 | #define HAL_CAN_ERROR_BD 0x80 /*!< LEC dominant */ | 
| Kojto | 106:ba1f97679dad | 263 | #define HAL_CAN_ERROR_CRC 0x100 /*!< LEC transfer error */ | 
| Kojto | 106:ba1f97679dad | 264 | /** | 
| Kojto | 106:ba1f97679dad | 265 | * @} | 
| Kojto | 106:ba1f97679dad | 266 | */ | 
| Kojto | 106:ba1f97679dad | 267 | |
| Kojto | 106:ba1f97679dad | 268 | /** @defgroup CAN_InitStatus CAN InitStatus | 
| Kojto | 106:ba1f97679dad | 269 | * @{ | 
| Kojto | 106:ba1f97679dad | 270 | */ | 
| Kojto | 106:ba1f97679dad | 271 | #define CAN_INITSTATUS_FAILED ((uint8_t)0x00) /*!< CAN initialization failed */ | 
| Kojto | 106:ba1f97679dad | 272 | #define CAN_INITSTATUS_SUCCESS ((uint8_t)0x01) /*!< CAN initialization OK */ | 
| Kojto | 106:ba1f97679dad | 273 | /** | 
| Kojto | 106:ba1f97679dad | 274 | * @} | 
| Kojto | 106:ba1f97679dad | 275 | */ | 
| Kojto | 106:ba1f97679dad | 276 | |
| Kojto | 106:ba1f97679dad | 277 | /** @defgroup CAN_operating_mode CAN Operating Mode | 
| Kojto | 106:ba1f97679dad | 278 | * @{ | 
| Kojto | 106:ba1f97679dad | 279 | */ | 
| Kojto | 106:ba1f97679dad | 280 | #define CAN_MODE_NORMAL ((uint32_t)0x00000000) /*!< Normal mode */ | 
| Kojto | 106:ba1f97679dad | 281 | #define CAN_MODE_LOOPBACK ((uint32_t)CAN_BTR_LBKM) /*!< Loopback mode */ | 
| Kojto | 106:ba1f97679dad | 282 | #define CAN_MODE_SILENT ((uint32_t)CAN_BTR_SILM) /*!< Silent mode */ | 
| Kojto | 106:ba1f97679dad | 283 | #define CAN_MODE_SILENT_LOOPBACK ((uint32_t)(CAN_BTR_LBKM | CAN_BTR_SILM)) /*!< Loopback combined with silent mode */ | 
| Kojto | 106:ba1f97679dad | 284 | /** | 
| Kojto | 106:ba1f97679dad | 285 | * @} | 
| Kojto | 106:ba1f97679dad | 286 | */ | 
| Kojto | 106:ba1f97679dad | 287 | |
| Kojto | 106:ba1f97679dad | 288 | /** @defgroup CAN_synchronisation_jump_width CAN Synchronisation Jump Width | 
| Kojto | 106:ba1f97679dad | 289 | * @{ | 
| Kojto | 106:ba1f97679dad | 290 | */ | 
| Kojto | 106:ba1f97679dad | 291 | #define CAN_SJW_1TQ ((uint32_t)0x00000000) /*!< 1 time quantum */ | 
| Kojto | 106:ba1f97679dad | 292 | #define CAN_SJW_2TQ ((uint32_t)CAN_BTR_SJW_0) /*!< 2 time quantum */ | 
| Kojto | 106:ba1f97679dad | 293 | #define CAN_SJW_3TQ ((uint32_t)CAN_BTR_SJW_1) /*!< 3 time quantum */ | 
| Kojto | 106:ba1f97679dad | 294 | #define CAN_SJW_4TQ ((uint32_t)CAN_BTR_SJW) /*!< 4 time quantum */ | 
| Kojto | 106:ba1f97679dad | 295 | /** | 
| Kojto | 106:ba1f97679dad | 296 | * @} | 
| Kojto | 106:ba1f97679dad | 297 | */ | 
| Kojto | 106:ba1f97679dad | 298 | |
| Kojto | 106:ba1f97679dad | 299 | /** @defgroup CAN_time_quantum_in_bit_segment_1 CAN Time Quantum in bit segment 1 | 
| Kojto | 106:ba1f97679dad | 300 | * @{ | 
| Kojto | 106:ba1f97679dad | 301 | */ | 
| Kojto | 106:ba1f97679dad | 302 | #define CAN_BS1_1TQ ((uint32_t)0x00000000) /*!< 1 time quantum */ | 
| Kojto | 106:ba1f97679dad | 303 | #define CAN_BS1_2TQ ((uint32_t)CAN_BTR_TS1_0) /*!< 2 time quantum */ | 
| Kojto | 106:ba1f97679dad | 304 | #define CAN_BS1_3TQ ((uint32_t)CAN_BTR_TS1_1) /*!< 3 time quantum */ | 
| Kojto | 106:ba1f97679dad | 305 | #define CAN_BS1_4TQ ((uint32_t)(CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 4 time quantum */ | 
| Kojto | 106:ba1f97679dad | 306 | #define CAN_BS1_5TQ ((uint32_t)CAN_BTR_TS1_2) /*!< 5 time quantum */ | 
| Kojto | 106:ba1f97679dad | 307 | #define CAN_BS1_6TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 6 time quantum */ | 
| Kojto | 106:ba1f97679dad | 308 | #define CAN_BS1_7TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 7 time quantum */ | 
| Kojto | 106:ba1f97679dad | 309 | #define CAN_BS1_8TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 8 time quantum */ | 
| Kojto | 106:ba1f97679dad | 310 | #define CAN_BS1_9TQ ((uint32_t)CAN_BTR_TS1_3) /*!< 9 time quantum */ | 
| Kojto | 106:ba1f97679dad | 311 | #define CAN_BS1_10TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_0)) /*!< 10 time quantum */ | 
| Kojto | 106:ba1f97679dad | 312 | #define CAN_BS1_11TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1)) /*!< 11 time quantum */ | 
| Kojto | 106:ba1f97679dad | 313 | #define CAN_BS1_12TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 12 time quantum */ | 
| Kojto | 106:ba1f97679dad | 314 | #define CAN_BS1_13TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2)) /*!< 13 time quantum */ | 
| Kojto | 106:ba1f97679dad | 315 | #define CAN_BS1_14TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 14 time quantum */ | 
| Kojto | 106:ba1f97679dad | 316 | #define CAN_BS1_15TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 15 time quantum */ | 
| Kojto | 106:ba1f97679dad | 317 | #define CAN_BS1_16TQ ((uint32_t)CAN_BTR_TS1) /*!< 16 time quantum */ | 
| Kojto | 106:ba1f97679dad | 318 | /** | 
| Kojto | 106:ba1f97679dad | 319 | * @} | 
| Kojto | 106:ba1f97679dad | 320 | */ | 
| Kojto | 106:ba1f97679dad | 321 | |
| Kojto | 106:ba1f97679dad | 322 | /** @defgroup CAN_time_quantum_in_bit_segment_2 CAN Time Quantum in bit segment 2 | 
| Kojto | 106:ba1f97679dad | 323 | * @{ | 
| Kojto | 106:ba1f97679dad | 324 | */ | 
| Kojto | 106:ba1f97679dad | 325 | #define CAN_BS2_1TQ ((uint32_t)0x00000000) /*!< 1 time quantum */ | 
| Kojto | 106:ba1f97679dad | 326 | #define CAN_BS2_2TQ ((uint32_t)CAN_BTR_TS2_0) /*!< 2 time quantum */ | 
| Kojto | 106:ba1f97679dad | 327 | #define CAN_BS2_3TQ ((uint32_t)CAN_BTR_TS2_1) /*!< 3 time quantum */ | 
| Kojto | 106:ba1f97679dad | 328 | #define CAN_BS2_4TQ ((uint32_t)(CAN_BTR_TS2_1 | CAN_BTR_TS2_0)) /*!< 4 time quantum */ | 
| Kojto | 106:ba1f97679dad | 329 | #define CAN_BS2_5TQ ((uint32_t)CAN_BTR_TS2_2) /*!< 5 time quantum */ | 
| Kojto | 106:ba1f97679dad | 330 | #define CAN_BS2_6TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_0)) /*!< 6 time quantum */ | 
| Kojto | 106:ba1f97679dad | 331 | #define CAN_BS2_7TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_1)) /*!< 7 time quantum */ | 
| Kojto | 106:ba1f97679dad | 332 | #define CAN_BS2_8TQ ((uint32_t)CAN_BTR_TS2) /*!< 8 time quantum */ | 
| Kojto | 106:ba1f97679dad | 333 | /** | 
| Kojto | 106:ba1f97679dad | 334 | * @} | 
| Kojto | 106:ba1f97679dad | 335 | */ | 
| Kojto | 106:ba1f97679dad | 336 | |
| Kojto | 106:ba1f97679dad | 337 | /** @defgroup CAN_filter_mode CAN Filter Mode | 
| Kojto | 106:ba1f97679dad | 338 | * @{ | 
| Kojto | 106:ba1f97679dad | 339 | */ | 
| Kojto | 106:ba1f97679dad | 340 | #define CAN_FILTERMODE_IDMASK ((uint8_t)0x00) /*!< Identifier mask mode */ | 
| Kojto | 106:ba1f97679dad | 341 | #define CAN_FILTERMODE_IDLIST ((uint8_t)0x01) /*!< Identifier list mode */ | 
| Kojto | 106:ba1f97679dad | 342 | /** | 
| Kojto | 106:ba1f97679dad | 343 | * @} | 
| Kojto | 106:ba1f97679dad | 344 | */ | 
| Kojto | 106:ba1f97679dad | 345 | |
| Kojto | 106:ba1f97679dad | 346 | /** @defgroup CAN_filter_scale CAN Filter Scale | 
| Kojto | 106:ba1f97679dad | 347 | * @{ | 
| Kojto | 106:ba1f97679dad | 348 | */ | 
| Kojto | 106:ba1f97679dad | 349 | #define CAN_FILTERSCALE_16BIT ((uint8_t)0x00) /*!< Two 16-bit filters */ | 
| Kojto | 106:ba1f97679dad | 350 | #define CAN_FILTERSCALE_32BIT ((uint8_t)0x01) /*!< One 32-bit filter */ | 
| Kojto | 106:ba1f97679dad | 351 | /** | 
| Kojto | 106:ba1f97679dad | 352 | * @} | 
| Kojto | 106:ba1f97679dad | 353 | */ | 
| Kojto | 106:ba1f97679dad | 354 | |
| Kojto | 106:ba1f97679dad | 355 | /** @defgroup CAN_filter_FIFO CAN Filter FIFO | 
| Kojto | 106:ba1f97679dad | 356 | * @{ | 
| Kojto | 106:ba1f97679dad | 357 | */ | 
| Kojto | 106:ba1f97679dad | 358 | #define CAN_FILTER_FIFO0 ((uint8_t)0x00) /*!< Filter FIFO 0 assignment for filter x */ | 
| Kojto | 106:ba1f97679dad | 359 | #define CAN_FILTER_FIFO1 ((uint8_t)0x01) /*!< Filter FIFO 1 assignment for filter x */ | 
| Kojto | 106:ba1f97679dad | 360 | /** | 
| Kojto | 106:ba1f97679dad | 361 | * @} | 
| Kojto | 106:ba1f97679dad | 362 | */ | 
| Kojto | 106:ba1f97679dad | 363 | |
| Kojto | 106:ba1f97679dad | 364 | /** @defgroup CAN_Identifier_Type CAN Identifier Type | 
| Kojto | 106:ba1f97679dad | 365 | * @{ | 
| Kojto | 106:ba1f97679dad | 366 | */ | 
| Kojto | 106:ba1f97679dad | 367 | #define CAN_ID_STD ((uint32_t)0x00000000) /*!< Standard Id */ | 
| Kojto | 106:ba1f97679dad | 368 | #define CAN_ID_EXT ((uint32_t)0x00000004) /*!< Extended Id */ | 
| Kojto | 106:ba1f97679dad | 369 | /** | 
| Kojto | 106:ba1f97679dad | 370 | * @} | 
| Kojto | 106:ba1f97679dad | 371 | */ | 
| Kojto | 106:ba1f97679dad | 372 | |
| Kojto | 106:ba1f97679dad | 373 | /** @defgroup CAN_remote_transmission_request CAN Remote Transmission Request | 
| Kojto | 106:ba1f97679dad | 374 | * @{ | 
| Kojto | 106:ba1f97679dad | 375 | */ | 
| Kojto | 106:ba1f97679dad | 376 | #define CAN_RTR_DATA ((uint32_t)0x00000000) /*!< Data frame */ | 
| Kojto | 106:ba1f97679dad | 377 | #define CAN_RTR_REMOTE ((uint32_t)0x00000002) /*!< Remote frame */ | 
| Kojto | 106:ba1f97679dad | 378 | /** | 
| Kojto | 106:ba1f97679dad | 379 | * @} | 
| Kojto | 106:ba1f97679dad | 380 | */ | 
| Kojto | 106:ba1f97679dad | 381 | |
| Kojto | 106:ba1f97679dad | 382 | /** @defgroup CAN_receive_FIFO_number_constants CAN Receive FIFO Number Constants | 
| Kojto | 106:ba1f97679dad | 383 | * @{ | 
| Kojto | 106:ba1f97679dad | 384 | */ | 
| Kojto | 106:ba1f97679dad | 385 | #define CAN_FIFO0 ((uint8_t)0x00) /*!< CAN FIFO 0 used to receive */ | 
| Kojto | 106:ba1f97679dad | 386 | #define CAN_FIFO1 ((uint8_t)0x01) /*!< CAN FIFO 1 used to receive */ | 
| Kojto | 106:ba1f97679dad | 387 | /** | 
| Kojto | 106:ba1f97679dad | 388 | * @} | 
| Kojto | 106:ba1f97679dad | 389 | */ | 
| Kojto | 106:ba1f97679dad | 390 | |
| Kojto | 106:ba1f97679dad | 391 | /** @defgroup CAN_flags CAN Flags | 
| Kojto | 106:ba1f97679dad | 392 | * @{ | 
| Kojto | 106:ba1f97679dad | 393 | */ | 
| Kojto | 106:ba1f97679dad | 394 | /* If the flag is 0x3XXXXXXX, it means that it can be used with CAN_GetFlagStatus() | 
| Kojto | 106:ba1f97679dad | 395 | and CAN_ClearFlag() functions. */ | 
| Kojto | 106:ba1f97679dad | 396 | /* If the flag is 0x1XXXXXXX, it means that it can only be used with | 
| Kojto | 106:ba1f97679dad | 397 | CAN_GetFlagStatus() function. */ | 
| Kojto | 106:ba1f97679dad | 398 | |
| Kojto | 106:ba1f97679dad | 399 | /* Transmit Flags */ | 
| Kojto | 106:ba1f97679dad | 400 | #define CAN_FLAG_RQCP0 ((uint32_t)0x00000500) /*!< Request MailBox0 flag */ | 
| Kojto | 106:ba1f97679dad | 401 | #define CAN_FLAG_RQCP1 ((uint32_t)0x00000508) /*!< Request MailBox1 flag */ | 
| Kojto | 106:ba1f97679dad | 402 | #define CAN_FLAG_RQCP2 ((uint32_t)0x00000510) /*!< Request MailBox2 flag */ | 
| Kojto | 106:ba1f97679dad | 403 | #define CAN_FLAG_TXOK0 ((uint32_t)0x00000501) /*!< Transmission OK MailBox0 flag */ | 
| Kojto | 106:ba1f97679dad | 404 | #define CAN_FLAG_TXOK1 ((uint32_t)0x00000509) /*!< Transmission OK MailBox1 flag */ | 
| Kojto | 106:ba1f97679dad | 405 | #define CAN_FLAG_TXOK2 ((uint32_t)0x00000511) /*!< Transmission OK MailBox2 flag */ | 
| Kojto | 106:ba1f97679dad | 406 | #define CAN_FLAG_TME0 ((uint32_t)0x0000051A) /*!< Transmit mailbox 0 empty flag */ | 
| Kojto | 106:ba1f97679dad | 407 | #define CAN_FLAG_TME1 ((uint32_t)0x0000051B) /*!< Transmit mailbox 0 empty flag */ | 
| Kojto | 106:ba1f97679dad | 408 | #define CAN_FLAG_TME2 ((uint32_t)0x0000051C) /*!< Transmit mailbox 0 empty flag */ | 
| Kojto | 106:ba1f97679dad | 409 | |
| Kojto | 106:ba1f97679dad | 410 | /* Receive Flags */ | 
| Kojto | 106:ba1f97679dad | 411 | #define CAN_FLAG_FF0 ((uint32_t)0x00000203) /*!< FIFO 0 Full flag */ | 
| Kojto | 106:ba1f97679dad | 412 | #define CAN_FLAG_FOV0 ((uint32_t)0x00000204) /*!< FIFO 0 Overrun flag */ | 
| Kojto | 106:ba1f97679dad | 413 | |
| Kojto | 106:ba1f97679dad | 414 | #define CAN_FLAG_FF1 ((uint32_t)0x00000403) /*!< FIFO 1 Full flag */ | 
| Kojto | 106:ba1f97679dad | 415 | #define CAN_FLAG_FOV1 ((uint32_t)0x00000404) /*!< FIFO 1 Overrun flag */ | 
| Kojto | 106:ba1f97679dad | 416 | |
| Kojto | 106:ba1f97679dad | 417 | /* Operating Mode Flags */ | 
| Kojto | 106:ba1f97679dad | 418 | #define CAN_FLAG_WKU ((uint32_t)0x00000103) /*!< Wake up flag */ | 
| Kojto | 106:ba1f97679dad | 419 | #define CAN_FLAG_SLAK ((uint32_t)0x00000101) /*!< Sleep acknowledge flag */ | 
| Kojto | 106:ba1f97679dad | 420 | #define CAN_FLAG_SLAKI ((uint32_t)0x00000104) /*!< Sleep acknowledge flag */ | 
| Kojto | 106:ba1f97679dad | 421 | /* @note When SLAK interrupt is disabled (SLKIE=0), no polling on SLAKI is possible. | 
| Kojto | 106:ba1f97679dad | 422 | In this case the SLAK bit can be polled.*/ | 
| Kojto | 106:ba1f97679dad | 423 | |
| Kojto | 106:ba1f97679dad | 424 | /* Error Flags */ | 
| Kojto | 106:ba1f97679dad | 425 | #define CAN_FLAG_EWG ((uint32_t)0x00000300) /*!< Error warning flag */ | 
| Kojto | 106:ba1f97679dad | 426 | #define CAN_FLAG_EPV ((uint32_t)0x00000301) /*!< Error passive flag */ | 
| Kojto | 106:ba1f97679dad | 427 | #define CAN_FLAG_BOF ((uint32_t)0x00000302) /*!< Bus-Off flag */ | 
| Kojto | 106:ba1f97679dad | 428 | /** | 
| Kojto | 106:ba1f97679dad | 429 | * @} | 
| Kojto | 106:ba1f97679dad | 430 | */ | 
| Kojto | 106:ba1f97679dad | 431 | |
| Kojto | 106:ba1f97679dad | 432 | /** @defgroup CAN_Interrupts CAN Interrupts | 
| Kojto | 106:ba1f97679dad | 433 | * @{ | 
| Kojto | 106:ba1f97679dad | 434 | */ | 
| Kojto | 106:ba1f97679dad | 435 | #define CAN_IT_TME ((uint32_t)CAN_IER_TMEIE) /*!< Transmit mailbox empty interrupt */ | 
| Kojto | 106:ba1f97679dad | 436 | |
| Kojto | 106:ba1f97679dad | 437 | /* Receive Interrupts */ | 
| Kojto | 106:ba1f97679dad | 438 | #define CAN_IT_FMP0 ((uint32_t)CAN_IER_FMPIE0) /*!< FIFO 0 message pending interrupt */ | 
| Kojto | 106:ba1f97679dad | 439 | #define CAN_IT_FF0 ((uint32_t)CAN_IER_FFIE0) /*!< FIFO 0 full interrupt */ | 
| Kojto | 106:ba1f97679dad | 440 | #define CAN_IT_FOV0 ((uint32_t)CAN_IER_FOVIE0) /*!< FIFO 0 overrun interrupt */ | 
| Kojto | 106:ba1f97679dad | 441 | #define CAN_IT_FMP1 ((uint32_t)CAN_IER_FMPIE1) /*!< FIFO 1 message pending interrupt */ | 
| Kojto | 106:ba1f97679dad | 442 | #define CAN_IT_FF1 ((uint32_t)CAN_IER_FFIE1) /*!< FIFO 1 full interrupt */ | 
| Kojto | 106:ba1f97679dad | 443 | #define CAN_IT_FOV1 ((uint32_t)CAN_IER_FOVIE1) /*!< FIFO 1 overrun interrupt */ | 
| Kojto | 106:ba1f97679dad | 444 | |
| Kojto | 106:ba1f97679dad | 445 | /* Operating Mode Interrupts */ | 
| Kojto | 106:ba1f97679dad | 446 | #define CAN_IT_WKU ((uint32_t)CAN_IER_WKUIE) /*!< Wake-up interrupt */ | 
| Kojto | 106:ba1f97679dad | 447 | #define CAN_IT_SLK ((uint32_t)CAN_IER_SLKIE) /*!< Sleep acknowledge interrupt */ | 
| Kojto | 106:ba1f97679dad | 448 | |
| Kojto | 106:ba1f97679dad | 449 | /* Error Interrupts */ | 
| Kojto | 106:ba1f97679dad | 450 | #define CAN_IT_EWG ((uint32_t)CAN_IER_EWGIE) /*!< Error warning interrupt */ | 
| Kojto | 106:ba1f97679dad | 451 | #define CAN_IT_EPV ((uint32_t)CAN_IER_EPVIE) /*!< Error passive interrupt */ | 
| Kojto | 106:ba1f97679dad | 452 | #define CAN_IT_BOF ((uint32_t)CAN_IER_BOFIE) /*!< Bus-off interrupt */ | 
| Kojto | 106:ba1f97679dad | 453 | #define CAN_IT_LEC ((uint32_t)CAN_IER_LECIE) /*!< Last error code interrupt */ | 
| Kojto | 106:ba1f97679dad | 454 | #define CAN_IT_ERR ((uint32_t)CAN_IER_ERRIE) /*!< Error Interrupt */ | 
| Kojto | 106:ba1f97679dad | 455 | /** | 
| Kojto | 106:ba1f97679dad | 456 | * @} | 
| Kojto | 106:ba1f97679dad | 457 | */ | 
| Kojto | 106:ba1f97679dad | 458 | |
| Kojto | 106:ba1f97679dad | 459 | /** @defgroup CAN_Mailboxes_Definition CAN Mailboxes Definition | 
| Kojto | 106:ba1f97679dad | 460 | * @{ | 
| Kojto | 106:ba1f97679dad | 461 | */ | 
| Kojto | 106:ba1f97679dad | 462 | #define CAN_TXMAILBOX_0 ((uint8_t)0x00) | 
| Kojto | 106:ba1f97679dad | 463 | #define CAN_TXMAILBOX_1 ((uint8_t)0x01) | 
| Kojto | 106:ba1f97679dad | 464 | #define CAN_TXMAILBOX_2 ((uint8_t)0x02) | 
| Kojto | 106:ba1f97679dad | 465 | /** | 
| Kojto | 106:ba1f97679dad | 466 | * @} | 
| Kojto | 106:ba1f97679dad | 467 | */ | 
| Kojto | 106:ba1f97679dad | 468 | |
| Kojto | 106:ba1f97679dad | 469 | /** | 
| Kojto | 106:ba1f97679dad | 470 | * @} | 
| Kojto | 106:ba1f97679dad | 471 | */ | 
| Kojto | 106:ba1f97679dad | 472 | |
| Kojto | 106:ba1f97679dad | 473 | /* Exported macro ------------------------------------------------------------*/ | 
| Kojto | 106:ba1f97679dad | 474 | /** @defgroup CAN_Exported_Macros CAN Exported Macros | 
| Kojto | 106:ba1f97679dad | 475 | * @{ | 
| Kojto | 106:ba1f97679dad | 476 | */ | 
| Kojto | 106:ba1f97679dad | 477 | |
| Kojto | 106:ba1f97679dad | 478 | /** @brief Reset CAN handle state | 
| Kojto | 106:ba1f97679dad | 479 | * @param __HANDLE__: specifies the CAN Handle. | 
| Kojto | 106:ba1f97679dad | 480 | * @retval None | 
| Kojto | 106:ba1f97679dad | 481 | */ | 
| Kojto | 106:ba1f97679dad | 482 | #define __HAL_CAN_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CAN_STATE_RESET) | 
| Kojto | 106:ba1f97679dad | 483 | |
| Kojto | 106:ba1f97679dad | 484 | /** | 
| Kojto | 106:ba1f97679dad | 485 | * @brief Enable the specified CAN interrupts. | 
| Kojto | 106:ba1f97679dad | 486 | * @param __HANDLE__: CAN handle | 
| Kojto | 106:ba1f97679dad | 487 | * @param __INTERRUPT__: CAN Interrupt | 
| Kojto | 106:ba1f97679dad | 488 | * @retval None | 
| Kojto | 106:ba1f97679dad | 489 | */ | 
| Kojto | 106:ba1f97679dad | 490 | #define __HAL_CAN_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) |= (__INTERRUPT__)) | 
| Kojto | 106:ba1f97679dad | 491 | |
| Kojto | 106:ba1f97679dad | 492 | /** | 
| Kojto | 106:ba1f97679dad | 493 | * @brief Disable the specified CAN interrupts. | 
| Kojto | 106:ba1f97679dad | 494 | * @param __HANDLE__: CAN handle | 
| Kojto | 106:ba1f97679dad | 495 | * @param __INTERRUPT__: CAN Interrupt | 
| Kojto | 106:ba1f97679dad | 496 | * @retval None | 
| Kojto | 106:ba1f97679dad | 497 | */ | 
| Kojto | 106:ba1f97679dad | 498 | #define __HAL_CAN_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) &= ~(__INTERRUPT__)) | 
| Kojto | 106:ba1f97679dad | 499 | |
| Kojto | 106:ba1f97679dad | 500 | /** | 
| Kojto | 106:ba1f97679dad | 501 | * @brief Return the number of pending received messages. | 
| Kojto | 106:ba1f97679dad | 502 | * @param __HANDLE__: CAN handle | 
| Kojto | 106:ba1f97679dad | 503 | * @param __FIFONUMBER__: Receive FIFO number, CAN_FIFO0 or CAN_FIFO1. | 
| Kojto | 106:ba1f97679dad | 504 | * @retval The number of pending message. | 
| Kojto | 106:ba1f97679dad | 505 | */ | 
| Kojto | 106:ba1f97679dad | 506 | #define __HAL_CAN_MSG_PENDING(__HANDLE__, __FIFONUMBER__) (((__FIFONUMBER__) == CAN_FIFO0)? \ | 
| Kojto | 106:ba1f97679dad | 507 | ((uint8_t)((__HANDLE__)->Instance->RF0R&(uint32_t)0x03)) : ((uint8_t)((__HANDLE__)->Instance->RF1R&(uint32_t)0x03))) | 
| Kojto | 106:ba1f97679dad | 508 | |
| Kojto | 106:ba1f97679dad | 509 | /** @brief Check whether the specified CAN flag is set or not. | 
| Kojto | 106:ba1f97679dad | 510 | * @param __HANDLE__: CAN Handle | 
| Kojto | 106:ba1f97679dad | 511 | * @param __FLAG__: specifies the flag to check. | 
| Kojto | 106:ba1f97679dad | 512 | * This parameter can be one of the following values: | 
| Kojto | 106:ba1f97679dad | 513 | * @arg CAN_TSR_RQCP0: Request MailBox0 Flag | 
| Kojto | 106:ba1f97679dad | 514 | * @arg CAN_TSR_RQCP1: Request MailBox1 Flag | 
| Kojto | 106:ba1f97679dad | 515 | * @arg CAN_TSR_RQCP2: Request MailBox2 Flag | 
| Kojto | 106:ba1f97679dad | 516 | * @arg CAN_FLAG_TXOK0: Transmission OK MailBox0 Flag | 
| Kojto | 106:ba1f97679dad | 517 | * @arg CAN_FLAG_TXOK1: Transmission OK MailBox1 Flag | 
| Kojto | 106:ba1f97679dad | 518 | * @arg CAN_FLAG_TXOK2: Transmission OK MailBox2 Flag | 
| Kojto | 106:ba1f97679dad | 519 | * @arg CAN_FLAG_TME0: Transmit mailbox 0 empty Flag | 
| Kojto | 106:ba1f97679dad | 520 | * @arg CAN_FLAG_TME1: Transmit mailbox 1 empty Flag | 
| Kojto | 106:ba1f97679dad | 521 | * @arg CAN_FLAG_TME2: Transmit mailbox 2 empty Flag | 
| Kojto | 106:ba1f97679dad | 522 | * @arg CAN_FLAG_FMP0: FIFO 0 Message Pending Flag | 
| Kojto | 106:ba1f97679dad | 523 | * @arg CAN_FLAG_FF0: FIFO 0 Full Flag | 
| Kojto | 106:ba1f97679dad | 524 | * @arg CAN_FLAG_FOV0: FIFO 0 Overrun Flag | 
| Kojto | 106:ba1f97679dad | 525 | * @arg CAN_FLAG_FMP1: FIFO 1 Message Pending Flag | 
| Kojto | 106:ba1f97679dad | 526 | * @arg CAN_FLAG_FF1: FIFO 1 Full Flag | 
| Kojto | 106:ba1f97679dad | 527 | * @arg CAN_FLAG_FOV1: FIFO 1 Overrun Flag | 
| Kojto | 106:ba1f97679dad | 528 | * @arg CAN_FLAG_WKU: Wake up Flag | 
| Kojto | 106:ba1f97679dad | 529 | * @arg CAN_FLAG_SLAK: Sleep acknowledge Flag | 
| Kojto | 106:ba1f97679dad | 530 | * @arg CAN_FLAG_SLAKI: Sleep acknowledge Flag | 
| Kojto | 106:ba1f97679dad | 531 | * @arg CAN_FLAG_EWG: Error Warning Flag | 
| Kojto | 106:ba1f97679dad | 532 | * @arg CAN_FLAG_EPV: Error Passive Flag | 
| Kojto | 106:ba1f97679dad | 533 | * @arg CAN_FLAG_BOF: Bus-Off Flag | 
| Kojto | 106:ba1f97679dad | 534 | * @retval The new state of __FLAG__ (TRUE or FALSE). | 
| Kojto | 106:ba1f97679dad | 535 | */ | 
| Kojto | 106:ba1f97679dad | 536 | #define __HAL_CAN_GET_FLAG(__HANDLE__, __FLAG__) \ | 
| Kojto | 106:ba1f97679dad | 537 | ((((__FLAG__) >> 8) == 5)? ((((__HANDLE__)->Instance->TSR) & (1 << ((__FLAG__) & CAN_FLAG_MASK))) == (1 << ((__FLAG__) & CAN_FLAG_MASK))): \ | 
| Kojto | 106:ba1f97679dad | 538 | (((__FLAG__) >> 8) == 2)? ((((__HANDLE__)->Instance->RF0R) & (1 << ((__FLAG__) & CAN_FLAG_MASK))) == (1 << ((__FLAG__) & CAN_FLAG_MASK))): \ | 
| Kojto | 106:ba1f97679dad | 539 | (((__FLAG__) >> 8) == 4)? ((((__HANDLE__)->Instance->RF1R) & (1 << ((__FLAG__) & CAN_FLAG_MASK))) == (1 << ((__FLAG__) & CAN_FLAG_MASK))): \ | 
| Kojto | 106:ba1f97679dad | 540 | (((__FLAG__) >> 8) == 1)? ((((__HANDLE__)->Instance->MSR) & (1 << ((__FLAG__) & CAN_FLAG_MASK))) == (1 << ((__FLAG__) & CAN_FLAG_MASK))): \ | 
| Kojto | 106:ba1f97679dad | 541 | ((((__HANDLE__)->Instance->ESR) & (1 << ((__FLAG__) & CAN_FLAG_MASK))) == (1 << ((__FLAG__) & CAN_FLAG_MASK)))) | 
| Kojto | 106:ba1f97679dad | 542 | |
| Kojto | 106:ba1f97679dad | 543 | /** @brief Clear the specified CAN pending flag. | 
| Kojto | 106:ba1f97679dad | 544 | * @param __HANDLE__: CAN Handle. | 
| Kojto | 106:ba1f97679dad | 545 | * @param __FLAG__: specifies the flag to check. | 
| Kojto | 106:ba1f97679dad | 546 | * This parameter can be one of the following values: | 
| Kojto | 106:ba1f97679dad | 547 | * @arg CAN_TSR_RQCP0: Request MailBox0 Flag | 
| Kojto | 106:ba1f97679dad | 548 | * @arg CAN_TSR_RQCP1: Request MailBox1 Flag | 
| Kojto | 106:ba1f97679dad | 549 | * @arg CAN_TSR_RQCP2: Request MailBox2 Flag | 
| Kojto | 106:ba1f97679dad | 550 | * @arg CAN_FLAG_TXOK0: Transmission OK MailBox0 Flag | 
| Kojto | 106:ba1f97679dad | 551 | * @arg CAN_FLAG_TXOK1: Transmission OK MailBox1 Flag | 
| Kojto | 106:ba1f97679dad | 552 | * @arg CAN_FLAG_TXOK2: Transmission OK MailBox2 Flag | 
| Kojto | 106:ba1f97679dad | 553 | * @arg CAN_FLAG_TME0: Transmit mailbox 0 empty Flag | 
| Kojto | 106:ba1f97679dad | 554 | * @arg CAN_FLAG_TME1: Transmit mailbox 1 empty Flag | 
| Kojto | 106:ba1f97679dad | 555 | * @arg CAN_FLAG_TME2: Transmit mailbox 2 empty Flag | 
| Kojto | 106:ba1f97679dad | 556 | * @arg CAN_FLAG_FMP0: FIFO 0 Message Pending Flag | 
| Kojto | 106:ba1f97679dad | 557 | * @arg CAN_FLAG_FF0: FIFO 0 Full Flag | 
| Kojto | 106:ba1f97679dad | 558 | * @arg CAN_FLAG_FOV0: FIFO 0 Overrun Flag | 
| Kojto | 106:ba1f97679dad | 559 | * @arg CAN_FLAG_FMP1: FIFO 1 Message Pending Flag | 
| Kojto | 106:ba1f97679dad | 560 | * @arg CAN_FLAG_FF1: FIFO 1 Full Flag | 
| Kojto | 106:ba1f97679dad | 561 | * @arg CAN_FLAG_FOV1: FIFO 1 Overrun Flag | 
| Kojto | 106:ba1f97679dad | 562 | * @arg CAN_FLAG_WKU: Wake up Flag | 
| Kojto | 106:ba1f97679dad | 563 | * @arg CAN_FLAG_SLAK: Sleep acknowledge Flag | 
| Kojto | 106:ba1f97679dad | 564 | * @arg CAN_FLAG_SLAKI: Sleep acknowledge Flag | 
| Kojto | 106:ba1f97679dad | 565 | * @arg CAN_FLAG_EWG: Error Warning Flag | 
| Kojto | 106:ba1f97679dad | 566 | * @arg CAN_FLAG_EPV: Error Passive Flag | 
| Kojto | 106:ba1f97679dad | 567 | * @arg CAN_FLAG_BOF: Bus-Off Flag | 
| Kojto | 106:ba1f97679dad | 568 | * @retval The new state of __FLAG__ (TRUE or FALSE). | 
| Kojto | 106:ba1f97679dad | 569 | */ | 
| Kojto | 106:ba1f97679dad | 570 | #define __HAL_CAN_CLEAR_FLAG(__HANDLE__, __FLAG__) \ | 
| Kojto | 106:ba1f97679dad | 571 | ((((__FLAG__) >> 8) == 5)? (((__HANDLE__)->Instance->TSR) = ~((uint32_t)1 << ((__FLAG__) & CAN_FLAG_MASK))): \ | 
| Kojto | 106:ba1f97679dad | 572 | (((__FLAG__) >> 8) == 2)? (((__HANDLE__)->Instance->RF0R) = ~((uint32_t)1 << ((__FLAG__) & CAN_FLAG_MASK))): \ | 
| Kojto | 106:ba1f97679dad | 573 | (((__FLAG__) >> 8) == 4)? (((__HANDLE__)->Instance->RF1R) = ~((uint32_t)1 << ((__FLAG__) & CAN_FLAG_MASK))): \ | 
| Kojto | 106:ba1f97679dad | 574 | (((__FLAG__) >> 8) == 1)? (((__HANDLE__)->Instance->MSR) = ~((uint32_t)1 << ((__FLAG__) & CAN_FLAG_MASK))): \ | 
| Kojto | 106:ba1f97679dad | 575 | (((__HANDLE__)->Instance->ESR) = ~((uint32_t)1 << ((__FLAG__) & CAN_FLAG_MASK)))) | 
| Kojto | 106:ba1f97679dad | 576 | |
| Kojto | 106:ba1f97679dad | 577 | /** @brief Check if the specified CAN interrupt source is enabled or disabled. | 
| Kojto | 106:ba1f97679dad | 578 | * @param __HANDLE__: CAN Handle | 
| Kojto | 106:ba1f97679dad | 579 | * @param __INTERRUPT__: specifies the CAN interrupt source to check. | 
| Kojto | 106:ba1f97679dad | 580 | * This parameter can be one of the following values: | 
| Kojto | 106:ba1f97679dad | 581 | * @arg CAN_IT_TME: Transmit mailbox empty interrupt enable | 
| Kojto | 106:ba1f97679dad | 582 | * @arg CAN_IT_FMP0: FIFO0 message pending interrupt enable | 
| Kojto | 106:ba1f97679dad | 583 | * @arg CAN_IT_FMP1: FIFO1 message pending interrupt enable | 
| Kojto | 106:ba1f97679dad | 584 | * @retval The new state of __IT__ (TRUE or FALSE). | 
| Kojto | 106:ba1f97679dad | 585 | */ | 
| Kojto | 106:ba1f97679dad | 586 | #define __HAL_CAN_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) | 
| Kojto | 106:ba1f97679dad | 587 | |
| Kojto | 106:ba1f97679dad | 588 | /** | 
| Kojto | 106:ba1f97679dad | 589 | * @brief Check the transmission status of a CAN Frame. | 
| Kojto | 106:ba1f97679dad | 590 | * @param __HANDLE__: CAN Handle | 
| Kojto | 106:ba1f97679dad | 591 | * @param __TRANSMITMAILBOX__: the number of the mailbox that is used for transmission. | 
| Kojto | 106:ba1f97679dad | 592 | * @retval The new status of transmission (TRUE or FALSE). | 
| Kojto | 106:ba1f97679dad | 593 | */ | 
| Kojto | 106:ba1f97679dad | 594 | #define __HAL_CAN_TRANSMIT_STATUS(__HANDLE__, __TRANSMITMAILBOX__)\ | 
| Kojto | 106:ba1f97679dad | 595 | (((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_0)? ((((__HANDLE__)->Instance->TSR) & (CAN_TSR_RQCP0 | CAN_TSR_TXOK0 | CAN_TSR_TME0)) == (CAN_TSR_RQCP0 | CAN_TSR_TXOK0 | CAN_TSR_TME0)) :\ | 
| Kojto | 106:ba1f97679dad | 596 | ((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_1)? ((((__HANDLE__)->Instance->TSR) & (CAN_TSR_RQCP1 | CAN_TSR_TXOK1 | CAN_TSR_TME1)) == (CAN_TSR_RQCP1 | CAN_TSR_TXOK1 | CAN_TSR_TME1)) :\ | 
| Kojto | 106:ba1f97679dad | 597 | ((((__HANDLE__)->Instance->TSR) & (CAN_TSR_RQCP2 | CAN_TSR_TXOK2 | CAN_TSR_TME2)) == (CAN_TSR_RQCP2 | CAN_TSR_TXOK2 | CAN_TSR_TME2))) | 
| Kojto | 106:ba1f97679dad | 598 | |
| Kojto | 106:ba1f97679dad | 599 | /** | 
| Kojto | 106:ba1f97679dad | 600 | * @brief Release the specified receive FIFO. | 
| Kojto | 106:ba1f97679dad | 601 | * @param __HANDLE__: CAN handle | 
| Kojto | 106:ba1f97679dad | 602 | * @param __FIFONUMBER__: Receive FIFO number, CAN_FIFO0 or CAN_FIFO1. | 
| Kojto | 106:ba1f97679dad | 603 | * @retval None | 
| Kojto | 106:ba1f97679dad | 604 | */ | 
| Kojto | 106:ba1f97679dad | 605 | #define __HAL_CAN_FIFO_RELEASE(__HANDLE__, __FIFONUMBER__) (((__FIFONUMBER__) == CAN_FIFO0)? \ | 
| Kojto | 106:ba1f97679dad | 606 | ((__HANDLE__)->Instance->RF0R |= CAN_RF0R_RFOM0) : ((__HANDLE__)->Instance->RF1R |= CAN_RF1R_RFOM1)) | 
| Kojto | 106:ba1f97679dad | 607 | |
| Kojto | 106:ba1f97679dad | 608 | /** | 
| Kojto | 106:ba1f97679dad | 609 | * @brief Cancel a transmit request. | 
| Kojto | 106:ba1f97679dad | 610 | * @param __HANDLE__: CAN Handle | 
| Kojto | 106:ba1f97679dad | 611 | * @param __TRANSMITMAILBOX__: the number of the mailbox that is used for transmission. | 
| Kojto | 106:ba1f97679dad | 612 | * @retval None | 
| Kojto | 106:ba1f97679dad | 613 | */ | 
| Kojto | 106:ba1f97679dad | 614 | #define __HAL_CAN_CANCEL_TRANSMIT(__HANDLE__, __TRANSMITMAILBOX__)\ | 
| Kojto | 106:ba1f97679dad | 615 | (((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_0)? ((__HANDLE__)->Instance->TSR |= CAN_TSR_ABRQ0) :\ | 
| Kojto | 106:ba1f97679dad | 616 | ((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_1)? ((__HANDLE__)->Instance->TSR |= CAN_TSR_ABRQ1) :\ | 
| Kojto | 106:ba1f97679dad | 617 | ((__HANDLE__)->Instance->TSR |= CAN_TSR_ABRQ2)) | 
| Kojto | 106:ba1f97679dad | 618 | |
| Kojto | 106:ba1f97679dad | 619 | /** | 
| Kojto | 106:ba1f97679dad | 620 | * @brief Enable or disable the DBG Freeze for CAN. | 
| Kojto | 106:ba1f97679dad | 621 | * @param __HANDLE__: CAN Handle | 
| Kojto | 106:ba1f97679dad | 622 | * @param __NEWSTATE__: new state of the CAN peripheral. | 
| Kojto | 106:ba1f97679dad | 623 | * This parameter can be: ENABLE (CAN reception/transmission is frozen | 
| Kojto | 106:ba1f97679dad | 624 | * during debug. Reception FIFOs can still be accessed/controlled normally) | 
| Kojto | 106:ba1f97679dad | 625 | * or DISABLE (CAN is working during debug). | 
| Kojto | 106:ba1f97679dad | 626 | * @retval None | 
| Kojto | 106:ba1f97679dad | 627 | */ | 
| Kojto | 106:ba1f97679dad | 628 | #define __HAL_CAN_DBG_FREEZE(__HANDLE__, __NEWSTATE__) (((__NEWSTATE__) == ENABLE)? \ | 
| Kojto | 106:ba1f97679dad | 629 | ((__HANDLE__)->Instance->MCR |= CAN_MCR_DBF) : ((__HANDLE__)->Instance->MCR &= ~CAN_MCR_DBF)) | 
| Kojto | 106:ba1f97679dad | 630 | |
| Kojto | 106:ba1f97679dad | 631 | /** | 
| Kojto | 106:ba1f97679dad | 632 | * @} | 
| Kojto | 106:ba1f97679dad | 633 | */ | 
| Kojto | 106:ba1f97679dad | 634 | |
| Kojto | 106:ba1f97679dad | 635 | /* Exported functions --------------------------------------------------------*/ | 
| Kojto | 106:ba1f97679dad | 636 | /** @addtogroup CAN_Exported_Functions | 
| Kojto | 106:ba1f97679dad | 637 | * @{ | 
| Kojto | 106:ba1f97679dad | 638 | */ | 
| Kojto | 106:ba1f97679dad | 639 | |
| Kojto | 106:ba1f97679dad | 640 | /** @addtogroup CAN_Exported_Functions_Group1 | 
| Kojto | 106:ba1f97679dad | 641 | * @{ | 
| Kojto | 106:ba1f97679dad | 642 | */ | 
| Kojto | 106:ba1f97679dad | 643 | /* Initialization/de-initialization functions ***********************************/ | 
| Kojto | 106:ba1f97679dad | 644 | HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef* hcan); | 
| Kojto | 106:ba1f97679dad | 645 | HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef* hcan, CAN_FilterConfTypeDef* sFilterConfig); | 
| Kojto | 106:ba1f97679dad | 646 | HAL_StatusTypeDef HAL_CAN_DeInit(CAN_HandleTypeDef* hcan); | 
| Kojto | 106:ba1f97679dad | 647 | void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan); | 
| Kojto | 106:ba1f97679dad | 648 | void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan); | 
| Kojto | 106:ba1f97679dad | 649 | /** | 
| Kojto | 106:ba1f97679dad | 650 | * @} | 
| Kojto | 106:ba1f97679dad | 651 | */ | 
| Kojto | 106:ba1f97679dad | 652 | |
| Kojto | 106:ba1f97679dad | 653 | /** @addtogroup CAN_Exported_Functions_Group2 | 
| Kojto | 106:ba1f97679dad | 654 | * @{ | 
| Kojto | 106:ba1f97679dad | 655 | */ | 
| Kojto | 106:ba1f97679dad | 656 | /* I/O operation functions ******************************************************/ | 
| Kojto | 106:ba1f97679dad | 657 | HAL_StatusTypeDef HAL_CAN_Transmit(CAN_HandleTypeDef *hcan, uint32_t Timeout); | 
| Kojto | 106:ba1f97679dad | 658 | HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef *hcan); | 
| Kojto | 106:ba1f97679dad | 659 | HAL_StatusTypeDef HAL_CAN_Receive(CAN_HandleTypeDef *hcan, uint8_t FIFONumber, uint32_t Timeout); | 
| Kojto | 106:ba1f97679dad | 660 | HAL_StatusTypeDef HAL_CAN_Receive_IT(CAN_HandleTypeDef *hcan, uint8_t FIFONumber); | 
| Kojto | 106:ba1f97679dad | 661 | HAL_StatusTypeDef HAL_CAN_Sleep(CAN_HandleTypeDef *hcan); | 
| Kojto | 106:ba1f97679dad | 662 | HAL_StatusTypeDef HAL_CAN_WakeUp(CAN_HandleTypeDef *hcan); | 
| Kojto | 106:ba1f97679dad | 663 | void HAL_CAN_IRQHandler(CAN_HandleTypeDef* hcan); | 
| Kojto | 106:ba1f97679dad | 664 | void HAL_CAN_TxCpltCallback(CAN_HandleTypeDef* hcan); | 
| Kojto | 106:ba1f97679dad | 665 | void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef* hcan); | 
| Kojto | 106:ba1f97679dad | 666 | void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan); | 
| Kojto | 106:ba1f97679dad | 667 | /** | 
| Kojto | 106:ba1f97679dad | 668 | * @} | 
| Kojto | 106:ba1f97679dad | 669 | */ | 
| Kojto | 106:ba1f97679dad | 670 | |
| Kojto | 106:ba1f97679dad | 671 | /** @addtogroup CAN_Exported_Functions_Group3 | 
| Kojto | 106:ba1f97679dad | 672 | * @{ | 
| Kojto | 106:ba1f97679dad | 673 | */ | 
| Kojto | 106:ba1f97679dad | 674 | /* Peripheral State functions ***************************************************/ | 
| Kojto | 106:ba1f97679dad | 675 | uint32_t HAL_CAN_GetError(CAN_HandleTypeDef *hcan); | 
| Kojto | 106:ba1f97679dad | 676 | HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef* hcan); | 
| Kojto | 106:ba1f97679dad | 677 | /** | 
| Kojto | 106:ba1f97679dad | 678 | * @} | 
| Kojto | 106:ba1f97679dad | 679 | */ | 
| Kojto | 106:ba1f97679dad | 680 | |
| Kojto | 106:ba1f97679dad | 681 | /** | 
| Kojto | 106:ba1f97679dad | 682 | * @} | 
| Kojto | 106:ba1f97679dad | 683 | */ | 
| Kojto | 106:ba1f97679dad | 684 | |
| Kojto | 106:ba1f97679dad | 685 | /* Private types -------------------------------------------------------------*/ | 
| Kojto | 106:ba1f97679dad | 686 | /** @defgroup CAN_Private_Types CAN Private Types | 
| Kojto | 106:ba1f97679dad | 687 | * @{ | 
| Kojto | 106:ba1f97679dad | 688 | */ | 
| Kojto | 106:ba1f97679dad | 689 | |
| Kojto | 106:ba1f97679dad | 690 | /** | 
| Kojto | 106:ba1f97679dad | 691 | * @} | 
| Kojto | 106:ba1f97679dad | 692 | */ | 
| Kojto | 106:ba1f97679dad | 693 | |
| Kojto | 106:ba1f97679dad | 694 | /* Private variables ---------------------------------------------------------*/ | 
| Kojto | 106:ba1f97679dad | 695 | /** @defgroup CAN_Private_Variables CAN Private Variables | 
| Kojto | 106:ba1f97679dad | 696 | * @{ | 
| Kojto | 106:ba1f97679dad | 697 | */ | 
| Kojto | 106:ba1f97679dad | 698 | |
| Kojto | 106:ba1f97679dad | 699 | /** | 
| Kojto | 106:ba1f97679dad | 700 | * @} | 
| Kojto | 106:ba1f97679dad | 701 | */ | 
| Kojto | 106:ba1f97679dad | 702 | |
| Kojto | 106:ba1f97679dad | 703 | /* Private constants ---------------------------------------------------------*/ | 
| Kojto | 106:ba1f97679dad | 704 | /** @defgroup CAN_Private_Constants CAN Private Constants | 
| Kojto | 106:ba1f97679dad | 705 | * @{ | 
| Kojto | 106:ba1f97679dad | 706 | */ | 
| Kojto | 106:ba1f97679dad | 707 | #define CAN_TXSTATUS_NOMAILBOX ((uint8_t)0x04) /*!< CAN cell did not provide CAN_TxStatus_NoMailBox */ | 
| Kojto | 106:ba1f97679dad | 708 | #define CAN_FLAG_MASK ((uint32_t)0x000000FF) | 
| Kojto | 106:ba1f97679dad | 709 | /** | 
| Kojto | 106:ba1f97679dad | 710 | * @} | 
| Kojto | 106:ba1f97679dad | 711 | */ | 
| Kojto | 106:ba1f97679dad | 712 | |
| Kojto | 106:ba1f97679dad | 713 | /* Private macros ------------------------------------------------------------*/ | 
| Kojto | 106:ba1f97679dad | 714 | /** @defgroup CAN_Private_Macros CAN Private Macros | 
| Kojto | 106:ba1f97679dad | 715 | * @{ | 
| Kojto | 106:ba1f97679dad | 716 | */ | 
| Kojto | 106:ba1f97679dad | 717 | #define IS_CAN_MODE(MODE) (((MODE) == CAN_MODE_NORMAL) || \ | 
| Kojto | 106:ba1f97679dad | 718 | ((MODE) == CAN_MODE_LOOPBACK)|| \ | 
| Kojto | 106:ba1f97679dad | 719 | ((MODE) == CAN_MODE_SILENT) || \ | 
| Kojto | 106:ba1f97679dad | 720 | ((MODE) == CAN_MODE_SILENT_LOOPBACK)) | 
| Kojto | 106:ba1f97679dad | 721 | #define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1TQ) || ((SJW) == CAN_SJW_2TQ)|| \ | 
| Kojto | 106:ba1f97679dad | 722 | ((SJW) == CAN_SJW_3TQ) || ((SJW) == CAN_SJW_4TQ)) | 
| Kojto | 106:ba1f97679dad | 723 | #define IS_CAN_BS1(BS1) ((BS1) <= CAN_BS1_16TQ) | 
| Kojto | 106:ba1f97679dad | 724 | #define IS_CAN_BS2(BS2) ((BS2) <= CAN_BS2_8TQ) | 
| Kojto | 106:ba1f97679dad | 725 | #define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1) && ((PRESCALER) <= 1024)) | 
| Kojto | 106:ba1f97679dad | 726 | #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 27) | 
| Kojto | 106:ba1f97679dad | 727 | #define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FILTERMODE_IDMASK) || \ | 
| Kojto | 106:ba1f97679dad | 728 | ((MODE) == CAN_FILTERMODE_IDLIST)) | 
| Kojto | 106:ba1f97679dad | 729 | #define IS_CAN_FILTER_SCALE(SCALE) (((SCALE) == CAN_FILTERSCALE_16BIT) || \ | 
| Kojto | 106:ba1f97679dad | 730 | ((SCALE) == CAN_FILTERSCALE_32BIT)) | 
| Kojto | 106:ba1f97679dad | 731 | #define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FILTER_FIFO0) || \ | 
| Kojto | 106:ba1f97679dad | 732 | ((FIFO) == CAN_FILTER_FIFO1)) | 
| Kojto | 106:ba1f97679dad | 733 | #define IS_CAN_BANKNUMBER(BANKNUMBER) ((BANKNUMBER) <= 28) | 
| Kojto | 106:ba1f97679dad | 734 | |
| Kojto | 106:ba1f97679dad | 735 | #define IS_CAN_TRANSMITMAILBOX(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= ((uint8_t)0x02)) | 
| Kojto | 106:ba1f97679dad | 736 | #define IS_CAN_STDID(STDID) ((STDID) <= ((uint32_t)0x7FF)) | 
| Kojto | 106:ba1f97679dad | 737 | #define IS_CAN_EXTID(EXTID) ((EXTID) <= ((uint32_t)0x1FFFFFFF)) | 
| Kojto | 106:ba1f97679dad | 738 | #define IS_CAN_DLC(DLC) ((DLC) <= ((uint8_t)0x08)) | 
| Kojto | 106:ba1f97679dad | 739 | |
| Kojto | 106:ba1f97679dad | 740 | #define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_ID_STD) || \ | 
| Kojto | 106:ba1f97679dad | 741 | ((IDTYPE) == CAN_ID_EXT)) | 
| Kojto | 106:ba1f97679dad | 742 | #define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_DATA) || ((RTR) == CAN_RTR_REMOTE)) | 
| Kojto | 106:ba1f97679dad | 743 | #define IS_CAN_FIFO(FIFO) (((FIFO) == CAN_FIFO0) || ((FIFO) == CAN_FIFO1)) | 
| Kojto | 106:ba1f97679dad | 744 | |
| Kojto | 106:ba1f97679dad | 745 | /** | 
| Kojto | 106:ba1f97679dad | 746 | * @} | 
| Kojto | 106:ba1f97679dad | 747 | */ | 
| Kojto | 106:ba1f97679dad | 748 | |
| Kojto | 106:ba1f97679dad | 749 | /* Private functions ---------------------------------------------------------*/ | 
| Kojto | 106:ba1f97679dad | 750 | /** @defgroup CAN_Private_Functions CAN Private Functions | 
| Kojto | 106:ba1f97679dad | 751 | * @{ | 
| Kojto | 106:ba1f97679dad | 752 | */ | 
| Kojto | 106:ba1f97679dad | 753 | |
| Kojto | 106:ba1f97679dad | 754 | /** | 
| Kojto | 106:ba1f97679dad | 755 | * @} | 
| Kojto | 106:ba1f97679dad | 756 | */ | 
| Kojto | 106:ba1f97679dad | 757 | |
| Kojto | 110:165afa46840b | 758 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\ | 
| Kojto | 110:165afa46840b | 759 | STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ | 
| Kojto | 106:ba1f97679dad | 760 | |
| Kojto | 106:ba1f97679dad | 761 | /** | 
| Kojto | 106:ba1f97679dad | 762 | * @} | 
| Kojto | 106:ba1f97679dad | 763 | */ | 
| Kojto | 106:ba1f97679dad | 764 | |
| Kojto | 106:ba1f97679dad | 765 | /** | 
| Kojto | 106:ba1f97679dad | 766 | * @} | 
| Kojto | 106:ba1f97679dad | 767 | */ | 
| Kojto | 106:ba1f97679dad | 768 | |
| Kojto | 106:ba1f97679dad | 769 | #ifdef __cplusplus | 
| Kojto | 106:ba1f97679dad | 770 | } | 
| Kojto | 106:ba1f97679dad | 771 | #endif | 
| Kojto | 106:ba1f97679dad | 772 | |
| Kojto | 106:ba1f97679dad | 773 | #endif /* __STM32F4xx_CAN_H */ | 
| Kojto | 106:ba1f97679dad | 774 | |
| Kojto | 106:ba1f97679dad | 775 | |
| Kojto | 106:ba1f97679dad | 776 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | 


