Subversion Repositories FuelGauge

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 6
Line 50... Line 50...
50
                                           The baud rate register is computed using the following formula:
50
                                           The baud rate register is computed using the following formula:
51
                                              Baud Rate Register = ((usart_ker_ckpres) / ((hsmartcard->Init.BaudRate)))
51
                                              Baud Rate Register = ((usart_ker_ckpres) / ((hsmartcard->Init.BaudRate)))
52
                                           where usart_ker_ckpres is the USART input clock divided by a prescaler */
52
                                           where usart_ker_ckpres is the USART input clock divided by a prescaler */
53
 
53
 
54
  uint32_t WordLength;                /*!< Specifies the number of data bits transmitted or received in a frame.
54
  uint32_t WordLength;                /*!< Specifies the number of data bits transmitted or received in a frame.
55
                                           This parameter @ref SMARTCARD_Word_Length can only be set to 9 (8 data + 1 parity bits). */
55
                                           This parameter @ref SMARTCARD_Word_Length can only be
-
 
56
                                           set to 9 (8 data + 1 parity bits). */
56
 
57
 
57
  uint32_t StopBits;                  /*!< Specifies the number of stop bits.
58
  uint32_t StopBits;                  /*!< Specifies the number of stop bits.
58
                                           This parameter can be a value of @ref SMARTCARD_Stop_Bits. */
59
                                           This parameter can be a value of @ref SMARTCARD_Stop_Bits. */
59
 
60
 
60
  uint16_t Parity;                    /*!< Specifies the parity mode.
61
  uint16_t Parity;                    /*!< Specifies the parity mode.
Line 74... Line 75...
74
 
75
 
75
  uint16_t CLKLastBit;                /*!< Specifies whether the clock pulse corresponding to the last transmitted
76
  uint16_t CLKLastBit;                /*!< Specifies whether the clock pulse corresponding to the last transmitted
76
                                           data bit (MSB) has to be output on the SCLK pin in synchronous mode.
77
                                           data bit (MSB) has to be output on the SCLK pin in synchronous mode.
77
                                           This parameter can be a value of @ref SMARTCARD_Last_Bit */
78
                                           This parameter can be a value of @ref SMARTCARD_Last_Bit */
78
 
79
 
79
  uint16_t OneBitSampling;            /*!< Specifies whether a single sample or three samples' majority vote is selected.
80
  uint16_t OneBitSampling;            /*!< Specifies whether a single sample or three samples' majority vote
80
                                           Selecting the single sample method increases the receiver tolerance to clock
81
                                           is selected. Selecting the single sample method increases
-
 
82
                                           the receiver tolerance to clock deviations. This parameter can be a value
81
                                           deviations. This parameter can be a value of @ref SMARTCARD_OneBit_Sampling. */
83
                                           of @ref SMARTCARD_OneBit_Sampling. */
82
 
84
 
83
  uint8_t  Prescaler;                 /*!< Specifies the SmartCard Prescaler.
85
  uint8_t  Prescaler;                 /*!< Specifies the SmartCard Prescaler.
84
                                           This parameter can be any value from 0x01 to 0x1F. Prescaler value is multiplied
86
                                           This parameter can be any value from 0x01 to 0x1F. Prescaler value is
85
                                           by 2 to give the division factor of the source clock frequency */
87
                                           multiplied by 2 to give the division factor of the source clock frequency */
86
 
88
 
87
  uint8_t  GuardTime;                 /*!< Specifies the SmartCard Guard Time applied after stop bits. */
89
  uint8_t  GuardTime;                 /*!< Specifies the SmartCard Guard Time applied after stop bits. */
88
 
90
 
89
  uint16_t NACKEnable;                /*!< Specifies whether the SmartCard NACK transmission is enabled
91
  uint16_t NACKEnable;                /*!< Specifies whether the SmartCard NACK transmission is enabled
90
                                           in case of parity error.
92
                                           in case of parity error.
Line 106... Line 108...
106
                                            an error) */
108
                                            an error) */
107
 
109
 
108
} SMARTCARD_InitTypeDef;
110
} SMARTCARD_InitTypeDef;
109
 
111
 
110
/**
112
/**
111
  * @brief  SMARTCARD advanced features initalization structure definition
113
  * @brief  SMARTCARD advanced features initialization structure definition
112
  */
114
  */
