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