meh
Fork of mbed by
TARGET_NUCLEO_F030R8/stm32f0xx_hal_smartcard.h@108:34e6b704fe68, 2015-10-02 (annotated)
- Committer:
- Kojto
- Date:
- Fri Oct 02 07:35:07 2015 +0200
- Revision:
- 108:34e6b704fe68
- Parent:
- 93:e188a91d3eaa
Release 108 of the mbed library
Changes:
- new platforms - ELMO_F411RE, WIZNET_7500P, ARM_MPS2_BEID
- EFM32 - bugfixes in rtc, serial
- Cortex A cmsis - update files
- STML4 - RAM fixes
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 | 108:34e6b704fe68 | 5 | * @version V1.3.0 |
Kojto | 108:34e6b704fe68 | 6 | * @date 26-June-2015 |
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 | 108:34e6b704fe68 | 11 | * <h2><center>© COPYRIGHT(c) 2015 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 | 108:34e6b704fe68 | 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 | 93:e188a91d3eaa | 46 | #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) |
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 | 108:34e6b704fe68 | 57 | */ |
Kojto | 90:cb3d968589d8 | 58 | |
Kojto | 108:34e6b704fe68 | 59 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 60 | /** @defgroup SMARTCARD_Exported_Types SMARTCARD Exported Types |
Kojto | 90:cb3d968589d8 | 61 | * @{ |
Kojto | 108:34e6b704fe68 | 62 | */ |
Kojto | 90:cb3d968589d8 | 63 | |
Kojto | 108:34e6b704fe68 | 64 | /** |
Kojto | 108:34e6b704fe68 | 65 | * @brief SMARTCARD Init Structure definition |
Kojto | 108:34e6b704fe68 | 66 | */ |
Kojto | 90:cb3d968589d8 | 67 | typedef struct |
Kojto | 90:cb3d968589d8 | 68 | { |
Kojto | 90:cb3d968589d8 | 69 | uint32_t BaudRate; /*!< Configures the SmartCard communication baud rate. |
Kojto | 90:cb3d968589d8 | 70 | The baud rate register is computed using the following formula: |
Kojto | 90:cb3d968589d8 | 71 | Baud Rate Register = ((PCLKx) / ((hsmartcard->Init.BaudRate))) */ |
Kojto | 108:34e6b704fe68 | 72 | |
Kojto | 90:cb3d968589d8 | 73 | uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
Kojto | 90:cb3d968589d8 | 74 | This parameter @ref SMARTCARD_Word_Length can only be set to 9 (8 data + 1 parity bits). */ |
Kojto | 90:cb3d968589d8 | 75 | |
Kojto | 90:cb3d968589d8 | 76 | uint32_t StopBits; /*!< Specifies the number of stop bits @ref SMARTCARD_Stop_Bits. |
Kojto | 90:cb3d968589d8 | 77 | Only 1.5 stop bits are authorized in SmartCard mode. */ |
Kojto | 90:cb3d968589d8 | 78 | |
Kojto | 90:cb3d968589d8 | 79 | uint16_t Parity; /*!< Specifies the parity mode. |
Kojto | 90:cb3d968589d8 | 80 | This parameter can be a value of @ref SMARTCARD_Parity |
Kojto | 90:cb3d968589d8 | 81 | @note The parity is enabled by default (PCE is forced to 1). |
Kojto | 90:cb3d968589d8 | 82 | Since the WordLength is forced to 8 bits + parity, M is |
Kojto | 90:cb3d968589d8 | 83 | forced to 1 and the parity bit is the 9th bit. */ |
Kojto | 108:34e6b704fe68 | 84 | |
Kojto | 90:cb3d968589d8 | 85 | uint16_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled. |
Kojto | 90:cb3d968589d8 | 86 | This parameter can be a value of @ref SMARTCARD_Mode */ |
Kojto | 90:cb3d968589d8 | 87 | |
Kojto | 90:cb3d968589d8 | 88 | uint16_t CLKPolarity; /*!< Specifies the steady state of the serial clock. |
Kojto | 90:cb3d968589d8 | 89 | This parameter can be a value of @ref SMARTCARD_Clock_Polarity */ |
Kojto | 90:cb3d968589d8 | 90 | |
Kojto | 90:cb3d968589d8 | 91 | uint16_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made. |
Kojto | 90:cb3d968589d8 | 92 | This parameter can be a value of @ref SMARTCARD_Clock_Phase */ |
Kojto | 90:cb3d968589d8 | 93 | |
Kojto | 90:cb3d968589d8 | 94 | uint16_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted |
Kojto | 90:cb3d968589d8 | 95 | data bit (MSB) has to be output on the SCLK pin in synchronous mode. |
Kojto | 90:cb3d968589d8 | 96 | This parameter can be a value of @ref SMARTCARD_Last_Bit */ |
Kojto | 108:34e6b704fe68 | 97 | |
Kojto | 90:cb3d968589d8 | 98 | uint16_t OneBitSampling; /*!< Specifies whether a single sample or three samples' majority vote is selected. |
Kojto | 90:cb3d968589d8 | 99 | Selecting the single sample method increases the receiver tolerance to clock |
Kojto | 90:cb3d968589d8 | 100 | deviations. This parameter can be a value of @ref SMARTCARD_OneBit_Sampling. */ |
Kojto | 90:cb3d968589d8 | 101 | |
Kojto | 90:cb3d968589d8 | 102 | uint8_t Prescaler; /*!< Specifies the SmartCard Prescaler */ |
Kojto | 108:34e6b704fe68 | 103 | |
Kojto | 90:cb3d968589d8 | 104 | uint8_t GuardTime; /*!< Specifies the SmartCard Guard Time */ |
Kojto | 108:34e6b704fe68 | 105 | |
Kojto | 90:cb3d968589d8 | 106 | uint16_t NACKEnable; /*!< Specifies whether the SmartCard NACK transmission is enabled |
Kojto | 90:cb3d968589d8 | 107 | in case of parity error. |
Kojto | 108:34e6b704fe68 | 108 | This parameter can be a value of @ref SMARTCARD_NACK_Enable */ |
Kojto | 108:34e6b704fe68 | 109 | |
Kojto | 108:34e6b704fe68 | 110 | uint32_t TimeOutEnable; /*!< Specifies whether the receiver timeout is enabled. |
Kojto | 90:cb3d968589d8 | 111 | This parameter can be a value of @ref SMARTCARD_Timeout_Enable*/ |
Kojto | 108:34e6b704fe68 | 112 | |
Kojto | 108:34e6b704fe68 | 113 | uint32_t TimeOutValue; /*!< Specifies the receiver time out value in number of baud blocks: |
Kojto | 108:34e6b704fe68 | 114 | it is used to implement the Character Wait Time (CWT) and |
Kojto | 108:34e6b704fe68 | 115 | Block Wait Time (BWT). It is coded over 24 bits. */ |
Kojto | 108:34e6b704fe68 | 116 | |
Kojto | 90:cb3d968589d8 | 117 | uint8_t BlockLength; /*!< Specifies the SmartCard Block Length in T=1 Reception mode. |
Kojto | 108:34e6b704fe68 | 118 | This parameter can be any value from 0x0 to 0xFF */ |
Kojto | 108:34e6b704fe68 | 119 | |
Kojto | 90:cb3d968589d8 | 120 | uint8_t AutoRetryCount; /*!< Specifies the SmartCard auto-retry count (number of retries in |
Kojto | 108:34e6b704fe68 | 121 | receive and transmit mode). When set to 0, retransmission is |
Kojto | 90:cb3d968589d8 | 122 | disabled. Otherwise, its maximum value is 7 (before signalling |
Kojto | 108:34e6b704fe68 | 123 | an error) */ |
Kojto | 108:34e6b704fe68 | 124 | |
Kojto | 90:cb3d968589d8 | 125 | }SMARTCARD_InitTypeDef; |
Kojto | 90:cb3d968589d8 | 126 | |
Kojto | 108:34e6b704fe68 | 127 | /** |
Kojto | 108:34e6b704fe68 | 128 | * @brief SMARTCARD advanced features initalization structure definition |
Kojto | 90:cb3d968589d8 | 129 | */ |
Kojto | 108:34e6b704fe68 | 130 | typedef struct |
Kojto | 90:cb3d968589d8 | 131 | { |
Kojto | 90:cb3d968589d8 | 132 | uint32_t AdvFeatureInit; /*!< Specifies which advanced SMARTCARD features is initialized. Several |
Kojto | 108:34e6b704fe68 | 133 | advanced features may be initialized at the same time. This parameter |
Kojto | 108:34e6b704fe68 | 134 | can be a value of @ref SMARTCARD_Advanced_Features_Initialization_Type */ |
Kojto | 90:cb3d968589d8 | 135 | |
Kojto | 90:cb3d968589d8 | 136 | uint32_t TxPinLevelInvert; /*!< Specifies whether the TX pin active level is inverted. |
Kojto | 90:cb3d968589d8 | 137 | This parameter can be a value of @ref SMARTCARD_Tx_Inv */ |
Kojto | 108:34e6b704fe68 | 138 | |
Kojto | 90:cb3d968589d8 | 139 | uint32_t RxPinLevelInvert; /*!< Specifies whether the RX pin active level is inverted. |
Kojto | 90:cb3d968589d8 | 140 | This parameter can be a value of @ref SMARTCARD_Rx_Inv */ |
Kojto | 90:cb3d968589d8 | 141 | |
Kojto | 90:cb3d968589d8 | 142 | uint32_t DataInvert; /*!< Specifies whether data are inverted (positive/direct logic |
Kojto | 90:cb3d968589d8 | 143 | vs negative/inverted logic). |
Kojto | 90:cb3d968589d8 | 144 | This parameter can be a value of @ref SMARTCARD_Data_Inv */ |
Kojto | 108:34e6b704fe68 | 145 | |
Kojto | 108:34e6b704fe68 | 146 | uint32_t Swap; /*!< Specifies whether TX and RX pins are swapped. |
Kojto | 90:cb3d968589d8 | 147 | This parameter can be a value of @ref SMARTCARD_Rx_Tx_Swap */ |
Kojto | 108:34e6b704fe68 | 148 | |
Kojto | 108:34e6b704fe68 | 149 | uint32_t OverrunDisable; /*!< Specifies whether the reception overrun detection is disabled. |
Kojto | 90:cb3d968589d8 | 150 | This parameter can be a value of @ref SMARTCARD_Overrun_Disable */ |
Kojto | 108:34e6b704fe68 | 151 | |
Kojto | 108:34e6b704fe68 | 152 | uint32_t DMADisableonRxError; /*!< Specifies whether the DMA is disabled in case of reception error. |
Kojto | 90:cb3d968589d8 | 153 | This parameter can be a value of @ref SMARTCARD_DMA_Disable_on_Rx_Error */ |
Kojto | 108:34e6b704fe68 | 154 | |
Kojto | 108:34e6b704fe68 | 155 | uint32_t MSBFirst; /*!< Specifies whether MSB is sent first on UART line. |
Kojto | 90:cb3d968589d8 | 156 | This parameter can be a value of @ref SMARTCARD_MSB_First */ |
Kojto | 90:cb3d968589d8 | 157 | }SMARTCARD_AdvFeatureInitTypeDef; |
Kojto | 90:cb3d968589d8 | 158 | |
Kojto | 108:34e6b704fe68 | 159 | /** |
Kojto | 108:34e6b704fe68 | 160 | * @brief HAL State structures definition |
Kojto | 108:34e6b704fe68 | 161 | */ |
Kojto | 90:cb3d968589d8 | 162 | typedef enum |
Kojto | 90:cb3d968589d8 | 163 | { |
Kojto | 90:cb3d968589d8 | 164 | HAL_SMARTCARD_STATE_RESET = 0x00, /*!< Peripheral is not initialized */ |
Kojto | 90:cb3d968589d8 | 165 | HAL_SMARTCARD_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */ |
Kojto | 108:34e6b704fe68 | 166 | HAL_SMARTCARD_STATE_BUSY = 0x02, /*!< an internal process is ongoing */ |
Kojto | 90:cb3d968589d8 | 167 | HAL_SMARTCARD_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */ |
Kojto | 90:cb3d968589d8 | 168 | HAL_SMARTCARD_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */ |
Kojto | 108:34e6b704fe68 | 169 | HAL_SMARTCARD_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */ |
Kojto | 90:cb3d968589d8 | 170 | HAL_SMARTCARD_STATE_TIMEOUT = 0x03, /*!< Timeout state */ |
Kojto | 90:cb3d968589d8 | 171 | HAL_SMARTCARD_STATE_ERROR = 0x04 /*!< Error */ |
Kojto | 90:cb3d968589d8 | 172 | }HAL_SMARTCARD_StateTypeDef; |
Kojto | 90:cb3d968589d8 | 173 | |
Kojto | 108:34e6b704fe68 | 174 | /** |
Kojto | 108:34e6b704fe68 | 175 | * @brief SMARTCARD clock sources |
Kojto | 90:cb3d968589d8 | 176 | */ |
Kojto | 90:cb3d968589d8 | 177 | typedef enum |
Kojto | 90:cb3d968589d8 | 178 | { |
Kojto | 90:cb3d968589d8 | 179 | SMARTCARD_CLOCKSOURCE_PCLK1 = 0x00, /*!< PCLK1 clock source */ |
Kojto | 90:cb3d968589d8 | 180 | SMARTCARD_CLOCKSOURCE_HSI = 0x02, /*!< HSI clock source */ |
Kojto | 90:cb3d968589d8 | 181 | SMARTCARD_CLOCKSOURCE_SYSCLK = 0x04, /*!< SYSCLK clock source */ |
Kojto | 90:cb3d968589d8 | 182 | SMARTCARD_CLOCKSOURCE_LSE = 0x08, /*!< LSE clock source */ |
Kojto | 108:34e6b704fe68 | 183 | SMARTCARD_CLOCKSOURCE_UNDEFINED = 0x10 /*!< undefined clock source */ |
Kojto | 90:cb3d968589d8 | 184 | }SMARTCARD_ClockSourceTypeDef; |
Kojto | 90:cb3d968589d8 | 185 | |
Kojto | 108:34e6b704fe68 | 186 | /** |
Kojto | 108:34e6b704fe68 | 187 | * @brief SMARTCARD handle Structure definition |
Kojto | 108:34e6b704fe68 | 188 | */ |
Kojto | 90:cb3d968589d8 | 189 | typedef struct |
Kojto | 90:cb3d968589d8 | 190 | { |
Kojto | 93:e188a91d3eaa | 191 | USART_TypeDef *Instance; /*!< USART registers base address */ |
Kojto | 108:34e6b704fe68 | 192 | |
Kojto | 93:e188a91d3eaa | 193 | SMARTCARD_InitTypeDef Init; /*!< SmartCard communication parameters */ |
Kojto | 108:34e6b704fe68 | 194 | |
Kojto | 93:e188a91d3eaa | 195 | SMARTCARD_AdvFeatureInitTypeDef AdvancedInit; /*!< SmartCard advanced features initialization parameters */ |
Kojto | 108:34e6b704fe68 | 196 | |
Kojto | 93:e188a91d3eaa | 197 | uint8_t *pTxBuffPtr; /*!< Pointer to SmartCard Tx transfer Buffer */ |
Kojto | 108:34e6b704fe68 | 198 | |
Kojto | 93:e188a91d3eaa | 199 | uint16_t TxXferSize; /*!< SmartCard Tx Transfer size */ |
Kojto | 108:34e6b704fe68 | 200 | |
Kojto | 93:e188a91d3eaa | 201 | uint16_t TxXferCount; /*!< SmartCard Tx Transfer Counter */ |
Kojto | 108:34e6b704fe68 | 202 | |
Kojto | 93:e188a91d3eaa | 203 | uint8_t *pRxBuffPtr; /*!< Pointer to SmartCard Rx transfer Buffer */ |
Kojto | 108:34e6b704fe68 | 204 | |
Kojto | 93:e188a91d3eaa | 205 | uint16_t RxXferSize; /*!< SmartCard Rx Transfer size */ |
Kojto | 108:34e6b704fe68 | 206 | |
Kojto | 93:e188a91d3eaa | 207 | uint16_t RxXferCount; /*!< SmartCard Rx Transfer Counter */ |
Kojto | 108:34e6b704fe68 | 208 | |
Kojto | 93:e188a91d3eaa | 209 | DMA_HandleTypeDef *hdmatx; /*!< SmartCard Tx DMA Handle parameters */ |
Kojto | 108:34e6b704fe68 | 210 | |
Kojto | 93:e188a91d3eaa | 211 | DMA_HandleTypeDef *hdmarx; /*!< SmartCard Rx DMA Handle parameters */ |
Kojto | 108:34e6b704fe68 | 212 | |
Kojto | 93:e188a91d3eaa | 213 | HAL_LockTypeDef Lock; /*!< Locking object */ |
Kojto | 108:34e6b704fe68 | 214 | |
Kojto | 108:34e6b704fe68 | 215 | __IO HAL_SMARTCARD_StateTypeDef State; /*!< SmartCard communication state */ |
Kojto | 108:34e6b704fe68 | 216 | |
Kojto | 93:e188a91d3eaa | 217 | __IO uint32_t ErrorCode; /*!< SmartCard Error code |
Kojto | 93:e188a91d3eaa | 218 | This parameter can be a value of @ref SMARTCARD_Error */ |
Kojto | 108:34e6b704fe68 | 219 | |
Kojto | 90:cb3d968589d8 | 220 | }SMARTCARD_HandleTypeDef; |
Kojto | 90:cb3d968589d8 | 221 | |
Kojto | 90:cb3d968589d8 | 222 | /** |
Kojto | 90:cb3d968589d8 | 223 | * @} |
Kojto | 90:cb3d968589d8 | 224 | */ |
Kojto | 90:cb3d968589d8 | 225 | |
Kojto | 90:cb3d968589d8 | 226 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 108:34e6b704fe68 | 227 | /** @defgroup SMARTCARD_Exported_Constants SMARTCARD Exported Constants |
Kojto | 90:cb3d968589d8 | 228 | * @{ |
Kojto | 90:cb3d968589d8 | 229 | */ |
Kojto | 90:cb3d968589d8 | 230 | |
Kojto | 108:34e6b704fe68 | 231 | /** @defgroup SMARTCARD_Error SMARTCARD Error |
Kojto | 93:e188a91d3eaa | 232 | * @{ |
Kojto | 93:e188a91d3eaa | 233 | */ |
Kojto | 93:e188a91d3eaa | 234 | #define HAL_SMARTCARD_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */ |
Kojto | 93:e188a91d3eaa | 235 | #define HAL_SMARTCARD_ERROR_PE ((uint32_t)0x00000001) /*!< Parity error */ |
Kojto | 93:e188a91d3eaa | 236 | #define HAL_SMARTCARD_ERROR_NE ((uint32_t)0x00000002) /*!< Noise error */ |
Kojto | 93:e188a91d3eaa | 237 | #define HAL_SMARTCARD_ERROR_FE ((uint32_t)0x00000004) /*!< frame error */ |
Kojto | 93:e188a91d3eaa | 238 | #define HAL_SMARTCARD_ERROR_ORE ((uint32_t)0x00000008) /*!< Overrun error */ |
Kojto | 93:e188a91d3eaa | 239 | #define HAL_SMARTCARD_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */ |
Kojto | 93:e188a91d3eaa | 240 | #define HAL_SMARTCARD_ERROR_RTO ((uint32_t)0x00000020) /*!< Receiver TimeOut error */ |
Kojto | 93:e188a91d3eaa | 241 | /** |
Kojto | 93:e188a91d3eaa | 242 | * @} |
Kojto | 93:e188a91d3eaa | 243 | */ |
Kojto | 93:e188a91d3eaa | 244 | |
Kojto | 108:34e6b704fe68 | 245 | /** @defgroup SMARTCARD_Word_Length SMARTCARD Word Length |
Kojto | 90:cb3d968589d8 | 246 | * @{ |
Kojto | 90:cb3d968589d8 | 247 | */ |
Kojto | 108:34e6b704fe68 | 248 | #define SMARTCARD_WORDLENGTH_9B ((uint32_t)USART_CR1_M0) /*!< SMARTCARD frame length */ |
Kojto | 90:cb3d968589d8 | 249 | /** |
Kojto | 90:cb3d968589d8 | 250 | * @} |
Kojto | 90:cb3d968589d8 | 251 | */ |
Kojto | 108:34e6b704fe68 | 252 | |
Kojto | 108:34e6b704fe68 | 253 | /** @defgroup SMARTCARD_Stop_Bits SMARTCARD Stop Bits |
Kojto | 90:cb3d968589d8 | 254 | * @{ |
Kojto | 90:cb3d968589d8 | 255 | */ |
Kojto | 108:34e6b704fe68 | 256 | #define SMARTCARD_STOPBITS_1_5 USART_CR2_STOP /*!< SMARTCARD frame with 1.5 stop bits */ |
Kojto | 90:cb3d968589d8 | 257 | /** |
Kojto | 90:cb3d968589d8 | 258 | * @} |
Kojto | 108:34e6b704fe68 | 259 | */ |
Kojto | 90:cb3d968589d8 | 260 | |
Kojto | 108:34e6b704fe68 | 261 | /** @defgroup SMARTCARD_Parity SMARTCARD Parity |
Kojto | 90:cb3d968589d8 | 262 | * @{ |
Kojto | 108:34e6b704fe68 | 263 | */ |
Kojto | 108:34e6b704fe68 | 264 | #define SMARTCARD_PARITY_EVEN ((uint32_t)USART_CR1_PCE) /*!< SMARTCARD frame even parity */ |
Kojto | 108:34e6b704fe68 | 265 | #define SMARTCARD_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) /*!< SMARTCARD frame odd parity */ |
Kojto | 90:cb3d968589d8 | 266 | /** |
Kojto | 90:cb3d968589d8 | 267 | * @} |
Kojto | 90:cb3d968589d8 | 268 | */ |
Kojto | 90:cb3d968589d8 | 269 | |
Kojto | 108:34e6b704fe68 | 270 | /** @defgroup SMARTCARD_Mode SMARTCARD Transfer Mode |
Kojto | 90:cb3d968589d8 | 271 | * @{ |
Kojto | 90:cb3d968589d8 | 272 | */ |
Kojto | 108:34e6b704fe68 | 273 | #define SMARTCARD_MODE_RX ((uint32_t)USART_CR1_RE) /*!< SMARTCARD RX mode */ |
Kojto | 108:34e6b704fe68 | 274 | #define SMARTCARD_MODE_TX ((uint32_t)USART_CR1_TE) /*!< SMARTCARD TX mode */ |
Kojto | 108:34e6b704fe68 | 275 | #define SMARTCARD_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE)) /*!< SMARTCARD RX and TX mode */ |
Kojto | 90:cb3d968589d8 | 276 | /** |
Kojto | 90:cb3d968589d8 | 277 | * @} |
Kojto | 108:34e6b704fe68 | 278 | */ |
Kojto | 108:34e6b704fe68 | 279 | |
Kojto | 108:34e6b704fe68 | 280 | /** @defgroup SMARTCARD_Clock_Polarity SMARTCARD Clock Polarity |
Kojto | 108:34e6b704fe68 | 281 | * @{ |
Kojto | 108:34e6b704fe68 | 282 | */ |
Kojto | 108:34e6b704fe68 | 283 | #define SMARTCARD_POLARITY_LOW ((uint32_t)0x00000000) /*!< SMARTCARD frame low polarity */ |
Kojto | 108:34e6b704fe68 | 284 | #define SMARTCARD_POLARITY_HIGH ((uint32_t)USART_CR2_CPOL) /*!< SMARTCARD frame high polarity */ |
Kojto | 108:34e6b704fe68 | 285 | /** |
Kojto | 108:34e6b704fe68 | 286 | * @} |
Kojto | 108:34e6b704fe68 | 287 | */ |
Kojto | 90:cb3d968589d8 | 288 | |
Kojto | 90:cb3d968589d8 | 289 | /** @defgroup SMARTCARD_Clock_Phase SMARTCARD Clock Phase |
Kojto | 90:cb3d968589d8 | 290 | * @{ |
Kojto | 90:cb3d968589d8 | 291 | */ |
Kojto | 108:34e6b704fe68 | 292 | #define SMARTCARD_PHASE_1EDGE ((uint32_t)0x00000000) /*!< SMARTCARD frame phase on first clock transition */ |
Kojto | 108:34e6b704fe68 | 293 | #define SMARTCARD_PHASE_2EDGE ((uint32_t)USART_CR2_CPHA) /*!< SMARTCARD frame phase on second clock transition */ |
Kojto | 90:cb3d968589d8 | 294 | /** |
Kojto | 90:cb3d968589d8 | 295 | * @} |
Kojto | 90:cb3d968589d8 | 296 | */ |
Kojto | 90:cb3d968589d8 | 297 | |
Kojto | 108:34e6b704fe68 | 298 | /** @defgroup SMARTCARD_Last_Bit SMARTCARD Last Bit |
Kojto | 90:cb3d968589d8 | 299 | * @{ |
Kojto | 90:cb3d968589d8 | 300 | */ |
Kojto | 108:34e6b704fe68 | 301 | #define SMARTCARD_LASTBIT_DISABLE ((uint32_t)0x00000000) /*!< SMARTCARD frame last data bit clock pulse not output to SCLK pin */ |
Kojto | 108:34e6b704fe68 | 302 | #define SMARTCARD_LASTBIT_ENABLE ((uint32_t)USART_CR2_LBCL) /*!< SMARTCARD frame last data bit clock pulse output to SCLK pin */ |
Kojto | 90:cb3d968589d8 | 303 | /** |
Kojto | 90:cb3d968589d8 | 304 | * @} |
Kojto | 90:cb3d968589d8 | 305 | */ |
Kojto | 90:cb3d968589d8 | 306 | |
Kojto | 90:cb3d968589d8 | 307 | /** @defgroup SMARTCARD_OneBit_Sampling SMARTCARD One Bit Sampling Method |
Kojto | 90:cb3d968589d8 | 308 | * @{ |
Kojto | 90:cb3d968589d8 | 309 | */ |
Kojto | 108:34e6b704fe68 | 310 | #define SMARTCARD_ONE_BIT_SAMPLE_DISABLE ((uint32_t)0x00000000) /*!< SMARTCARD frame one-bit sample disabled */ |
Kojto | 108:34e6b704fe68 | 311 | #define SMARTCARD_ONE_BIT_SAMPLE_ENABLE ((uint32_t)USART_CR3_ONEBIT) /*!< SMARTCARD frame one-bit sample enabled */ |
Kojto | 90:cb3d968589d8 | 312 | /** |
Kojto | 90:cb3d968589d8 | 313 | * @} |
Kojto | 108:34e6b704fe68 | 314 | */ |
Kojto | 90:cb3d968589d8 | 315 | |
Kojto | 93:e188a91d3eaa | 316 | |
Kojto | 108:34e6b704fe68 | 317 | /** @defgroup SMARTCARD_NACK_Enable SMARTCARD NACK Enable |
Kojto | 90:cb3d968589d8 | 318 | * @{ |
Kojto | 90:cb3d968589d8 | 319 | */ |
Kojto | 108:34e6b704fe68 | 320 | #define SMARTCARD_NACK_ENABLE ((uint32_t)USART_CR3_NACK) /*!< SMARTCARD NACK transmission disabled */ |
Kojto | 108:34e6b704fe68 | 321 | #define SMARTCARD_NACK_DISABLE ((uint32_t)0x00000000) /*!< SMARTCARD NACK transmission enabled */ |
Kojto | 90:cb3d968589d8 | 322 | /** |
Kojto | 90:cb3d968589d8 | 323 | * @} |
Kojto | 90:cb3d968589d8 | 324 | */ |
Kojto | 90:cb3d968589d8 | 325 | |
Kojto | 108:34e6b704fe68 | 326 | /** @defgroup SMARTCARD_Timeout_Enable SMARTCARD Timeout Enable |
Kojto | 90:cb3d968589d8 | 327 | * @{ |
Kojto | 90:cb3d968589d8 | 328 | */ |
Kojto | 108:34e6b704fe68 | 329 | #define SMARTCARD_TIMEOUT_DISABLE ((uint32_t)0x00000000) /*!< SMARTCARD receiver timeout disabled */ |
Kojto | 108:34e6b704fe68 | 330 | #define SMARTCARD_TIMEOUT_ENABLE ((uint32_t)USART_CR2_RTOEN) /*!< SMARTCARD receiver timeout enabled */ |
Kojto | 90:cb3d968589d8 | 331 | /** |
Kojto | 90:cb3d968589d8 | 332 | * @} |
Kojto | 90:cb3d968589d8 | 333 | */ |
Kojto | 108:34e6b704fe68 | 334 | |
Kojto | 90:cb3d968589d8 | 335 | /** @defgroup SMARTCARD_Advanced_Features_Initialization_Type SMARTCARD advanced feature initialization type |
Kojto | 90:cb3d968589d8 | 336 | * @{ |
Kojto | 90:cb3d968589d8 | 337 | */ |
Kojto | 108:34e6b704fe68 | 338 | #define SMARTCARD_ADVFEATURE_NO_INIT ((uint32_t)0x00000000) /*!< No advanced feature initialization */ |
Kojto | 108:34e6b704fe68 | 339 | #define SMARTCARD_ADVFEATURE_TXINVERT_INIT ((uint32_t)0x00000001) /*!< TX pin active level inversion */ |
Kojto | 108:34e6b704fe68 | 340 | #define SMARTCARD_ADVFEATURE_RXINVERT_INIT ((uint32_t)0x00000002) /*!< RX pin active level inversion */ |
Kojto | 108:34e6b704fe68 | 341 | #define SMARTCARD_ADVFEATURE_DATAINVERT_INIT ((uint32_t)0x00000004) /*!< Binary data inversion */ |
Kojto | 108:34e6b704fe68 | 342 | #define SMARTCARD_ADVFEATURE_SWAP_INIT ((uint32_t)0x00000008) /*!< TX/RX pins swap */ |
Kojto | 108:34e6b704fe68 | 343 | #define SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT ((uint32_t)0x00000010) /*!< RX overrun disable */ |
Kojto | 108:34e6b704fe68 | 344 | #define SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT ((uint32_t)0x00000020) /*!< DMA disable on Reception Error */ |
Kojto | 108:34e6b704fe68 | 345 | #define SMARTCARD_ADVFEATURE_MSBFIRST_INIT ((uint32_t)0x00000080) /*!< Most significant bit sent/received first */ |
Kojto | 90:cb3d968589d8 | 346 | /** |
Kojto | 90:cb3d968589d8 | 347 | * @} |
Kojto | 90:cb3d968589d8 | 348 | */ |
Kojto | 90:cb3d968589d8 | 349 | |
Kojto | 90:cb3d968589d8 | 350 | /** @defgroup SMARTCARD_Tx_Inv SMARTCARD advanced feature TX pin active level inversion |
Kojto | 90:cb3d968589d8 | 351 | * @{ |
Kojto | 90:cb3d968589d8 | 352 | */ |
Kojto | 108:34e6b704fe68 | 353 | #define SMARTCARD_ADVFEATURE_TXINV_DISABLE ((uint32_t)0x00000000) /*!< TX pin active level inversion disable */ |
Kojto | 108:34e6b704fe68 | 354 | #define SMARTCARD_ADVFEATURE_TXINV_ENABLE ((uint32_t)USART_CR2_TXINV) /*!< TX pin active level inversion enable */ |
Kojto | 90:cb3d968589d8 | 355 | /** |
Kojto | 90:cb3d968589d8 | 356 | * @} |
Kojto | 90:cb3d968589d8 | 357 | */ |
Kojto | 90:cb3d968589d8 | 358 | |
Kojto | 90:cb3d968589d8 | 359 | /** @defgroup SMARTCARD_Rx_Inv SMARTCARD advanced feature RX pin active level inversion |
Kojto | 90:cb3d968589d8 | 360 | * @{ |
Kojto | 90:cb3d968589d8 | 361 | */ |
Kojto | 108:34e6b704fe68 | 362 | #define SMARTCARD_ADVFEATURE_RXINV_DISABLE ((uint32_t)0x00000000) /*!< RX pin active level inversion disable */ |
Kojto | 108:34e6b704fe68 | 363 | #define SMARTCARD_ADVFEATURE_RXINV_ENABLE ((uint32_t)USART_CR2_RXINV) /*!< RX pin active level inversion enable */ |
Kojto | 108:34e6b704fe68 | 364 | /** |
Kojto | 108:34e6b704fe68 | 365 | * @} |
Kojto | 108:34e6b704fe68 | 366 | */ |
Kojto | 108:34e6b704fe68 | 367 | |
Kojto | 108:34e6b704fe68 | 368 | /** @defgroup SMARTCARD_Data_Inv SMARTCARD advanced feature Binary Data inversion |
Kojto | 108:34e6b704fe68 | 369 | * @{ |
Kojto | 108:34e6b704fe68 | 370 | */ |
Kojto | 108:34e6b704fe68 | 371 | #define SMARTCARD_ADVFEATURE_DATAINV_DISABLE ((uint32_t)0x00000000) /*!< Binary data inversion disable */ |
Kojto | 108:34e6b704fe68 | 372 | #define SMARTCARD_ADVFEATURE_DATAINV_ENABLE ((uint32_t)USART_CR2_DATAINV) /*!< Binary data inversion enable */ |
Kojto | 108:34e6b704fe68 | 373 | /** |
Kojto | 108:34e6b704fe68 | 374 | * @} |
Kojto | 108:34e6b704fe68 | 375 | */ |
Kojto | 108:34e6b704fe68 | 376 | |
Kojto | 108:34e6b704fe68 | 377 | /** @defgroup SMARTCARD_Rx_Tx_Swap SMARTCARD advanced feature RX TX pins swap |
Kojto | 108:34e6b704fe68 | 378 | * @{ |
Kojto | 108:34e6b704fe68 | 379 | */ |
Kojto | 108:34e6b704fe68 | 380 | #define SMARTCARD_ADVFEATURE_SWAP_DISABLE ((uint32_t)0x00000000) /*!< TX/RX pins swap disable */ |
Kojto | 108:34e6b704fe68 | 381 | #define SMARTCARD_ADVFEATURE_SWAP_ENABLE ((uint32_t)USART_CR2_SWAP) /*!< TX/RX pins swap enable */ |
Kojto | 108:34e6b704fe68 | 382 | /** |
Kojto | 108:34e6b704fe68 | 383 | * @} |
Kojto | 108:34e6b704fe68 | 384 | */ |
Kojto | 108:34e6b704fe68 | 385 | |
Kojto | 108:34e6b704fe68 | 386 | /** @defgroup SMARTCARD_Overrun_Disable SMARTCARD advanced feature Overrun Disable |
Kojto | 108:34e6b704fe68 | 387 | * @{ |
Kojto | 108:34e6b704fe68 | 388 | */ |
Kojto | 108:34e6b704fe68 | 389 | #define SMARTCARD_ADVFEATURE_OVERRUN_ENABLE ((uint32_t)0x00000000) /*!< RX overrun enable */ |
Kojto | 108:34e6b704fe68 | 390 | #define SMARTCARD_ADVFEATURE_OVERRUN_DISABLE ((uint32_t)USART_CR3_OVRDIS) /*!< RX overrun disable */ |
Kojto | 90:cb3d968589d8 | 391 | /** |
Kojto | 90:cb3d968589d8 | 392 | * @} |
Kojto | 90:cb3d968589d8 | 393 | */ |
Kojto | 90:cb3d968589d8 | 394 | |
Kojto | 108:34e6b704fe68 | 395 | /** @defgroup SMARTCARD_DMA_Disable_on_Rx_Error SMARTCARD advanced feature DMA Disable on Rx Error |
Kojto | 90:cb3d968589d8 | 396 | * @{ |
Kojto | 90:cb3d968589d8 | 397 | */ |
Kojto | 108:34e6b704fe68 | 398 | #define SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR ((uint32_t)0x00000000) /*!< DMA enable on Reception Error */ |
Kojto | 108:34e6b704fe68 | 399 | #define SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR ((uint32_t)USART_CR3_DDRE) /*!< DMA disable on Reception Error */ |
Kojto | 90:cb3d968589d8 | 400 | /** |
Kojto | 90:cb3d968589d8 | 401 | * @} |
Kojto | 90:cb3d968589d8 | 402 | */ |
Kojto | 90:cb3d968589d8 | 403 | |
Kojto | 90:cb3d968589d8 | 404 | /** @defgroup SMARTCARD_MSB_First SMARTCARD advanced feature MSB first |
Kojto | 90:cb3d968589d8 | 405 | * @{ |
Kojto | 90:cb3d968589d8 | 406 | */ |
Kojto | 108:34e6b704fe68 | 407 | #define SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE ((uint32_t)0x00000000) /*!< Most significant bit sent/received first disable */ |
Kojto | 108:34e6b704fe68 | 408 | #define SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE ((uint32_t)USART_CR2_MSBFIRST) /*!< Most significant bit sent/received first enable */ |
Kojto | 90:cb3d968589d8 | 409 | /** |
Kojto | 90:cb3d968589d8 | 410 | * @} |
Kojto | 108:34e6b704fe68 | 411 | */ |
Kojto | 90:cb3d968589d8 | 412 | |
Kojto | 108:34e6b704fe68 | 413 | /** @defgroup SMARTCARD_Flags SMARTCARD Flags |
Kojto | 90:cb3d968589d8 | 414 | * Elements values convention: 0xXXXX |
Kojto | 90:cb3d968589d8 | 415 | * - 0xXXXX : Flag mask in the ISR register |
Kojto | 90:cb3d968589d8 | 416 | * @{ |
Kojto | 90:cb3d968589d8 | 417 | */ |
Kojto | 108:34e6b704fe68 | 418 | #define SMARTCARD_FLAG_REACK USART_ISR_REACK /*!< SMARTCARD receive enable acknowledge flag */ |
Kojto | 108:34e6b704fe68 | 419 | #define SMARTCARD_FLAG_TEACK USART_ISR_TEACK /*!< SMARTCARD transmit enable acknowledge flag */ |
Kojto | 108:34e6b704fe68 | 420 | #define SMARTCARD_FLAG_BUSY USART_ISR_BUSY /*!< SMARTCARD busy flag */ |
Kojto | 108:34e6b704fe68 | 421 | #define SMARTCARD_FLAG_EOBF USART_ISR_EOBF /*!< SMARTCARD end of block flag */ |
Kojto | 108:34e6b704fe68 | 422 | #define SMARTCARD_FLAG_RTOF USART_ISR_RTOF /*!< SMARTCARD receiver timeout flag */ |
Kojto | 108:34e6b704fe68 | 423 | #define SMARTCARD_FLAG_TXE USART_ISR_TXE /*!< SMARTCARD transmit data register empty */ |
Kojto | 108:34e6b704fe68 | 424 | #define SMARTCARD_FLAG_TC USART_ISR_TC /*!< SMARTCARD transmission complete */ |
Kojto | 108:34e6b704fe68 | 425 | #define SMARTCARD_FLAG_RXNE USART_ISR_RXNE /*!< SMARTCARD read data register not empty */ |
Kojto | 108:34e6b704fe68 | 426 | #define SMARTCARD_FLAG_IDLE USART_ISR_IDLE /*!< SMARTCARD idle line detection */ |
Kojto | 108:34e6b704fe68 | 427 | #define SMARTCARD_FLAG_ORE USART_ISR_ORE /*!< SMARTCARD overrun error */ |
Kojto | 108:34e6b704fe68 | 428 | #define SMARTCARD_FLAG_NE USART_ISR_NE /*!< SMARTCARD noise error */ |
Kojto | 108:34e6b704fe68 | 429 | #define SMARTCARD_FLAG_FE USART_ISR_FE /*!< SMARTCARD frame error */ |
Kojto | 108:34e6b704fe68 | 430 | #define SMARTCARD_FLAG_PE USART_ISR_PE /*!< SMARTCARD parity error */ |
Kojto | 90:cb3d968589d8 | 431 | /** |
Kojto | 90:cb3d968589d8 | 432 | * @} |
Kojto | 90:cb3d968589d8 | 433 | */ |
Kojto | 90:cb3d968589d8 | 434 | |
Kojto | 90:cb3d968589d8 | 435 | /** @defgroup SMARTCARD_Interrupt_definition SMARTCARD Interrupts Definition |
Kojto | 90:cb3d968589d8 | 436 | * Elements values convention: 0000ZZZZ0XXYYYYYb |
Kojto | 90:cb3d968589d8 | 437 | * - YYYYY : Interrupt source position in the XX register (5bits) |
Kojto | 90:cb3d968589d8 | 438 | * - XX : Interrupt source register (2bits) |
Kojto | 90:cb3d968589d8 | 439 | * - 01: CR1 register |
Kojto | 90:cb3d968589d8 | 440 | * - 10: CR2 register |
Kojto | 90:cb3d968589d8 | 441 | * - 11: CR3 register |
Kojto | 90:cb3d968589d8 | 442 | * - ZZZZ : Flag position in the ISR register(4bits) |
Kojto | 90:cb3d968589d8 | 443 | * @{ |
Kojto | 90:cb3d968589d8 | 444 | */ |
Kojto | 90:cb3d968589d8 | 445 | |
Kojto | 108:34e6b704fe68 | 446 | #define SMARTCARD_IT_PE ((uint16_t)0x0028) /*!< SMARTCARD parity error interruption */ |
Kojto | 108:34e6b704fe68 | 447 | #define SMARTCARD_IT_TXE ((uint16_t)0x0727) /*!< SMARTCARD transmit data register empty interruption */ |
Kojto | 108:34e6b704fe68 | 448 | #define SMARTCARD_IT_TC ((uint16_t)0x0626) /*!< SMARTCARD transmission complete interruption */ |
Kojto | 108:34e6b704fe68 | 449 | #define SMARTCARD_IT_RXNE ((uint16_t)0x0525) /*!< SMARTCARD read data register not empty interruption */ |
Kojto | 108:34e6b704fe68 | 450 | #define SMARTCARD_IT_IDLE ((uint16_t)0x0424) /*!< SMARTCARD idle line detection interruption */ |
Kojto | 108:34e6b704fe68 | 451 | |
Kojto | 108:34e6b704fe68 | 452 | #define SMARTCARD_IT_ERR ((uint16_t)0x0060) /*!< SMARTCARD error interruption */ |
Kojto | 108:34e6b704fe68 | 453 | #define SMARTCARD_IT_ORE ((uint16_t)0x0300) /*!< SMARTCARD overrun error interruption */ |
Kojto | 108:34e6b704fe68 | 454 | #define SMARTCARD_IT_NE ((uint16_t)0x0200) /*!< SMARTCARD noise error interruption */ |
Kojto | 108:34e6b704fe68 | 455 | #define SMARTCARD_IT_FE ((uint16_t)0x0100) /*!< SMARTCARD frame error interruption */ |
Kojto | 108:34e6b704fe68 | 456 | |
Kojto | 108:34e6b704fe68 | 457 | #define SMARTCARD_IT_EOB ((uint16_t)0x0C3B) /*!< SMARTCARD end of block interruption */ |
Kojto | 108:34e6b704fe68 | 458 | #define SMARTCARD_IT_RTO ((uint16_t)0x0B3A) /*!< SMARTCARD receiver timeout interruption */ |
Kojto | 90:cb3d968589d8 | 459 | /** |
Kojto | 90:cb3d968589d8 | 460 | * @} |
Kojto | 108:34e6b704fe68 | 461 | */ |
Kojto | 90:cb3d968589d8 | 462 | |
Kojto | 90:cb3d968589d8 | 463 | /** @defgroup SMARTCARD_IT_CLEAR_Flags SMARTCARD Interruption Clear Flags |
Kojto | 90:cb3d968589d8 | 464 | * @{ |
Kojto | 90:cb3d968589d8 | 465 | */ |
Kojto | 108:34e6b704fe68 | 466 | #define SMARTCARD_CLEAR_PEF USART_ICR_PECF /*!< SMARTCARD parity error clear flag */ |
Kojto | 108:34e6b704fe68 | 467 | #define SMARTCARD_CLEAR_FEF USART_ICR_FECF /*!< SMARTCARD framing error clear flag */ |
Kojto | 108:34e6b704fe68 | 468 | #define SMARTCARD_CLEAR_NEF USART_ICR_NCF /*!< SMARTCARD noise detected clear flag */ |
Kojto | 108:34e6b704fe68 | 469 | #define SMARTCARD_CLEAR_OREF USART_ICR_ORECF /*!< SMARTCARD overrun error clear flag */ |
Kojto | 108:34e6b704fe68 | 470 | #define SMARTCARD_CLEAR_IDLEF USART_ICR_IDLECF /*!< SMARTCARD idle line detected clear flag */ |
Kojto | 108:34e6b704fe68 | 471 | #define SMARTCARD_CLEAR_TCF USART_ICR_TCCF /*!< SMARTCARD transmission complete clear flag */ |
Kojto | 108:34e6b704fe68 | 472 | #define SMARTCARD_CLEAR_RTOF USART_ICR_RTOCF /*!< SMARTCARD receiver time out clear flag */ |
Kojto | 108:34e6b704fe68 | 473 | #define SMARTCARD_CLEAR_EOBF USART_ICR_EOBCF /*!< SMARTCARD end of block clear flag */ |
Kojto | 108:34e6b704fe68 | 474 | /** |
Kojto | 108:34e6b704fe68 | 475 | * @} |
Kojto | 108:34e6b704fe68 | 476 | */ |
Kojto | 108:34e6b704fe68 | 477 | |
Kojto | 108:34e6b704fe68 | 478 | /** @defgroup SMARTCARD_CR3_SCARCNT_LSB_POS SMARTCARD auto retry counter LSB position in CR3 register |
Kojto | 108:34e6b704fe68 | 479 | * @{ |
Kojto | 108:34e6b704fe68 | 480 | */ |
Kojto | 108:34e6b704fe68 | 481 | #define SMARTCARD_CR3_SCARCNT_LSB_POS ((uint32_t) 17) /*!< SMARTCARD auto retry counter LSB position in CR3 register */ |
Kojto | 108:34e6b704fe68 | 482 | /** |
Kojto | 108:34e6b704fe68 | 483 | * @} |
Kojto | 108:34e6b704fe68 | 484 | */ |
Kojto | 108:34e6b704fe68 | 485 | |
Kojto | 108:34e6b704fe68 | 486 | /** @defgroup SMARTCARD_GTPR_GT_LSB_POS SMARTCARD guard time value LSB position in GTPR register |
Kojto | 108:34e6b704fe68 | 487 | * @{ |
Kojto | 108:34e6b704fe68 | 488 | */ |
Kojto | 108:34e6b704fe68 | 489 | #define SMARTCARD_GTPR_GT_LSB_POS ((uint32_t) 8) /*!< SMARTCARD guard time value LSB position in GTPR register */ |
Kojto | 108:34e6b704fe68 | 490 | /** |
Kojto | 108:34e6b704fe68 | 491 | * @} |
Kojto | 108:34e6b704fe68 | 492 | */ |
Kojto | 108:34e6b704fe68 | 493 | |
Kojto | 108:34e6b704fe68 | 494 | /** @defgroup SMARTCARD_RTOR_BLEN_LSB_POS SMARTCARD block length LSB position in RTOR register |
Kojto | 108:34e6b704fe68 | 495 | * @{ |
Kojto | 108:34e6b704fe68 | 496 | */ |
Kojto | 108:34e6b704fe68 | 497 | #define SMARTCARD_RTOR_BLEN_LSB_POS ((uint32_t) 24) /*!< SMARTCARD block length LSB position in RTOR register */ |
Kojto | 108:34e6b704fe68 | 498 | /** |
Kojto | 108:34e6b704fe68 | 499 | * @} |
Kojto | 108:34e6b704fe68 | 500 | */ |
Kojto | 108:34e6b704fe68 | 501 | |
Kojto | 108:34e6b704fe68 | 502 | /** @defgroup SMARTCARD_Interruption_Mask SMARTCARD interruptions flags mask |
Kojto | 108:34e6b704fe68 | 503 | * @{ |
Kojto | 108:34e6b704fe68 | 504 | */ |
Kojto | 108:34e6b704fe68 | 505 | #define SMARTCARD_IT_MASK ((uint16_t)0x001F) /*!< SMARTCARD interruptions flags mask */ |
Kojto | 90:cb3d968589d8 | 506 | /** |
Kojto | 90:cb3d968589d8 | 507 | * @} |
Kojto | 90:cb3d968589d8 | 508 | */ |
Kojto | 90:cb3d968589d8 | 509 | |
Kojto | 90:cb3d968589d8 | 510 | /** @defgroup SMARTCARD_Request_Parameters SMARTCARD Request Parameters |
Kojto | 90:cb3d968589d8 | 511 | * @{ |
Kojto | 90:cb3d968589d8 | 512 | */ |
Kojto | 90:cb3d968589d8 | 513 | #define SMARTCARD_RXDATA_FLUSH_REQUEST ((uint16_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */ |
Kojto | 90:cb3d968589d8 | 514 | #define SMARTCARD_TXDATA_FLUSH_REQUEST ((uint16_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */ |
Kojto | 90:cb3d968589d8 | 515 | /** |
Kojto | 90:cb3d968589d8 | 516 | * @} |
Kojto | 90:cb3d968589d8 | 517 | */ |
Kojto | 108:34e6b704fe68 | 518 | |
Kojto | 90:cb3d968589d8 | 519 | /** |
Kojto | 90:cb3d968589d8 | 520 | * @} |
Kojto | 90:cb3d968589d8 | 521 | */ |
Kojto | 108:34e6b704fe68 | 522 | |
Kojto | 108:34e6b704fe68 | 523 | /* Exported macros -----------------------------------------------------------*/ |
Kojto | 108:34e6b704fe68 | 524 | /** @defgroup SMARTCARD_Exported_Macros SMARTCARD Exported Macros |
Kojto | 90:cb3d968589d8 | 525 | * @{ |
Kojto | 90:cb3d968589d8 | 526 | */ |
Kojto | 90:cb3d968589d8 | 527 | |
Kojto | 108:34e6b704fe68 | 528 | /** @brief Reset SMARTCARD handle state. |
Kojto | 90:cb3d968589d8 | 529 | * @param __HANDLE__: SMARTCARD handle. |
Kojto | 90:cb3d968589d8 | 530 | * @retval None |
Kojto | 90:cb3d968589d8 | 531 | */ |
Kojto | 90:cb3d968589d8 | 532 | #define __HAL_SMARTCARD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SMARTCARD_STATE_RESET) |
Kojto | 90:cb3d968589d8 | 533 | |
Kojto | 108:34e6b704fe68 | 534 | /** @brief Flush the Smartcard Data registers. |
Kojto | 108:34e6b704fe68 | 535 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 108:34e6b704fe68 | 536 | * @retval None |
Kojto | 108:34e6b704fe68 | 537 | */ |
Kojto | 108:34e6b704fe68 | 538 | #define __HAL_SMARTCARD_FLUSH_DRREGISTER(__HANDLE__) \ |
Kojto | 108:34e6b704fe68 | 539 | do{ \ |
Kojto | 108:34e6b704fe68 | 540 | SET_BIT((__HANDLE__)->Instance->RQR, SMARTCARD_RXDATA_FLUSH_REQUEST); \ |
Kojto | 108:34e6b704fe68 | 541 | SET_BIT((__HANDLE__)->Instance->RQR, SMARTCARD_TXDATA_FLUSH_REQUEST); \ |
Kojto | 108:34e6b704fe68 | 542 | } while(0) |
Kojto | 108:34e6b704fe68 | 543 | |
Kojto | 108:34e6b704fe68 | 544 | /** @brief Clear the specified SMARTCARD pending flag. |
Kojto | 108:34e6b704fe68 | 545 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 108:34e6b704fe68 | 546 | * @param __FLAG__: specifies the flag to check. |
Kojto | 108:34e6b704fe68 | 547 | * This parameter can be any combination of the following values: |
Kojto | 108:34e6b704fe68 | 548 | * @arg SMARTCARD_CLEAR_PEF: Parity error clear flag |
Kojto | 108:34e6b704fe68 | 549 | * @arg SMARTCARD_CLEAR_FEF: Framing error clear flag |
Kojto | 108:34e6b704fe68 | 550 | * @arg SMARTCARD_CLEAR_NEF: Noise detected clear flag |
Kojto | 108:34e6b704fe68 | 551 | * @arg SMARTCARD_CLEAR_OREF: OverRun error clear flag |
Kojto | 108:34e6b704fe68 | 552 | * @arg SMARTCARD_CLEAR_IDLEF: Idle line detected clear flag |
Kojto | 108:34e6b704fe68 | 553 | * @arg SMARTCARD_CLEAR_TCF: Transmission complete clear flag |
Kojto | 108:34e6b704fe68 | 554 | * @arg SMARTCARD_CLEAR_RTOF: Receiver timeout clear flag |
Kojto | 108:34e6b704fe68 | 555 | * @arg SMARTCARD_CLEAR_EOBF: End of block clear flag |
Kojto | 108:34e6b704fe68 | 556 | * @retval None |
Kojto | 108:34e6b704fe68 | 557 | */ |
Kojto | 108:34e6b704fe68 | 558 | #define __HAL_SMARTCARD_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) |
Kojto | 108:34e6b704fe68 | 559 | |
Kojto | 108:34e6b704fe68 | 560 | /** @brief Clear the SMARTCARD PE pending flag. |
Kojto | 108:34e6b704fe68 | 561 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 108:34e6b704fe68 | 562 | * @retval None |
Kojto | 108:34e6b704fe68 | 563 | */ |
Kojto | 108:34e6b704fe68 | 564 | #define __HAL_SMARTCARD_CLEAR_PEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_PEF) |
Kojto | 108:34e6b704fe68 | 565 | |
Kojto | 108:34e6b704fe68 | 566 | |
Kojto | 108:34e6b704fe68 | 567 | /** @brief Clear the SMARTCARD FE pending flag. |
Kojto | 108:34e6b704fe68 | 568 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 108:34e6b704fe68 | 569 | * @retval None |
Kojto | 108:34e6b704fe68 | 570 | */ |
Kojto | 108:34e6b704fe68 | 571 | #define __HAL_SMARTCARD_CLEAR_FEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_FEF) |
Kojto | 108:34e6b704fe68 | 572 | |
Kojto | 108:34e6b704fe68 | 573 | /** @brief Clear the SMARTCARD NE pending flag. |
Kojto | 108:34e6b704fe68 | 574 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 108:34e6b704fe68 | 575 | * @retval None |
Kojto | 108:34e6b704fe68 | 576 | */ |
Kojto | 108:34e6b704fe68 | 577 | #define __HAL_SMARTCARD_CLEAR_NEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_NEF) |
Kojto | 108:34e6b704fe68 | 578 | |
Kojto | 108:34e6b704fe68 | 579 | /** @brief Clear the SMARTCARD ORE pending flag. |
Kojto | 108:34e6b704fe68 | 580 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 108:34e6b704fe68 | 581 | * @retval None |
Kojto | 108:34e6b704fe68 | 582 | */ |
Kojto | 108:34e6b704fe68 | 583 | #define __HAL_SMARTCARD_CLEAR_OREFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_OREF) |
Kojto | 108:34e6b704fe68 | 584 | |
Kojto | 108:34e6b704fe68 | 585 | /** @brief Clear the SMARTCARD IDLE pending flag. |
Kojto | 108:34e6b704fe68 | 586 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 108:34e6b704fe68 | 587 | * @retval None |
Kojto | 108:34e6b704fe68 | 588 | */ |
Kojto | 108:34e6b704fe68 | 589 | #define __HAL_SMARTCARD_CLEAR_IDLEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_IDLEF) |
Kojto | 108:34e6b704fe68 | 590 | |
Kojto | 108:34e6b704fe68 | 591 | /** @brief Check whether the specified Smartcard flag is set or not. |
Kojto | 90:cb3d968589d8 | 592 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 593 | * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral. |
Kojto | 90:cb3d968589d8 | 594 | * @param __FLAG__: specifies the flag to check. |
Kojto | 90:cb3d968589d8 | 595 | * This parameter can be one of the following values: |
Kojto | 108:34e6b704fe68 | 596 | * @arg SMARTCARD_FLAG_REACK: Receive enable acknowledge flag |
Kojto | 108:34e6b704fe68 | 597 | * @arg SMARTCARD_FLAG_TEACK: Transmit enable acknowledge flag |
Kojto | 90:cb3d968589d8 | 598 | * @arg SMARTCARD_FLAG_BUSY: Busy flag |
Kojto | 108:34e6b704fe68 | 599 | * @arg SMARTCARD_FLAG_EOBF: End of block flag |
Kojto | 108:34e6b704fe68 | 600 | * @arg SMARTCARD_FLAG_RTOF: Receiver timeout flag |
Kojto | 90:cb3d968589d8 | 601 | * @arg SMARTCARD_FLAG_TXE: Transmit data register empty flag |
Kojto | 108:34e6b704fe68 | 602 | * @arg SMARTCARD_FLAG_TC: Transmission complete flag |
Kojto | 90:cb3d968589d8 | 603 | * @arg SMARTCARD_FLAG_RXNE: Receive data register not empty flag |
Kojto | 108:34e6b704fe68 | 604 | * @arg SMARTCARD_FLAG_IDLE: Idle line detection flag |
Kojto | 108:34e6b704fe68 | 605 | * @arg SMARTCARD_FLAG_ORE: Overrun error flag |
Kojto | 108:34e6b704fe68 | 606 | * @arg SMARTCARD_FLAG_NE: Noise error flag |
Kojto | 108:34e6b704fe68 | 607 | * @arg SMARTCARD_FLAG_FE: Framing error flag |
Kojto | 108:34e6b704fe68 | 608 | * @arg SMARTCARD_FLAG_PE: Parity error flag |
Kojto | 90:cb3d968589d8 | 609 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
Kojto | 90:cb3d968589d8 | 610 | */ |
Kojto | 90:cb3d968589d8 | 611 | #define __HAL_SMARTCARD_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__)) |
Kojto | 90:cb3d968589d8 | 612 | |
Kojto | 90:cb3d968589d8 | 613 | |
Kojto | 108:34e6b704fe68 | 614 | /** @brief Enable the specified SmartCard interrupt. |
Kojto | 90:cb3d968589d8 | 615 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 616 | * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral. |
Kojto | 90:cb3d968589d8 | 617 | * @param __INTERRUPT__: specifies the SMARTCARD interrupt to enable. |
Kojto | 90:cb3d968589d8 | 618 | * This parameter can be one of the following values: |
Kojto | 108:34e6b704fe68 | 619 | * @arg SMARTCARD_IT_EOB: End of block interrupt |
Kojto | 108:34e6b704fe68 | 620 | * @arg SMARTCARD_IT_RTO: Receive timeout interrupt |
Kojto | 108:34e6b704fe68 | 621 | * @arg SMARTCARD_IT_TXE: Transmit data register empty interrupt |
Kojto | 108:34e6b704fe68 | 622 | * @arg SMARTCARD_IT_TC: Transmission complete interrupt |
Kojto | 108:34e6b704fe68 | 623 | * @arg SMARTCARD_IT_RXNE: Receive data register not empty interrupt |
Kojto | 108:34e6b704fe68 | 624 | * @arg SMARTCARD_IT_IDLE: Idle line detection interrupt |
Kojto | 108:34e6b704fe68 | 625 | * @arg SMARTCARD_IT_PE: Parity error interrupt |
Kojto | 108:34e6b704fe68 | 626 | * @arg SMARTCARD_IT_ERR: Error interrupt(frame error, noise error, overrun error) |
Kojto | 90:cb3d968589d8 | 627 | * @retval None |
Kojto | 90:cb3d968589d8 | 628 | */ |
Kojto | 90:cb3d968589d8 | 629 | #define __HAL_SMARTCARD_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
Kojto | 90:cb3d968589d8 | 630 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
Kojto | 90:cb3d968589d8 | 631 | ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK)))) |
Kojto | 90:cb3d968589d8 | 632 | |
Kojto | 108:34e6b704fe68 | 633 | /** @brief Disable the specified SmartCard interrupt. |
Kojto | 90:cb3d968589d8 | 634 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 635 | * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral. |
Kojto | 90:cb3d968589d8 | 636 | * @param __INTERRUPT__: specifies the SMARTCARD interrupt to disable. |
Kojto | 90:cb3d968589d8 | 637 | * This parameter can be one of the following values: |
Kojto | 108:34e6b704fe68 | 638 | * @arg SMARTCARD_IT_EOB: End of block interrupt |
Kojto | 108:34e6b704fe68 | 639 | * @arg SMARTCARD_IT_RTO: Receive timeout interrupt |
Kojto | 108:34e6b704fe68 | 640 | * @arg SMARTCARD_IT_TXE: Transmit data register empty interrupt |
Kojto | 108:34e6b704fe68 | 641 | * @arg SMARTCARD_IT_TC: Transmission complete interrupt |
Kojto | 108:34e6b704fe68 | 642 | * @arg SMARTCARD_IT_RXNE: Receive data register not empty interrupt |
Kojto | 108:34e6b704fe68 | 643 | * @arg SMARTCARD_IT_IDLE: Idle line detection interrupt |
Kojto | 108:34e6b704fe68 | 644 | * @arg SMARTCARD_IT_PE: Parity error interrupt |
Kojto | 108:34e6b704fe68 | 645 | * @arg SMARTCARD_IT_ERR: Error interrupt(frame error, noise error, overrun error) |
Kojto | 90:cb3d968589d8 | 646 | * @retval None |
Kojto | 90:cb3d968589d8 | 647 | */ |
Kojto | 90:cb3d968589d8 | 648 | #define __HAL_SMARTCARD_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
Kojto | 90:cb3d968589d8 | 649 | ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
Kojto | 90:cb3d968589d8 | 650 | ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK)))) |
Kojto | 90:cb3d968589d8 | 651 | |
Kojto | 108:34e6b704fe68 | 652 | |
Kojto | 108:34e6b704fe68 | 653 | /** @brief Check whether the specified SmartCard interrupt has occurred or not. |
Kojto | 90:cb3d968589d8 | 654 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 655 | * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral. |
Kojto | 90:cb3d968589d8 | 656 | * @param __IT__: specifies the SMARTCARD interrupt to check. |
Kojto | 90:cb3d968589d8 | 657 | * This parameter can be one of the following values: |
Kojto | 108:34e6b704fe68 | 658 | * @arg SMARTCARD_IT_EOB: End of block interrupt |
Kojto | 108:34e6b704fe68 | 659 | * @arg SMARTCARD_IT_RTO: Receive timeout interrupt |
Kojto | 108:34e6b704fe68 | 660 | * @arg SMARTCARD_IT_TXE: Transmit data register empty interrupt |
Kojto | 108:34e6b704fe68 | 661 | * @arg SMARTCARD_IT_TC: Transmission complete interrupt |
Kojto | 108:34e6b704fe68 | 662 | * @arg SMARTCARD_IT_RXNE: Receive data register not empty interrupt |
Kojto | 108:34e6b704fe68 | 663 | * @arg SMARTCARD_IT_IDLE: Idle line detection interrupt |
Kojto | 108:34e6b704fe68 | 664 | * @arg SMARTCARD_IT_ORE: Overrun error interrupt |
Kojto | 108:34e6b704fe68 | 665 | * @arg SMARTCARD_IT_NE: Noise error interrupt |
Kojto | 108:34e6b704fe68 | 666 | * @arg SMARTCARD_IT_FE: Framing error interrupt |
Kojto | 108:34e6b704fe68 | 667 | * @arg SMARTCARD_IT_PE: Parity error interrupt |
Kojto | 90:cb3d968589d8 | 668 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 90:cb3d968589d8 | 669 | */ |
Kojto | 108:34e6b704fe68 | 670 | #define __HAL_SMARTCARD_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & ((uint32_t)1 << ((__IT__)>> 0x08))) |
Kojto | 90:cb3d968589d8 | 671 | |
Kojto | 108:34e6b704fe68 | 672 | /** @brief Check whether the specified SmartCard interrupt source is enabled or not. |
Kojto | 90:cb3d968589d8 | 673 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 674 | * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral. |
Kojto | 90:cb3d968589d8 | 675 | * @param __IT__: specifies the SMARTCARD interrupt source to check. |
Kojto | 90:cb3d968589d8 | 676 | * This parameter can be one of the following values: |
Kojto | 108:34e6b704fe68 | 677 | * @arg SMARTCARD_IT_EOB: End of block interrupt |
Kojto | 108:34e6b704fe68 | 678 | * @arg SMARTCARD_IT_RTO: Receive timeout interrupt |
Kojto | 108:34e6b704fe68 | 679 | * @arg SMARTCARD_IT_TXE: Transmit data register empty interrupt |
Kojto | 108:34e6b704fe68 | 680 | * @arg SMARTCARD_IT_TC: Transmission complete interrupt |
Kojto | 108:34e6b704fe68 | 681 | * @arg SMARTCARD_IT_RXNE: Receive data register not empty interrupt |
Kojto | 108:34e6b704fe68 | 682 | * @arg SMARTCARD_IT_IDLE: Idle line detection interrupt |
Kojto | 108:34e6b704fe68 | 683 | * @arg SMARTCARD_IT_ORE: Overrun error interrupt |
Kojto | 108:34e6b704fe68 | 684 | * @arg SMARTCARD_IT_NE: Noise error interrupt |
Kojto | 108:34e6b704fe68 | 685 | * @arg SMARTCARD_IT_FE: Framing error interrupt |
Kojto | 108:34e6b704fe68 | 686 | * @arg SMARTCARD_IT_PE: Parity error interrupt |
Kojto | 90:cb3d968589d8 | 687 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 90:cb3d968589d8 | 688 | */ |
Kojto | 90:cb3d968589d8 | 689 | #define __HAL_SMARTCARD_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5U) == 1)? (__HANDLE__)->Instance->CR1 : \ |
Kojto | 90:cb3d968589d8 | 690 | (((((uint8_t)(__IT__)) >> 5U) == 2)? (__HANDLE__)->Instance->CR2 : \ |
Kojto | 90:cb3d968589d8 | 691 | (__HANDLE__)->Instance->CR3)) & ((uint32_t)1 << (((uint16_t)(__IT__)) & SMARTCARD_IT_MASK))) |
Kojto | 90:cb3d968589d8 | 692 | |
Kojto | 90:cb3d968589d8 | 693 | |
Kojto | 108:34e6b704fe68 | 694 | /** @brief Clear the specified SMARTCARD ISR flag, in setting the proper ICR register flag. |
Kojto | 90:cb3d968589d8 | 695 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 696 | * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral. |
Kojto | 90:cb3d968589d8 | 697 | * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set |
Kojto | 90:cb3d968589d8 | 698 | * to clear the corresponding interrupt |
Kojto | 90:cb3d968589d8 | 699 | * This parameter can be one of the following values: |
Kojto | 108:34e6b704fe68 | 700 | * @arg SMARTCARD_CLEAR_PEF: Parity error clear flag |
Kojto | 108:34e6b704fe68 | 701 | * @arg SMARTCARD_CLEAR_FEF: Framing error clear flag |
Kojto | 108:34e6b704fe68 | 702 | * @arg SMARTCARD_CLEAR_NEF: Noise detected clear flag |
Kojto | 108:34e6b704fe68 | 703 | * @arg SMARTCARD_CLEAR_OREF: OverRun error clear flag |
Kojto | 108:34e6b704fe68 | 704 | * @arg SMARTCARD_CLEAR_IDLEF: Idle line detection clear flag |
Kojto | 108:34e6b704fe68 | 705 | * @arg SMARTCARD_CLEAR_TCF: Transmission complete clear flag |
Kojto | 108:34e6b704fe68 | 706 | * @arg SMARTCARD_CLEAR_RTOF: Receiver timeout clear flag |
Kojto | 108:34e6b704fe68 | 707 | * @arg SMARTCARD_CLEAR_EOBF: End of block clear flag |
Kojto | 90:cb3d968589d8 | 708 | * @retval None |
Kojto | 90:cb3d968589d8 | 709 | */ |
Kojto | 108:34e6b704fe68 | 710 | #define __HAL_SMARTCARD_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__)) |
Kojto | 90:cb3d968589d8 | 711 | |
Kojto | 90:cb3d968589d8 | 712 | /** @brief Set a specific SMARTCARD request flag. |
Kojto | 90:cb3d968589d8 | 713 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 714 | * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral. |
Kojto | 90:cb3d968589d8 | 715 | * @param __REQ__: specifies the request flag to set |
Kojto | 108:34e6b704fe68 | 716 | * This parameter can be one of the following values: |
Kojto | 108:34e6b704fe68 | 717 | * @arg SMARTCARD_RXDATA_FLUSH_REQUEST: Receive data flush Request |
Kojto | 108:34e6b704fe68 | 718 | * @arg SMARTCARD_TXDATA_FLUSH_REQUEST: Transmit data flush Request |
Kojto | 90:cb3d968589d8 | 719 | * |
Kojto | 90:cb3d968589d8 | 720 | * @retval None |
Kojto | 108:34e6b704fe68 | 721 | */ |
Kojto | 108:34e6b704fe68 | 722 | #define __HAL_SMARTCARD_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint16_t)(__REQ__)) |
Kojto | 90:cb3d968589d8 | 723 | |
Kojto | 108:34e6b704fe68 | 724 | /** @brief Enable the SMARTCARD one bit sample method. |
Kojto | 108:34e6b704fe68 | 725 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 108:34e6b704fe68 | 726 | * @retval None |
Kojto | 108:34e6b704fe68 | 727 | */ |
Kojto | 108:34e6b704fe68 | 728 | #define __HAL_SMARTCARD_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT) |
Kojto | 108:34e6b704fe68 | 729 | |
Kojto | 108:34e6b704fe68 | 730 | /** @brief Disable the SMARTCARD one bit sample method. |
Kojto | 108:34e6b704fe68 | 731 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 108:34e6b704fe68 | 732 | * @retval None |
Kojto | 108:34e6b704fe68 | 733 | */ |
Kojto | 108:34e6b704fe68 | 734 | #define __HAL_SMARTCARD_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= (uint32_t)~((uint32_t)USART_CR3_ONEBIT)) |
Kojto | 108:34e6b704fe68 | 735 | |
Kojto | 108:34e6b704fe68 | 736 | /** @brief Enable the USART associated to the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 737 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 738 | * The Handle Instance can be UARTx where x: 1, 2, 3 to select the USART peripheral |
Kojto | 90:cb3d968589d8 | 739 | * @retval None |
Kojto | 108:34e6b704fe68 | 740 | */ |
Kojto | 90:cb3d968589d8 | 741 | #define __HAL_SMARTCARD_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE) |
Kojto | 90:cb3d968589d8 | 742 | |
Kojto | 90:cb3d968589d8 | 743 | /** @brief Disable the USART associated to the SMARTCARD Handle |
Kojto | 90:cb3d968589d8 | 744 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 90:cb3d968589d8 | 745 | * The Handle Instance can be UARTx where x: 1, 2, 3 to select the USART peripheral |
Kojto | 90:cb3d968589d8 | 746 | * @retval None |
Kojto | 108:34e6b704fe68 | 747 | */ |
Kojto | 90:cb3d968589d8 | 748 | #define __HAL_SMARTCARD_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE) |
Kojto | 90:cb3d968589d8 | 749 | |
Kojto | 108:34e6b704fe68 | 750 | /** |
Kojto | 108:34e6b704fe68 | 751 | * @} |
Kojto | 108:34e6b704fe68 | 752 | */ |
Kojto | 108:34e6b704fe68 | 753 | |
Kojto | 108:34e6b704fe68 | 754 | /* Private macros -------------------------------------------------------------*/ |
Kojto | 108:34e6b704fe68 | 755 | /** @defgroup SMARTCARD_Private_Macros SMARTCARD Private Macros |
Kojto | 108:34e6b704fe68 | 756 | * @{ |
Kojto | 108:34e6b704fe68 | 757 | */ |
Kojto | 108:34e6b704fe68 | 758 | |
Kojto | 90:cb3d968589d8 | 759 | /** @brief Check the Baud rate range. The maximum Baud Rate is derived from the |
Kojto | 90:cb3d968589d8 | 760 | * maximum clock on F0 (i.e. 48 MHz) divided by the oversampling used |
Kojto | 108:34e6b704fe68 | 761 | * on the SMARTCARD (i.e. 16). |
Kojto | 90:cb3d968589d8 | 762 | * @param __BAUDRATE__: Baud rate set by the configuration function. |
Kojto | 108:34e6b704fe68 | 763 | * @retval Test result (TRUE or FALSE) |
Kojto | 108:34e6b704fe68 | 764 | */ |
Kojto | 90:cb3d968589d8 | 765 | #define IS_SMARTCARD_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 4500001) |
Kojto | 90:cb3d968589d8 | 766 | |
Kojto | 108:34e6b704fe68 | 767 | /** @brief Check the block length range. |
Kojto | 108:34e6b704fe68 | 768 | * @note The maximum SMARTCARD block length is 0xFF. |
Kojto | 90:cb3d968589d8 | 769 | * @param __LENGTH__: block length. |
Kojto | 108:34e6b704fe68 | 770 | * @retval Test result (TRUE or FALSE) |
Kojto | 90:cb3d968589d8 | 771 | */ |
Kojto | 90:cb3d968589d8 | 772 | #define IS_SMARTCARD_BLOCKLENGTH(__LENGTH__) ((__LENGTH__) <= 0xFF) |
Kojto | 90:cb3d968589d8 | 773 | |
Kojto | 108:34e6b704fe68 | 774 | /** @brief Check the receiver timeout value. |
Kojto | 108:34e6b704fe68 | 775 | * @note The maximum SMARTCARD receiver timeout value is 0xFFFFFF. |
Kojto | 90:cb3d968589d8 | 776 | * @param __TIMEOUTVALUE__: receiver timeout value. |
Kojto | 108:34e6b704fe68 | 777 | * @retval Test result (TRUE or FALSE) |
Kojto | 90:cb3d968589d8 | 778 | */ |
Kojto | 90:cb3d968589d8 | 779 | #define IS_SMARTCARD_TIMEOUT_VALUE(__TIMEOUTVALUE__) ((__TIMEOUTVALUE__) <= 0xFFFFFF) |
Kojto | 90:cb3d968589d8 | 780 | |
Kojto | 108:34e6b704fe68 | 781 | /** @brief Check the SMARTCARD autoretry counter value. |
Kojto | 108:34e6b704fe68 | 782 | * @note The maximum number of retransmissions is 0x7. |
Kojto | 108:34e6b704fe68 | 783 | * @param __COUNT__: number of retransmissions. |
Kojto | 108:34e6b704fe68 | 784 | * @retval Test result (TRUE or FALSE) |
Kojto | 90:cb3d968589d8 | 785 | */ |
Kojto | 90:cb3d968589d8 | 786 | #define IS_SMARTCARD_AUTORETRY_COUNT(__COUNT__) ((__COUNT__) <= 0x7) |
Kojto | 90:cb3d968589d8 | 787 | |
Kojto | 90:cb3d968589d8 | 788 | /** |
Kojto | 108:34e6b704fe68 | 789 | * @brief Ensure that SMARTCARD frame length is valid. |
Kojto | 108:34e6b704fe68 | 790 | * @param __LENGTH__: SMARTCARD frame length. |
Kojto | 108:34e6b704fe68 | 791 | * @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid) |
Kojto | 108:34e6b704fe68 | 792 | */ |
Kojto | 108:34e6b704fe68 | 793 | #define IS_SMARTCARD_WORD_LENGTH(__LENGTH__) ((__LENGTH__) == SMARTCARD_WORDLENGTH_9B) |
Kojto | 108:34e6b704fe68 | 794 | |
Kojto | 108:34e6b704fe68 | 795 | /** |
Kojto | 108:34e6b704fe68 | 796 | * @brief Ensure that SMARTCARD frame number of stop bits is valid. |
Kojto | 108:34e6b704fe68 | 797 | * @param __STOPBITS__: SMARTCARD frame number of stop bits. |
Kojto | 108:34e6b704fe68 | 798 | * @retval SET (__STOPBITS__ is valid) or RESET (__STOPBITS__ is invalid) |
Kojto | 108:34e6b704fe68 | 799 | */ |
Kojto | 108:34e6b704fe68 | 800 | #define IS_SMARTCARD_STOPBITS(__STOPBITS__) ((__STOPBITS__) == SMARTCARD_STOPBITS_1_5) |
Kojto | 108:34e6b704fe68 | 801 | |
Kojto | 108:34e6b704fe68 | 802 | /** |
Kojto | 108:34e6b704fe68 | 803 | * @brief Ensure that SMARTCARD frame parity is valid. |
Kojto | 108:34e6b704fe68 | 804 | * @param __PARITY__: SMARTCARD frame parity. |
Kojto | 108:34e6b704fe68 | 805 | * @retval SET (__PARITY__ is valid) or RESET (__PARITY__ is invalid) |
Kojto | 108:34e6b704fe68 | 806 | */ |
Kojto | 108:34e6b704fe68 | 807 | #define IS_SMARTCARD_PARITY(__PARITY__) (((__PARITY__) == SMARTCARD_PARITY_EVEN) || \ |
Kojto | 108:34e6b704fe68 | 808 | ((__PARITY__) == SMARTCARD_PARITY_ODD)) |
Kojto | 108:34e6b704fe68 | 809 | |
Kojto | 108:34e6b704fe68 | 810 | /** |
Kojto | 108:34e6b704fe68 | 811 | * @brief Ensure that SMARTCARD communication mode is valid. |
Kojto | 108:34e6b704fe68 | 812 | * @param __MODE__: SMARTCARD communication mode. |
Kojto | 108:34e6b704fe68 | 813 | * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) |
Kojto | 108:34e6b704fe68 | 814 | */ |
Kojto | 108:34e6b704fe68 | 815 | #define IS_SMARTCARD_MODE(__MODE__) ((((__MODE__) & (uint16_t)0xFFF3) == 0x00) && ((__MODE__) != (uint16_t)0x00)) |
Kojto | 108:34e6b704fe68 | 816 | |
Kojto | 108:34e6b704fe68 | 817 | /** |
Kojto | 108:34e6b704fe68 | 818 | * @brief Ensure that SMARTCARD frame polarity is valid. |
Kojto | 108:34e6b704fe68 | 819 | * @param __CPOL__: SMARTCARD frame polarity. |
Kojto | 108:34e6b704fe68 | 820 | * @retval SET (__CPOL__ is valid) or RESET (__CPOL__ is invalid) |
Kojto | 108:34e6b704fe68 | 821 | */ |
Kojto | 108:34e6b704fe68 | 822 | #define IS_SMARTCARD_POLARITY(__CPOL__) (((__CPOL__) == SMARTCARD_POLARITY_LOW) || ((__CPOL__) == SMARTCARD_POLARITY_HIGH)) |
Kojto | 108:34e6b704fe68 | 823 | |
Kojto | 108:34e6b704fe68 | 824 | /** |
Kojto | 108:34e6b704fe68 | 825 | * @brief Ensure that SMARTCARD frame phase is valid. |
Kojto | 108:34e6b704fe68 | 826 | * @param __CPHA__: SMARTCARD frame phase. |
Kojto | 108:34e6b704fe68 | 827 | * @retval SET (__CPHA__ is valid) or RESET (__CPHA__ is invalid) |
Kojto | 108:34e6b704fe68 | 828 | */ |
Kojto | 108:34e6b704fe68 | 829 | #define IS_SMARTCARD_PHASE(__CPHA__) (((__CPHA__) == SMARTCARD_PHASE_1EDGE) || ((__CPHA__) == SMARTCARD_PHASE_2EDGE)) |
Kojto | 108:34e6b704fe68 | 830 | |
Kojto | 108:34e6b704fe68 | 831 | /** |
Kojto | 108:34e6b704fe68 | 832 | * @brief Ensure that SMARTCARD frame last bit clock pulse setting is valid. |
Kojto | 108:34e6b704fe68 | 833 | * @param __LASTBIT__: SMARTCARD frame last bit clock pulse setting. |
Kojto | 108:34e6b704fe68 | 834 | * @retval SET (__LASTBIT__ is valid) or RESET (__LASTBIT__ is invalid) |
Kojto | 108:34e6b704fe68 | 835 | */ |
Kojto | 108:34e6b704fe68 | 836 | #define IS_SMARTCARD_LASTBIT(__LASTBIT__) (((__LASTBIT__) == SMARTCARD_LASTBIT_DISABLE) || \ |
Kojto | 108:34e6b704fe68 | 837 | ((__LASTBIT__) == SMARTCARD_LASTBIT_ENABLE)) |
Kojto | 108:34e6b704fe68 | 838 | |
Kojto | 108:34e6b704fe68 | 839 | /** |
Kojto | 108:34e6b704fe68 | 840 | * @brief Ensure that SMARTCARD frame sampling is valid. |
Kojto | 108:34e6b704fe68 | 841 | * @param __ONEBIT__: SMARTCARD frame sampling. |
Kojto | 108:34e6b704fe68 | 842 | * @retval SET (__ONEBIT__ is valid) or RESET (__ONEBIT__ is invalid) |
Kojto | 108:34e6b704fe68 | 843 | */ |
Kojto | 108:34e6b704fe68 | 844 | #define IS_SMARTCARD_ONE_BIT_SAMPLE(__ONEBIT__) (((__ONEBIT__) == SMARTCARD_ONE_BIT_SAMPLE_DISABLE) || \ |
Kojto | 108:34e6b704fe68 | 845 | ((__ONEBIT__) == SMARTCARD_ONE_BIT_SAMPLE_ENABLE)) |
Kojto | 108:34e6b704fe68 | 846 | |
Kojto | 108:34e6b704fe68 | 847 | /** |
Kojto | 108:34e6b704fe68 | 848 | * @brief Ensure that SMARTCARD NACK transmission setting is valid. |
Kojto | 108:34e6b704fe68 | 849 | * @param __NACK__: SMARTCARD NACK transmission setting. |
Kojto | 108:34e6b704fe68 | 850 | * @retval SET (__NACK__ is valid) or RESET (__NACK__ is invalid) |
Kojto | 108:34e6b704fe68 | 851 | */ |
Kojto | 108:34e6b704fe68 | 852 | #define IS_SMARTCARD_NACK(__NACK__) (((__NACK__) == SMARTCARD_NACK_ENABLE) || \ |
Kojto | 108:34e6b704fe68 | 853 | ((__NACK__) == SMARTCARD_NACK_DISABLE)) |
Kojto | 108:34e6b704fe68 | 854 | |
Kojto | 108:34e6b704fe68 | 855 | /** |
Kojto | 108:34e6b704fe68 | 856 | * @brief Ensure that SMARTCARD receiver timeout setting is valid. |
Kojto | 108:34e6b704fe68 | 857 | * @param __TIMEOUT__: SMARTCARD receiver timeout setting. |
Kojto | 108:34e6b704fe68 | 858 | * @retval SET (__TIMEOUT__ is valid) or RESET (__TIMEOUT__ is invalid) |
Kojto | 108:34e6b704fe68 | 859 | */ |
Kojto | 108:34e6b704fe68 | 860 | #define IS_SMARTCARD_TIMEOUT(__TIMEOUT__) (((__TIMEOUT__) == SMARTCARD_TIMEOUT_DISABLE) || \ |
Kojto | 108:34e6b704fe68 | 861 | ((__TIMEOUT__) == SMARTCARD_TIMEOUT_ENABLE)) |
Kojto | 108:34e6b704fe68 | 862 | |
Kojto | 108:34e6b704fe68 | 863 | /** |
Kojto | 108:34e6b704fe68 | 864 | * @brief Ensure that SMARTCARD advanced features initialization is valid. |
Kojto | 108:34e6b704fe68 | 865 | * @param __INIT__: SMARTCARD advanced features initialization. |
Kojto | 108:34e6b704fe68 | 866 | * @retval SET (__INIT__ is valid) or RESET (__INIT__ is invalid) |
Kojto | 108:34e6b704fe68 | 867 | */ |
Kojto | 108:34e6b704fe68 | 868 | #define IS_SMARTCARD_ADVFEATURE_INIT(__INIT__) ((__INIT__) <= (SMARTCARD_ADVFEATURE_NO_INIT | \ |
Kojto | 108:34e6b704fe68 | 869 | SMARTCARD_ADVFEATURE_TXINVERT_INIT | \ |
Kojto | 108:34e6b704fe68 | 870 | SMARTCARD_ADVFEATURE_RXINVERT_INIT | \ |
Kojto | 108:34e6b704fe68 | 871 | SMARTCARD_ADVFEATURE_DATAINVERT_INIT | \ |
Kojto | 108:34e6b704fe68 | 872 | SMARTCARD_ADVFEATURE_SWAP_INIT | \ |
Kojto | 108:34e6b704fe68 | 873 | SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT | \ |
Kojto | 108:34e6b704fe68 | 874 | SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT | \ |
Kojto | 108:34e6b704fe68 | 875 | SMARTCARD_ADVFEATURE_MSBFIRST_INIT)) |
Kojto | 108:34e6b704fe68 | 876 | |
Kojto | 108:34e6b704fe68 | 877 | /** |
Kojto | 108:34e6b704fe68 | 878 | * @brief Ensure that SMARTCARD frame TX inversion setting is valid. |
Kojto | 108:34e6b704fe68 | 879 | * @param __TXINV__: SMARTCARD frame TX inversion setting. |
Kojto | 108:34e6b704fe68 | 880 | * @retval SET (__TXINV__ is valid) or RESET (__TXINV__ is invalid) |
Kojto | 108:34e6b704fe68 | 881 | */ |
Kojto | 108:34e6b704fe68 | 882 | #define IS_SMARTCARD_ADVFEATURE_TXINV(__TXINV__) (((__TXINV__) == SMARTCARD_ADVFEATURE_TXINV_DISABLE) || \ |
Kojto | 108:34e6b704fe68 | 883 | ((__TXINV__) == SMARTCARD_ADVFEATURE_TXINV_ENABLE)) |
Kojto | 108:34e6b704fe68 | 884 | |
Kojto | 108:34e6b704fe68 | 885 | /** |
Kojto | 108:34e6b704fe68 | 886 | * @brief Ensure that SMARTCARD frame RX inversion setting is valid. |
Kojto | 108:34e6b704fe68 | 887 | * @param __RXINV__: SMARTCARD frame RX inversion setting. |
Kojto | 108:34e6b704fe68 | 888 | * @retval SET (__RXINV__ is valid) or RESET (__RXINV__ is invalid) |
Kojto | 108:34e6b704fe68 | 889 | */ |
Kojto | 108:34e6b704fe68 | 890 | #define IS_SMARTCARD_ADVFEATURE_RXINV(__RXINV__) (((__RXINV__) == SMARTCARD_ADVFEATURE_RXINV_DISABLE) || \ |
Kojto | 108:34e6b704fe68 | 891 | ((__RXINV__) == SMARTCARD_ADVFEATURE_RXINV_ENABLE)) |
Kojto | 108:34e6b704fe68 | 892 | |
Kojto | 108:34e6b704fe68 | 893 | /** |
Kojto | 108:34e6b704fe68 | 894 | * @brief Ensure that SMARTCARD frame data inversion setting is valid. |
Kojto | 108:34e6b704fe68 | 895 | * @param __DATAINV__: SMARTCARD frame data inversion setting. |
Kojto | 108:34e6b704fe68 | 896 | * @retval SET (__DATAINV__ is valid) or RESET (__DATAINV__ is invalid) |
Kojto | 108:34e6b704fe68 | 897 | */ |
Kojto | 108:34e6b704fe68 | 898 | #define IS_SMARTCARD_ADVFEATURE_DATAINV(__DATAINV__) (((__DATAINV__) == SMARTCARD_ADVFEATURE_DATAINV_DISABLE) || \ |
Kojto | 108:34e6b704fe68 | 899 | ((__DATAINV__) == SMARTCARD_ADVFEATURE_DATAINV_ENABLE)) |
Kojto | 108:34e6b704fe68 | 900 | |
Kojto | 108:34e6b704fe68 | 901 | /** |
Kojto | 108:34e6b704fe68 | 902 | * @brief Ensure that SMARTCARD frame RX/TX pins swap setting is valid. |
Kojto | 108:34e6b704fe68 | 903 | * @param __SWAP__: SMARTCARD frame RX/TX pins swap setting. |
Kojto | 108:34e6b704fe68 | 904 | * @retval SET (__SWAP__ is valid) or RESET (__SWAP__ is invalid) |
Kojto | 108:34e6b704fe68 | 905 | */ |
Kojto | 108:34e6b704fe68 | 906 | #define IS_SMARTCARD_ADVFEATURE_SWAP(__SWAP__) (((__SWAP__) == SMARTCARD_ADVFEATURE_SWAP_DISABLE) || \ |
Kojto | 108:34e6b704fe68 | 907 | ((__SWAP__) == SMARTCARD_ADVFEATURE_SWAP_ENABLE)) |
Kojto | 108:34e6b704fe68 | 908 | |
Kojto | 108:34e6b704fe68 | 909 | /** |
Kojto | 108:34e6b704fe68 | 910 | * @brief Ensure that SMARTCARD frame overrun setting is valid. |
Kojto | 108:34e6b704fe68 | 911 | * @param __OVERRUN__: SMARTCARD frame overrun setting. |
Kojto | 108:34e6b704fe68 | 912 | * @retval SET (__OVERRUN__ is valid) or RESET (__OVERRUN__ is invalid) |
Kojto | 108:34e6b704fe68 | 913 | */ |
Kojto | 108:34e6b704fe68 | 914 | #define IS_SMARTCARD_OVERRUN(__OVERRUN__) (((__OVERRUN__) == SMARTCARD_ADVFEATURE_OVERRUN_ENABLE) || \ |
Kojto | 108:34e6b704fe68 | 915 | ((__OVERRUN__) == SMARTCARD_ADVFEATURE_OVERRUN_DISABLE)) |
Kojto | 108:34e6b704fe68 | 916 | |
Kojto | 108:34e6b704fe68 | 917 | /** |
Kojto | 108:34e6b704fe68 | 918 | * @brief Ensure that SMARTCARD DMA enabling or disabling on error setting is valid. |
Kojto | 108:34e6b704fe68 | 919 | * @param __DMA__: SMARTCARD DMA enabling or disabling on error setting. |
Kojto | 108:34e6b704fe68 | 920 | * @retval SET (__DMA__ is valid) or RESET (__DMA__ is invalid) |
Kojto | 108:34e6b704fe68 | 921 | */ |
Kojto | 108:34e6b704fe68 | 922 | #define IS_SMARTCARD_ADVFEATURE_DMAONRXERROR(__DMA__) (((__DMA__) == SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR) || \ |
Kojto | 108:34e6b704fe68 | 923 | ((__DMA__) == SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR)) |
Kojto | 108:34e6b704fe68 | 924 | |
Kojto | 108:34e6b704fe68 | 925 | /** |
Kojto | 108:34e6b704fe68 | 926 | * @brief Ensure that SMARTCARD frame MSB first setting is valid. |
Kojto | 108:34e6b704fe68 | 927 | * @param __MSBFIRST__: SMARTCARD frame MSB first setting. |
Kojto | 108:34e6b704fe68 | 928 | * @retval SET (__MSBFIRST__ is valid) or RESET (__MSBFIRST__ is invalid) |
Kojto | 108:34e6b704fe68 | 929 | */ |
Kojto | 108:34e6b704fe68 | 930 | #define IS_SMARTCARD_ADVFEATURE_MSBFIRST(__MSBFIRST__) (((__MSBFIRST__) == SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE) || \ |
Kojto | 108:34e6b704fe68 | 931 | ((__MSBFIRST__) == SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE)) |
Kojto | 108:34e6b704fe68 | 932 | |
Kojto | 108:34e6b704fe68 | 933 | /** |
Kojto | 108:34e6b704fe68 | 934 | * @brief Ensure that SMARTCARD request parameter is valid. |
Kojto | 108:34e6b704fe68 | 935 | * @param __PARAM__: SMARTCARD request parameter. |
Kojto | 108:34e6b704fe68 | 936 | * @retval SET (__PARAM__ is valid) or RESET (__PARAM__ is invalid) |
Kojto | 108:34e6b704fe68 | 937 | */ |
Kojto | 108:34e6b704fe68 | 938 | #define IS_SMARTCARD_REQUEST_PARAMETER(__PARAM__) (((__PARAM__) == SMARTCARD_RXDATA_FLUSH_REQUEST) || \ |
Kojto | 108:34e6b704fe68 | 939 | ((__PARAM__) == SMARTCARD_TXDATA_FLUSH_REQUEST)) |
Kojto | 108:34e6b704fe68 | 940 | |
Kojto | 108:34e6b704fe68 | 941 | /** |
Kojto | 90:cb3d968589d8 | 942 | * @} |
Kojto | 108:34e6b704fe68 | 943 | */ |
Kojto | 90:cb3d968589d8 | 944 | |
Kojto | 93:e188a91d3eaa | 945 | /* Include SMARTCARD HAL Extended module */ |
Kojto | 108:34e6b704fe68 | 946 | #include "stm32f0xx_hal_smartcard_ex.h" |
Kojto | 90:cb3d968589d8 | 947 | |
Kojto | 90:cb3d968589d8 | 948 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 949 | /** @addtogroup SMARTCARD_Exported_Functions SMARTCARD Exported Functions |
Kojto | 90:cb3d968589d8 | 950 | * @{ |
Kojto | 90:cb3d968589d8 | 951 | */ |
Kojto | 90:cb3d968589d8 | 952 | |
Kojto | 90:cb3d968589d8 | 953 | /** @addtogroup SMARTCARD_Exported_Functions_Group1 Initialization and de-initialization functions |
Kojto | 90:cb3d968589d8 | 954 | * @{ |
Kojto | 90:cb3d968589d8 | 955 | */ |
Kojto | 90:cb3d968589d8 | 956 | |
Kojto | 90:cb3d968589d8 | 957 | /* Initialization and de-initialization functions ****************************/ |
Kojto | 90:cb3d968589d8 | 958 | HAL_StatusTypeDef HAL_SMARTCARD_Init(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 959 | HAL_StatusTypeDef HAL_SMARTCARD_DeInit(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 960 | void HAL_SMARTCARD_MspInit(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 961 | void HAL_SMARTCARD_MspDeInit(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 108:34e6b704fe68 | 962 | |
Kojto | 90:cb3d968589d8 | 963 | /** |
Kojto | 90:cb3d968589d8 | 964 | * @} |
Kojto | 108:34e6b704fe68 | 965 | */ |
Kojto | 90:cb3d968589d8 | 966 | |
Kojto | 90:cb3d968589d8 | 967 | /** @addtogroup SMARTCARD_Exported_Functions_Group2 IO operation functions |
Kojto | 90:cb3d968589d8 | 968 | * @{ |
Kojto | 90:cb3d968589d8 | 969 | */ |
Kojto | 90:cb3d968589d8 | 970 | /* IO operation functions *****************************************************/ |
Kojto | 90:cb3d968589d8 | 971 | HAL_StatusTypeDef HAL_SMARTCARD_Transmit(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 90:cb3d968589d8 | 972 | HAL_StatusTypeDef HAL_SMARTCARD_Receive(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 90:cb3d968589d8 | 973 | HAL_StatusTypeDef HAL_SMARTCARD_Transmit_IT(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size); |
Kojto | 90:cb3d968589d8 | 974 | HAL_StatusTypeDef HAL_SMARTCARD_Receive_IT(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size); |
Kojto | 90:cb3d968589d8 | 975 | HAL_StatusTypeDef HAL_SMARTCARD_Transmit_DMA(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size); |
Kojto | 90:cb3d968589d8 | 976 | HAL_StatusTypeDef HAL_SMARTCARD_Receive_DMA(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size); |
Kojto | 90:cb3d968589d8 | 977 | void HAL_SMARTCARD_IRQHandler(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 978 | void HAL_SMARTCARD_TxCpltCallback(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 979 | void HAL_SMARTCARD_RxCpltCallback(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 90:cb3d968589d8 | 980 | void HAL_SMARTCARD_ErrorCallback(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 108:34e6b704fe68 | 981 | |
Kojto | 90:cb3d968589d8 | 982 | /** |
Kojto | 90:cb3d968589d8 | 983 | * @} |
Kojto | 108:34e6b704fe68 | 984 | */ |
Kojto | 90:cb3d968589d8 | 985 | |
Kojto | 90:cb3d968589d8 | 986 | /** @addtogroup SMARTCARD_Exported_Functions_Group3 Peripheral State and Errors functions |
Kojto | 90:cb3d968589d8 | 987 | * @{ |
Kojto | 108:34e6b704fe68 | 988 | */ |
Kojto | 90:cb3d968589d8 | 989 | /* Peripheral State and Error functions ***************************************/ |
Kojto | 90:cb3d968589d8 | 990 | HAL_SMARTCARD_StateTypeDef HAL_SMARTCARD_GetState(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 108:34e6b704fe68 | 991 | uint32_t HAL_SMARTCARD_GetError(SMARTCARD_HandleTypeDef *hsmartcard); |
Kojto | 108:34e6b704fe68 | 992 | |
Kojto | 90:cb3d968589d8 | 993 | /** |
Kojto | 90:cb3d968589d8 | 994 | * @} |
Kojto | 90:cb3d968589d8 | 995 | */ |
Kojto | 108:34e6b704fe68 | 996 | |
Kojto | 90:cb3d968589d8 | 997 | /** |
Kojto | 90:cb3d968589d8 | 998 | * @} |
Kojto | 108:34e6b704fe68 | 999 | */ |
Kojto | 90:cb3d968589d8 | 1000 | |
Kojto | 90:cb3d968589d8 | 1001 | /** |
Kojto | 90:cb3d968589d8 | 1002 | * @} |
Kojto | 90:cb3d968589d8 | 1003 | */ |
Kojto | 90:cb3d968589d8 | 1004 | |
Kojto | 90:cb3d968589d8 | 1005 | /** |
Kojto | 90:cb3d968589d8 | 1006 | * @} |
Kojto | 90:cb3d968589d8 | 1007 | */ |
Kojto | 90:cb3d968589d8 | 1008 | |
Kojto | 93:e188a91d3eaa | 1009 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */ |
Kojto | 90:cb3d968589d8 | 1010 | |
Kojto | 90:cb3d968589d8 | 1011 | #ifdef __cplusplus |
Kojto | 90:cb3d968589d8 | 1012 | } |
Kojto | 90:cb3d968589d8 | 1013 | #endif |
Kojto | 90:cb3d968589d8 | 1014 | |
Kojto | 90:cb3d968589d8 | 1015 | #endif /* __STM32F0xx_HAL_SMARTCARD_H */ |
Kojto | 90:cb3d968589d8 | 1016 | |
Kojto | 90:cb3d968589d8 | 1017 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
Kojto | 90:cb3d968589d8 | 1018 |