Init
This commit is contained in:
commit
61dddae2e0
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"cmake": {
|
||||||
|
"inc_dirs": [
|
||||||
|
"./"
|
||||||
|
],
|
||||||
|
"srcs": [
|
||||||
|
"./**.c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
//
|
||||||
|
// Created by cfif on 24.02.2025.
|
||||||
|
//
|
||||||
|
#include "at32f435_437.h"
|
||||||
|
#include "wdt_timer.h"
|
||||||
|
#include "SystemDelayInterface.h"
|
||||||
|
|
||||||
|
void Wdt_Start() {
|
||||||
|
|
||||||
|
if (crm_flag_get(CRM_WDT_RESET_FLAG) != RESET) {
|
||||||
|
// reset from wdt
|
||||||
|
crm_flag_clear(CRM_WDT_RESET_FLAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
// disable register write protection
|
||||||
|
wdt_register_write_enable(TRUE);
|
||||||
|
|
||||||
|
// set the wdt divider value
|
||||||
|
wdt_divider_set(WDT_CLK_DIV_4);
|
||||||
|
|
||||||
|
/* set reload value
|
||||||
|
|
||||||
|
timeout = reload_value * (divider / lick_freq ) (s)
|
||||||
|
|
||||||
|
lick_freq = 40000 Hz
|
||||||
|
divider = 4
|
||||||
|
reload_value = 3000
|
||||||
|
|
||||||
|
timeout = 3000 * (4 / 40000 ) = 0.3s = 300ms
|
||||||
|
*/
|
||||||
|
wdt_reload_value_set(3000 - 1);
|
||||||
|
|
||||||
|
// enable wdt
|
||||||
|
wdt_enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
//
|
||||||
|
// Created by cfif on 24.02.2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef SMART_COMPONENTS_V2_WDT_TIMER_H
|
||||||
|
#define SMART_COMPONENTS_V2_WDT_TIMER_H
|
||||||
|
|
||||||
|
#include "CmsisRtosThreadUtils.h"
|
||||||
|
|
||||||
|
void Wdt_Start();
|
||||||
|
|
||||||
|
#endif //SMART_COMPONENTS_V2_WDT_TIMER_H
|
||||||
Loading…
Reference in New Issue