0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 22:31:25 +03:00

sleep option

This commit is contained in:
OneOfEleven 2023-10-28 20:03:09 +01:00
parent 059436fdf1
commit daa3d298cd
3 changed files with 10 additions and 8 deletions

Binary file not shown.

Binary file not shown.

18
main.c
View File

@ -242,14 +242,16 @@ void Main(void)
while (1)
{
// Mask interrupts
__asm volatile ("cpsid i");
if (!g_next_time_slice)
// Idle condition, hint the MCU to sleep
// CMSIS suggests GCC reorders memory and is undesirable
__asm volatile ("wfi":::"memory");
// Unmask interrupts
__asm volatile ("cpsie i");
#if 0
// Mask interrupts
__asm volatile ("cpsid i");
if (!g_next_time_slice)
// Idle condition, hint the MCU to sleep
// CMSIS suggests GCC reorders memory and is undesirable
__asm volatile ("wfi":::"memory");
// Unmask interrupts
__asm volatile ("cpsie i");
#endif
APP_process();