113
typedef struct
115
typedef struct
114
{
116
{
115
  uint32_t AdvFeatureInit;            /*!< Specifies which advanced SMARTCARD features is initialized. Several
117
  uint32_t AdvFeatureInit;            /*!< Specifies which advanced SMARTCARD features is initialized. Several
116
                                           advanced features may be initialized at the same time. This parameter
118
                                           advanced features may be initialized at the same time. This parameter
Line 136... Line 138...
136
                                           This parameter can be a value of @ref SMARTCARD_DMA_Disable_on_Rx_Error */
138
                                           This parameter can be a value of @ref SMARTCARD_DMA_Disable_on_Rx_Error */
137
 
139
 
138
  uint32_t MSBFirst;                  /*!< Specifies whether MSB is sent first on UART line.
140
  uint32_t MSBFirst;                  /*!< Specifies whether MSB is sent first on UART line.
139
                                           This parameter can be a value of @ref SMARTCARD_MSB_First */
141
                                           This parameter can be a value of @ref SMARTCARD_MSB_First */
140
 
142
 
141
  uint16_t TxCompletionIndication;     /*!< Specifies which transmission completion indication is used: before (when
143
  uint16_t TxCompletionIndication;    /*!< Specifies which transmission completion indication is used: before (when
142
                                            relevant flag is available) or once guard time period has elapsed.
144
                                           relevant flag is available) or once guard time period has elapsed.
-
 
145
                                           This parameter can be a value
143
                                           This parameter can be a value of @ref SMARTCARDEx_Transmission_Completion_Indication. */
146
                                           of @ref SMARTCARDEx_Transmission_Completion_Indication. */
144
} SMARTCARD_AdvFeatureInitTypeDef;
147
} SMARTCARD_AdvFeatureInitTypeDef;
145
 
148
 
146
/**
149
/**
147
  * @brief HAL SMARTCARD State definition
150
  * @brief HAL SMARTCARD State definition
148
  * @note  HAL SMARTCARD State value is a combination of 2 different substates: gState and RxState (see @ref SMARTCARD_State_Definition).
151
  * @note  HAL SMARTCARD State value is a combination of 2 different substates:
-
 
152
  *        gState and RxState (see @ref SMARTCARD_State_Definition).
149
  *        - gState contains SMARTCARD state information related to global Handle management
153
  *        - gState contains SMARTCARD state information related to global Handle management
150
  *          and also information related to Tx operations.
154
  *          and also information related to Tx operations.
151
  *          gState value coding follow below described bitmap :
155
  *          gState value coding follow below described bitmap :
152
  *          b7-b6  Error information
156
  *          b7-b6  Error information
153
  *             00 : No Error
157
  *             00 : No Error
154
  *             01 : (Not Used)
158
  *             01 : (Not Used)
155
  *             10 : Timeout
159
  *             10 : Timeout
156
  *             11 : Error
160
  *             11 : Error
157
  *          b5     Peripheral initialization status
161
  *          b5     Peripheral initialization status
158
  *             0  : Reset (Peripheral not initialized)
162
  *             0  : Reset (Peripheral not initialized)
159
  *             1  : Init done (Peripheral not initialized. HAL SMARTCARD Init function already called)
163
  *             1  : Init done (Peripheral initialized. HAL SMARTCARD Init function already called)
160
  *          b4-b3  (not used)
164
  *          b4-b3  (not used)
161
  *             xx : Should be set to 00
165
  *             xx : Should be set to 00
162
  *          b2     Intrinsic process state
166
  *          b2     Intrinsic process state
163
  *             0  : Ready
167
  *             0  : Ready
164
  *             1  : Busy (Peripheral busy with some configuration or internal operations)
168
  *             1  : Busy (Peripheral busy with some configuration or internal operations)
Line 171... Line 175...
171
  *          RxState value coding follow below described bitmap :
175
  *          RxState value coding follow below described bitmap :
172
  *          b7-b6  (not used)
176
  *          b7-b6  (not used)
173
  *             xx : Should be set to 00
177
  *             xx : Should be set to 00
174
  *          b5     Peripheral initialization status
178
  *          b5     Peripheral initialization status
175
  *             0  : Reset (Peripheral not initialized)
179
  *             0  : Reset (Peripheral not initialized)
176
  *             1  : Init done (Peripheral not initialized)
180
  *             1  : Init done (Peripheral initialized)
177
  *          b4-b2  (not used)
181
  *          b4-b2  (not used)
178
  *            xxx : Should be set to 000
182
  *            xxx : Should be set to 000
179
  *          b1     Rx state
183
  *          b1     Rx state
180
  *             0  : Ready (no Rx operation ongoing)
184
  *             0  : Ready (no Rx operation ongoing)
181
  *             1  : Busy (Rx operation ongoing)
185
  *             1  : Busy (Rx operation ongoing)
Line 216... Line 220...
216
 
220
 
217
  DMA_HandleTypeDef                 *hdmarx;               /*!< SmartCard Rx DMA Handle parameters                    */
