|
1 |
| -/** |
2 |
| - ****************************************************************************** |
3 |
| - * @file stm8s_awu.h |
4 |
| - * @author MCD Application Team |
5 |
| - * @version V2.3.0 |
6 |
| - * @date 16-June-2017 |
7 |
| - * @brief This file contains all functions prototype and macros for the AWU peripheral. |
8 |
| - ****************************************************************************** |
9 |
| - * @attention |
10 |
| - * |
11 |
| - * <h2><center>© 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 |
| - |
28 |
| -/* Define to prevent recursive inclusion -------------------------------------*/ |
29 |
| -#ifndef __STM8S_AWU_H |
30 |
| -#define __STM8S_AWU_H |
31 |
| - |
32 |
| -/* Includes ------------------------------------------------------------------*/ |
33 |
| -#include "stm8s.h" |
34 |
| - |
35 |
| -/* Exported types ------------------------------------------------------------*/ |
36 |
| - |
37 |
| -/** @addtogroup AWU_Exported_Types |
38 |
| - * @{ |
39 |
| - */ |
40 |
| - |
41 |
| -/** |
42 |
| - * @brief AWU TimeBase selection |
43 |
| - */ |
44 |
| - |
45 |
| -typedef enum |
46 |
| -{ |
47 |
| - AWU_TIMEBASE_NO_IT = (uint8_t)0, /*!< No AWU interrupt selected */ |
48 |
| - AWU_TIMEBASE_250US = (uint8_t)1, /*!< AWU Timebase equals 0.25 ms */ |
49 |
| - AWU_TIMEBASE_500US = (uint8_t)2, /*!< AWU Timebase equals 0.5 ms */ |
50 |
| - AWU_TIMEBASE_1MS = (uint8_t)3, /*!< AWU Timebase equals 1 ms */ |
51 |
| - AWU_TIMEBASE_2MS = (uint8_t)4, /*!< AWU Timebase equals 2 ms */ |
52 |
| - AWU_TIMEBASE_4MS = (uint8_t)5, /*!< AWU Timebase equals 4 ms */ |
53 |
| - AWU_TIMEBASE_8MS = (uint8_t)6, /*!< AWU Timebase equals 8 ms */ |
54 |
| - AWU_TIMEBASE_16MS = (uint8_t)7, /*!< AWU Timebase equals 16 ms */ |
55 |
| - AWU_TIMEBASE_32MS = (uint8_t)8, /*!< AWU Timebase equals 32 ms */ |
56 |
| - AWU_TIMEBASE_64MS = (uint8_t)9, /*!< AWU Timebase equals 64 ms */ |
57 |
| - AWU_TIMEBASE_128MS = (uint8_t)10, /*!< AWU Timebase equals 128 ms */ |
58 |
| - AWU_TIMEBASE_256MS = (uint8_t)11, /*!< AWU Timebase equals 256 ms */ |
59 |
| - AWU_TIMEBASE_512MS = (uint8_t)12, /*!< AWU Timebase equals 512 ms */ |
60 |
| - AWU_TIMEBASE_1S = (uint8_t)13, /*!< AWU Timebase equals 1 s */ |
61 |
| - AWU_TIMEBASE_2S = (uint8_t)14, /*!< AWU Timebase equals 2 s */ |
62 |
| - AWU_TIMEBASE_12S = (uint8_t)15, /*!< AWU Timebase equals 12 s */ |
63 |
| - AWU_TIMEBASE_30S = (uint8_t)16 /*!< AWU Timebase equals 30 s */ |
64 |
| -} AWU_Timebase_TypeDef; |
65 |
| - |
66 |
| -/** |
67 |
| - * @} |
68 |
| - */ |
69 |
| - |
70 |
| -/* Exported constants --------------------------------------------------------*/ |
71 |
| - |
72 |
| -/** @addtogroup AWU_Exported_Constants |
73 |
| - * @{ |
74 |
| - */ |
75 |
| - |
76 |
| -#define LSI_FREQUENCY_MIN ((uint32_t)110000) /*!< LSI minimum value in Hertz */ |
77 |
| -#define LSI_FREQUENCY_MAX ((uint32_t)150000) /*!< LSI maximum value in Hertz */ |
78 |
| - |
79 |
| -/** |
80 |
| - * @} |
81 |
| - */ |
82 |
| - |
83 |
| -/* Exported macros ------------------------------------------------------------*/ |
84 |
| - |
85 |
| -/* Private macros ------------------------------------------------------------*/ |
86 |
| - |
87 |
| -/** @addtogroup AWU_Private_Macros |
88 |
| - * @{ |
89 |
| - */ |
90 |
| - |
91 |
| -/** |
92 |
| - * @brief Macro used by the assert function to check the different functions parameters. |
93 |
| - */ |
94 |
| - |
95 |
| -/** |
96 |
| - * @brief Macro used by the assert function to check the AWU timebases |
97 |
| - */ |
98 |
| -#define IS_AWU_TIMEBASE_OK(TB) \ |
99 |
| - (((TB) == AWU_TIMEBASE_NO_IT) || \ |
100 |
| - ((TB) == AWU_TIMEBASE_250US) || \ |
101 |
| - ((TB) == AWU_TIMEBASE_500US) || \ |
102 |
| - ((TB) == AWU_TIMEBASE_1MS) || \ |
103 |
| - ((TB) == AWU_TIMEBASE_2MS) || \ |
104 |
| - ((TB) == AWU_TIMEBASE_4MS) || \ |
105 |
| - ((TB) == AWU_TIMEBASE_8MS) || \ |
106 |
| - ((TB) == AWU_TIMEBASE_16MS) || \ |
107 |
| - ((TB) == AWU_TIMEBASE_32MS) || \ |
108 |
| - ((TB) == AWU_TIMEBASE_64MS) || \ |
109 |
| - ((TB) == AWU_TIMEBASE_128MS) || \ |
110 |
| - ((TB) == AWU_TIMEBASE_256MS) || \ |
111 |
| - ((TB) == AWU_TIMEBASE_512MS) || \ |
112 |
| - ((TB) == AWU_TIMEBASE_1S) || \ |
113 |
| - ((TB) == AWU_TIMEBASE_2S) || \ |
114 |
| - ((TB) == AWU_TIMEBASE_12S) || \ |
115 |
| - ((TB) == AWU_TIMEBASE_30S)) |
116 |
| - |
117 |
| -/** |
118 |
| - * @brief Macro used by the assert function to check the LSI frequency (in Hz) |
119 |
| - */ |
120 |
| -#define IS_LSI_FREQUENCY_OK(FREQ) \ |
121 |
| - (((FREQ) >= LSI_FREQUENCY_MIN) && \ |
122 |
| - ((FREQ) <= LSI_FREQUENCY_MAX)) |
123 |
| - |
124 |
| -/** |
125 |
| - * @} |
126 |
| - */ |
127 |
| - |
128 |
| -/* Exported functions ------------------------------------------------------- */ |
129 |
| - |
130 |
| -/** @addtogroup AWU_Exported_Functions |
131 |
| - * @{ |
132 |
| - */ |
133 |
| -void AWU_DeInit(void); |
134 |
| -void AWU_Init(AWU_Timebase_TypeDef AWU_TimeBase); |
135 |
| -void AWU_Cmd(FunctionalState NewState); |
136 |
| -void AWU_LSICalibrationConfig(uint32_t LSIFreqHz); |
137 |
| -void AWU_IdleModeEnable(void); |
138 |
| -FlagStatus AWU_GetFlagStatus(void); |
139 |
| - |
140 |
| -/** |
141 |
| - * @} |
142 |
| - */ |
143 |
| - |
144 |
| -#endif /* __STM8S_AWU_H */ |
145 |
| - |
146 |
| - |
147 |
| -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
| 1 | +/** |
| 2 | + ****************************************************************************** |
| 3 | + * @file stm8s_awu.h |
| 4 | + * @author MCD Application Team |
| 5 | + * @version V2.3.0 |
| 6 | + * @date 16-June-2017 |
| 7 | + * @brief This file contains all functions prototype and macros for the AWU peripheral. |
| 8 | + ****************************************************************************** |
| 9 | + * @attention |
| 10 | + * |
| 11 | + * <h2><center>© 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 | + |
| 28 | +/* Define to prevent recursive inclusion -------------------------------------*/ |
| 29 | +#ifndef __STM8S_AWU_H |
| 30 | +#define __STM8S_AWU_H |
| 31 | + |
| 32 | +/* Includes ------------------------------------------------------------------*/ |
| 33 | +#include "stm8s.h" |
| 34 | + |
| 35 | +/* Exported types ------------------------------------------------------------*/ |
| 36 | + |
| 37 | +/** @addtogroup AWU_Exported_Types |
| 38 | + * @{ |
| 39 | + */ |
| 40 | + |
| 41 | +/** |
| 42 | + * @brief AWU TimeBase selection |
| 43 | + */ |
| 44 | + |
| 45 | +typedef enum |
| 46 | +{ |
| 47 | + AWU_TIMEBASE_NO_IT = (uint8_t)0, /*!< No AWU interrupt selected */ |
| 48 | + AWU_TIMEBASE_250US = (uint8_t)1, /*!< AWU Timebase equals 0.25 ms */ |
| 49 | + AWU_TIMEBASE_500US = (uint8_t)2, /*!< AWU Timebase equals 0.5 ms */ |
| 50 | + AWU_TIMEBASE_1MS = (uint8_t)3, /*!< AWU Timebase equals 1 ms */ |
| 51 | + AWU_TIMEBASE_2MS = (uint8_t)4, /*!< AWU Timebase equals 2 ms */ |
| 52 | + AWU_TIMEBASE_4MS = (uint8_t)5, /*!< AWU Timebase equals 4 ms */ |
| 53 | + AWU_TIMEBASE_8MS = (uint8_t)6, /*!< AWU Timebase equals 8 ms */ |
| 54 | + AWU_TIMEBASE_16MS = (uint8_t)7, /*!< AWU Timebase equals 16 ms */ |
| 55 | + AWU_TIMEBASE_32MS = (uint8_t)8, /*!< AWU Timebase equals 32 ms */ |
| 56 | + AWU_TIMEBASE_64MS = (uint8_t)9, /*!< AWU Timebase equals 64 ms */ |
| 57 | + AWU_TIMEBASE_128MS = (uint8_t)10, /*!< AWU Timebase equals 128 ms */ |
| 58 | + AWU_TIMEBASE_256MS = (uint8_t)11, /*!< AWU Timebase equals 256 ms */ |
| 59 | + AWU_TIMEBASE_512MS = (uint8_t)12, /*!< AWU Timebase equals 512 ms */ |
| 60 | + AWU_TIMEBASE_1S = (uint8_t)13, /*!< AWU Timebase equals 1 s */ |
| 61 | + AWU_TIMEBASE_2S = (uint8_t)14, /*!< AWU Timebase equals 2 s */ |
| 62 | + AWU_TIMEBASE_12S = (uint8_t)15, /*!< AWU Timebase equals 12 s */ |
| 63 | + AWU_TIMEBASE_30S = (uint8_t)16 /*!< AWU Timebase equals 30 s */ |
| 64 | +} AWU_Timebase_TypeDef; |
| 65 | + |
| 66 | +/** |
| 67 | + * @} |
| 68 | + */ |
| 69 | + |
| 70 | +/* Exported constants --------------------------------------------------------*/ |
| 71 | + |
| 72 | +/** @addtogroup AWU_Exported_Constants |
| 73 | + * @{ |
| 74 | + */ |
| 75 | + |
| 76 | +#define LSI_FREQUENCY_MIN ((uint32_t)110000) /*!< LSI minimum value in Hertz */ |
| 77 | +#define LSI_FREQUENCY_MAX ((uint32_t)150000) /*!< LSI maximum value in Hertz */ |
| 78 | + |
| 79 | +/** |
| 80 | + * @} |
| 81 | + */ |
| 82 | + |
| 83 | +/* Exported macros ------------------------------------------------------------*/ |
| 84 | + |
| 85 | +/* Private macros ------------------------------------------------------------*/ |
| 86 | + |
| 87 | +/** @addtogroup AWU_Private_Macros |
| 88 | + * @{ |
| 89 | + */ |
| 90 | + |
| 91 | +/** |
| 92 | + * @brief Macro used by the assert function to check the different functions parameters. |
| 93 | + */ |
| 94 | + |
| 95 | +/** |
| 96 | + * @brief Macro used by the assert function to check the AWU timebases |
| 97 | + */ |
| 98 | +#define IS_AWU_TIMEBASE_OK(TB) \ |
| 99 | + (((TB) == AWU_TIMEBASE_NO_IT) || \ |
| 100 | + ((TB) == AWU_TIMEBASE_250US) || \ |
| 101 | + ((TB) == AWU_TIMEBASE_500US) || \ |
| 102 | + ((TB) == AWU_TIMEBASE_1MS) || \ |
| 103 | + ((TB) == AWU_TIMEBASE_2MS) || \ |
| 104 | + ((TB) == AWU_TIMEBASE_4MS) || \ |
| 105 | + ((TB) == AWU_TIMEBASE_8MS) || \ |
| 106 | + ((TB) == AWU_TIMEBASE_16MS) || \ |
| 107 | + ((TB) == AWU_TIMEBASE_32MS) || \ |
| 108 | + ((TB) == AWU_TIMEBASE_64MS) || \ |
| 109 | + ((TB) == AWU_TIMEBASE_128MS) || \ |
| 110 | + ((TB) == AWU_TIMEBASE_256MS) || \ |
| 111 | + ((TB) == AWU_TIMEBASE_512MS) || \ |
| 112 | + ((TB) == AWU_TIMEBASE_1S) || \ |
| 113 | + ((TB) == AWU_TIMEBASE_2S) || \ |
| 114 | + ((TB) == AWU_TIMEBASE_12S) || \ |
| 115 | + ((TB) == AWU_TIMEBASE_30S)) |
| 116 | + |
| 117 | +/** |
| 118 | + * @brief Macro used by the assert function to check the LSI frequency (in Hz) |
| 119 | + */ |
| 120 | +#define IS_LSI_FREQUENCY_OK(FREQ) \ |
| 121 | + (((FREQ) >= LSI_FREQUENCY_MIN) && \ |
| 122 | + ((FREQ) <= LSI_FREQUENCY_MAX)) |
| 123 | + |
| 124 | +/** |
| 125 | + * @} |
| 126 | + */ |
| 127 | + |
| 128 | +/* Exported functions ------------------------------------------------------- */ |
| 129 | + |
| 130 | +/** @addtogroup AWU_Exported_Functions |
| 131 | + * @{ |
| 132 | + */ |
| 133 | +void AWU_DeInit(void); |
| 134 | +void AWU_Init(AWU_Timebase_TypeDef AWU_TimeBase); |
| 135 | +void AWU_Cmd(FunctionalState NewState); |
| 136 | +void AWU_LSICalibrationConfig(uint32_t LSIFreqHz); |
| 137 | +void AWU_IdleModeEnable(void); |
| 138 | +FlagStatus AWU_GetFlagStatus(void); |
| 139 | + |
| 140 | +/** |
| 141 | + * @} |
| 142 | + */ |
| 143 | + |
| 144 | +#endif /* __STM8S_AWU_H */ |
| 145 | + |
| 146 | + |
| 147 | +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
0 commit comments