STM8L15x Standard Peripherals Drivers
|
stm8l15x_iwdg.h
Go to the documentation of this file.
00001 /******************************************************************************* 00002 * @file stm8l15x_iwdg.h 00003 * @author MCD Application Team 00004 * @version V1.5.0 00005 * @date 13-May-2011 00006 * @brief This file contains all the functions prototypes for the IWDG 00007 * firmware library. 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 00012 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 00013 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 00014 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 00015 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 00016 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 00017 * 00018 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2> 00019 ****************************************************************************** 00020 */ 00021 00022 /* Define to prevent recursive inclusion -------------------------------------*/ 00023 #ifndef __STM8L15x_IWDG_H 00024 #define __STM8L15x_IWDG_H 00025 00026 /* Includes ------------------------------------------------------------------*/ 00027 #include "stm8l15x.h" 00028 00029 /** @addtogroup STM8L15x_StdPeriph_Driver 00030 * @{ 00031 */ 00032 00033 /** @addtogroup IWDG 00034 * @{ 00035 */ 00036 00037 /* Exported variables ------------------------------------------------------- */ 00038 /* Exported constants --------------------------------------------------------*/ 00039 00040 /** @defgroup IWDG_Exported_Constants 00041 * @{ 00042 */ 00043 00044 /** @defgroup IWDG_KeyRefresh 00045 * @{ 00046 */ 00047 #define IWDG_KEY_REFRESH ((uint8_t)0xAA) /*!< This value written in the Key 00048 register prevent the watchdog reset */ 00049 /** 00050 * @} 00051 */ 00052 00053 /** @defgroup IWDG_KeyEnable 00054 * @{ 00055 */ 00056 #define IWDG_KEY_ENABLE ((uint8_t)0xCC) /*!< This value written in the Key 00057 register start the watchdog counting down*/ 00058 /** 00059 * @} 00060 */ 00061 /** 00062 * @} 00063 */ 00064 00065 /* Exported macros -----------------------------------------------------------*/ 00066 /* Exported types ------------------------------------------------------------*/ 00067 00068 /** @defgroup IWDG_Exported_Types 00069 * @{ 00070 */ 00071 00072 /** @defgroup IWDG_WriteAccess 00073 * @{ 00074 */ 00075 typedef enum 00076 { 00077 IWDG_WriteAccess_Enable = (uint8_t)0x55, 00078 IWDG_WriteAccess_Disable = (uint8_t)0x00 00079 } IWDG_WriteAccess_TypeDef; 00080 #define IS_IWDG_WRITE_ACCESS_MODE(MODE) (((MODE) == IWDG_WriteAccess_Enable) || \ 00081 ((MODE) == IWDG_WriteAccess_Disable)) 00082 /** 00083 * @} 00084 */ 00085 00086 /** @defgroup IWDG_prescaler 00087 * @{ 00088 */ 00089 typedef enum 00090 { 00091 IWDG_Prescaler_4 = (uint8_t)0x00, /*!< Used to set prescaler register to 4 */ 00092 IWDG_Prescaler_8 = (uint8_t)0x01, /*!< Used to set prescaler register to 8 */ 00093 IWDG_Prescaler_16 = (uint8_t)0x02, /*!< Used to set prescaler register to 16 */ 00094 IWDG_Prescaler_32 = (uint8_t)0x03, /*!< Used to set prescaler register to 32 */ 00095 IWDG_Prescaler_64 = (uint8_t)0x04, /*!< Used to set prescaler register to 64 */ 00096 IWDG_Prescaler_128 = (uint8_t)0x05, /*!< Used to set prescaler register to 128 */ 00097 IWDG_Prescaler_256 = (uint8_t)0x06 /*!< Used to set prescaler register to 256 */ 00098 } IWDG_Prescaler_TypeDef; 00099 #define IS_IWDG_PRESCALER_VALUE(VALUE) (((VALUE) == IWDG_Prescaler_4) || \ 00100 ((VALUE) == IWDG_Prescaler_8) || \ 00101 ((VALUE) == IWDG_Prescaler_16) || \ 00102 ((VALUE) == IWDG_Prescaler_32) || \ 00103 ((VALUE) == IWDG_Prescaler_64) || \ 00104 ((VALUE) == IWDG_Prescaler_128) || \ 00105 ((VALUE) == IWDG_Prescaler_256)) 00106 /** 00107 * @} 00108 */ 00109 00110 /** 00111 * @} 00112 */ 00113 00114 /* Exported functions ------------------------------------------------------- */ 00115 /* Prescaler and Counter configuration functions ******************************/ 00116 void IWDG_WriteAccessCmd(IWDG_WriteAccess_TypeDef IWDG_WriteAccess); 00117 void IWDG_SetPrescaler(IWDG_Prescaler_TypeDef IWDG_Prescaler); 00118 void IWDG_SetReload(uint8_t IWDG_Reload); 00119 void IWDG_ReloadCounter(void); 00120 00121 /* IWDG activation function ***************************************************/ 00122 void IWDG_Enable(void); 00123 00124 #endif /* __STM8L15x_IWDG_H */ 00125 00126 /** 00127 * @} 00128 */ 00129 00130 /** 00131 * @} 00132 */ 00133 00134 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/