221
  DMA_HandleTypeDef                 *hdmarx;               /*!< SmartCard Rx DMA Handle parameters                    */
218
 
222
 
219
  HAL_LockTypeDef                   Lock;                  /*!< Locking object                                        */
223
  HAL_LockTypeDef                   Lock;                  /*!< Locking object                                        */
220
 
224
 
221
  __IO HAL_SMARTCARD_StateTypeDef   gState;                /*!< SmartCard state information related to global Handle management
225
  __IO HAL_SMARTCARD_StateTypeDef   gState;                /*!< SmartCard state information related to global
222
                                                                and also related to Tx operations.
226
                                                                Handle management and also related to Tx operations.
223
                                                                This parameter can be a value of @ref HAL_SMARTCARD_StateTypeDef */
227
                                                                This parameter can be a value
-
 
228
                                                                of @ref HAL_SMARTCARD_StateTypeDef                    */
224
 
229
 
225
  __IO HAL_SMARTCARD_StateTypeDef   RxState;               /*!< SmartCard state information related to Rx operations.
230
  __IO HAL_SMARTCARD_StateTypeDef   RxState;               /*!< SmartCard state information related to Rx operations.
226
                                                                This parameter can be a value of @ref HAL_SMARTCARD_StateTypeDef */
231
                                                                This parameter can be a value
-
 
232
                                                                of @ref HAL_SMARTCARD_StateTypeDef                    */
227
 
233
 
228
  __IO uint32_t                     ErrorCode;             /*!< SmartCard Error code                                  */
234
  __IO uint32_t                     ErrorCode;             /*!< SmartCard Error code                                  */
229
 
235
 
230
#if (USE_HAL_SMARTCARD_REGISTER_CALLBACKS == 1)
236
#if (USE_HAL_SMARTCARD_REGISTER_CALLBACKS == 1)
231
  void (* TxCpltCallback)(struct __SMARTCARD_HandleTypeDef *hsmartcard);            /*!< SMARTCARD Tx Complete Callback             */
237
  void (* TxCpltCallback)(struct __SMARTCARD_HandleTypeDef *hsmartcard);            /*!< SMARTCARD Tx Complete Callback             */
Line 294... Line 300...
294
  */
300
  */
295
 
301
 
296
/** @defgroup SMARTCARD_State_Definition SMARTCARD State Code Definition
302
/** @defgroup SMARTCARD_State_Definition SMARTCARD State Code Definition
297
  * @{
303
  * @{
298
  */
304
  */
299
#define HAL_SMARTCARD_STATE_RESET            0x00000000U                     /*!< Peripheral is not initialized
305
#define HAL_SMARTCARD_STATE_RESET            0x00000000U                     /*!< Peripheral is not initialized. Value
300
                                                                                  Value is allowed for gState and RxState */
306
                                                                                  is allowed for gState and RxState */
301
#define HAL_SMARTCARD_STATE_READY            0x00000020U                     /*!< Peripheral Initialized and ready for use
307
#define HAL_SMARTCARD_STATE_READY            0x00000020U                     /*!< Peripheral Initialized and ready for
302
                                                                                  Value is allowed for gState and RxState */
308
                                                                                  use. Value is allowed for gState
-
 
309
                                                                                  and RxState                       */
303
#define HAL_SMARTCARD_STATE_BUSY             0x00000024U                     /*!< an internal process is ongoing
310
#define HAL_SMARTCARD_STATE_BUSY             0x00000024U                     /*!< an internal process is ongoing
304
                                                                                  Value is allowed for gState only */
311
                                                                                  Value is allowed for gState only  */
305
#define HAL_SMARTCARD_STATE_BUSY_TX          0x00000021U                     /*!< Data Transmission process is ongoing
312
#define HAL_SMARTCARD_STATE_BUSY_TX          0x00000021U                     /*!< Data Transmission process is ongoing
306
                                                                                  Value is allowed for gState only */
313
                                                                                  Value is allowed for gState only  */
