0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-20 15:08:37 +03:00

feature: enable wfi

This commit is contained in:
bricky149
2023-10-28 19:10:35 +01:00
parent 4153389778
commit 5ba5a887a5
3 changed files with 28 additions and 1 deletions

9
main.c
View File

@ -236,8 +236,17 @@ void Main(void)
#endif
}
// Everything is initialised, set SLEEP* bits
SYSCON_REGISTER |= SYSCON_REGISTER_SLEEPONEXIT_BITS_ENABLE;
SYSCON_REGISTER |= SYSCON_REGISTER_SLEEPDEEP_BITS_ENABLE;
while (1)
{
if (!g_next_time_slice && !g_next_time_slice_500ms)
// Idle condition, hint the MCU to sleep
// CMSIS suggests GCC reorders memory and is undesired
__asm volatile ("wfi":::"memory");
APP_process();
if (g_next_time_slice)