api-hal-boot.c 415 B

12345678910111213
  1. #include <api-hal-boot.h>
  2. #include <stm32l4xx_ll_rtc.h>
  3. #define BOOT_REQUEST_NONE 0x00000000
  4. #define BOOT_REQUEST_DFU 0xDF00B000
  5. void api_hal_boot_set_mode(ApiHalBootMode mode) {
  6. if (mode == ApiHalBootModeNormal) {
  7. LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_NONE);
  8. } else if (mode == ApiHalBootModeDFU) {
  9. LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_DFU);
  10. }
  11. }