| BlueNRG-1 Peripherals drivers APIs

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

BlueNRG1_wdg.c
Go to the documentation of this file.
1
22 /* Includes ------------------------------------------------------------------*/
23 #include "BlueNRG1_wdg.h"
24
25
46 #define WDG_WRITE_ACCESS_UNLOCK ((uint32_t)0x1ACCE551)
47 #define WDG_WRITE_ACCESS_LOCK ((uint32_t)0x00000000)
95 void WDG_SetWriteAccess(FunctionalState NewState)
96 {
97 /* Check the parameters */
98 assert_param(IS_FUNCTIONAL_STATE(NewState));
99
100 if (NewState != DISABLE) {
101 WDG->LOCK = WDG_WRITE_ACCESS_UNLOCK;
102 }
103 else {
104 WDG->LOCK = WDG_WRITE_ACCESS_LOCK;
105 }
106 }
107
108
115 FunctionalState WDG_GetWriteAccess(void)
116 {
117 return (FunctionalState)!WDG->LOCK;
118
119 }
120
127 void WDG_SetReload(uint32_t WDG_Reload)
128 {
129 /* Check the parameters */
130 assert_param(WDG_Reload > 0);
131 WDG->LR = WDG_Reload;
132 }
133
139 void WDG_Enable(void)
140 {
141 WDG->CR_b.INTEN = SET;
142 WDG->CR_b.RESEN = SET;
143 }
144
150 uint32_t WDG_GetCounter(void)
151 {
152 return WDG->VAL;
153 }
154
161 void WDG_ITConfig(FunctionalState NewState)
162 {
163 /* Check the parameters */
164 assert_param(IS_FUNCTIONAL_STATE(NewState));
165
166 if (NewState != DISABLE) {
167 WDG->CR_b.INTEN = SET;
168 }
169 else {
170 WDG->CR_b.INTEN = RESET;
171 }
172 }
173
180 ITStatus WDG_GetITStatus(void)
181 {
182 FlagStatus bitstatus = RESET;
183
184 /* Check the status of the WDG interrupt */
185 if (WDG->RIS != (uint32_t)RESET) {
186 bitstatus = SET;
187 }
188
189 return bitstatus;
190 }
191
197 void WDG_ClearITPendingBit(void)
198 {
199 WDG->ICR = 0xFFFFFFFF;
200 }
201
214 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/
WDG_SetReload
void WDG_SetReload(uint32_t WDG_Reload)
Sets WDG reload value.
Definition: BlueNRG1_wdg.c:127
WDG_ITConfig
void WDG_ITConfig(FunctionalState NewState)
Enables or disables the WDG interrupt.
Definition: BlueNRG1_wdg.c:161
BlueNRG1_wdg.h
This file contains all the functions prototypes for the WDG firmware library.
WDG_WRITE_ACCESS_LOCK
#define WDG_WRITE_ACCESS_LOCK
Definition: BlueNRG1_wdg.c:47
WDG_Enable
void WDG_Enable(void)
Enables WDG reset.
Definition: BlueNRG1_wdg.c:139
WDG_WRITE_ACCESS_UNLOCK
#define WDG_WRITE_ACCESS_UNLOCK
Definition: BlueNRG1_wdg.c:46
WDG_ClearITPendingBit
void WDG_ClearITPendingBit(void)
Clears the WDG's interrupt pending bit.
Definition: BlueNRG1_wdg.c:197
WDG_GetITStatus
ITStatus WDG_GetITStatus(void)
Checks whether the WDG interrupt has occurred or not.
Definition: BlueNRG1_wdg.c:180
WDG_GetCounter
uint32_t WDG_GetCounter(void)
Gets the WDG counter value.
Definition: BlueNRG1_wdg.c:150
WDG_GetWriteAccess
FunctionalState WDG_GetWriteAccess(void)
Get the write access state.
Definition: BlueNRG1_wdg.c:115