307
#define HAL_SMARTCARD_STATE_BUSY_RX          0x00000022U                     /*!< Data Reception process is ongoing
314
#define HAL_SMARTCARD_STATE_BUSY_RX          0x00000022U                     /*!< Data Reception process is ongoing
308
                                                                                  Value is allowed for RxState only */
315
                                                                                  Value is allowed for RxState only */
309
#define HAL_SMARTCARD_STATE_BUSY_TX_RX       0x00000023U                     /*!< Data Transmission and Reception process is ongoing
316
#define HAL_SMARTCARD_STATE_BUSY_TX_RX       0x00000023U                     /*!< Data Transmission and Reception
-
 
317
                                                                                  process is ongoing Not to be used for
310
                                                                                  Not to be used for neither gState nor RxState.
318
                                                                                  neither gState nor RxState.
-
 
319
                                                                                  Value is result of combination (Or)
311
                                                                                  Value is result of combination (Or) between gState and RxState values */
320
                                                                                  between gState and RxState values */
312
#define HAL_SMARTCARD_STATE_TIMEOUT          0x000000A0U                     /*!< Timeout state
321
#define HAL_SMARTCARD_STATE_TIMEOUT          0x000000A0U                     /*!< Timeout state
313
                                                                                  Value is allowed for gState only */
322
                                                                                  Value is allowed for gState only  */
314
#define HAL_SMARTCARD_STATE_ERROR            0x000000E0U                     /*!< Error
323
#define HAL_SMARTCARD_STATE_ERROR            0x000000E0U                     /*!< Error
315
                                                                                  Value is allowed for gState only */
324
                                                                                  Value is allowed for gState only  */
316
/**
325
/**
317
  * @}
326
  * @}
318
  */
327
  */
319
 
328
 
320
/** @defgroup SMARTCARD_Error_Definition SMARTCARD Error Code Definition
329
/** @defgroup SMARTCARD_Error_Definition SMARTCARD Error Code Definition
321
  * @{
330
  * @{
322
  */
331
  */
323
#define HAL_SMARTCARD_ERROR_NONE             ((uint32_t)0x00000000U)         /*!< No error                */
332
#define HAL_SMARTCARD_ERROR_NONE             (0x00000000U)         /*!< No error                */
324
#define HAL_SMARTCARD_ERROR_PE               ((uint32_t)0x00000001U)         /*!< Parity error            */
333
#define HAL_SMARTCARD_ERROR_PE               (0x00000001U)         /*!< Parity error            */
325
#define HAL_SMARTCARD_ERROR_NE               ((uint32_t)0x00000002U)         /*!< Noise error             */
334
#define HAL_SMARTCARD_ERROR_NE               (0x00000002U)         /*!< Noise error             */
326
#define HAL_SMARTCARD_ERROR_FE               ((uint32_t)0x00000004U)         /*!< frame error             */
335
#define HAL_SMARTCARD_ERROR_FE               (0x00000004U)         /*!< frame error             */
327
#define HAL_SMARTCARD_ERROR_ORE              ((uint32_t)0x00000008U)         /*!< Overrun error           */
336
#define HAL_SMARTCARD_ERROR_ORE              (0x00000008U)         /*!< Overrun error           */
328
#define HAL_SMARTCARD_ERROR_DMA              ((uint32_t)0x00000010U)         /*!< DMA transfer error      */
337
#define HAL_SMARTCARD_ERROR_DMA              (0x00000010U)         /*!< DMA transfer error      */
329
#define HAL_SMARTCARD_ERROR_RTO              ((uint32_t)0x00000020U)         /*!< Receiver TimeOut error  */
338
#define HAL_SMARTCARD_ERROR_RTO              (0x00000020U)         /*!< Receiver TimeOut error  */
330
#if (USE_HAL_SMARTCARD_REGISTER_CALLBACKS == 1)
339
#if (USE_HAL_SMARTCARD_REGISTER_CALLBACKS == 1)
331
#define HAL_SMARTCARD_ERROR_INVALID_CALLBACK ((uint32_t)0x00000040U)         /*!< Invalid Callback error  */
340
#define HAL_SMARTCARD_ERROR_INVALID_CALLBACK (0x00000040U)         /*!< Invalid Callback error  */
332
#endif /* USE_HAL_SMARTCARD_REGISTER_CALLBACKS */
341
#endif /* USE_HAL_SMARTCARD_REGISTER_CALLBACKS */
333
/**
342
/**
334
  * @}
343
  * @}
335
  */
344
  */
336
 
345
 
Line 624... Line 633...
624
  *          This parameter can be one of the following values:
633
  *          This parameter can be one of the following values:
625
  *            @arg @ref SMARTCARD_IT_EOB    End of block interrupt
634
  *            @arg @ref SMARTCARD_IT_EOB    End of block interrupt
626
  *            @arg @ref SMARTCARD_IT_RTO    Receive timeout interrupt
635
  *            @arg @ref SMARTCARD_IT_RTO    Receive timeout interrupt
627
  *            @arg @ref SMARTCARD_IT_TXE    Transmit data register empty interrupt
636
  *            @arg @ref SMARTCARD_IT_TXE    Transmit data register empty interrupt
628
  *            @arg @ref SMARTCARD_IT_TC     Transmission complete interrupt
637
  *            @arg @ref SMARTCARD_IT_TC     Transmission complete interrupt
-
 
638
  *            @arg @ref SMARTCARD_IT_TCBGT  Transmission complete before
629
  *            @arg @ref SMARTCARD_IT_TCBGT  Transmission complete before guard time interrupt (when interruption available)
639
  *                                          guard time interrupt (when interruption available)
630
  *            @arg @ref SMARTCARD_IT_RXNE   Receive data register not empty interrupt
640
  *            @arg @ref SMARTCARD_IT_RXNE   Receive data register not empty interrupt
631
  *            @arg @ref SMARTCARD_IT_IDLE   Idle line detection interrupt
641
  *            @arg @ref SMARTCARD_IT_IDLE   Idle line detection interrupt
632
  *            @arg @ref SMARTCARD_IT_PE     Parity error interrupt
642
  *            @arg @ref SMARTCARD_IT_PE     Parity error interrupt
633
  *            @arg @ref SMARTCARD_IT_ERR    Error interrupt(frame error, noise error, overrun error)
643
  *            @arg @ref SMARTCARD_IT_ERR    Error interrupt(frame error, noise error, overrun error)
634
  * @retval None
644
  * @retval None
635
  */
645
  */
636
#define __HAL_SMARTCARD_ENABLE_IT(__HANDLE__, __INTERRUPT__)   (((((__INTERRUPT__) & SMARTCARD_CR_MASK) >> SMARTCARD_CR_POS) == 1U)? ((__HANDLE__)->Instance->CR1 |= ((uint32_t)1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
646
#define __HAL_SMARTCARD_ENABLE_IT(__HANDLE__, __INTERRUPT__)   (((((__INTERRUPT__) & SMARTCARD_CR_MASK) >>\
-
 
647
                                                                  SMARTCARD_CR_POS) == 1U)?\
-
 
648
                                                                ((__HANDLE__)->Instance->CR1 |= (1UL <<\
-
 
649
                                                                    ((__INTERRUPT__) & SMARTCARD_IT_MASK))):\
-
 
650
                                                                ((((__INTERRUPT__) & SMARTCARD_CR_MASK) >>\
-
 
651
                                                                  SMARTCARD_CR_POS) == 2U)?\
-
 
