Subversion Repositories FuelGauge

Rev

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

Rev 2 Rev 6
Line 74... Line 74...
74
 
74
 
75
} IRDA_InitTypeDef;
75
} IRDA_InitTypeDef;
76
 
76
 
77
/**
77
/**
78
  * @brief HAL IRDA State definition
78
  * @brief HAL IRDA State definition
79
  * @note  HAL IRDA State value is a combination of 2 different substates: gState and RxState (see @ref IRDA_State_Definition).
79
  * @note  HAL IRDA State value is a combination of 2 different substates:
-
 
80
  *        gState and RxState (see @ref IRDA_State_Definition).
80
  *        - gState contains IRDA state information related to global Handle management
81
  *        - gState contains IRDA state information related to global Handle management
81
  *          and also information related to Tx operations.
82
  *          and also information related to Tx operations.
82
  *          gState value coding follow below described bitmap :
83
  *          gState value coding follow below described bitmap :
83
  *          b7-b6  Error information
84
  *          b7-b6  Error information
84
  *             00 : No Error
85
  *             00 : No Error
85
  *             01 : (Not Used)
86
  *             01 : (Not Used)
86
  *             10 : Timeout
87
  *             10 : Timeout
87
  *             11 : Error
88
  *             11 : Error
88
  *          b5     Peripheral initialization status
89
  *          b5     Peripheral initialization status
89
  *             0  : Reset (Peripheral not initialized)
90
  *             0  : Reset (Peripheral not initialized)
90
  *             1  : Init done (Peripheral not initialized. HAL IRDA Init function already called)
91
  *             1  : Init done (Peripheral initialized. HAL IRDA Init function already called)
91
  *          b4-b3  (not used)
92
  *          b4-b3  (not used)
92
  *             xx : Should be set to 00
93
  *             xx : Should be set to 00
93
  *          b2     Intrinsic process state
94
  *          b2     Intrinsic process state
94
  *             0  : Ready
95
  *             0  : Ready
95
  *             1  : Busy (Peripheral busy with some configuration or internal operations)
96
  *             1  : Busy (Peripheral busy with some configuration or internal operations)
Line 102... Line 103...
102
  *          RxState value coding follow below described bitmap :
103
  *          RxState value coding follow below described bitmap :
103
  *          b7-b6  (not used)
104
  *          b7-b6  (not used)
104
  *             xx : Should be set to 00
105
  *             xx : Should be set to 00
105
  *          b5     Peripheral initialization status
106
  *          b5     Peripheral initialization status
106
  *             0  : Reset (Peripheral not initialized)
107
  *             0  : Reset (Peripheral not initialized)
107
  *             1  : Init done (Peripheral not initialized)
108
  *             1  : Init done (Peripheral initialized)
108
  *          b4-b2  (not used)
109
  *          b4-b2  (not used)
109
  *            xxx : Should be set to 000
110
  *            xxx : Should be set to 000
110
  *          b1     Rx state
111
  *          b1     Rx state
111
  *             0  : Ready (no Rx operation ongoing)
112
  *             0  : Ready (no Rx operation ongoing)
112
  *             1  : Busy (Rx operation ongoing)
113
  *             1  : Busy (Rx operation ongoing)
Line 243... Line 244...
243
                                                               Value is allowed for gState only */
244
                                                               Value is allowed for gState only */
244
#define HAL_IRDA_STATE_BUSY_RX              0x00000022U   /*!< Data Reception process is ongoing
245
#define HAL_IRDA_STATE_BUSY_RX              0x00000022U   /*!< Data Reception process is ongoing
245
                                                               Value is allowed for RxState only */
246
                                                               Value is allowed for RxState only */
246
#define HAL_IRDA_STATE_BUSY_TX_RX           0x00000023U   /*!< Data Transmission and Reception process is ongoing
247
#define HAL_IRDA_STATE_BUSY_TX_RX           0x00000023U   /*!< Data Transmission and Reception process is ongoing
247
                                                               Not to be used for neither gState nor RxState.
248
                                                               Not to be used for neither gState nor RxState.
248
                                                               Value is result of combination (Or) between gState and RxState values */
249
                                                               Value is result of combination (Or) between
-
 
250
                                                               gState and RxState values */
