From 679bf054c3847ab7f4f6c59d39531a626968bf63 Mon Sep 17 00:00:00 2001 From: schneider <schneider@blinkenlichts.net> Date: Sun, 15 Aug 2021 20:26:55 +0200 Subject: [PATCH] feat(epicardium): Add a simple sleep() API call This can be used by the second core to signal that the system can go to a light sleep to recuce power consumption. --- epicardium/drivers/sleep.c | 5 +++++ epicardium/epicardium.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/epicardium/drivers/sleep.c b/epicardium/drivers/sleep.c index 236689b14..70ded1925 100644 --- a/epicardium/drivers/sleep.c +++ b/epicardium/drivers/sleep.c @@ -207,3 +207,8 @@ void sleep_deepsleep(void) SystemCoreClockUpdate(); MAX77650_setEN_SBB2(0b110); } + +void epic_sleep(uint32_t ms) +{ + vTaskDelay(ms); +} diff --git a/epicardium/epicardium.h b/epicardium/epicardium.h index 6957b43bd..a4615364e 100644 --- a/epicardium/epicardium.h +++ b/epicardium/epicardium.h @@ -33,6 +33,7 @@ typedef _Bool bool; #define API_SYSTEM_EXEC 0x2 #define API_SYSTEM_RESET 0x3 #define API_BATTERY_VOLTAGE 0x4 +#define API_SLEEP 0x5 #define API_INTERRUPT_ENABLE 0xA #define API_INTERRUPT_DISABLE 0xB @@ -335,6 +336,8 @@ API(API_SYSTEM_EXEC, int __epic_exec(char *name)); */ API(API_SYSTEM_RESET, void epic_system_reset(void)); +API(API_SLEEP, void epic_sleep(uint32_t ms)); + /** * PMIC API * =============== -- GitLab