652
                                                                ((__HANDLE__)->Instance->CR2 |= (1UL <<\
637
                                                                ((((__INTERRUPT__) & SMARTCARD_CR_MASK) >> SMARTCARD_CR_POS) == 2U)? ((__HANDLE__)->Instance->CR2 |= ((uint32_t)1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
653
                                                                    ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
-
 
654
                                                                ((__HANDLE__)->Instance->CR3 |= (1UL <<\
638
                                                                ((__HANDLE__)->Instance->CR3 |= ((uint32_t)1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))))
655
                                                                    ((__INTERRUPT__) & SMARTCARD_IT_MASK))))
639
 
656
 
640
/** @brief  Disable the specified SmartCard interrupt.
657
/** @brief  Disable the specified SmartCard interrupt.
641
  * @param  __HANDLE__ specifies the SMARTCARD Handle.
658
  * @param  __HANDLE__ specifies the SMARTCARD Handle.
642
  * @param  __INTERRUPT__ specifies the SMARTCARD interrupt to disable.
659
  * @param  __INTERRUPT__ specifies the SMARTCARD interrupt to disable.
643
  *          This parameter can be one of the following values:
660
  *          This parameter can be one of the following values:
644
  *            @arg @ref SMARTCARD_IT_EOB    End of block interrupt
661
  *            @arg @ref SMARTCARD_IT_EOB    End of block interrupt
645
  *            @arg @ref SMARTCARD_IT_RTO    Receive timeout interrupt
662
  *            @arg @ref SMARTCARD_IT_RTO    Receive timeout interrupt
646
  *            @arg @ref SMARTCARD_IT_TXE    Transmit data register empty interrupt
663
  *            @arg @ref SMARTCARD_IT_TXE    Transmit data register empty interrupt
647
  *            @arg @ref SMARTCARD_IT_TC     Transmission complete interrupt
664
  *            @arg @ref SMARTCARD_IT_TC     Transmission complete interrupt
648
  *            @arg @ref SMARTCARD_IT_TCBGT  Transmission complete before guard time interrupt (when interruption available)
665
  *            @arg @ref SMARTCARD_IT_TCBGT  Transmission complete before guard
-
 
666
  *                                          time interrupt (when interruption available)
649
  *            @arg @ref SMARTCARD_IT_RXNE   Receive data register not empty interrupt
667
  *            @arg @ref SMARTCARD_IT_RXNE   Receive data register not empty interrupt
650
  *            @arg @ref SMARTCARD_IT_IDLE   Idle line detection interrupt
668
  *            @arg @ref SMARTCARD_IT_IDLE   Idle line detection interrupt
651
  *            @arg @ref SMARTCARD_IT_PE     Parity error interrupt
669
  *            @arg @ref SMARTCARD_IT_PE     Parity error interrupt
652
  *            @arg @ref SMARTCARD_IT_ERR    Error interrupt(frame error, noise error, overrun error)
670
  *            @arg @ref SMARTCARD_IT_ERR    Error interrupt(frame error, noise error, overrun error)
653
  * @retval None
671
  * @retval None
654
  */
672
  */
655
#define __HAL_SMARTCARD_DISABLE_IT(__HANDLE__, __INTERRUPT__)  (((((__INTERRUPT__) & SMARTCARD_CR_MASK) >> SMARTCARD_CR_POS) == 1U)? ((__HANDLE__)->Instance->CR1 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
673
#define __HAL_SMARTCARD_DISABLE_IT(__HANDLE__, __INTERRUPT__)  (((((__INTERRUPT__) & SMARTCARD_CR_MASK) >>\
-
 
674
                                                                  SMARTCARD_CR_POS) == 1U)?\
-
 
675
                                                                ((__HANDLE__)->Instance->CR1 &= ~ (1U <<\
-
 
676
                                                                    ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
-
 
677
                                                                ((((__INTERRUPT__) & SMARTCARD_CR_MASK) >>\
-
 
678
                                                                  SMARTCARD_CR_POS) == 2U)?\
-
 
679
                                                                ((__HANDLE__)->Instance->CR2 &= ~ (1U <<\
656
                                                                ((((__INTERRUPT__) & SMARTCARD_CR_MASK) >> SMARTCARD_CR_POS) == 2U)? ((__HANDLE__)->Instance->CR2 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
680
                                                                    ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
-
 
681
                                                                ((__HANDLE__)->Instance->CR3 &= ~ (1U <<\
657
                                                                ((__HANDLE__)->Instance->CR3 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))))
682
                                                                    ((__INTERRUPT__) & SMARTCARD_IT_MASK))))
658
 
683
 
659
/** @brief  Check whether the specified SmartCard interrupt has occurred or not.
684
/** @brief  Check whether the specified SmartCard interrupt has occurred or not.
660
  * @param  __HANDLE__ specifies the SMARTCARD Handle.
685
  * @param  __HANDLE__ specifies the SMARTCARD Handle.
661
  * @param  __INTERRUPT__ specifies the SMARTCARD interrupt to check.
686
  * @param  __INTERRUPT__ specifies the SMARTCARD interrupt to check.
662
  *          This parameter can be one of the following values:
687
  *          This parameter can be one of the following values:
663
  *            @arg @ref SMARTCARD_IT_EOB    End of block interrupt
688
  *            @arg @ref SMARTCARD_IT_EOB    End of block interrupt
664
  *            @arg @ref SMARTCARD_IT_RTO    Receive timeout interrupt
689
  *            @arg @ref SMARTCARD_IT_RTO    Receive timeout interrupt
665
  *            @arg @ref SMARTCARD_IT_TXE    Transmit data register empty interrupt
690
  *            @arg @ref SMARTCARD_IT_TXE    Transmit data register empty interrupt
666
  *            @arg @ref SMARTCARD_IT_TC     Transmission complete interrupt
691
  *            @arg @ref SMARTCARD_IT_TC     Transmission complete interrupt
667
  *            @arg @ref SMARTCARD_IT_TCBGT  Transmission complete before guard time interrupt (when interruption available)
692
  *            @arg @ref SMARTCARD_IT_TCBGT  Transmission complete before guard time
-
 
693
  *                                          interrupt (when interruption available)
668
  *            @arg @ref SMARTCARD_IT_RXNE   Receive data register not empty interrupt
694
  *            @arg @ref SMARTCARD_IT_RXNE   Receive data register not empty interrupt
669
  *            @arg @ref SMARTCARD_IT_IDLE   Idle line detection interrupt
695
  *            @arg @ref SMARTCARD_IT_IDLE   Idle line detection interrupt
670
  *            @arg @ref SMARTCARD_IT_PE     Parity error interrupt
696
  *            @arg @ref SMARTCARD_IT_PE     Parity error interrupt
671
  *            @arg @ref SMARTCARD_IT_ERR    Error interrupt(frame error, noise error, overrun error)
697
  *            @arg @ref SMARTCARD_IT_ERR    Error interrupt(frame error, noise error, overrun error)
672
  * @retval The new state of __INTERRUPT__ (SET or RESET).
698
  * @retval The new state of __INTERRUPT__ (SET or RESET).
673
  */
699
  */
674
#define __HAL_SMARTCARD_GET_IT(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->ISR\
700
#define __HAL_SMARTCARD_GET_IT(__HANDLE__, __INTERRUPT__) (\
-
 
701
                                                           (((__HANDLE__)->Instance->ISR & (0x01UL << (((__INTERRUPT__)\
675
                                                             & ((uint32_t)0x01U << (((__INTERRUPT__) & SMARTCARD_ISR_MASK)>> SMARTCARD_ISR_POS))) != 0U) ? SET : RESET)
702
                                                               & SMARTCARD_ISR_MASK)>> SMARTCARD_ISR_POS)))!= 0U)\
