diff options
Diffstat (limited to 'firmware/targets/f6/furi_hal')
-rw-r--r-- | firmware/targets/f6/furi_hal/furi_hal_power.c | 8 | ||||
-rw-r--r-- | firmware/targets/f6/furi_hal/furi_hal_rtc.c | 8 | ||||
-rw-r--r-- | firmware/targets/f6/furi_hal/furi_hal_usb.c | 5 |
3 files changed, 17 insertions, 4 deletions
diff --git a/firmware/targets/f6/furi_hal/furi_hal_power.c b/firmware/targets/f6/furi_hal/furi_hal_power.c index a211b8c5..e34ba46e 100644 --- a/firmware/targets/f6/furi_hal/furi_hal_power.c +++ b/firmware/targets/f6/furi_hal/furi_hal_power.c @@ -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() { diff --git a/firmware/targets/f6/furi_hal/furi_hal_rtc.c b/firmware/targets/f6/furi_hal/furi_hal_rtc.c index 4d45c748..1f262692 100644 --- a/firmware/targets/f6/furi_hal/furi_hal_rtc.c +++ b/firmware/targets/f6/furi_hal/furi_hal_rtc.c @@ -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); +} diff --git a/firmware/targets/f6/furi_hal/furi_hal_usb.c b/firmware/targets/f6/furi_hal/furi_hal_usb.c index 881081b6..7ca8ffdf 100644 --- a/firmware/targets/f6/furi_hal/furi_hal_usb.c +++ b/firmware/targets/f6/furi_hal/furi_hal_usb.c @@ -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); |