stm32f10x_iwdg.c
Go to the documentation of this file.
1 
22 /* Includes ------------------------------------------------------------------*/
23 #include "stm32f10x_iwdg.h"
24 
46 /* ---------------------- IWDG registers bit mask ----------------------------*/
47 
48 /* KR register bit mask */
49 #define KR_KEY_Reload ((uint16_t)0xAAAA)
50 #define KR_KEY_Enable ((uint16_t)0xCCCC)
51 
92 void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess)
93 {
94  /* Check the parameters */
95  assert_param(IS_IWDG_WRITE_ACCESS(IWDG_WriteAccess));
96  IWDG->KR = IWDG_WriteAccess;
97 }
98 
112 void IWDG_SetPrescaler(uint8_t IWDG_Prescaler)
113 {
114  /* Check the parameters */
115  assert_param(IS_IWDG_PRESCALER(IWDG_Prescaler));
116  IWDG->PR = IWDG_Prescaler;
117 }
118 
125 void IWDG_SetReload(uint16_t Reload)
126 {
127  /* Check the parameters */
128  assert_param(IS_IWDG_RELOAD(Reload));
129  IWDG->RLR = Reload;
130 }
131 
139 {
140  IWDG->KR = KR_KEY_Reload;
141 }
142 
148 void IWDG_Enable(void)
149 {
150  IWDG->KR = KR_KEY_Enable;
151 }
152 
161 FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG)
162 {
163  FlagStatus bitstatus = RESET;
164  /* Check the parameters */
165  assert_param(IS_IWDG_FLAG(IWDG_FLAG));
166  if ((IWDG->SR & IWDG_FLAG) != (uint32_t)RESET)
167  {
168  bitstatus = SET;
169  }
170  else
171  {
172  bitstatus = RESET;
173  }
174  /* Return the flag status */
175  return bitstatus;
176 }
177 
190 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
#define IWDG
Definition: stm32f4xx.h:2048
FlagStatus
Definition: stm32f4xx.h:706
void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess)
Enables or disables write access to IWDG_PR and IWDG_RLR registers.
#define IS_IWDG_FLAG(FLAG)
void IWDG_Enable(void)
Enables IWDG (write access to IWDG_PR and IWDG_RLR registers disabled).
void assert_param(int val)
This file contains all the functions prototypes for the IWDG firmware library.
Definition: stm32f4xx.h:706
void IWDG_SetReload(uint16_t Reload)
Sets IWDG Reload value.
#define KR_KEY_Enable
void IWDG_SetPrescaler(uint8_t IWDG_Prescaler)
Sets IWDG Prescaler value.
#define IS_IWDG_RELOAD(RELOAD)
FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG)
Checks whether the specified IWDG flag is set or not.
#define IS_IWDG_PRESCALER(PRESCALER)
#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_WRITE_ACCESS(ACCESS)


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Oct 24 2019 03:17:19