249
#define HAL_IRDA_STATE_TIMEOUT              0x000000A0U   /*!< Timeout state
251
#define HAL_IRDA_STATE_TIMEOUT              0x000000A0U   /*!< Timeout state
250
                                                               Value is allowed for gState only */
252
                                                               Value is allowed for gState only */
251
#define HAL_IRDA_STATE_ERROR                0x000000E0U   /*!< Error
253
#define HAL_IRDA_STATE_ERROR                0x000000E0U   /*!< Error
252
                                                               Value is allowed for gState only */
254
                                                               Value is allowed for gState only */
253
/**
255
/**
Line 255... Line 257...
255
  */
257
  */
256
 
258
 
257
/** @defgroup IRDA_Error_Definition IRDA Error Code Definition
259
/** @defgroup IRDA_Error_Definition IRDA Error Code Definition
258
  * @{
260
  * @{
259
  */
261
  */
260
#define HAL_IRDA_ERROR_NONE                 ((uint32_t)0x00000000U)          /*!< No error                */
262
#define HAL_IRDA_ERROR_NONE                 (0x00000000U)          /*!< No error                */
261
#define HAL_IRDA_ERROR_PE                   ((uint32_t)0x00000001U)          /*!< Parity error            */
263
#define HAL_IRDA_ERROR_PE                   (0x00000001U)          /*!< Parity error            */
262
#define HAL_IRDA_ERROR_NE                   ((uint32_t)0x00000002U)          /*!< Noise error             */
264
#define HAL_IRDA_ERROR_NE                   (0x00000002U)          /*!< Noise error             */
263
#define HAL_IRDA_ERROR_FE                   ((uint32_t)0x00000004U)          /*!< frame error             */
265
#define HAL_IRDA_ERROR_FE                   (0x00000004U)          /*!< frame error             */
264
#define HAL_IRDA_ERROR_ORE                  ((uint32_t)0x00000008U)          /*!< Overrun error           */
266
#define HAL_IRDA_ERROR_ORE                  (0x00000008U)          /*!< Overrun error           */
265
#define HAL_IRDA_ERROR_DMA                  ((uint32_t)0x00000010U)          /*!< DMA transfer error      */
267
#define HAL_IRDA_ERROR_DMA                  (0x00000010U)          /*!< DMA transfer error      */
266
#define HAL_IRDA_ERROR_BUSY                 ((uint32_t)0x00000020U)          /*!< Busy Error              */
268
#define HAL_IRDA_ERROR_BUSY                 (0x00000020U)          /*!< Busy Error              */
267
#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
269
#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
268
#define HAL_IRDA_ERROR_INVALID_CALLBACK     ((uint32_t)0x00000040U)          /*!< Invalid Callback error  */
270
#define HAL_IRDA_ERROR_INVALID_CALLBACK     (0x00000040U)          /*!< Invalid Callback error  */
269
#endif /* USE_HAL_IRDA_REGISTER_CALLBACKS */
271
#endif /* USE_HAL_IRDA_REGISTER_CALLBACKS */
270
/**
272
/**
271
  * @}
273
  * @}
272
  */
274
  */
273
 
275
 
Line 547... Line 549...
547
  *            @arg @ref IRDA_IT_IDLE Idle line detection interrupt
549
  *            @arg @ref IRDA_IT_IDLE Idle line detection interrupt
548
  *            @arg @ref IRDA_IT_PE   Parity Error interrupt
550
  *            @arg @ref IRDA_IT_PE   Parity Error interrupt
549
  *            @arg @ref IRDA_IT_ERR  Error interrupt(Frame error, noise error, overrun error)
551
  *            @arg @ref IRDA_IT_ERR  Error interrupt(Frame error, noise error, overrun error)
550
  * @retval None
552
  * @retval None
551
  */
553
  */
552
#define __HAL_IRDA_ENABLE_IT(__HANDLE__, __INTERRUPT__)   (((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 1U)? ((__HANDLE__)->Instance->CR1 |= ((uint32_t)1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \
554
#define __HAL_IRDA_ENABLE_IT(__HANDLE__, __INTERRUPT__)   (((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 1U)? \
-
 
