apm32f0xx_iwdt.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*!
  2. * @file apm32f0xx_iwdt.h
  3. *
  4. * @brief This file contains all the functions prototypes for the IWDT firmware library
  5. *
  6. * @version V1.0.3
  7. *
  8. * @date 2022-09-20
  9. *
  10. * @attention
  11. *
  12. * Copyright (C) 2020-2022 Geehy Semiconductor
  13. *
  14. * You may not use this file except in compliance with the
  15. * GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
  16. *
  17. * The program is only for reference, which is distributed in the hope
  18. * that it will be useful and instructional for customers to develop
  19. * their software. Unless required by applicable law or agreed to in
  20. * writing, the program is distributed on an "AS IS" BASIS, WITHOUT
  21. * ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
  23. * and limitations under the License.
  24. */
  25. /* Define to prevent recursive inclusion */
  26. #ifndef __APM32F0XX_IWDT_H
  27. #define __APM32F0XX_IWDT_H
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /* Includes */
  32. #include "apm32f0xx.h"
  33. /** @addtogroup APM32F0xx_StdPeriphDriver
  34. @{
  35. */
  36. /** @addtogroup IWDT_Driver
  37. @{
  38. */
  39. /** @defgroup IWDT_Macros Macros
  40. @{
  41. */
  42. /**@} end of group IWDT_Macros*/
  43. /** @defgroup IWDT_Enumerations Enumerations
  44. @{
  45. */
  46. /**@} end of group IWDT_Enumerations*/
  47. /** @defgroup IWDT_Structures Structures
  48. @{
  49. */
  50. /**@} end of group IWDT_Structures*/
  51. /** @defgroup IWDT_Variables Variables
  52. @{
  53. */
  54. /**@} end of group IWDT_Variables*/
  55. /** @defgroup IWDT_Functions Functions
  56. @{
  57. */
  58. /**
  59. * @brief IWDT key definition
  60. */
  61. typedef enum
  62. {
  63. IWDT_KEY_REFRESH = ((uint16_t)0xAAAA), /*!< Value of Reload Register reoload to the counter to prevent the IWDT from resetting */
  64. IWDT_KEY_ENABLE = ((uint16_t)0xCCCC), /*!< Enable the IWDT then the counter starts to count down from the reset value */
  65. IWDT_KEY_ACCESS = ((uint16_t)0x5555), /*!< Rewrite the value of the Prescaler Register, Reload Register and Window Value Register */
  66. } IWDT_KEY_T;
  67. /**
  68. * @brief IWDT divider
  69. */
  70. typedef enum
  71. {
  72. IWDT_DIV_4 = ((uint8_t)0x00), /*!< Prescaler divider 4 */
  73. IWDT_DIV_8 = ((uint8_t)0x01), /*!< Prescaler divider 8 */
  74. IWDT_DIV_16 = ((uint8_t)0x02), /*!< Prescaler divider 16 */
  75. IWDT_DIV_32 = ((uint8_t)0x03), /*!< Prescaler divider 32 */
  76. IWDT_DIV_64 = ((uint8_t)0x04), /*!< Prescaler divider 64 */
  77. IWDT_DIV_128 = ((uint8_t)0x05), /*!< Prescaler divider 128 */
  78. IWDT_DIV_256 = ((uint8_t)0x06), /*!< Prescaler divider 256 */
  79. } IWDT_DIV_T;
  80. /**
  81. * @brief IWDT flag definition
  82. */
  83. typedef enum
  84. {
  85. IWDT_FLAG_DIVU = ((uint8_t)0X01), /*!< Watchdog prescaler value update */
  86. IWDT_FLAG_CNTU = ((uint8_t)0X02), /*!< Watchdog counter reload value update */
  87. IWDT_FLAG_WINU = ((uint8_t)0X04), /*!< Watchdog counter window value update */
  88. } IWDT_FLAG_T;
  89. /**@} end of group IWDT_Enumerations*/
  90. /** @defgroup IWDT_Functions
  91. @{
  92. */
  93. /* Enable IWDT */
  94. void IWDT_Enable(void);
  95. /* Refresh IWDT */
  96. void IWDT_Refresh(void);
  97. /* Window Value */
  98. void IWDT_ConfigWindowValue(uint16_t windowValue);
  99. /* Set Counter reload */
  100. void IWDT_ConfigReload(uint16_t reload);
  101. /* Write Access */
  102. void IWDT_EnableWriteAccess(void);
  103. void IWDT_DisableWriteAccess(void);
  104. /* divider */
  105. void IWDT_ConfigDivider(IWDT_DIV_T div);
  106. /* flag */
  107. uint8_t IWDT_ReadStatusFlag(uint8_t flag);
  108. #ifdef __cplusplus
  109. }
  110. #endif
  111. #endif /* __APM32F0XX_IWDT_H */
  112. /**@} end of group IWDT_Functions*/
  113. /**@} end of group IWDT_Driver */
  114. /**@} end of group APM32F0xx_StdPeriphDriver*/