1
0
Fork 0

Improve and Cleanup Shutdown callbacks (#21060)

Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
This commit is contained in:
Drashna Jael're 2023-11-26 03:59:18 -08:00 committed by GitHub
parent 4601f339e4
commit 3ef06aa732
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
79 changed files with 277 additions and 1684 deletions

View file

@ -92,13 +92,8 @@ bool led_update_kb(led_t led_state) {
}
#define REBOOT_MAGIC 0x41544B42
void shutdown_user(void)
{
// set the magic number for resetting to the bootloader
*(uint32_t *)(&(RTCD1.rtc->BKP0R)) = REBOOT_MAGIC;
}
void bootloader_jump(void) {
shutdown_user();
*(uint32_t *)(&(RTCD1.rtc->BKP0R)) = REBOOT_MAGIC;
NVIC_SystemReset();
}

View file

@ -54,13 +54,9 @@ bool led_update_kb(led_t led_state) {
}
#define REBOOT_MAGIC 0x41544B42
void shutdown_user(void)
{
// set the magic number for resetting to the bootloader
*(uint32_t *)(&(RTCD1.rtc->BKP0R)) = REBOOT_MAGIC;
}
void bootloader_jump(void) {
shutdown_user();
// set the magic number for resetting to the bootloader
*(uint32_t *)(&(RTCD1.rtc->BKP0R)) = REBOOT_MAGIC;
NVIC_SystemReset();
}