ft32f0xx_iwdg.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /**
  2. ******************************************************************************
  3. * @file ft32f0xx_iwdg.h
  4. * @author FMD AE
  5. * @brief This file contains all the functions prototypes for the IWDG
  6. * firmware library.
  7. * @version V1.0.0
  8. * @data 2021-07-01
  9. ******************************************************************************
  10. */
  11. /* Define to prevent recursive inclusion -------------------------------------*/
  12. #ifndef __FT32F030X8_IWDG_H
  13. #define __FT32F030X8_IWDG_H
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /* Includes ------------------------------------------------------------------*/
  18. #include "ft32f0xx.h"
  19. /** @addtogroup IWDG
  20. * @{
  21. */
  22. /* Exported types ------------------------------------------------------------*/
  23. /* Exported constants --------------------------------------------------------*/
  24. /** @defgroup IWDG_Exported_Constants
  25. * @{
  26. */
  27. /** @defgroup IWDG_WriteAccess
  28. * @{
  29. */
  30. #define IWDG_WriteAccess_Enable ((uint16_t)0x5555)
  31. #define IWDG_WriteAccess_Disable ((uint16_t)0x0000)
  32. #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \
  33. ((ACCESS) == IWDG_WriteAccess_Disable))
  34. /**
  35. * @}
  36. */
  37. /** @defgroup IWDG_prescaler
  38. * @{
  39. */
  40. #define IWDG_Prescaler_4 ((uint8_t)0x00)
  41. #define IWDG_Prescaler_8 ((uint8_t)0x01)
  42. #define IWDG_Prescaler_16 ((uint8_t)0x02)
  43. #define IWDG_Prescaler_32 ((uint8_t)0x03)
  44. #define IWDG_Prescaler_64 ((uint8_t)0x04)
  45. #define IWDG_Prescaler_128 ((uint8_t)0x05)
  46. #define IWDG_Prescaler_256 ((uint8_t)0x06)
  47. #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \
  48. ((PRESCALER) == IWDG_Prescaler_8) || \
  49. ((PRESCALER) == IWDG_Prescaler_16) || \
  50. ((PRESCALER) == IWDG_Prescaler_32) || \
  51. ((PRESCALER) == IWDG_Prescaler_64) || \
  52. ((PRESCALER) == IWDG_Prescaler_128)|| \
  53. ((PRESCALER) == IWDG_Prescaler_256))
  54. /**
  55. * @}
  56. */
  57. /** @defgroup IWDG_Flag
  58. * @{
  59. */
  60. #define IWDG_FLAG_PVU IWDG_SR_PVU
  61. #define IWDG_FLAG_RVU IWDG_SR_RVU
  62. #define IWDG_FLAG_WVU IWDG_SR_WVU
  63. #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU) || \
  64. ((FLAG) == IWDG_FLAG_WVU))
  65. #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF)
  66. #define IS_IWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0xFFF)
  67. /**
  68. * @}
  69. */
  70. /**
  71. * @}
  72. */
  73. /* Exported macro ------------------------------------------------------------*/
  74. /* Exported functions ------------------------------------------------------- */
  75. /* Prescaler and Counter configuration functions ******************************/
  76. void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess);
  77. void IWDG_SetPrescaler(uint8_t IWDG_Prescaler);
  78. void IWDG_SetReload(uint16_t Reload);
  79. void IWDG_ReloadCounter(void);
  80. void IWDG_SetWindowValue(uint16_t WindowValue);
  81. /* IWDG activation function ***************************************************/
  82. void IWDG_Enable(void);
  83. /* Flag management function ***************************************************/
  84. FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG);
  85. #ifdef __cplusplus
  86. }
  87. #endif
  88. #endif /* __FT32F0XX_IWDG_H */
  89. /**
  90. * @}
  91. */
  92. /**
  93. * @}
  94. */
  95. /************************ (C) COPYRIGHT FMD *****END OF FILE****/