STM8S/A Standard Peripherals Drivers
|
stm8s_awu.h
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file stm8s_awu.h 00004 * @author MCD Application Team 00005 * @version V2.3.0 00006 * @date 16-June-2017 00007 * @brief This file contains all functions prototype and macros for the AWU 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_AWU_H 00030 #define __STM8S_AWU_H 00031 00032 /* Includes ------------------------------------------------------------------*/ 00033 #include "stm8s.h" 00034 00035 /* Exported types ------------------------------------------------------------*/ 00036 00037 /** @addtogroup AWU_Exported_Types 00038 * @{ 00039 */ 00040 00041 /** 00042 * @brief AWU TimeBase selection 00043 */ 00044 00045 typedef enum 00046 { 00047 AWU_TIMEBASE_NO_IT = (uint8_t)0, /*!< No AWU interrupt selected */ 00048 AWU_TIMEBASE_250US = (uint8_t)1, /*!< AWU Timebase equals 0.25 ms */ 00049 AWU_TIMEBASE_500US = (uint8_t)2, /*!< AWU Timebase equals 0.5 ms */ 00050 AWU_TIMEBASE_1MS = (uint8_t)3, /*!< AWU Timebase equals 1 ms */ 00051 AWU_TIMEBASE_2MS = (uint8_t)4, /*!< AWU Timebase equals 2 ms */ 00052 AWU_TIMEBASE_4MS = (uint8_t)5, /*!< AWU Timebase equals 4 ms */ 00053 AWU_TIMEBASE_8MS = (uint8_t)6, /*!< AWU Timebase equals 8 ms */ 00054 AWU_TIMEBASE_16MS = (uint8_t)7, /*!< AWU Timebase equals 16 ms */ 00055 AWU_TIMEBASE_32MS = (uint8_t)8, /*!< AWU Timebase equals 32 ms */ 00056 AWU_TIMEBASE_64MS = (uint8_t)9, /*!< AWU Timebase equals 64 ms */ 00057 AWU_TIMEBASE_128MS = (uint8_t)10, /*!< AWU Timebase equals 128 ms */ 00058 AWU_TIMEBASE_256MS = (uint8_t)11, /*!< AWU Timebase equals 256 ms */ 00059 AWU_TIMEBASE_512MS = (uint8_t)12, /*!< AWU Timebase equals 512 ms */ 00060 AWU_TIMEBASE_1S = (uint8_t)13, /*!< AWU Timebase equals 1 s */ 00061 AWU_TIMEBASE_2S = (uint8_t)14, /*!< AWU Timebase equals 2 s */ 00062 AWU_TIMEBASE_12S = (uint8_t)15, /*!< AWU Timebase equals 12 s */ 00063 AWU_TIMEBASE_30S = (uint8_t)16 /*!< AWU Timebase equals 30 s */ 00064 } AWU_Timebase_TypeDef; 00065 00066 /** 00067 * @} 00068 */ 00069 00070 /* Exported constants --------------------------------------------------------*/ 00071 00072 /** @addtogroup AWU_Exported_Constants 00073 * @{ 00074 */ 00075 00076 #define LSI_FREQUENCY_MIN ((uint32_t)110000) /*!< LSI minimum value in Hertz */ 00077 #define LSI_FREQUENCY_MAX ((uint32_t)150000) /*!< LSI maximum value in Hertz */ 00078 00079 /** 00080 * @} 00081 */ 00082 00083 /* Exported macros ------------------------------------------------------------*/ 00084 00085 /* Private macros ------------------------------------------------------------*/ 00086 00087 /** @addtogroup AWU_Private_Macros 00088 * @{ 00089 */ 00090 00091 /** 00092 * @brief Macro used by the assert function to check the different functions parameters. 00093 */ 00094 00095 /** 00096 * @brief Macro used by the assert function to check the AWU timebases 00097 */ 00098 #define IS_AWU_TIMEBASE_OK(TB) \ 00099 (((TB) == AWU_TIMEBASE_NO_IT) || \ 00100 ((TB) == AWU_TIMEBASE_250US) || \ 00101 ((TB) == AWU_TIMEBASE_500US) || \ 00102 ((TB) == AWU_TIMEBASE_1MS) || \ 00103 ((TB) == AWU_TIMEBASE_2MS) || \ 00104 ((TB) == AWU_TIMEBASE_4MS) || \ 00105 ((TB) == AWU_TIMEBASE_8MS) || \ 00106 ((TB) == AWU_TIMEBASE_16MS) || \ 00107 ((TB) == AWU_TIMEBASE_32MS) || \ 00108 ((TB) == AWU_TIMEBASE_64MS) || \ 00109 ((TB) == AWU_TIMEBASE_128MS) || \ 00110 ((TB) == AWU_TIMEBASE_256MS) || \ 00111 ((TB) == AWU_TIMEBASE_512MS) || \ 00112 ((TB) == AWU_TIMEBASE_1S) || \ 00113 ((TB) == AWU_TIMEBASE_2S) || \ 00114 ((TB) == AWU_TIMEBASE_12S) || \ 00115 ((TB) == AWU_TIMEBASE_30S)) 00116 00117 /** 00118 * @brief Macro used by the assert function to check the LSI frequency (in Hz) 00119 */ 00120 #define IS_LSI_FREQUENCY_OK(FREQ) \ 00121 (((FREQ) >= LSI_FREQUENCY_MIN) && \ 00122 ((FREQ) <= LSI_FREQUENCY_MAX)) 00123 00124 /** 00125 * @} 00126 */ 00127 00128 /* Exported functions ------------------------------------------------------- */ 00129 00130 /** @addtogroup AWU_Exported_Functions 00131 * @{ 00132 */ 00133 void AWU_DeInit(void); 00134 void AWU_Init(AWU_Timebase_TypeDef AWU_TimeBase); 00135 void AWU_Cmd(FunctionalState NewState); 00136 void AWU_LSICalibrationConfig(uint32_t LSIFreqHz); 00137 void AWU_IdleModeEnable(void); 00138 FlagStatus AWU_GetFlagStatus(void); 00139 00140 /** 00141 * @} 00142 */ 00143 00144 #endif /* __STM8S_AWU_H */ 00145 00146 00147 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/