mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
yusuke_kyo
Date:
Wed Apr 08 08:04:18 2015 +0000
Revision:
98:01a414ca7d6d
Parent:
96:487b796308b0
remove SerialHalfDuplex.h

Who changed what in which revision?

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