Welcome to mirror list, hosted at ThFree Co, Russian Federation.

furi-hal-lock.c « furi-hal « f7 « targets « firmware - github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0f51938010ede6b772ebde1fa382cf4b4e0d4508 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "furi-hal-lock.h"
#include <stm32wbxx_ll_rtc.h>

#define FLIPPER_LOCKED_VALUE 0x5432FAFA

bool furi_hal_lock_get() {
    return FLIPPER_LOCKED_VALUE == LL_RTC_BAK_GetRegister(RTC, LL_RTC_BKP_DR3);
}

void furi_hal_lock_set(bool locked) {
    if (locked) {
        LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR3, FLIPPER_LOCKED_VALUE);
    } else {
        LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR3, 0);
    }
}