File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 2424// Initialize static variable
2525bool IWatchdogClass::_enabled = false ;
2626
27+ IWatchdogClass::IWatchdogClass ()
28+ {
29+ #if defined(LL_APB0_GRP1_PERIPH_WDG)
30+ LL_APB0_GRP1_EnableClock (LL_APB0_GRP1_PERIPH_WDG);
31+ #endif
32+ }
33+
2734/* *
2835 * @brief Enable IWDG, must be called once
2936 * @param timeout: value in microseconds
@@ -46,6 +53,9 @@ void IWatchdogClass::begin(uint32_t timeout, uint32_t window)
4653 LL_RCC_LSI_Enable ();
4754 while (LL_RCC_LSI_IsReady () != 1 ) {
4855 }
56+ #endif
57+ #if defined(LL_RCC_LSCO_CLKSOURCE_LSI)
58+ LL_RCC_LSCO_SetSource (LL_RCC_LSCO_CLKSOURCE_LSI);
4959#endif
5060 // Enable the IWDG by writing 0x0000 CCCC in the IWDG_KR register
5161 LL_IWDG_Enable (IWDG);
@@ -168,8 +178,10 @@ void IWatchdogClass::reload(void)
168178 */
169179bool IWatchdogClass::isReset (bool clear)
170180{
171- #ifdef IWDG1
181+ #if defined( IWDG1)
172182 bool status = LL_RCC_IsActiveFlag_IWDG1RST ();
183+ #elif defined(STM32WB0x)
184+ bool status = LL_RCC_IsActiveFlag_WDGRST ();
173185#else
174186 bool status = LL_RCC_IsActiveFlag_IWDGRST ();
175187#endif
Original file line number Diff line number Diff line change 3737class IWatchdogClass {
3838
3939 public:
40+ IWatchdogClass ();
4041 void begin (uint32_t timeout, uint32_t window = IWDG_TIMEOUT_MAX);
4142 void set (uint32_t timeout, uint32_t window = IWDG_TIMEOUT_MAX);
4243 void get (uint32_t *timeout, uint32_t *window = NULL );
You can’t perform that action at this time.
0 commit comments