generated from Embedded_Projects/MPyATE_Template
Added reset function.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Signed-off-by: Yilin Sun <imi415@imi.moe>
This commit is contained in:
parent
c52e1a865a
commit
c5fae6db36
|
@ -47,6 +47,7 @@ set(TARGET_SOURCES
|
|||
"src/app_gpio.c"
|
||||
"src/app_periodic_tasks.c"
|
||||
"src/app_reg_if.c"
|
||||
"src/app_sys_utils.c"
|
||||
"src/main.c"
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef APP_SYS_UTILS_H
|
||||
#define APP_SYS_UTILS_H
|
||||
|
||||
#include "fsl_common_arm.h"
|
||||
|
||||
static inline void app_sys_util_reset(void) {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
void app_sys_util_update(void);
|
||||
|
||||
#endif // APP_SYS_UTILS_H
|
|
@ -7,6 +7,7 @@
|
|||
/* App */
|
||||
#include "app_gpio.h"
|
||||
#include "app_periodic_tasks.h"
|
||||
#include "app_sys_utils.h"
|
||||
|
||||
#define APP_PERIODIC_RATE 1000
|
||||
|
||||
|
@ -28,6 +29,7 @@ void app_periodic_tasks_init(void) {
|
|||
}
|
||||
|
||||
static void app_periodic_task(void) {
|
||||
app_sys_util_update();
|
||||
app_gpio_update();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
/* App */
|
||||
#include "app_reg_if.h"
|
||||
|
||||
/* Private */
|
||||
#include "app_sys_utils.h"
|
||||
|
||||
#define APP_SYS_RST_Pos 15
|
||||
#define APP_SYS_RST_Msk (1U << APP_SYS_RST_Pos)
|
||||
|
||||
void app_sys_util_update(void) {
|
||||
uint16_t cfg = app_reg_if_internal_read(APP_REG_CFG);
|
||||
|
||||
if (cfg & APP_SYS_RST_Msk) {
|
||||
cfg &= ~(APP_SYS_RST_Msk);
|
||||
|
||||
app_reg_if_internal_write(APP_REG_CFG, cfg);
|
||||
|
||||
app_sys_util_reset();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue