[FL-2152] New PIN lock (#989)
* [Fl-2152] New PIN Lock, part 1 * Fix errors & leaks, renaming * Add support to f6 * Fix error, remove duplicate code * Fix drawing corners of Lock Popup * FuriHal: insomnia if usb connected * Applications: cleanup timers use Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -89,17 +89,17 @@ uint16_t furi_hal_power_insomnia_level() {
|
||||
}
|
||||
|
||||
void furi_hal_power_insomnia_enter() {
|
||||
vTaskSuspendAll();
|
||||
FURI_CRITICAL_ENTER();
|
||||
furi_assert(furi_hal_power.insomnia < UINT8_MAX);
|
||||
furi_hal_power.insomnia++;
|
||||
xTaskResumeAll();
|
||||
FURI_CRITICAL_EXIT();
|
||||
}
|
||||
|
||||
void furi_hal_power_insomnia_exit() {
|
||||
vTaskSuspendAll();
|
||||
FURI_CRITICAL_ENTER();
|
||||
furi_assert(furi_hal_power.insomnia > 0);
|
||||
furi_hal_power.insomnia--;
|
||||
xTaskResumeAll();
|
||||
FURI_CRITICAL_EXIT();
|
||||
}
|
||||
|
||||
bool furi_hal_power_sleep_available() {
|
||||
|
@@ -163,3 +163,11 @@ void furi_hal_rtc_set_fault_data(uint32_t value) {
|
||||
uint32_t furi_hal_rtc_get_fault_data() {
|
||||
return furi_hal_rtc_get_register(FuriHalRtcRegisterFaultData);
|
||||
}
|
||||
|
||||
void furi_hal_rtc_set_pin_fails(uint32_t value) {
|
||||
furi_hal_rtc_set_register(FuriHalRtcRegisterPinFails, value);
|
||||
}
|
||||
|
||||
uint32_t furi_hal_rtc_get_pin_fails() {
|
||||
return furi_hal_rtc_get_register(FuriHalRtcRegisterPinFails);
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "furi_hal_version.h"
|
||||
#include "furi_hal_usb_i.h"
|
||||
#include "furi_hal_usb.h"
|
||||
#include <furi_hal_power.h>
|
||||
#include <furi.h>
|
||||
|
||||
#include "usb.h"
|
||||
@@ -189,6 +190,8 @@ static void susp_evt(usbd_device* dev, uint8_t event, uint8_t ep) {
|
||||
if((usb_if_cur != NULL) && (usb_config.connected == true)) {
|
||||
usb_config.connected = false;
|
||||
usb_if_cur->suspend(&udev);
|
||||
|
||||
furi_hal_power_insomnia_exit();
|
||||
}
|
||||
if(callback != NULL) {
|
||||
callback(FuriHalUsbStateEventSuspend, cb_ctx);
|
||||
@@ -199,6 +202,8 @@ static void wkup_evt(usbd_device* dev, uint8_t event, uint8_t ep) {
|
||||
if((usb_if_cur != NULL) && (usb_config.connected == false)) {
|
||||
usb_config.connected = true;
|
||||
usb_if_cur->wakeup(&udev);
|
||||
|
||||
furi_hal_power_insomnia_enter();
|
||||
}
|
||||
if(callback != NULL) {
|
||||
callback(FuriHalUsbStateEventWakeup, cb_ctx);
|
||||
|
@@ -89,17 +89,17 @@ uint16_t furi_hal_power_insomnia_level() {
|
||||
}
|
||||
|
||||
void furi_hal_power_insomnia_enter() {
|
||||
vTaskSuspendAll();
|
||||
FURI_CRITICAL_ENTER();
|
||||
furi_assert(furi_hal_power.insomnia < UINT8_MAX);
|
||||
furi_hal_power.insomnia++;
|
||||
xTaskResumeAll();
|
||||
FURI_CRITICAL_EXIT();
|
||||
}
|
||||
|
||||
void furi_hal_power_insomnia_exit() {
|
||||
vTaskSuspendAll();
|
||||
FURI_CRITICAL_ENTER();
|
||||
furi_assert(furi_hal_power.insomnia > 0);
|
||||
furi_hal_power.insomnia--;
|
||||
xTaskResumeAll();
|
||||
FURI_CRITICAL_EXIT();
|
||||
}
|
||||
|
||||
bool furi_hal_power_sleep_available() {
|
||||
|
@@ -163,3 +163,11 @@ void furi_hal_rtc_set_fault_data(uint32_t value) {
|
||||
uint32_t furi_hal_rtc_get_fault_data() {
|
||||
return furi_hal_rtc_get_register(FuriHalRtcRegisterFaultData);
|
||||
}
|
||||
|
||||
void furi_hal_rtc_set_pin_fails(uint32_t value) {
|
||||
furi_hal_rtc_set_register(FuriHalRtcRegisterPinFails, value);
|
||||
}
|
||||
|
||||
uint32_t furi_hal_rtc_get_pin_fails() {
|
||||
return furi_hal_rtc_get_register(FuriHalRtcRegisterPinFails);
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "furi_hal_version.h"
|
||||
#include "furi_hal_usb_i.h"
|
||||
#include "furi_hal_usb.h"
|
||||
#include <furi_hal_power.h>
|
||||
#include <furi.h>
|
||||
|
||||
#include "usb.h"
|
||||
@@ -189,6 +190,8 @@ static void susp_evt(usbd_device* dev, uint8_t event, uint8_t ep) {
|
||||
if((usb_if_cur != NULL) && (usb_config.connected == true)) {
|
||||
usb_config.connected = false;
|
||||
usb_if_cur->suspend(&udev);
|
||||
|
||||
furi_hal_power_insomnia_exit();
|
||||
}
|
||||
if(callback != NULL) {
|
||||
callback(FuriHalUsbStateEventSuspend, cb_ctx);
|
||||
@@ -199,6 +202,8 @@ static void wkup_evt(usbd_device* dev, uint8_t event, uint8_t ep) {
|
||||
if((usb_if_cur != NULL) && (usb_config.connected == false)) {
|
||||
usb_config.connected = true;
|
||||
usb_if_cur->wakeup(&udev);
|
||||
|
||||
furi_hal_power_insomnia_enter();
|
||||
}
|
||||
if(callback != NULL) {
|
||||
callback(FuriHalUsbStateEventWakeup, cb_ctx);
|
||||
|
@@ -38,6 +38,7 @@ typedef enum {
|
||||
FuriHalRtcRegisterSystemVersion,
|
||||
FuriHalRtcRegisterLfsFingerprint,
|
||||
FuriHalRtcRegisterFaultData,
|
||||
FuriHalRtcRegisterPinFails,
|
||||
} FuriHalRtcRegister;
|
||||
|
||||
/** Initialize RTC subsystem */
|
||||
@@ -67,6 +68,10 @@ void furi_hal_rtc_set_fault_data(uint32_t value);
|
||||
|
||||
uint32_t furi_hal_rtc_get_fault_data();
|
||||
|
||||
void furi_hal_rtc_set_pin_fails(uint32_t value);
|
||||
|
||||
uint32_t furi_hal_rtc_get_pin_fails();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user