STM8S/A Standard Peripherals Drivers
|
stm8s_iwdg.h
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file stm8s_iwdg.h 00004 * @author MCD Application Team 00005 * @version V2.3.0 00006 * @date 16-June-2017 00007 * @brief This file contains all functions prototypes and macros for the IWDG peripheral. 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2> 00012 * 00013 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 00014 * You may not use this file except in compliance with the License. 00015 * You may obtain a copy of the License at: 00016 * 00017 * http://www.st.com/software_license_agreement_liberty_v2 00018 * 00019 * Unless required by applicable law or agreed to in writing, software 00020 * distributed under the License is distributed on an "AS IS" BASIS, 00021 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00022 * See the License for the specific language governing permissions and 00023 * limitations under the License. 00024 * 00025 ****************************************************************************** 00026 */ 00027 00028 /* Define to prevent recursive inclusion -------------------------------------*/ 00029 #ifndef __STM8S_IWDG_H 00030 #define __STM8S_IWDG_H 00031 00032 /* Includes ------------------------------------------------------------------*/ 00033 #include "stm8s.h" 00034 00035 /** @addtogroup STM8S_StdPeriph_Driver 00036 * @{ 00037 */ 00038 00039 /** @addtogroup IWDG_Private_Define 00040 * @{ 00041 */ 00042 00043 /** 00044 * @brief Define used to prevent watchdog reset 00045 */ 00046 #define IWDG_KEY_REFRESH ((uint8_t)0xAA) /*!< This value written in the Key register prevent the watchdog reset */ 00047 00048 /** 00049 * @brief Define used to start the watchdog counter down 00050 */ 00051 #define IWDG_KEY_ENABLE ((uint8_t)0xCC) /*!< This value written in the Key register start the watchdog counting down*/ 00052 00053 /** 00054 * @} 00055 */ 00056 00057 /** @addtogroup IWDG_Private_Macros 00058 * @{ 00059 */ 00060 00061 /** 00062 * @brief Macro used by the assert function in order to check the different 00063 * values of the prescaler. 00064 */ 00065 #define IS_IWDG_PRESCALER_OK(VALUE) (((VALUE) == IWDG_Prescaler_4 ) || \ 00066 ((VALUE) == IWDG_Prescaler_8 ) || \ 00067 ((VALUE) == IWDG_Prescaler_16 ) || \ 00068 ((VALUE) == IWDG_Prescaler_32 ) || \ 00069 ((VALUE) == IWDG_Prescaler_64 ) || \ 00070 ((VALUE) == IWDG_Prescaler_128 ) || \ 00071 ((VALUE) == IWDG_Prescaler_256)) 00072 00073 /** 00074 * @brief Macro used by the assert function in order to check the different 00075 * values of the counter register. 00076 */ 00077 #define IS_IWDG_WRITEACCESS_MODE_OK(MODE) (((MODE) == IWDG_WriteAccess_Enable) || ((MODE) == IWDG_WriteAccess_Disable)) 00078 00079 /** 00080 * @} 00081 */ 00082 00083 /** @addtogroup IWDG_Exported_Types 00084 * @{ 00085 */ 00086 00087 /** IWDG write access enumeration */ 00088 typedef enum 00089 { 00090 IWDG_WriteAccess_Enable = (uint8_t)0x55, /*!< Code 0x55 in Key register, allow write access to Prescaler and Reload registers */ 00091 IWDG_WriteAccess_Disable = (uint8_t)0x00 /*!< Code 0x00 in Key register, not allow write access to Prescaler and Reload registers */ 00092 } IWDG_WriteAccess_TypeDef; 00093 00094 /** IWDG prescaler enumaration */ 00095 typedef enum 00096 { 00097 IWDG_Prescaler_4 = (uint8_t)0x00, /*!< Used to set prescaler register to 4 */ 00098 IWDG_Prescaler_8 = (uint8_t)0x01, /*!< Used to set prescaler register to 8 */ 00099 IWDG_Prescaler_16 = (uint8_t)0x02, /*!< Used to set prescaler register to 16 */ 00100 IWDG_Prescaler_32 = (uint8_t)0x03, /*!< Used to set prescaler register to 32 */ 00101 IWDG_Prescaler_64 = (uint8_t)0x04, /*!< Used to set prescaler register to 64 */ 00102 IWDG_Prescaler_128 = (uint8_t)0x05, /*!< Used to set prescaler register to 128 */ 00103 IWDG_Prescaler_256 = (uint8_t)0x06 /*!< Used to set prescaler register to 256 */ 00104 } IWDG_Prescaler_TypeDef; 00105 00106 /** 00107 * @} 00108 */ 00109 00110 /** @addtogroup IWDG_Exported_Functions 00111 * @{ 00112 */ 00113 00114 void IWDG_WriteAccessCmd(IWDG_WriteAccess_TypeDef IWDG_WriteAccess); 00115 void IWDG_SetPrescaler(IWDG_Prescaler_TypeDef IWDG_Prescaler); 00116 void IWDG_SetReload(uint8_t IWDG_Reload); 00117 void IWDG_ReloadCounter(void); 00118 void IWDG_Enable(void); 00119 00120 /** 00121 * @} 00122 */ 00123 00124 #endif /* __STM8S_IWDG_H */ 00125 00126 /** 00127 * @} 00128 */ 00129 00130 00131 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/