-
 
703
                                                           ? SET : RESET)
676
 
704
 
677
/** @brief  Check whether the specified SmartCard interrupt source is enabled or not.
705
/** @brief  Check whether the specified SmartCard interrupt source is enabled or not.
678
  * @param  __HANDLE__ specifies the SMARTCARD Handle.
706
  * @param  __HANDLE__ specifies the SMARTCARD Handle.
679
  * @param  __INTERRUPT__ specifies the SMARTCARD interrupt source to check.
707
  * @param  __INTERRUPT__ specifies the SMARTCARD interrupt source to check.
680
  *          This parameter can be one of the following values:
708
  *          This parameter can be one of the following values:
681
  *            @arg @ref SMARTCARD_IT_EOB    End of block interrupt
709
  *            @arg @ref SMARTCARD_IT_EOB    End of block interrupt
682
  *            @arg @ref SMARTCARD_IT_RTO    Receive timeout interrupt
710
  *            @arg @ref SMARTCARD_IT_RTO    Receive timeout interrupt
683
  *            @arg @ref SMARTCARD_IT_TXE    Transmit data register empty interrupt
711
  *            @arg @ref SMARTCARD_IT_TXE    Transmit data register empty interrupt
684
  *            @arg @ref SMARTCARD_IT_TC     Transmission complete interrupt
712
  *            @arg @ref SMARTCARD_IT_TC     Transmission complete interrupt
685
  *            @arg @ref SMARTCARD_IT_TCBGT  Transmission complete before guard time interrupt (when interruption available)
713
  *            @arg @ref SMARTCARD_IT_TCBGT  Transmission complete before guard time
-
 
714
  *                                          interrupt (when interruption available)
686
  *            @arg @ref SMARTCARD_IT_RXNE   Receive data register not empty interrupt
715
  *            @arg @ref SMARTCARD_IT_RXNE   Receive data register not empty interrupt
687
  *            @arg @ref SMARTCARD_IT_IDLE   Idle line detection interrupt
716
  *            @arg @ref SMARTCARD_IT_IDLE   Idle line detection interrupt
688
  *            @arg @ref SMARTCARD_IT_PE     Parity error interrupt
717
  *            @arg @ref SMARTCARD_IT_PE     Parity error interrupt
689
  *            @arg @ref SMARTCARD_IT_ERR    Error interrupt(frame error, noise error, overrun error)
718
  *            @arg @ref SMARTCARD_IT_ERR    Error interrupt(frame error, noise error, overrun error)
690
  * @retval The new state of __INTERRUPT__ (SET or RESET).
719
  * @retval The new state of __INTERRUPT__ (SET or RESET).
691
  */
