meh
Fork of mbed by
TARGET_NUCLEO_F030R8/stm32f0xx_hal_smartcard.h@118:16969dd821af, 2016-04-05 (annotated)
- Committer:
- ricardobtez
- Date:
- Tue Apr 05 23:51:21 2016 +0000
- Revision:
- 118:16969dd821af
- Parent:
- 90:cb3d968589d8
- Child:
- 93:e188a91d3eaa
dgdgr
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 90:cb3d968589d8 | 1 | /** |
Kojto | 90:cb3d968589d8 | 2 | ****************************************************************************** |
Kojto | 90:cb3d968589d8 | 3 | * @file stm32f0xx_hal_smartcard.h |
Kojto | 90:cb3d968589d8 | 4 | * @author MCD Application Team |
Kojto | 90:cb3d968589d8 | 5 | * @version V1.1.0 |
Kojto | 90:cb3d968589d8 | 6 | * @date 03-Oct-2014 |
Kojto | 90:cb3d968589d8 | 7 | * @brief Header file of SMARTCARD HAL module. |
Kojto | 90:cb3d968589d8 | 8 | ****************************************************************************** |
Kojto | 90:cb3d968589d8 | 9 | * @attention |
Kojto | 90:cb3d968589d8 | 10 | * |
Kojto | 90:cb3d968589d8 | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
Kojto | 90:cb3d968589d8 | 12 | * |
Kojto | 90:cb3d968589d8 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 90:cb3d968589d8 | 14 | * are permitted provided that the following conditions are met: |
Kojto | 90:cb3d968589d8 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 90:cb3d968589d8 | 16 | * this list of conditions and the following disclaimer. |
Kojto | 90:cb3d968589d8 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 90:cb3d968589d8 | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 90:cb3d968589d8 | 19 | * and/or other materials provided with the distribution. |
Kojto | 90:cb3d968589d8 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 90:cb3d968589d8 | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 90:cb3d968589d8 | 22 | * without specific prior written permission. |
Kojto | 90:cb3d968589d8 | 23 | * |
Kojto | 90:cb3d968589d8 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 90:cb3d968589d8 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 90:cb3d968589d8 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 90:cb3d968589d8 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 90:cb3d968589d8 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 90:cb3d968589d8 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 90:cb3d968589d8 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 90:cb3d968589d8 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 90:cb3d968589d8 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 90:cb3d968589d8 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 90:cb3d968589d8 | 34 | * |
Kojto | 90:cb3d968589d8 | 35 | ****************************************************************************** |
Kojto | 90:cb3d968589d8 | 36 | */ |
Kojto | 90:cb3d968589d8 | 37 | |
Kojto | 90:cb3d968589d8 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 39 | #ifndef __STM32F0xx_HAL_SMARTCARD_H |
Kojto | 90:cb3d968589d8 | 40 | #define __STM32F0xx_HAL_SMARTCARD_H |
Kojto | 90:cb3d968589d8 | 41 | |
Kojto | 90:cb3d968589d8 | 42 | #ifdef __cplusplus |
Kojto | 90:cb3d968589d8 | 43 | extern "C" { |
Kojto | 90:cb3d968589d8 | 44 | #endif |
Kojto | 90:cb3d968589d8 | 45 | |
Kojto | 90:cb3d968589d8 | 46 | #if !defined(STM32F030x4) && !defined(STM32F030x6) && !defined(STM32F030x8) |
Kojto | 90:cb3d968589d8 | 47 | |
Kojto | 90:cb3d968589d8 | 48 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 49 | #include "stm32f0xx_hal_def.h" |
Kojto | 90:cb3d968589d8 | 50 | |
Kojto | 90:cb3d968589d8 | 51 | /** @addtogroup STM32F0xx_HAL_Driver |
Kojto | 90:cb3d968589d8 | 52 | * @{ |
Kojto | 90:cb3d968589d8 | 53 | */ |
Kojto | 90:cb3d968589d8 | 54 | |
Kojto | 90:cb3d968589d8 | 55 | /** @addtogroup SMARTCARD |
Kojto | 90:cb3d968589d8 | 56 | * @{ |
Kojto | 90:cb3d968589d8 | 57 | */ |
Kojto | 90:cb3d968589d8 | 58 | |
Kojto | 90:cb3d968589d8 | 59 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 60 | /** @defgroup SMARTCARD_Exported_Types SMARTCARD Exported Types |
Kojto | 90:cb3d968589d8 | 61 | * @{ |
Kojto | 90:cb3d968589d8 | 62 | */ |
Kojto | 90:cb3d968589d8 | 63 | |
Kojto | 90:cb3d968589d8 | 64 | |
Kojto | 90:cb3d968589d8 | 65 | /** |
Kojto | 90:cb3d968589d8 | 66 | * @brief SMARTCARD Init Structure definition |
Kojto | 90:cb3d968589d8 | 67 | */ |
Kojto | 90:cb3d968589d8 | 68 | typedef struct |
Kojto | 90:cb3d968589d8 | 69 | { |
Kojto | 90:cb3d968589d8 | 70 | uint32_t BaudRate; /*!< Configures the SmartCard communication baud rate. |
Kojto | 90:cb3d968589d8 | 71 | The baud rate register is computed using the following formula: |
Kojto | 90:cb3d968589d8 | 72 | Baud Rate Register = ((PCLKx) / ((hsmartcard->Init.BaudRate))) */ |
Kojto | 90:cb3d968589d8 | 73 | |
Kojto | 90:cb3d968589d8 | 74 | uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
Kojto | 90:cb3d968589d8 | 75 | This parameter @ref SMARTCARD_Word_Length can only be set to 9 (8 data + 1 parity bits). */ |
Kojto | 90:cb3d968589d8 | 76 | |
Kojto | 90:cb3d968589d8 | 77 | uint32_t StopBits; /*!< Specifies the number of stop bits @ref SMARTCARD_Stop_Bits. |
Kojto | 90:cb3d968589d8 | 78 | Only 1.5 stop bits are authorized in SmartCard mode. */ |
Kojto | 90:cb3d968589d8 | 79 | |
Kojto | 90:cb3d968589d8 | 80 | uint16_t Parity; /*!< Specifies the parity mode. |
Kojto | 90:cb3d968589d8 | 81 | This parameter can be a value of @ref SMARTCARD_Parity |
Kojto | 90:cb3d968589d8 | 82 | @note The parity is enabled by default (PCE is forced to 1). |
Kojto | 90:cb3d968589d8 | 83 | Since the WordLength is forced to 8 bits + parity, M is |
Kojto | 90:cb3d968589d8 | 84 | forced to 1 and the parity bit is the 9th bit. */ |
Kojto | 90:cb3d968589d8 | 85 | |
Kojto | 90:cb3d968589d8 | 86 | uint16_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled. |
Kojto | 90:cb3d968589d8 | 87 | This parameter can be a value of @ref SMARTCARD_Mode */ |
Kojto | 90:cb3d968589d8 | 88 | |
Kojto | 90:cb3d968589d8 | 89 | uint16_t CLKPolarity; /*!< Specifies the steady state of the serial clock. |
Kojto | 90:cb3d968589d8 | 90 | This parameter can be a value of @ref SMARTCARD_Clock_Polarity */ |
Kojto | 90:cb3d968589d8 | 91 | |
Kojto | 90:cb3d968589d8 | 92 | uint16_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made. |
Kojto | 90:cb3d968589d8 | 93 | This parameter can be a value of @ref SMARTCARD_Clock_Phase */ |
Kojto | 90:cb3d968589d8 | 94 | |
Kojto | 90:cb3d968589d8 | 95 | uint16_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted |
Kojto | 90:cb3d968589d8 | 96 | data bit (MSB) has to be output on the SCLK pin in synchronous mode. |
Kojto | 90:cb3d968589d8 | 97 | This parameter can be a value of @ref SMARTCARD_Last_Bit */ |
Kojto | 90:cb3d968589d8 | 98 | |
Kojto | 90:cb3d968589d8 | 99 | uint16_t OneBitSampling; /*!< Specifies whether a single sample or three samples' majority vote is selected. |
Kojto | 90:cb3d968589d8 | 100 | Selecting the single sample method increases the receiver tolerance to clock |
Kojto | 90:cb3d968589d8 | 101 | deviations. This parameter can be a value of @ref SMARTCARD_OneBit_Sampling. */ |
Kojto | 90:cb3d968589d8 | 102 | |
Kojto | 90:cb3d968589d8 | 103 | uint8_t Prescaler; /*!< Specifies the SmartCard Prescaler */ |
Kojto | 90:cb3d968589d8 | 104 | |
Kojto | 90:cb3d968589d8 | 105 | uint8_t GuardTime; /*!< Specifies the SmartCard Guard Time */ |
Kojto | 90:cb3d968589d8 | 106 | |
Kojto | 90:cb3d968589d8 | 107 | uint16_t NACKEnable; /*!< Specifies whether the SmartCard NACK transmission is enabled |
Kojto | 90:cb3d968589d8 | 108 | in case of parity error. |
Kojto | 90:cb3d968589d8 | 109 | This parameter can be a value of @ref SMARTCARD_NACK_State */ |
Kojto | 90:cb3d968589d8 | 110 | |
Kojto | 90:cb3d968589d8 | 111 | uint32_t TimeOutEnable; /*!< Specifies whether the receiver timeout is enabled. |
Kojto | 90:cb3d968589d8 | 112 | This parameter can be a value of @ref SMARTCARD_Timeout_Enable*/ |
Kojto | 90:cb3d968589d8 | 113 | |
Kojto | 90:cb3d968589d8 | 114 | uint32_t TimeOutValue; /*!< Specifies the receiver time out value in number of baud blocks: |
Kojto | 90:cb3d968589d8 | 115 | it is used to implement the Character Wait Time (CWT) and |
Kojto | 90:cb3d968589d8 | 116 | Block Wait Time (BWT). It is coded over 24 bits. */ |
Kojto | 90:cb3d968589d8 | 117 | |
Kojto | 90:cb3d968589d8 | 118 | uint8_t BlockLength; /*!< Specifies the SmartCard Block Length in T=1 Reception mode. |
Kojto | 90:cb3d968589d8 | 119 | This parameter can be any value from 0x0 to 0xFF */ |
Kojto | 90:cb3d968589d8 | 120 | |
Kojto | 90:cb3d968589d8 | 121 | uint8_t AutoRetryCount; /*!< Specifies the SmartCard auto-retry count (number of retries in |
Kojto | 90:cb3d968589d8 | 122 | receive and transmit mode). When set to 0, retransmission is |
Kojto | 90:cb3d968589d8 | 123 | disabled. Otherwise, its maximum value is 7 (before signalling |
Kojto | 90:cb3d968589d8 | 124 | an error) */ |
Kojto | 90:cb3d968589d8 | 125 | |
Kojto | 90:cb3d968589d8 | 126 | }SMARTCARD_InitTypeDef; |
Kojto | 90:cb3d968589d8 | 127 | |
Kojto | 90:cb3d968589d8 | 128 | /** |
Kojto | 90:cb3d968589d8 | 129 | * @brief SMARTCARD advanced features initalization structure definition |
Kojto | 90:cb3d968589d8 | 130 | */ |
Kojto | 90:cb3d968589d8 | 131 | typedef struct |
Kojto | 90:cb3d968589d8 | 132 | { |
Kojto | 90:cb3d968589d8 | 133 | uint32_t AdvFeatureInit; /*!< Specifies which advanced SMARTCARD features is initialized. Several |
Kojto | 90:cb3d968589d8 | 134 | advanced features may be initialized at the same time. This parameter |
Kojto | 90:cb3d968589d8 | 135 | can be a value of @ref SMARTCARD_Advanced_Features_Initialization_Type */ |
Kojto | 90:cb3d968589d8 | 136 | |
Kojto | 90:cb3d968589d8 | 137 | uint32_t TxPinLevelInvert; /*!< Specifies whether the TX pin active level is inverted. |
Kojto | 90:cb3d968589d8 | 138 | This parameter can be a value of @ref SMARTCARD_Tx_Inv */ |
Kojto | 90:cb3d968589d8 | 139 | |
Kojto | 90:cb3d968589d8 | 140 | uint32_t RxPinLevelInvert; /*!< Specifies whether the RX pin active level is inverted. |
Kojto | 90:cb3d968589d8 | 141 | This parameter can be a value of @ref SMARTCARD_Rx_Inv */ |
Kojto | 90:cb3d968589d8 | 142 | |
Kojto | 90:cb3d968589d8 | 143 | uint32_t DataInvert; /*!< Specifies whether data are inverted (positive/direct logic |
Kojto | 90:cb3d968589d8 | 144 | vs negative/inverted logic). |
Kojto | 90:cb3d968589d8 | 145 | This parameter can be a value of @ref SMARTCARD_Data_Inv */ |
Kojto | 90:cb3d968589d8 | 146 | |
Kojto | 90:cb3d968589d8 | 147 | uint32_t Swap; /*!< Specifies whether TX and RX pins are swapped. |
Kojto | 90:cb3d968589d8 | 148 | This parameter can be a value of @ref SMARTCARD_Rx_Tx_Swap */ |
Kojto | 90:cb3d968589d8 | 149 | |
Kojto | 90:cb3d968589d8 | 150 | uint32_t OverrunDisable; /*!< Specifies whether the reception overrun detection is disabled. |
Kojto | 90:cb3d968589d8 | 151 | This parameter can be a value of @ref SMARTCARD_Overrun_Disable */ |
Kojto | 90:cb3d968589d8 | 152 | |
Kojto | 90:cb3d968589d8 | 153 | uint32_t DMADisableonRxError; /*!< Specifies whether the DMA is disabled in case of reception error. |
Kojto | 90:cb3d968589d8 | 154 | This parameter can be a value of @ref SMARTCARD_DMA_Disable_on_Rx_Error */ |
Kojto | 90:cb3d968589d8 | 155 | |
Kojto | 90:cb3d968589d8 | 156 | uint32_t MSBFirst; /*!< Specifies whether MSB is sent first on UART line. |
Kojto | 90:cb3d968589d8 | 157 | This parameter can be a value of @ref SMARTCARD_MSB_First */ |
Kojto | 90:cb3d968589d8 | 158 | }SMARTCARD_AdvFeatureInitTypeDef; |
Kojto | 90:cb3d968589d8 | 159 | |
Kojto | 90:cb3d968589d8 | 160 | /** |
Kojto | 90:cb3d968589d8 | 161 | * @brief HAL State structures definition |
Kojto | 90:cb3d968589d8 | 162 | */ |
Kojto | 90:cb3d968589d8 | 163 | typedef enum |
Kojto | 90:cb3d968589d8 | 164 | { |
Kojto | 90:cb3d968589d8 | 165 | HAL_SMARTCARD_STATE_RESET = 0x00, /*!< Peripheral is not initialized */ |
Kojto | 90:cb3d968589d8 | 166 | HAL_SMARTCARD_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */ |
Kojto | 90:cb3d968589d8 | 167 | HAL_SMARTCARD_STATE_BUSY = 0x02, /*!< an internal process is ongoing */ |
Kojto | 90:cb3d968589d8 | 168 | HAL_SMARTCARD_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */ |
Kojto | 90:cb3d968589d8 | 169 | HAL_SMARTCARD_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */ |
Kojto | 90:cb3d968589d8 | 170 | HAL_SMARTCARD_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */ |
Kojto | 90:cb3d968589d8 | 171 | HAL_SMARTCARD_STATE_TIMEOUT = 0x03, /*!< Timeout state */ |
Kojto | 90:cb3d968589d8 | 172 | HAL_SMARTCARD_STATE_ERROR = 0x04 /*!< Error */ |
Kojto | 90:cb3d968589d8 | 173 | }HAL_SMARTCARD_StateTypeDef; |
Kojto | 90:cb3d968589d8 | 174 | |
Kojto | 90:cb3d968589d8 | 175 | /** |
Kojto | 90:cb3d968589d8 | 176 | * @brief HAL SMARTCARD Error Code structure definition |
Kojto | 90:cb3d968589d8 | 177 | */ |
Kojto | 90:cb3d968589d8 | 178 | typedef enum |
Kojto | 90:cb3d968589d8 | 179 | { |
Kojto | 90:cb3d968589d8 | 180 | HAL_SMARTCARD_ERROR_NONE = 0x00, /*!< No error */ |
Kojto | 90:cb3d968589d8 | 181 | HAL_SMARTCARD_ERROR_PE = 0x01, /*!< Parity error */ |
Kojto | 90:cb3d968589d8 | 182 | HAL_SMARTCARD_ERROR_NE = 0x02, /*!< Noise error */ |
Kojto | 90:cb3d968589d8 | 183 | HAL_SMARTCARD_ERROR_FE = 0x04, /*!< frame error */ |
Kojto | 90:cb3d968589d8 | 184 | HAL_SMARTCARD_ERROR_ORE = 0x08, /*!< Overrun error */ |
Kojto | 90:cb3d968589d8 | 185 | HAL_SMARTCARD_ERROR_DMA = 0x10, /*!< DMA transfer error */ |
Kojto | 90:cb3d968589d8 | 186 | HAL_SMARTCARD_ERROR_RTO = 0x20 /*!< Receiver TimeOut error */ |
Kojto | 90:cb3d968589d8 | 187 | }HAL_SMARTCARD_ErrorTypeDef; |
Kojto | 90:cb3d968589d8 | 188 | |
Kojto | 90:cb3d968589d8 | 189 | /** |
Kojto | 90:cb3d968589d8 | 190 | * @brief SMARTCARD clock sources |
Kojto | 90:cb3d968589d8 | 191 | */ |
Kojto | 90:cb3d968589d8 | 192 | typedef enum |
Kojto | 90:cb3d968589d8 | 193 | { |
Kojto | 90:cb3d968589d8 | 194 | SMARTCARD_CLOCKSOURCE_PCLK1 = 0x00, /*!< PCLK1 clock source */ |
Kojto | 90:cb3d968589d8 | 195 | SMARTCARD_CLOCKSOURCE_HSI = 0x02, /*!< HSI clock source */ |
Kojto | 90:cb3d968589d8 | 196 | SMARTCARD_CLOCKSOURCE_SYSCLK = 0x04, /*!< SYSCLK clock source */ |
Kojto | 90:cb3d968589d8 | 197 | SMARTCARD_CLOCKSOURCE_LSE = 0x08, /*!< LSE clock source */ |
Kojto | 90:cb3d968589d8 | 198 | SMARTCARD_CLOCKSOURCE_UNDEFINED = 0x10 /*!< undefined clock source */ |
Kojto | 90:cb3d968589d8 | 199 | }SMARTCARD_ClockSourceTypeDef; |
Kojto | 90:cb3d968589d8 | 200 | |
Kojto | 90:cb3d968589d8 | 201 | /** |
Kojto | 90:cb3d968589d8 | 202 | * @brief SMARTCARD handle Structure definition |
Kojto | 90:cb3d968589d8 | 203 | */ |
Kojto | 90:cb3d968589d8 | 204 | typedef struct |
Kojto | 90:cb3d968589d8 | 205 | { |
Kojto | 90:cb3d968589d8 | 206 | USART_TypeDef *Instance; /* USART registers base address */ |
Kojto | 90:cb3d968589d8 | 207 | |
Kojto | 90:cb3d968589d8 | 208 | SMARTCARD_InitTypeDef Init; /* SmartCard communication parameters */ |
Kojto | 90:cb3d968589d8 | 209 | |
Kojto | 90:cb3d968589d8 | 210 | SMARTCARD_AdvFeatureInitTypeDef AdvancedInit; /* SmartCard advanced features initialization parameters */ |
Kojto | 90:cb3d968589d8 | 211 | |
Kojto | 90:cb3d968589d8 | 212 | uint8_t *pTxBuffPtr; /* Pointer to SmartCard Tx transfer Buffer */ |
Kojto | 90:cb3d968589d8 | 213 | |
Kojto | 90:cb3d968589d8 | 214 | uint16_t TxXferSize; /* SmartCard Tx Transfer size */ |
Kojto | 90:cb3d968589d8 | 215 | |
Kojto | 90:cb3d968589d8 | 216 | uint16_t TxXferCount; /* SmartCard Tx Transfer Counter */ |
Kojto | 90:cb3d968589d8 | 217 | |
Kojto | 90:cb3d968589d8 | 218 | uint8_t *pRxBuffPtr; /* Pointer to SmartCard Rx transfer Buffer */ |
Kojto | 90:cb3d968589d8 | 219 | |
Kojto | 90:cb3d968589d8 | 220 | uint16_t RxXferSize; /* SmartCard Rx Transfer size */ |
Kojto | 90:cb3d968589d8 | 221 | |
Kojto | 90:cb3d968589d8 | 222 | uint16_t RxXferCount; /* SmartCard Rx Transfer Counter */ |
Kojto | 90:cb3d968589d8 | 223 | |
Kojto | 90:cb3d968589d8 | 224 | DMA_HandleTypeDef *hdmatx; /* SmartCard Tx DMA Handle parameters */ |
Kojto | 90:cb3d968589d8 | 225 | |
Kojto | 90:cb3d968589d8 | 226 | DMA_HandleTypeDef *hdmarx; /* SmartCard Rx DMA Handle parameters */ |
Kojto | 90:cb3d968589d8 | 227 | |
Kojto | 90:cb3d968589d8 | 228 | HAL_LockTypeDef Lock; /* Locking object */ |
Kojto | 90:cb3d968589d8 | 229 | |
Kojto | 90:cb3d968589d8 | 230 | HAL_SMARTCARD_StateTypeDef State; /* SmartCard communication state */ |
Kojto | 90:cb3d968589d8 | 231 | |
Kojto | 90:cb3d968589d8 | 232 | HAL_SMARTCARD_ErrorTypeDef ErrorCode; /* SmartCard Error code */ |
Kojto | 90:cb3d968589d8 | 233 | |
Kojto | 90:cb3d968589d8 | 234 | }SMARTCARD_HandleTypeDef; |
Kojto | 90:cb3d968589d8 | 235 | |
Kojto | 90:cb3d968589d8 | 236 | /** |
Kojto | 90:cb3d968589d8 | 237 | * @} |
Kojto | 90:cb3d968589d8 | 238 | */ |
Kojto | 90:cb3d968589d8 | 239 | |
Kojto | 90:cb3d968589d8 | 240 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 241 | /** @defgroup SMARTCARD_Exported_Constants SMARTCARD Exported constants |
Kojto | 90:cb3d968589d8 | 242 | * @{ |
Kojto | 90:cb3d968589d8 | 243 | */ |
Kojto | 90:cb3d968589d8 | 244 | |
Kojto | 90:cb3d968589d8 | 245 | /** @defgroup SMARTCARD_Word_Length SMARTCARD Word Length |
Kojto | 90:cb3d968589d8 | 246 | * @{ |
Kojto | 90:cb3d968589d8 | 247 | */ |
Kojto | 90:cb3d968589d8 | 248 | #define SMARTCARD_WORDLENGTH_9B ((uint32_t)USART_CR1_M0) |
Kojto | 90:cb3d968589d8 | 249 | #define IS_SMARTCARD_WORD_LENGTH(LENGTH) ((LENGTH) == SMARTCARD_WORDLENGTH_9B) |
Kojto | 90:cb3d968589d8 | 250 | /** |
Kojto | 90:cb3d968589d8 | 251 | * @} |
Kojto | 90:cb3d968589d8 | 252 | */ |
Kojto | 90:cb3d968589d8 | 253 | |
Kojto | 90:cb3d968589d8 | 254 | /** @defgroup SMARTCARD_Stop_Bits SMARTCARD Stop Bits |
Kojto | 90:cb3d968589d8 | 255 | * @{ |
Kojto | 90:cb3d968589d8 | 256 | */ |
Kojto | 90:cb3d968589d8 | 257 | #define SMARTCARD_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP)) |
Kojto | 90:cb3d968589d8 | 258 | #define IS_SMARTCARD_STOPBITS(STOPBITS) ((STOPBITS) == SMARTCARD_STOPBITS_1_5) |
Kojto | 90:cb3d968589d8 | 259 | /** |
Kojto | 90:cb3d968589d8 | 260 | * @} |
Kojto | 90:cb3d968589d8 | 261 | */ |
Kojto | 90:cb3d968589d8 | 262 | |
Kojto | 90:cb3d968589d8 | 263 | /** @defgroup SMARTCARD_Parity SMARTCARD Parity |
Kojto | 90:cb3d968589d8 | 264 | * @{ |
Kojto | 90:cb3d968589d8 | 265 | */ |
Kojto | 90:cb3d968589d8 | 266 | #define SMARTCARD_PARITY_EVEN ((uint16_t)USART_CR1_PCE) |
Kojto | 90:cb3d968589d8 | 267 | #define SMARTCARD_PARITY_ODD ((uint16_t)(USART_CR1_PCE | USART_CR1_PS)) |
Kojto | 90:cb3d968589d8 | 268 | #define IS_SMARTCARD_PARITY(PARITY) (((PARITY) == SMARTCARD_PARITY_EVEN) || \ |
Kojto | 90:cb3d968589d8 | 269 | ((PARITY) == SMARTCARD_PARITY_ODD)) |
Kojto | 90:cb3d968589d8 | 270 | /** |
Kojto | 90:cb3d968589d8 | 271 | * @} |
Kojto | 90:cb3d968589d8 | 272 | */ |
Kojto | 90:cb3d968589d8 | 273 | |
Kojto | 90:cb3d968589d8 | 274 | /** @defgroup SMARTCARD_Mode SMARTCARD Transfer Mode |
Kojto | 90:cb3d968589d8 | 275 | * @{ |
Kojto | 90:cb3d968589d8 | 276 | */ |
Kojto | 90:cb3d968589d8 | 277 | #define SMARTCARD_MODE_RX ((uint16_t)USART_CR1_RE) |
Kojto | 90:cb3d968589d8 | 278 | #define SMARTCARD_MODE_TX ((uint16_t)USART_CR1_TE) |
Kojto | 90:cb3d968589d8 | 279 | #define SMARTCARD_MODE_TX_RX ((uint16_t)(USART_CR1_TE |USART_CR1_RE)) |
Kojto | 90:cb3d968589d8 | 280 | #define IS_SMARTCARD_MODE(MODE) ((((MODE) & (uint16_t)0xFFF3) == 0x00) && ((MODE) != (uint16_t)0x00)) |
Kojto | 90:cb3d968589d8 | 281 | /** |
Kojto | 90:cb3d968589d8 | 282 | * @} |
Kojto | 90:cb3d968589d8 | 283 | */ |
Kojto | 90:cb3d968589d8 | 284 | |
Kojto | 90:cb3d968589d8 | 285 | /** @defgroup SMARTCARD_Clock_Polarity SMARTCARD Clock Polarity |
Kojto | 90:cb3d968589d8 | 286 | * @{ |
Kojto | 90:cb3d968589d8 | 287 | */ |
Kojto | 90:cb3d968589d8 | 288 | #define SMARTCARD_POLARITY_LOW ((uint16_t)0x0000) |
Kojto | 90:cb3d968589d8 | 289 | #define SMARTCARD_POLARITY_HIGH ((uint16_t)USART_CR2_CPOL) |
Kojto | 90:cb3d968589d8 | 290 | #define IS_SMARTCARD_POLARITY(CPOL) (((CPOL) == SMARTCARD_POLARITY_LOW) || ((CPOL) == SMARTCARD_POLARITY_HIGH)) |
Kojto | 90:cb3d968589d8 | 291 | /** |
Kojto | 90:cb3d968589d8 | 292 | * @} |
Kojto | 90:cb3d968589d8 | 293 | */ |
Kojto | 90:cb3d968589d8 | 294 | |
Kojto | 90:cb3d968589d8 | 295 | /** @defgroup SMARTCARD_Clock_Phase SMARTCARD Clock Phase |
Kojto | 90:cb3d968589d8 | 296 | * @{ |
Kojto | 90:cb3d968589d8 | 297 | */ |
Kojto | 90:cb3d968589d8 | 298 | #define SMARTCARD_PHASE_1EDGE ((uint16_t)0x0000) |
Kojto | 90:cb3d968589d8 | 299 | #define SMARTCARD_PHASE_2EDGE ((uint16_t)USART_CR2_CPHA) |
Kojto | 90:cb3d968589d8 | 300 | #define IS_SMARTCARD_PHASE(CPHA) (((CPHA) == SMARTCARD_PHASE_1EDGE) || ((CPHA) == SMARTCARD_PHASE_2EDGE)) |
Kojto | 90:cb3d968589d8 | 301 | /** |
Kojto | 90:cb3d968589d8 | 302 | * @} |
Kojto | 90:cb3d968589d8 | 303 | */ |
Kojto | 90:cb3d968589d8 | 304 | |
Kojto | 90:cb3d968589d8 | 305 | /** @defgroup SMARTCARD_Last_Bit SMARTCARD Last Bit |
Kojto | 90:cb3d968589d8 | 306 | * @{ |
Kojto | 90:cb3d968589d8 | 307 | */ |
Kojto | 90:cb3d968589d8 | 308 | #define SMARTCARD_LASTBIT_DISABLED ((uint16_t)0x0000) |
Kojto | 90:cb3d968589d8 | 309 | #define SMARTCARD_LASTBIT_ENABLED ((uint16_t)USART_CR2_LBCL) |
Kojto | 90:cb3d968589d8 | 310 | #define IS_SMARTCARD_LASTBIT(LASTBIT) (((LASTBIT) == SMARTCARD_LASTBIT_DISABLED) || \ |
Kojto | 90:cb3d968589d8 | 311 | ((LASTBIT) == SMARTCARD_LASTBIT_ENABLED)) |
Kojto | 90:cb3d968589d8 | 312 | /** |
Kojto | 90:cb3d968589d8 | 313 | * @} |
Kojto | 90:cb3d968589d8 | 314 | */ |
Kojto | 90:cb3d968589d8 | 315 | |
Kojto | 90:cb3d968589d8 | 316 | /** @defgroup SMARTCARD_OneBit_Sampling SMARTCARD One Bit Sampling Method |
Kojto | 90:cb3d968589d8 | 317 | * @{ |
Kojto | 90:cb3d968589d8 | 318 | */ |
Kojto | 90:cb3d968589d8 | 319 | #define SMARTCARD_ONEBIT_SAMPLING_DISABLED ((uint16_t)0x0000) |
Kojto | 90:cb3d968589d8 | 320 | #define SMARTCARD_ONEBIT_SAMPLING_ENABLED ((uint16_t)USART_CR3_ONEBIT) |
Kojto | 90:cb3d968589d8 | 321 | #define IS_SMARTCARD_ONEBIT_SAMPLING(ONEBIT) (((ONEBIT) == SMARTCARD_ONEBIT_SAMPLING_DISABLED) || \ |
Kojto | 90:cb3d968589d8 | 322 | ((ONEBIT) == SMARTCARD_ONEBIT_SAMPLING_ENABLED)) |
Kojto | 90:cb3d968589d8 | 323 | /** |
Kojto | 90:cb3d968589d8 | 324 | * @} |
Kojto | 90:cb3d968589d8 | 325 | */ |
Kojto | 90:cb3d968589d8 | 326 | |
Kojto | 90:cb3d968589d8 | 327 | /** @defgroup SMARTCARD_NACK_State SMARTCARD NACK State |
Kojto | 90:cb3d968589d8 | 328 | * @{ |
Kojto | 90:cb3d968589d8 | 329 | */ |
Kojto | 90:cb3d968589d8 | 330 | #define SMARTCARD_NACK_ENABLED ((uint16_t)USART_CR3_NACK) |
Kojto | 90:cb3d968589d8 | 331 | #define SMARTCARD_NACK_DISABLED ((uint16_t)0x0000) |
Kojto | 90:cb3d968589d8 | 332 | #define IS_SMARTCARD_NACK(NACK) (((NACK) == SMARTCARD_NACK_ENABLED) || \ |
Kojto | 90:cb3d968589d8 | 333 | ((NACK) == SMARTCARD_NACK_DISABLED)) |
Kojto | 90:cb3d968589d8 | 334 | /** |
Kojto | 90:cb3d968589d8 | 335 | * @} |
Kojto | 90:cb3d968589d8 | 336 | */ |
Kojto | 90:cb3d968589d8 | 337 | |
Kojto | 90:cb3d968589d8 | 338 | /** @defgroup SMARTCARD_Timeout_Enable SMARTCARD Timeout Enable |
Kojto | 90:cb3d968589d8 | 339 | * @{ |
Kojto | 90:cb3d968589d8 | 340 | */ |
Kojto | 90:cb3d968589d8 | 341 | #define SMARTCARD_TIMEOUT_DISABLED ((uint32_t)0x00000000) |
Kojto | 90:cb3d968589d8 | 342 | #define SMARTCARD_TIMEOUT_ENABLED ((uint32_t)USART_CR2_RTOEN) |
Kojto | 90:cb3d968589d8 | 343 | #define IS_SMARTCARD_TIMEOUT(TIMEOUT) (((TIMEOUT) == SMARTCARD_TIMEOUT_DISABLED) || \ |
Kojto | 90:cb3d968589d8 | 344 | ((TIMEOUT) == SMARTCARD_TIMEOUT_ENABLED)) |
Kojto | 90:cb3d968589d8 | 345 | /** |
Kojto | 90:cb3d968589d8 | 346 | * @} |
Kojto | 90:cb3d968589d8 | 347 | */ |
Kojto | 90:cb3d968589d8 | 348 | |
Kojto | 90:cb3d968589d8 | 349 | /** @defgroup SMARTCARD_Advanced_Features_Initialization_Type SMARTCARD advanced feature initialization type |
Kojto | 90:cb3d968589d8 | 350 | * @{ |
Kojto | 90:cb3d968589d8 | 351 | */ |
Kojto | 90:cb3d968589d8 | 352 | #define SMARTCARD_ADVFEATURE_NO_INIT ((uint32_t)0x00000000) |
Kojto | 90:cb3d968589d8 | 353 | #define SMARTCARD_ADVFEATURE_TXINVERT_INIT ((uint32_t)0x00000001) |
Kojto | 90:cb3d968589d8 | 354 | #define SMARTCARD_ADVFEATURE_RXINVERT_INIT ((uint32_t)0x00000002) |
Kojto | 90:cb3d968589d8 | 355 | #define SMARTCARD_ADVFEATURE_DATAINVERT_INIT ((uint32_t)0x00000004) |
Kojto | 90:cb3d968589d8 | 356 | #define SMARTCARD_ADVFEATURE_SWAP_INIT ((uint32_t)0x00000008) |
Kojto | 90:cb3d968589d8 | 357 | #define SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT ((uint32_t)0x00000010) |
Kojto | 90:cb3d968589d8 | 358 | #define SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT ((uint32_t)0x00000020) |
Kojto | 90:cb3d968589d8 | 359 | #define SMARTCARD_ADVFEATURE_MSBFIRST_INIT ((uint32_t)0x00000080) |
Kojto | 90:cb3d968589d8 | 360 | #define IS_SMARTCARD_ADVFEATURE_INIT(INIT) ((INIT) <= (SMARTCARD_ADVFEATURE_NO_INIT | \ |
Kojto | 90:cb3d968589d8 | 361 | SMARTCARD_ADVFEATURE_TXINVERT_INIT | \ |
Kojto | 90:cb3d968589d8 | 362 | SMARTCARD_ADVFEATURE_RXINVERT_INIT | \ |
Kojto | 90:cb3d968589d8 | 363 | SMARTCARD_ADVFEATURE_DATAINVERT_INIT | \ |
Kojto | 90:cb3d968589d8 | 364 | SMARTCARD_ADVFEATURE_SWAP_INIT | \ |
Kojto | 90:cb3d968589d8 | 365 | SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT | \ |
Kojto | 90:cb3d968589d8 | 366 | SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT | \ |
Kojto | 90:cb3d968589d8 | 367 | SMARTCARD_ADVFEATURE_MSBFIRST_INIT)) |
Kojto | 90:cb3d968589d8 | 368 | /** |
Kojto | 90:cb3d968589d8 | 369 | * @} |
Kojto | 90:cb3d968589d8 | 370 | */ |
Kojto | 90:cb3d968589d8 | 371 | |
Kojto | 90:cb3d968589d8 | 372 | /** @defgroup SMARTCARD_Tx_Inv SMARTCARD advanced feature TX pin active level inversion |
Kojto | 90:cb3d968589d8 | 373 | * @{ |
Kojto | 90:cb3d968589d8 | 374 | */ |
Kojto | 90:cb3d968589d8 | 375 | #define SMARTCARD_ADVFEATURE_TXINV_DISABLE ((uint32_t)0x00000000) |
Kojto | 90:cb3d968589d8 | 376 | #define SMARTCARD_ADVFEATURE_TXINV_ENABLE ((uint32_t)USART_CR2_TXINV) |
Kojto | 90:cb3d968589d8 | 377 | #define IS_SMARTCARD_ADVFEATURE_TXINV(TXINV) (((TXINV) == SMARTCARD_ADVFEATURE_TXINV_DISABLE) || \ |
Kojto | 90:cb3d968589d8 | 378 | ((TXINV) == SMARTCARD_ADVFEATURE_TXINV_ENABLE)) |
Kojto | 90:cb3d968589d8 | 379 | /** |
Kojto | 90:cb3d968589d8 | 380 | * @} |
Kojto | 90:cb3d968589d8 | 381 | */ |
Kojto | 90:cb3d968589d8 | 382 | |
Kojto | 90:cb3d968589d8 | 383 | /** @defgroup SMARTCARD_Rx_Inv SMARTCARD advanced feature RX pin active level inversion |
Kojto | 90:cb3d968589d8 | 384 | * @{ |
Kojto | 90:cb3d968589d8 | 385 | */ |
Kojto | 90:cb3d968589d8 | 386 | #define SMARTCARD_ADVFEATURE_RXINV_DISABLE ((uint32_t)0x00000000) |
Kojto | 90:cb3d968589d8 | 387 | #define SMARTCARD_ADVFEATURE_RXINV_ENABLE ((uint32_t)USART_CR2_RXINV) |
Kojto | 90:cb3d968589d8 | 388 | #define IS_SMARTCARD_ADVFEATURE_RXINV(RXINV) (((RXINV) == SMARTCARD_ADVFEATURE_RXINV_DISABLE) || \ |
Kojto | 90:cb3d968589d8 | 389 | ((RXINV) == SMARTCARD_ADVFEATURE_RXINV_ENABLE)) |
Kojto | 90:cb3d968589d8 | 390 | /** |
Kojto | 90:cb3d968589d8 | 391 | * @} |
Kojto | 90:cb3d968589d8 | 392 | */ |
Kojto | 90:cb3d968589d8 | 393 | |
Kojto | 90:cb3d968589d8 | 394 | /** @defgroup SMARTCARD_Data_Inv SMARTCARD advanced feature Binary Data inversion |
Kojto | 90:cb3d968589d8 | 395 | * @{ |
Kojto | 90:cb3d968589d8 | 396 | */ |
Kojto | 90:cb3d968589d8 | 397 | #define SMARTCARD_ADVFEATURE_DATAINV_DISABLE ((uint32_t)0x00000000) |
Kojto | 90:cb3d968589d8 | 398 | #define SMARTCARD_ADVFEATURE_DATAINV_ENABLE ((uint32_t)USART_CR2_DATAINV) |
Kojto | 90:cb3d968589d8 | 399 | #define IS_SMARTCARD_ADVFEATURE_DATAINV(DATAINV) (((DATAINV) == SMARTCARD_ADVFEATURE_DATAINV_DISABLE) || \ |
Kojto | 90:cb3d968589d8 | 400 | ((DATAINV) == SMARTCARD_ADVFEATURE_DATAINV_ENABLE)) |
Kojto | 90:cb3d968589d8 | 401 | /** |
Kojto | 90:cb3d968589d8 | 402 | * @} |
Kojto | 90:cb3d968589d8 | 403 | */ |
Kojto | 90:cb3d968589d8 | 404 | |
Kojto | 90:cb3d968589d8 | 405 | /** @defgroup SMARTCARD_Rx_Tx_Swap SMARTCARD advanced feature RX TX pins swap |
Kojto | 90:cb3d968589d8 | 406 | * @{ |
Kojto | 90:cb3d968589d8 | 407 | */ |
Kojto | 90:cb3d968589d8 | 408 | #define SMARTCARD_ADVFEATURE_SWAP_DISABLE ((uint32_t)0x00000000) |
Kojto | 90:cb3d968589d8 | 409 | #define SMARTCARD_ADVFEATURE_SWAP_ENABLE ((uint32_t)USART_CR2_SWAP) |
Kojto | 90:cb3d968589d8 | 410 | #define IS_SMARTCARD_ADVFEATURE_SWAP(SWAP) (((SWAP) == SMARTCARD_ADVFEATURE_SWAP_DISABLE) || \ |
Kojto | 90:cb3d968589d8 | 411 | ((SWAP) == SMARTCARD_ADVFEATURE_SWAP_ENABLE)) |
Kojto | 90:cb3d968589d8 | 412 | /** |
Kojto | 90:cb3d968589d8 | 413 | * @} |
Kojto | 90:cb3d968589d8 | 414 | */ |
Kojto | 90:cb3d968589d8 | 415 | |
Kojto | 90:cb3d968589d8 | 416 | /** @defgroup SMARTCARD_Overrun_Disable SMARTCARD advanced feature Overrun Disable |
Kojto | 90:cb3d968589d8 | 417 | * @{ |
Kojto | 90:cb3d968589d8 | 418 | */ |
Kojto | 90:cb3d968589d8 | 419 | #define SMARTCARD_ADVFEATURE_OVERRUN_ENABLE ((uint32_t)0x00000000) |
Kojto | 90:cb3d968589d8 | 420 | #define SMARTCARD_ADVFEATURE_OVERRUN_DISABLE ((uint32_t)USART_CR3_OVRDIS) |
Kojto | 90:cb3d968589d8 | 421 | #define IS_SMARTCARD_OVERRUN(OVERRUN) (((OVERRUN) == SMARTCARD_ADVFEATURE_OVERRUN_ENABLE) || \ |
Kojto | 90:cb3d968589d8 | 422 | ((OVERRUN) == SMARTCARD_ADVFEATURE_OVERRUN_DISABLE)) |
Kojto | 90:cb3d968589d8 | 423 | /** |
Kojto | 90:cb3d968589d8 | 424 | * @} |
Kojto | 90:cb3d968589d8 | 425 | */ |
Kojto | 90:cb3d968589d8 | 426 | |
Kojto | 90:cb3d968589d8 | 427 | /** @defgroup SMARTCARD_DMA_Disable_on_Rx_Error SMARTCARD advanced feature DMA Disable on Rx Error |
Kojto | 90:cb3d968589d8 | 428 | * @{ |
Kojto | 90:cb3d968589d8 | 429 | */ |
Kojto | 90:cb3d968589d8 | 430 | #define SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR ((uint32_t)0x00000000) |
Kojto | 90:cb3d968589d8 | 431 | #define SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR ((uint32_t)USART_CR3_DDRE) |
Kojto | 90:cb3d968589d8 | 432 | #define IS_SMARTCARD_ADVFEATURE_DMAONRXERROR(DMA) (((DMA) == SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR) || \ |
Kojto | 90:cb3d968589d8 | 433 | ((DMA) == SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR)) |
Kojto | 90:cb3d968589d8 | 434 | /** |
Kojto | 90:cb3d968589d8 | 435 | * @} |
Kojto | 90:cb3d968589d8 | 436 | */ |
Kojto | 90:cb3d968589d8 | 437 | |
Kojto | 90:cb3d968589d8 | 438 | /** @defgroup SMARTCARD_MSB_First SMARTCARD advanced feature MSB first |
Kojto | 90:cb3d968589d8 | 439 | * @{ |
Kojto | 90:cb3d968589d8 | 440 | */ |
Kojto | 90:cb3d968589d8 | 441 | #define SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE ((uint32_t)0x00000000) |
Kojto | 90:cb3d968589d8 | 442 | #define SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE ((uint32_t)USART_CR2_MSBFIRST) |
Kojto | 90:cb3d968589d8 | 443 | #define IS_SMARTCARD_ADVFEATURE_MSBFIRST(MSBFIRST) (((MSBFIRST) == SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE) || \ |
Kojto | 90:cb3d968589d8 | 444 | ((MSBFIRST) == SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE)) |
Kojto | 90:cb3d968589d8 | 445 | /** |
Kojto | 90:cb3d968589d8 | 446 | * @} |
Kojto | 90:cb3d968589d8 | 447 | */ |
Kojto | 90:cb3d968589d8 | 448 | |
Kojto | 90:cb3d968589d8 | 449 | /** @defgroup SMARTCARD_Flags SMARTCARD Flags |
Kojto | 90:cb3d968589d8 | 450 | * Elements values convention: 0xXXXX |
Kojto | 90:cb3d968589d8 | 451 | * - 0xXXXX : Flag mask in the ISR register |
Kojto | 90:cb3d968589d8 | 452 | * @{ |
Kojto | 90:cb3d968589d8 | 453 | */ |
Kojto | 90:cb3d968589d8 | 454 | #define SMARTCARD_FLAG_REACK ((uint32_t)0x00400000) |
Kojto | 90:cb3d968589d8 | 455 | #define SMARTCARD_FLAG_TEACK ((uint32_t)0x00200000) |
Kojto | 90:cb3d968589d8 | 456 | #define SMARTCARD_FLAG_BUSY ((uint32_t)0x00010000) |
Kojto | 90:cb3d968589d8 | 457 | #define SMARTCARD_FLAG_EOBF ((uint32_t)0x00001000) |
Kojto | 90:cb3d968589d8 | 458 | #define SMARTCARD_FLAG_RTOF ((uint32_t)0x00000800) |
Kojto | 90:cb3d968589d8 | 459 | #define SMARTCARD_FLAG_TXE ((uint32_t)0x00000080) |
Kojto | 90:cb3d968589d8 | 460 | #define SMARTCARD_FLAG_TC ((uint32_t)0x00000040) |
Kojto | 90:cb3d968589d8 | 461 | #define SMARTCARD_FLAG_RXNE ((uint32_t)0x00000020) |
Kojto | 90:cb3d968589d8 | 462 | #define SMARTCARD_FLAG_ORE ((uint32_t)0x00000008) |
Kojto | 90:cb3d968589d8 | 463 | #define SMARTCARD_FLAG_NE ((uint32_t)0x00000004) |
Kojto | 90:cb3d968589d8 | 464 | #define SMARTCARD_FLAG_FE ((uint32_t)0x00000002) |
Kojto | 90:cb3d968589d8 | 465 | #define SMARTCARD_FLAG_PE ((uint32_t)0x00000001) |
Kojto | 90:cb3d968589d8 | 466 | /** |
Kojto | 90:cb3d968589d8 | 467 | * @} |
Kojto | 90:cb3d968589d8 | 468 | */ |
Kojto | 90:cb3d968589d8 | 469 | |
Kojto | 90:cb3d968589d8 | 470 | /** @defgroup SMARTCARD_Interrupt_definition SMARTCARD Interrupts Definition |
Kojto | 90:cb3d968589d8 | 471 | * Elements values convention: 0000ZZZZ0XXYYYYYb |
Kojto | 90:cb3d968589d8 | 472 | * - YYYYY : Interrupt source position in the XX register (5bits) |
Kojto | 90:cb3d968589d8 | 473 | * - XX : Interrupt source register (2bits) |
Kojto | 90:cb3d968589d8 | 474 | * - 01: CR1 register |
Kojto | 90:cb3d968589d8 | 475 | * - 10: CR2 register |
Kojto | 90:cb3d968589d8 | 476 | * - 11: CR3 register |
Kojto | 90:cb3d968589d8 | 477 | * - ZZZZ : Flag position in the ISR register(4bits) |
Kojto | 90:cb3d968589d8 | 478 | * @{ |
Kojto | 90:cb3d968589d8 | 479 | */ |
Kojto | 90:cb3d968589d8 | 480 | |
Kojto | 90:cb3d968589d8 | 481 | #define SMARTCARD_IT_PE ((uint16_t)0x0028) |
Kojto | 90:cb3d968589d8 | 482 | #define SMARTCARD_IT_TXE ((uint16_t)0x0727) |
Kojto | 90:cb3d968589d8 | 483 | #define SMARTCARD_IT_TC ((uint16_t)0x0626) |
Kojto | 90:cb3d968589d8 | 484 | #define SMARTCARD_IT_RXNE ((uint16_t)0x0525) |
Kojto | 90:cb3d968589d8 | 485 | |
Kojto | 90:cb3d968589d8 | 486 | #define SMARTCARD_IT_ERR ((uint16_t)0x0060) |
Kojto | 90:cb3d968589d8 | 487 | #define SMARTCARD_IT_ORE ((uint16_t)0x0300) |
Kojto | 90:cb3d968589d8 | 488 | #define SMARTCARD_IT_NE ((uint16_t)0x0200) |
Kojto | 90:cb3d968589d8 | 489 | #define SMARTCARD_IT_FE ((uint16_t)0x0100) |
Kojto | 90:cb3d968589d8 | 490 | |
Kojto | 90:cb3d968589d8 | 491 | #define SMARTCARD_IT_EOB ((uint16_t)0x0C3B) |
Kojto | 90:cb3d968589d8 | 492 | #define SMARTCARD_IT_RTO ((uint16_t)0x0B3A) |
Kojto | 90:cb3d968589d8 | 493 | /** |
Kojto | 90:cb3d968589d8 | 494 | * @} |
Kojto | 90:cb3d968589d8 | 495 | */ |
Kojto | 90:cb3d968589d8 | 496 | |
Kojto | 90:cb3d968589d8 | 497 | |
Kojto | 90:cb3d968589d8 | 498 | /** @defgroup SMARTCARD_IT_CLEAR_Flags SMARTCARD Interruption Clear Flags |
Kojto | 90:cb3d968589d8 | 499 | * @{ |
Kojto | 90:cb3d968589d8 | 500 | */ |
Kojto | 90:cb3d968589d8 | 501 | #define SMARTCARD_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */ |
Kojto | 90:cb3d968589d8 | 502 | #define SMARTCARD_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */ |
Kojto | 90:cb3d968589d8 | 503 | #define SMARTCARD_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */ |
Kojto | 90:cb3d968589d8 | 504 | #define SMARTCARD_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */ |
Kojto | 90:cb3d968589d8 | 505 | #define SMARTCARD_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */ |
Kojto | 90:cb3d968589d8 | 506 | #define SMARTCARD_CLEAR_RTOF USART_ICR_RTOCF /*!< Receiver Time Out Clear Flag */ |
Kojto | 90:cb3d968589d8 | 507 | #define SMARTCARD_CLEAR_EOBF USART_ICR_EOBCF /*!< End Of Block Clear Flag */ |
Kojto | 90:cb3d968589d8 | 508 | /** |
Kojto | 90:cb3d968589d8 | 509 | * @} |
Kojto | 90:cb3d968589d8 | 510 | */ |
Kojto | 90:cb3d968589d8 | 511 | |
Kojto | 90:cb3d968589d8 | 512 | /** @defgroup SMARTCARD_Request_Parameters SMARTCARD Request Parameters |
Kojto | 90:cb3d968589d8 | 513 | * @{ |
Kojto | 90:cb3d968589d8 | 514 | */ |
Kojto | 90:cb3d968589d8 | 515 | #define SMARTCARD_RXDATA_FLUSH_REQUEST ((uint16_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */ |
Kojto | 90:cb3d968589d8 | 516 | #define SMARTCARD_TXDATA_FLUSH_REQUEST ((uint16_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */ |
Kojto | 90:cb3d968589d8 | 517 | #define IS_SMARTCARD_REQUEST_PARAMETER(PARAM) (((PARAM) == SMARTCARD_RXDATA_FLUSH_REQUEST) || \ |
Kojto | 90:cb3d968589d8 | 518 | ((PARAM) == SMARTCARD_TXDATA_FLUSH_REQUEST)) |
Kojto | 90:cb3d968589d8 | 519 | /** |
Kojto | 90:cb3d968589d8 | 520 | * @} |
Kojto | 90:cb3d968589d8 | 521 | */ |
Kojto | 90:cb3d968589d8 | 522 | |
Kojto | 90:cb3d968589d8 | 523 | |
Kojto | 90:cb3d968589d8 | 524 | /** @defgroup SMARTCARD_CR3_SCARCNT_LSB_POS SMARTCARD auto retry counter LSB position in CR3 register |
Kojto | 90:cb3d968589d8 | 525 | * @{ |
Kojto | 90:cb3d968589d8 | 526 | */ |
Kojto | 90:cb3d968589d8 | 527 | #define SMARTCARD_CR3_SCARCNT_LSB_POS ((uint32_t) 17) |
Kojto | 90:cb3d968589d8 | 528 | /** |
Kojto | 90:cb3d968589d8 | 529 | * @} |
Kojto | 90:cb3d968589d8 | 530 | */ |
Kojto | 90:cb3d968589d8 | 531 | |
Kojto | 90:cb3d968589d8 | 532 | /** @defgroup SMARTCARD_GTPR_GT_LSB_POS SMARTCARD guard time value LSB position in GTPR register |
Kojto | 90:cb3d968589d8 | 533 | * @{ |
Kojto | 90:cb3d968589d8 | 534 | */ |
Kojto | 90:cb3d968589d8 | 535 | #define SMARTCARD_GTPR_GT_LSB_POS ((uint32_t) 8) |
Kojto | 90:cb3d968589d8 | 536 | /** |
Kojto | 90:cb3d968589d8 | 537 | * @} |
Kojto | 90:cb3d968589d8 | 538 | */ |
Kojto | 90:cb3d968589d8 | 539 | |
Kojto | 90:cb3d968589d8 | 540 | /** @defgroup SMARTCARD_RTOR_BLEN_LSB_POS SMARTCARD block length LSB position in RTOR register |
Kojto | 90:cb3d968589d8 | 541 | * @{ |
Kojto | 90:cb3d968589d8 | 542 | */ |
Kojto | 90:cb3d968589d8 | 543 | #define SMARTCARD_RTOR_BLEN_LSB_POS ((uint32_t) 24) |
Kojto | 90:cb3d968589d8 | 544 | /** |
Kojto | 90:cb3d968589d8 | 545 | * @} |
Kojto | 90:cb3d968589d8 | 546 | */ |
Kojto | 90:cb3d968589d8 | 547 | |
Kojto | 90:cb3d968589d8 | 548 | /** @defgroup SMARTCARD_Interruption_Mask SMARTCARD interruptions flag mask |
Kojto | 90:cb3d968589d8 | 549 | * @{ |
Kojto | 90:cb3d968589d8 | 550 | */ |
Kojto | 90:cb3d968589d8 | 551 | #define SMARTCARD_IT_MASK ((uint16_t)0x001F) |
Kojto | 90:cb3d968589d8 | 552 | /** |
Kojto | 90:cb3d968589d8 | 553 | * @} |
Kojto | 90:cb3d968589d8 | 554 | */ |
Kojto | 90:cb3d968589d8 | 555 | |
Kojto | 90:cb3d968589d8 | 556 | /** |
Kojto | 90:cb3d968589d8 | 557 | * @} |
Kojto | 90:cb3d968589d8 | 558 | */ |
Kojto | 90:cb3d968589d8 | 559 | |
Kojto | 90:cb3d968589d8 | 560 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 561 | /** @defgroup SMARTCARD_Exported_Macros SMARTCARD Exported Macros |
Kojto | 90:cb3d968589d8 | 562 | * @{ |
Kojto | 90:cb3d968589d8 | 563 | */ |
Kojto | 90:cb3d968589d8 | 564 | |
Kojto | 90:cb3d968589d8 | 565 | /** @brief Reset SMARTCARD handle state |
Kojto | 90:cb3d968589d8 | 566 | * @param __HANDLE__: SMARTCARD handle. |
Kojto | 90:cb3d968589d8 | 567 | * @retval None |
Kojto | 90:cb3d968589d8 | 568 | */ |
Kojto | 90:cb3d968589d8 | 569 | #define __HAL_SMARTCARD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SMARTCARD_STATE_RESET) |
Kojto | 90:cb3d968589d8 | 570 | |
Kojto | 90:cb3d968589d8 | 571 | /** @brief Checks whether the specified Smartcard flag is set or not. |
Kojto | 90:cb3d968589d8 | 572 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 573 | * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral. |
Kojto | 90:cb3d968589d8 | 574 | * @param __FLAG__: specifies the flag to check. |
Kojto | 90:cb3d968589d8 | 575 | * This parameter can be one of the following values: |
Kojto | 90:cb3d968589d8 | 576 | * @arg SMARTCARD_FLAG_REACK: Receive enable ackowledge flag |
Kojto | 90:cb3d968589d8 | 577 | * @arg SMARTCARD_FLAG_TEACK: Transmit enable ackowledge flag |
Kojto | 90:cb3d968589d8 | 578 | * @arg SMARTCARD_FLAG_BUSY: Busy flag |
Kojto | 90:cb3d968589d8 | 579 | * @arg SMARTCARD_FLAG_EOBF: End of block flag |
Kojto | 90:cb3d968589d8 | 580 | * @arg SMARTCARD_FLAG_RTOF: Receiver timeout flag |
Kojto | 90:cb3d968589d8 | 581 | * @arg SMARTCARD_FLAG_TXE: Transmit data register empty flag |
Kojto | 90:cb3d968589d8 | 582 | * @arg SMARTCARD_FLAG_TC: Transmission Complete flag |
Kojto | 90:cb3d968589d8 | 583 | * @arg SMARTCARD_FLAG_RXNE: Receive data register not empty flag |
Kojto | 90:cb3d968589d8 | 584 | * @arg SMARTCARD_FLAG_ORE: OverRun Error flag |
Kojto | 90:cb3d968589d8 | 585 | * @arg SMARTCARD_FLAG_NE: Noise Error flag |
Kojto | 90:cb3d968589d8 | 586 | * @arg SMARTCARD_FLAG_FE: Framing Error flag |
Kojto | 90:cb3d968589d8 | 587 | * @arg SMARTCARD_FLAG_PE: Parity Error flag |
Kojto | 90:cb3d968589d8 | 588 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
Kojto | 90:cb3d968589d8 | 589 | */ |
Kojto | 90:cb3d968589d8 | 590 | #define __HAL_SMARTCARD_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__)) |
Kojto | 90:cb3d968589d8 | 591 | |
Kojto | 90:cb3d968589d8 | 592 | |
Kojto | 90:cb3d968589d8 | 593 | /** @brief Enables the specified SmartCard interrupt. |
Kojto | 90:cb3d968589d8 | 594 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 595 | * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral. |
Kojto | 90:cb3d968589d8 | 596 | * @param __INTERRUPT__: specifies the SMARTCARD interrupt to enable. |
Kojto | 90:cb3d968589d8 | 597 | * This parameter can be one of the following values: |
Kojto | 90:cb3d968589d8 | 598 | * @arg SMARTCARD_IT_EOBF: End Of Block interrupt |
Kojto | 90:cb3d968589d8 | 599 | * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt |
Kojto | 90:cb3d968589d8 | 600 | * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 90:cb3d968589d8 | 601 | * @arg SMARTCARD_IT_TC: Transmission complete interrupt |
Kojto | 90:cb3d968589d8 | 602 | * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 90:cb3d968589d8 | 603 | * @arg SMARTCARD_IT_PE: Parity Error interrupt |
Kojto | 90:cb3d968589d8 | 604 | * @arg SMARTCARD_IT_ERR: Error interrupt(Frame error, noise error, overrun error) |
Kojto | 90:cb3d968589d8 | 605 | * @retval None |
Kojto | 90:cb3d968589d8 | 606 | */ |
Kojto | 90:cb3d968589d8 | 607 | #define __HAL_SMARTCARD_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
Kojto | 90:cb3d968589d8 | 608 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
Kojto | 90:cb3d968589d8 | 609 | ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK)))) |
Kojto | 90:cb3d968589d8 | 610 | |
Kojto | 90:cb3d968589d8 | 611 | /** @brief Disables the specified SmartCard interrupt. |
Kojto | 90:cb3d968589d8 | 612 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 613 | * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral. |
Kojto | 90:cb3d968589d8 | 614 | * @param __INTERRUPT__: specifies the SMARTCARD interrupt to disable. |
Kojto | 90:cb3d968589d8 | 615 | * This parameter can be one of the following values: |
Kojto | 90:cb3d968589d8 | 616 | * @arg SMARTCARD_IT_EOBF: End Of Block interrupt |
Kojto | 90:cb3d968589d8 | 617 | * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt |
Kojto | 90:cb3d968589d8 | 618 | * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 90:cb3d968589d8 | 619 | * @arg SMARTCARD_IT_TC: Transmission complete interrupt |
Kojto | 90:cb3d968589d8 | 620 | * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 90:cb3d968589d8 | 621 | * @arg SMARTCARD_IT_PE: Parity Error interrupt |
Kojto | 90:cb3d968589d8 | 622 | * @arg SMARTCARD_IT_ERR: Error interrupt(Frame error, noise error, overrun error) |
Kojto | 90:cb3d968589d8 | 623 | * @retval None |
Kojto | 90:cb3d968589d8 | 624 | */ |
Kojto | 90:cb3d968589d8 | 625 | #define __HAL_SMARTCARD_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
Kojto | 90:cb3d968589d8 | 626 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
Kojto | 90:cb3d968589d8 | 627 | ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK)))) |
Kojto | 90:cb3d968589d8 | 628 | |
Kojto | 90:cb3d968589d8 | 629 | |
Kojto | 90:cb3d968589d8 | 630 | /** @brief Checks whether the specified SmartCard interrupt has occurred or not. |
Kojto | 90:cb3d968589d8 | 631 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 632 | * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral. |
Kojto | 90:cb3d968589d8 | 633 | * @param __IT__: specifies the SMARTCARD interrupt to check. |
Kojto | 90:cb3d968589d8 | 634 | * This parameter can be one of the following values: |
Kojto | 90:cb3d968589d8 | 635 | * @arg SMARTCARD_IT_EOBF: End Of Block interrupt |
Kojto | 90:cb3d968589d8 | 636 | * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt |
Kojto | 90:cb3d968589d8 | 637 | * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 90:cb3d968589d8 | 638 | * @arg SMARTCARD_IT_TC: Transmission complete interrupt |
Kojto | 90:cb3d968589d8 | 639 | * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 90:cb3d968589d8 | 640 | * @arg SMARTCARD_IT_ORE: OverRun Error interrupt |
Kojto | 90:cb3d968589d8 | 641 | * @arg SMARTCARD_IT_NE: Noise Error interrupt |
Kojto | 90:cb3d968589d8 | 642 | * @arg SMARTCARD_IT_FE: Framing Error interrupt |
Kojto | 90:cb3d968589d8 | 643 | * @arg SMARTCARD_IT_PE: Parity Error interrupt |
Kojto | 90:cb3d968589d8 | 644 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 90:cb3d968589d8 | 645 | */ |
Kojto | 90:cb3d968589d8 | 646 | #define __HAL_SMARTCARD_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & ((uint32_t)1 << ((__IT__)>> 0x08))) |
Kojto | 90:cb3d968589d8 | 647 | |
Kojto | 90:cb3d968589d8 | 648 | /** @brief Checks whether the specified SmartCard interrupt interrupt source is enabled. |
Kojto | 90:cb3d968589d8 | 649 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 650 | * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral. |
Kojto | 90:cb3d968589d8 | 651 | * @param __IT__: specifies the SMARTCARD interrupt source to check. |
Kojto | 90:cb3d968589d8 | 652 | * This parameter can be one of the following values: |
Kojto | 90:cb3d968589d8 | 653 | * @arg SMARTCARD_IT_EOBF: End Of Block interrupt |
Kojto | 90:cb3d968589d8 | 654 | * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt |
Kojto | 90:cb3d968589d8 | 655 | * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 90:cb3d968589d8 | 656 | * @arg SMARTCARD_IT_TC: Transmission complete interrupt |
Kojto | 90:cb3d968589d8 | 657 | * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 90:cb3d968589d8 | 658 | * @arg SMARTCARD_IT_ORE: OverRun Error interrupt |
Kojto | 90:cb3d968589d8 | 659 | * @arg SMARTCARD_IT_NE: Noise Error interrupt |
Kojto | 90:cb3d968589d8 | 660 | * @arg SMARTCARD_IT_FE: Framing Error interrupt |
Kojto | 90:cb3d968589d8 | 661 | * @arg SMARTCARD_IT_PE: Parity Error interrupt |
Kojto | 90:cb3d968589d8 | 662 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 90:cb3d968589d8 | 663 | */ |
Kojto | 90:cb3d968589d8 | 664 | #define __HAL_SMARTCARD_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5U) == 1)? (__HANDLE__)->Instance->CR1 : \ |
Kojto | 90:cb3d968589d8 | 665 | (((((uint8_t)(__IT__)) >> 5U) == 2)? (__HANDLE__)->Instance->CR2 : \ |
Kojto | 90:cb3d968589d8 | 666 | (__HANDLE__)->Instance->CR3)) & ((uint32_t)1 << (((uint16_t)(__IT__)) & SMARTCARD_IT_MASK))) |
Kojto | 90:cb3d968589d8 | 667 | |
Kojto | 90:cb3d968589d8 | 668 | |
Kojto | 90:cb3d968589d8 | 669 | /** @brief Clears the specified SMARTCARD ISR flag, in setting the proper ICR register flag. |
Kojto | 90:cb3d968589d8 | 670 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 671 | * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral. |
Kojto | 90:cb3d968589d8 | 672 | * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set |
Kojto | 90:cb3d968589d8 | 673 | * to clear the corresponding interrupt |
Kojto | 90:cb3d968589d8 | 674 | * This parameter can be one of the following values: |
Kojto | 90:cb3d968589d8 | 675 | * @arg USART_CLEAR_PEF: Parity Error Clear Flag |
Kojto | 90:cb3d968589d8 | 676 | * @arg USART_CLEAR_FEF: Framing Error Clear Flag |
Kojto | 90:cb3d968589d8 | 677 | * @arg USART_CLEAR_NEF: Noise detected Clear Flag |
Kojto | 90:cb3d968589d8 | 678 | * @arg USART_CLEAR_OREF: OverRun Error Clear Flag |
Kojto | 90:cb3d968589d8 | 679 | * @arg USART_CLEAR_TCF: Transmission Complete Clear Flag |
Kojto | 90:cb3d968589d8 | 680 | * @arg USART_CLEAR_RTOF: Receiver Time Out Clear Flag |
Kojto | 90:cb3d968589d8 | 681 | * @arg USART_CLEAR_EOBF: End Of Block Clear Flag |
Kojto | 90:cb3d968589d8 | 682 | * @retval None |
Kojto | 90:cb3d968589d8 | 683 | */ |
Kojto | 90:cb3d968589d8 | 684 | #define __HAL_SMARTCARD_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__)) |
Kojto | 90:cb3d968589d8 | 685 | |
Kojto | 90:cb3d968589d8 | 686 | /** @brief Set a specific SMARTCARD request flag. |
Kojto | 90:cb3d968589d8 | 687 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 688 | * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral. |
Kojto | 90:cb3d968589d8 | 689 | * @param __REQ__: specifies the request flag to set |
Kojto | 90:cb3d968589d8 | 690 | * This parameter can be one of the following values: |
Kojto | 90:cb3d968589d8 | 691 | * @arg SMARTCARD_RXDATA_FLUSH_REQUEST: Receive Data flush Request |
Kojto | 90:cb3d968589d8 | 692 | * @arg SMARTCARD_TXDATA_FLUSH_REQUEST: Transmit data flush Request |
Kojto | 90:cb3d968589d8 | 693 | * |
Kojto | 90:cb3d968589d8 | 694 | * @retval None |
Kojto | 90:cb3d968589d8 | 695 | */ |
Kojto | 90:cb3d968589d8 | 696 | #define __HAL_SMARTCARD_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint16_t)(__REQ__)) |
Kojto | 90:cb3d968589d8 | 697 | |
Kojto | 90:cb3d968589d8 | 698 | /** @brief Enable the USART associated to the SMARTCARD Handle |
Kojto | 90:cb3d968589d8 | 699 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 700 | * The Handle Instance can be UARTx where x: 1, 2, 3 to select the USART peripheral |
Kojto | 90:cb3d968589d8 | 701 | * @retval None |
Kojto | 90:cb3d968589d8 | 702 | */ |
Kojto | 90:cb3d968589d8 | 703 | #define __HAL_SMARTCARD_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE) |
Kojto | 90:cb3d968589d8 | 704 | |
Kojto | 90:cb3d968589d8 | 705 | /** @brief Disable the USART associated to the SMARTCARD Handle |
Kojto | 90:cb3d968589d8 | 706 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 707 | * The Handle Instance can be UARTx where x: 1, 2, 3 to select the USART peripheral |
Kojto | 90:cb3d968589d8 | 708 | * @retval None |
Kojto | 90:cb3d968589d8 | 709 | */ |
Kojto | 90:cb3d968589d8 | 710 | #define __HAL_SMARTCARD_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE) |
Kojto | 90:cb3d968589d8 | 711 | |
Kojto | 90:cb3d968589d8 | 712 | /** @brief Check the Baud rate range. The maximum Baud Rate is derived from the |
Kojto | 90:cb3d968589d8 | 713 | * maximum clock on F0 (i.e. 48 MHz) divided by the oversampling used |
Kojto | 90:cb3d968589d8 | 714 | * on the SMARTCARD (i.e. 16) |
Kojto | 90:cb3d968589d8 | 715 | * @param __BAUDRATE__: Baud rate set by the configuration function. |
Kojto | 90:cb3d968589d8 | 716 | * @retval Test result (TRUE or FALSE) |
Kojto | 90:cb3d968589d8 | 717 | */ |
Kojto | 90:cb3d968589d8 | 718 | #define IS_SMARTCARD_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 4500001) |
Kojto | 90:cb3d968589d8 | 719 | |
Kojto | 90:cb3d968589d8 | 720 | /** @brief Check the block length range. The maximum SMARTCARD block length is 0xFF. |
Kojto | 90:cb3d968589d8 | 721 | * @param __LENGTH__: block length. |
Kojto | 90:cb3d968589d8 | 722 | * @retval Test result (TRUE or FALSE) |
Kojto | 90:cb3d968589d8 | 723 | */ |
Kojto | 90:cb3d968589d8 | 724 | #define IS_SMARTCARD_BLOCKLENGTH(__LENGTH__) ((__LENGTH__) <= 0xFF) |
Kojto | 90:cb3d968589d8 | 725 | |
Kojto | 90:cb3d968589d8 | 726 | /** @brief Check the receiver timeout value. The maximum SMARTCARD receiver timeout |
Kojto | 90:cb3d968589d8 | 727 | * value is 0xFFFFFF. |
Kojto | 90:cb3d968589d8 | 728 | * @param __TIMEOUTVALUE__: receiver timeout value. |
Kojto | 90:cb3d968589d8 | 729 | * @retval Test result (TRUE or FALSE) |
Kojto | 90:cb3d968589d8 | 730 | */ |
Kojto | 90:cb3d968589d8 | 731 | #define IS_SMARTCARD_TIMEOUT_VALUE(__TIMEOUTVALUE__) ((__TIMEOUTVALUE__) <= 0xFFFFFF) |
Kojto | 90:cb3d968589d8 | 732 | |
Kojto | 90:cb3d968589d8 | 733 | /** @brief Check the SMARTCARD autoretry counter value. The maximum number of |
Kojto | 90:cb3d968589d8 | 734 | * retransmissions is 0x7. |
Kojto | 90:cb3d968589d8 | 735 | * @param __COUNT__: number of retransmissions |
Kojto | 90:cb3d968589d8 | 736 | * @retval Test result (TRUE or FALSE) |
Kojto | 90:cb3d968589d8 | 737 | */ |
Kojto | 90:cb3d968589d8 | 738 | #define IS_SMARTCARD_AUTORETRY_COUNT(__COUNT__) ((__COUNT__) <= 0x7) |
Kojto | 90:cb3d968589d8 | 739 | |
Kojto | 90:cb3d968589d8 | 740 | /** |
Kojto | 90:cb3d968589d8 | 741 | * @} |
Kojto | 90:cb3d968589d8 | 742 | */ |
Kojto | 90:cb3d968589d8 | 743 | |
Kojto | 90:cb3d968589d8 | 744 | /* Include SMARTCARD HAL Extension module */ |
Kojto | 90:cb3d968589d8 | 745 | #include "stm32f0xx_hal_smartcard_ex.h" |
Kojto | 90:cb3d968589d8 | 746 | |
Kojto | 90:cb3d968589d8 | 747 | |
Kojto | 90:cb3d968589d8 | 748 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 749 | |
Kojto | 90:cb3d968589d8 | 750 | /** @addtogroup SMARTCARD_Exported_Functions SMARTCARD Exported Functions |
Kojto | 90:cb3d968589d8 | 751 | * @{ |
Kojto | 90:cb3d968589d8 | 752 | */ |
Kojto | 90:cb3d968589d8 | 753 | |
Kojto | 90:cb3d968589d8 | 754 | /** @addtogroup SMARTCARD_Exported_Functions_Group1 Initialization and de-initialization functions |
Kojto | 90:cb3d968589d8 | 755 | * @{ |
Kojto | 90:cb3d968589d8 | 756 | */ |
Kojto | 90:cb3d968589d8 | 757 | |
Kojto | 90:cb3d968589d8 | 758 | /* Initialization and de-initialization functions ****************************/ |
Kojto | 90:cb3d968589d8 | 759 | HAL_StatusTypeDef HAL_SMARTCARD_Init(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 760 | HAL_StatusTypeDef HAL_SMARTCARD_DeInit(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 761 | void HAL_SMARTCARD_MspInit(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 762 | void HAL_SMARTCARD_MspDeInit(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 763 | /** |
Kojto | 90:cb3d968589d8 | 764 | * @} |
Kojto | 90:cb3d968589d8 | 765 | */ |
Kojto | 90:cb3d968589d8 | 766 | |
Kojto | 90:cb3d968589d8 | 767 | /** @addtogroup SMARTCARD_Exported_Functions_Group2 IO operation functions |
Kojto | 90:cb3d968589d8 | 768 | * @{ |
Kojto | 90:cb3d968589d8 | 769 | */ |
Kojto | 90:cb3d968589d8 | 770 | /* IO operation functions *****************************************************/ |
Kojto | 90:cb3d968589d8 | 771 | HAL_StatusTypeDef HAL_SMARTCARD_Transmit(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 90:cb3d968589d8 | 772 | HAL_StatusTypeDef HAL_SMARTCARD_Receive(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 90:cb3d968589d8 | 773 | HAL_StatusTypeDef HAL_SMARTCARD_Transmit_IT(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size); |
Kojto | 90:cb3d968589d8 | 774 | HAL_StatusTypeDef HAL_SMARTCARD_Receive_IT(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size); |
Kojto | 90:cb3d968589d8 | 775 | HAL_StatusTypeDef HAL_SMARTCARD_Transmit_DMA(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size); |
Kojto | 90:cb3d968589d8 | 776 | HAL_StatusTypeDef HAL_SMARTCARD_Receive_DMA(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size); |
Kojto | 90:cb3d968589d8 | 777 | void HAL_SMARTCARD_IRQHandler(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 778 | void HAL_SMARTCARD_TxCpltCallback(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 779 | void HAL_SMARTCARD_RxCpltCallback(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 780 | void HAL_SMARTCARD_ErrorCallback(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 781 | /** |
Kojto | 90:cb3d968589d8 | 782 | * @} |
Kojto | 90:cb3d968589d8 | 783 | */ |
Kojto | 90:cb3d968589d8 | 784 | |
Kojto | 90:cb3d968589d8 | 785 | /** @addtogroup SMARTCARD_Exported_Functions_Group3 Peripheral State and Errors functions |
Kojto | 90:cb3d968589d8 | 786 | * @{ |
Kojto | 90:cb3d968589d8 | 787 | */ |
Kojto | 90:cb3d968589d8 | 788 | /* Peripheral State and Error functions ***************************************/ |
Kojto | 90:cb3d968589d8 | 789 | HAL_SMARTCARD_StateTypeDef HAL_SMARTCARD_GetState(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 790 | uint32_t HAL_SMARTCARD_GetError(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 791 | /** |
Kojto | 90:cb3d968589d8 | 792 | * @} |
Kojto | 90:cb3d968589d8 | 793 | */ |
Kojto | 90:cb3d968589d8 | 794 | |
Kojto | 90:cb3d968589d8 | 795 | /** |
Kojto | 90:cb3d968589d8 | 796 | * @} |
Kojto | 90:cb3d968589d8 | 797 | */ |
Kojto | 90:cb3d968589d8 | 798 | |
Kojto | 90:cb3d968589d8 | 799 | /** |
Kojto | 90:cb3d968589d8 | 800 | * @} |
Kojto | 90:cb3d968589d8 | 801 | */ |
Kojto | 90:cb3d968589d8 | 802 | |
Kojto | 90:cb3d968589d8 | 803 | /** |
Kojto | 90:cb3d968589d8 | 804 | * @} |
Kojto | 90:cb3d968589d8 | 805 | */ |
Kojto | 90:cb3d968589d8 | 806 | |
Kojto | 90:cb3d968589d8 | 807 | #endif /* !defined(STM32F030x4) && !defined(STM32F030x6) && !defined(STM32F030x8) */ |
Kojto | 90:cb3d968589d8 | 808 | |
Kojto | 90:cb3d968589d8 | 809 | #ifdef __cplusplus |
Kojto | 90:cb3d968589d8 | 810 | } |
Kojto | 90:cb3d968589d8 | 811 | #endif |
Kojto | 90:cb3d968589d8 | 812 | |
Kojto | 90:cb3d968589d8 | 813 | #endif /* __STM32F0xx_HAL_SMARTCARD_H */ |
Kojto | 90:cb3d968589d8 | 814 | |
Kojto | 90:cb3d968589d8 | 815 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
Kojto | 90:cb3d968589d8 | 816 |