stm8l15x_iwdg.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*******************************************************************************
  2. * @file stm8l15x_iwdg.h
  3. * @author MCD Application Team
  4. * @version V1.6.1
  5. * @date 30-September-2014
  6. * @brief This file contains all the functions prototypes for the IWDG
  7. * firmware library.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
  12. *
  13. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  14. * You may not use this file except in compliance with the License.
  15. * You may obtain a copy of the License at:
  16. *
  17. * http://www.st.com/software_license_agreement_liberty_v2
  18. *
  19. * Unless required by applicable law or agreed to in writing, software
  20. * distributed under the License is distributed on an "AS IS" BASIS,
  21. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the License for the specific language governing permissions and
  23. * limitations under the License.
  24. *
  25. ******************************************************************************
  26. */
  27. /* Define to prevent recursive inclusion -------------------------------------*/
  28. #ifndef __STM8L15x_IWDG_H
  29. #define __STM8L15x_IWDG_H
  30. /* Includes ------------------------------------------------------------------*/
  31. #include "stm8l15x.h"
  32. /** @addtogroup STM8L15x_StdPeriph_Driver
  33. * @{
  34. */
  35. /** @addtogroup IWDG
  36. * @{
  37. */
  38. /* Exported variables ------------------------------------------------------- */
  39. /* Exported constants --------------------------------------------------------*/
  40. /** @defgroup IWDG_Exported_Constants
  41. * @{
  42. */
  43. /** @defgroup IWDG_KeyRefresh
  44. * @{
  45. */
  46. #define IWDG_KEY_REFRESH ((uint8_t)0xAA) /*!< This value written in the Key
  47. register prevent the watchdog reset */
  48. /**
  49. * @}
  50. */
  51. /** @defgroup IWDG_KeyEnable
  52. * @{
  53. */
  54. #define IWDG_KEY_ENABLE ((uint8_t)0xCC) /*!< This value written in the Key
  55. register start the watchdog counting down*/
  56. /**
  57. * @}
  58. */
  59. /**
  60. * @}
  61. */
  62. /* Exported macros -----------------------------------------------------------*/
  63. /* Exported types ------------------------------------------------------------*/
  64. /** @defgroup IWDG_Exported_Types
  65. * @{
  66. */
  67. /** @defgroup IWDG_WriteAccess
  68. * @{
  69. */
  70. typedef enum
  71. {
  72. IWDG_WriteAccess_Enable = (uint8_t)0x55,
  73. IWDG_WriteAccess_Disable = (uint8_t)0x00
  74. } IWDG_WriteAccess_TypeDef;
  75. #define IS_IWDG_WRITE_ACCESS_MODE(MODE) (((MODE) == IWDG_WriteAccess_Enable) || \
  76. ((MODE) == IWDG_WriteAccess_Disable))
  77. /**
  78. * @}
  79. */
  80. /** @defgroup IWDG_prescaler
  81. * @{
  82. */
  83. typedef enum
  84. {
  85. IWDG_Prescaler_4 = (uint8_t)0x00, /*!< Used to set prescaler register to 4 */
  86. IWDG_Prescaler_8 = (uint8_t)0x01, /*!< Used to set prescaler register to 8 */
  87. IWDG_Prescaler_16 = (uint8_t)0x02, /*!< Used to set prescaler register to 16 */
  88. IWDG_Prescaler_32 = (uint8_t)0x03, /*!< Used to set prescaler register to 32 */
  89. IWDG_Prescaler_64 = (uint8_t)0x04, /*!< Used to set prescaler register to 64 */
  90. IWDG_Prescaler_128 = (uint8_t)0x05, /*!< Used to set prescaler register to 128 */
  91. IWDG_Prescaler_256 = (uint8_t)0x06 /*!< Used to set prescaler register to 256 */
  92. } IWDG_Prescaler_TypeDef;
  93. #define IS_IWDG_PRESCALER_VALUE(VALUE) (((VALUE) == IWDG_Prescaler_4) || \
  94. ((VALUE) == IWDG_Prescaler_8) || \
  95. ((VALUE) == IWDG_Prescaler_16) || \
  96. ((VALUE) == IWDG_Prescaler_32) || \
  97. ((VALUE) == IWDG_Prescaler_64) || \
  98. ((VALUE) == IWDG_Prescaler_128) || \
  99. ((VALUE) == IWDG_Prescaler_256))
  100. /**
  101. * @}
  102. */
  103. /**
  104. * @}
  105. */
  106. /* Exported functions ------------------------------------------------------- */
  107. /* Prescaler and Counter configuration functions ******************************/
  108. void IWDG_WriteAccessCmd(IWDG_WriteAccess_TypeDef IWDG_WriteAccess);
  109. void IWDG_SetPrescaler(IWDG_Prescaler_TypeDef IWDG_Prescaler);
  110. void IWDG_SetReload(uint8_t IWDG_Reload);
  111. void IWDG_ReloadCounter(void);
  112. /* IWDG activation function ***************************************************/
  113. void IWDG_Enable(void);
  114. #endif /* __STM8L15x_IWDG_H */
  115. /**
  116. * @}
  117. */
  118. /**
  119. * @}
  120. */
  121. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/