720
  */
692
#define __HAL_SMARTCARD_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((((__INTERRUPT__) & SMARTCARD_CR_MASK) >> SMARTCARD_CR_POS) == 0x01U)? (__HANDLE__)->Instance->CR1 : \
721
#define __HAL_SMARTCARD_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((((__INTERRUPT__) & SMARTCARD_CR_MASK) >>\
-
 
722
                                                                       SMARTCARD_CR_POS) == 0x01U)?\
-
 
723
                                                                     (__HANDLE__)->Instance->CR1 : \
693
                                                                     (((((__INTERRUPT__) & SMARTCARD_CR_MASK) >> SMARTCARD_CR_POS) == 0x02U)? (__HANDLE__)->Instance->CR2 : \
724
                                                                     (((((__INTERRUPT__) & SMARTCARD_CR_MASK) >>\
-
 
725
                                                                        SMARTCARD_CR_POS) == 0x02U)?\
-
 
726
                                                                      (__HANDLE__)->Instance->CR2 : \
-
 
727
                                                                      (__HANDLE__)->Instance->CR3)) &\
-
 
728
                                                                    (0x01UL << (((uint16_t)(__INTERRUPT__))\
694
                                                                      (__HANDLE__)->Instance->CR3)) & ((uint32_t)0x01U << (((uint16_t)(__INTERRUPT__)) & SMARTCARD_IT_MASK)))  != 0U) ? SET : RESET)
729
                                                                                & SMARTCARD_IT_MASK)))  != 0U)\
-
 
730
                                                                  ? SET : RESET)
695
 
731
 
696
/** @brief  Clear the specified SMARTCARD ISR flag, in setting the proper ICR register flag.
732
/** @brief  Clear the specified SMARTCARD ISR flag, in setting the proper ICR register flag.
697
  * @param  __HANDLE__ specifies the SMARTCARD Handle.
733
  * @param  __HANDLE__ specifies the SMARTCARD Handle.
698
  * @param  __IT_CLEAR__ specifies the interrupt clear register flag that needs to be set
734
  * @param  __IT_CLEAR__ specifies the interrupt clear register flag that needs to be set
699
  *                       to clear the corresponding interrupt.
735
  *                       to clear the corresponding interrupt.
Line 944... Line 980...
944
void HAL_SMARTCARD_MspDeInit(SMARTCARD_HandleTypeDef *hsmartcard);
980
void HAL_SMARTCARD_MspDeInit(SMARTCARD_HandleTypeDef *hsmartcard);
945
 
981
 
946
#if (USE_HAL_SMARTCARD_REGISTER_CALLBACKS == 1)
982
#if (USE_HAL_SMARTCARD_REGISTER_CALLBACKS == 1)
947
/* Callbacks Register/UnRegister functions  ***********************************/
983
/* Callbacks Register/UnRegister functions  ***********************************/
948
HAL_StatusTypeDef HAL_SMARTCARD_RegisterCallback(SMARTCARD_HandleTypeDef *hsmartcard,
984
HAL_StatusTypeDef HAL_SMARTCARD_RegisterCallback(SMARTCARD_HandleTypeDef *hsmartcard,
949
                                                 HAL_SMARTCARD_CallbackIDTypeDef CallbackID, pSMARTCARD_CallbackTypeDef pCallback);
985
                                                 HAL_SMARTCARD_CallbackIDTypeDef CallbackID,
-
 
986
                                                 pSMARTCARD_CallbackTypeDef pCallback);
950
HAL_StatusTypeDef HAL_SMARTCARD_UnRegisterCallback(SMARTCARD_HandleTypeDef *hsmartcard,
987
HAL_StatusTypeDef HAL_SMARTCARD_UnRegisterCallback(SMARTCARD_HandleTypeDef *hsmartcard,
951
                                                   HAL_SMARTCARD_CallbackIDTypeDef CallbackID);
988
                                                   HAL_SMARTCARD_CallbackIDTypeDef CallbackID);
952
#endif /* USE_HAL_SMARTCARD_REGISTER_CALLBACKS */
989
#endif /* USE_HAL_SMARTCARD_REGISTER_CALLBACKS */
953
 
990
 
954
/**
991
/**