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