555
                                                           ((__HANDLE__)->Instance->CR1 |= (1U << \
-
 
556
                                                               ((__INTERRUPT__) & IRDA_IT_MASK))):\
553
                                                           ((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 2U)? ((__HANDLE__)->Instance->CR2 |= ((uint32_t)1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \
557
                                                           ((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 2U)? \
-
 
558
                                                           ((__HANDLE__)->Instance->CR2 |= (1U << \
-
 
559
                                                               ((__INTERRUPT__) & IRDA_IT_MASK))):\
554
                                                           ((__HANDLE__)->Instance->CR3 |= ((uint32_t)1U << ((__INTERRUPT__) & IRDA_IT_MASK))))
560
                                                           ((__HANDLE__)->Instance->CR3 |= (1U << \
-
 
561
                                                               ((__INTERRUPT__) & IRDA_IT_MASK))))
555
 
562
 
556
/** @brief  Disable the specified IRDA interrupt.
563
/** @brief  Disable the specified IRDA interrupt.
557
  * @param  __HANDLE__ specifies the IRDA Handle.
564
  * @param  __HANDLE__ specifies the IRDA Handle.
558
  * @param  __INTERRUPT__ specifies the IRDA interrupt source to disable.
565
  * @param  __INTERRUPT__ specifies the IRDA interrupt source to disable.
559
  *          This parameter can be one of the following values:
566
  *          This parameter can be one of the following values:
Line 563... Line 570...
563
  *            @arg @ref IRDA_IT_IDLE Idle line detection interrupt
570
  *            @arg @ref IRDA_IT_IDLE Idle line detection interrupt
564
  *            @arg @ref IRDA_IT_PE   Parity Error interrupt
571
  *            @arg @ref IRDA_IT_PE   Parity Error interrupt
565
  *            @arg @ref IRDA_IT_ERR  Error interrupt(Frame error, noise error, overrun error)
572
  *            @arg @ref IRDA_IT_ERR  Error interrupt(Frame error, noise error, overrun error)
566
  * @retval None
573
  * @retval None
567
  */
574
  */
568
#define __HAL_IRDA_DISABLE_IT(__HANDLE__, __INTERRUPT__)  (((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 1U)? ((__HANDLE__)->Instance->CR1 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \
575
#define __HAL_IRDA_DISABLE_IT(__HANDLE__, __INTERRUPT__)  (((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 1U)? \
-
 
576
                                                           ((__HANDLE__)->Instance->CR1 &= ~ (1U << \
-
 
577
                                                               ((__INTERRUPT__) & IRDA_IT_MASK))): \
569
                                                           ((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 2U)? ((__HANDLE__)->Instance->CR2 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & IRDA_IT_MASK))): \
578
                                                           ((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 2U)? \
-
 
579
                                                           ((__HANDLE__)->Instance->CR2 &= ~ (1U << \
-
 
580
                                                               ((__INTERRUPT__) & IRDA_IT_MASK))): \
570
                                                           ((__HANDLE__)->Instance->CR3 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & IRDA_IT_MASK))))
581
                                                           ((__HANDLE__)->Instance->CR3 &= ~ (1U << \
571
 
-
 
-
 
582
                                                               ((__INTERRUPT__) & IRDA_IT_MASK))))
572
 
583
 
573
/** @brief  Check whether the specified IRDA interrupt has occurred or not.
584
/** @brief  Check whether the specified IRDA interrupt has occurred or not.
574
  * @param  __HANDLE__ specifies the IRDA Handle.
585
  * @param  __HANDLE__ specifies the IRDA Handle.
575
  * @param  __INTERRUPT__ specifies the IRDA interrupt source to check.
586
  * @param  __INTERRUPT__ specifies the IRDA interrupt source to check.
576
  *          This parameter can be one of the following values:
587
  *          This parameter can be one of the following values:
Line 582... Line 593...
582
  *            @arg @ref IRDA_IT_NE Noise Error interrupt
593
  *            @arg @ref IRDA_IT_NE Noise Error interrupt
583
  *            @arg @ref IRDA_IT_FE Framing Error interrupt
594
  *            @arg @ref IRDA_IT_FE Framing Error interrupt
584
  *            @arg @ref IRDA_IT_PE Parity Error interrupt
595
  *            @arg @ref IRDA_IT_PE Parity Error interrupt
585
  * @retval The new state of __IT__ (SET or RESET).
596
  * @retval The new state of __IT__ (SET or RESET).
586
  */
