stm32f30x_iwdg.c
Go to the documentation of this file.
1 
92 /* Includes ------------------------------------------------------------------*/
93 #include "stm32f30x_iwdg.h"
94 
104 /* Private typedef -----------------------------------------------------------*/
105 /* Private define ------------------------------------------------------------*/
106 /* ---------------------- IWDG registers bit mask ----------------------------*/
107 /* KR register bit mask */
108 #define KR_KEY_RELOAD ((uint16_t)0xAAAA)
109 #define KR_KEY_ENABLE ((uint16_t)0xCCCC)
110 
111 /* Private macro -------------------------------------------------------------*/
112 /* Private variables ---------------------------------------------------------*/
113 /* Private function prototypes -----------------------------------------------*/
114 /* Private functions ---------------------------------------------------------*/
115 
140 void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess)
141 {
142  /* Check the parameters */
143  assert_param(IS_IWDG_WRITE_ACCESS(IWDG_WriteAccess));
144  IWDG->KR = IWDG_WriteAccess;
145 }
146 
160 void IWDG_SetPrescaler(uint8_t IWDG_Prescaler)
161 {
162  /* Check the parameters */
163  assert_param(IS_IWDG_PRESCALER(IWDG_Prescaler));
164  IWDG->PR = IWDG_Prescaler;
165 }
166 
173 void IWDG_SetReload(uint16_t Reload)
174 {
175  /* Check the parameters */
176  assert_param(IS_IWDG_RELOAD(Reload));
177  IWDG->RLR = Reload;
178 }
179 
187 {
188  IWDG->KR = KR_KEY_RELOAD;
189 }
190 
191 
197 void IWDG_SetWindowValue(uint16_t WindowValue)
198 {
199  /* Check the parameters */
200  assert_param(IS_IWDG_WINDOW_VALUE(WindowValue));
201  IWDG->WINR = WindowValue;
202 }
203 
225 void IWDG_Enable(void)
226 {
227  IWDG->KR = KR_KEY_ENABLE;
228 }
229 
255 FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG)
256 {
257  FlagStatus bitstatus = RESET;
258  /* Check the parameters */
259  assert_param(IS_IWDG_FLAG(IWDG_FLAG));
260  if ((IWDG->SR & IWDG_FLAG) != (uint32_t)RESET)
261  {
262  bitstatus = SET;
263  }
264  else
265  {
266  bitstatus = RESET;
267  }
268  /* Return the flag status */
269  return bitstatus;
270 }
271 
288 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#define IWDG
Definition: stm32f4xx.h:2048
FlagStatus
Definition: stm32f4xx.h:706
void IWDG_Enable(void)
Enables IWDG (write access to IWDG_PR and IWDG_RLR registers disabled).
#define IS_IWDG_FLAG(FLAG)
void assert_param(int val)
This file contains all the functions prototypes for the IWDG firmware library.
void IWDG_SetWindowValue(uint16_t WindowValue)
Sets the IWDG window value.
Definition: stm32f4xx.h:706
#define KR_KEY_ENABLE
#define IS_IWDG_WINDOW_VALUE(VALUE)
void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess)
Enables or disables write access to IWDG_PR and IWDG_RLR registers.
#define KR_KEY_RELOAD
void IWDG_ReloadCounter(void)
Reloads IWDG counter with value defined in the reload register (write access to IWDG_PR and IWDG_RLR ...
#define IS_IWDG_RELOAD(RELOAD)
void IWDG_SetReload(uint16_t Reload)
Sets IWDG Reload value.
#define IS_IWDG_PRESCALER(PRESCALER)
void IWDG_SetPrescaler(uint8_t IWDG_Prescaler)
Sets IWDG Prescaler value.
FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG)
Checks whether the specified IWDG flag is set or not.
#define IS_IWDG_WRITE_ACCESS(ACCESS)


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:48