597
  */
587
#define __HAL_IRDA_GET_IT(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->ISR\
598
#define __HAL_IRDA_GET_IT(__HANDLE__, __INTERRUPT__) \
588
                                                        & (0x01U << (((__INTERRUPT__) & IRDA_ISR_MASK)>> IRDA_ISR_POS))) != 0U) ? SET : RESET)
599
  ((((__HANDLE__)->Instance->ISR& (0x01U << (((__INTERRUPT__) & IRDA_ISR_MASK)>>IRDA_ISR_POS))) != 0U) ? SET : RESET)
589
 
600
 
590
/** @brief  Check whether the specified IRDA interrupt source is enabled or not.
601
/** @brief  Check whether the specified IRDA interrupt source is enabled or not.
591
  * @param  __HANDLE__ specifies the IRDA Handle.
602
  * @param  __HANDLE__ specifies the IRDA Handle.
592
  * @param  __INTERRUPT__ specifies the IRDA interrupt source to check.
603
  * @param  __INTERRUPT__ specifies the IRDA interrupt source to check.
593
  *          This parameter can be one of the following values:
604
  *          This parameter can be one of the following values:
Line 597... Line 608...
597
  *            @arg @ref IRDA_IT_IDLE Idle line detection interrupt
608
  *            @arg @ref IRDA_IT_IDLE Idle line detection interrupt
598
  *            @arg @ref IRDA_IT_ERR Framing, overrun or noise error interrupt
609
  *            @arg @ref IRDA_IT_ERR Framing, overrun or noise error interrupt
599
  *            @arg @ref IRDA_IT_PE Parity Error interrupt
610
  *            @arg @ref IRDA_IT_PE Parity Error interrupt
600
  * @retval The new state of __IT__ (SET or RESET).
611
  * @retval The new state of __IT__ (SET or RESET).
601
  */
612
  */
602
#define __HAL_IRDA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 0x01U)? (__HANDLE__)->Instance->CR1 : \
613
#define __HAL_IRDA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)                                                          \
603
                                                                (((((__INTERRUPT__) & IRDA_CR_MASK) >> IRDA_CR_POS) == 0x02U)? (__HANDLE__)->Instance->CR2 : \
614
  ((((((((__INTERRUPT__) & IRDA_CR_MASK) >>IRDA_CR_POS) == 0x01U)? (__HANDLE__)->Instance->CR1 :(((((__INTERRUPT__)  \
-
 
615
      & IRDA_CR_MASK) >> IRDA_CR_POS)== 0x02U)? (__HANDLE__)->Instance->CR2 :(__HANDLE__)->Instance->CR3))           \
604
                                                                 (__HANDLE__)->Instance->CR3)) & ((uint32_t)0x01U << (((uint16_t)(__INTERRUPT__)) & IRDA_IT_MASK))) != 0U) ? SET : RESET)
616
     & (0x01U <<(((uint16_t)(__INTERRUPT__)) & IRDA_IT_MASK))) != 0U) ? SET : RESET)
605
 
617
 
606
/** @brief  Clear the specified IRDA ISR flag, in setting the proper ICR register flag.
618
/** @brief  Clear the specified IRDA ISR flag, in setting the proper ICR register flag.
607
  * @param  __HANDLE__ specifies the IRDA Handle.
619
  * @param  __HANDLE__ specifies the IRDA Handle.
608
  * @param  __IT_CLEAR__ specifies the interrupt clear register flag that needs to be set
620
  * @param  __IT_CLEAR__ specifies the interrupt clear register flag that needs to be set
609
  *                       to clear the corresponding interrupt
621
  *                       to clear the corresponding interrupt
Line 831... Line 843...
831
  */
843
  */
832
 
844
 
833
/**
845
/**
834
  * @}
846
  * @}
835
  */
847
  */
836
#endif /* USART_IRDA_SUPPORT */  
848
#endif /* USART_IRDA_SUPPORT */
837
 
849
 
838
#ifdef __cplusplus
850
#ifdef __cplusplus
839
}
851
}
840
#endif
852
#endif
841
 
853