0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 06:39:49 +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) while (1)
{ {
// Mask interrupts #if 0
__asm volatile ("cpsid i"); // Mask interrupts
if (!g_next_time_slice) __asm volatile ("cpsid i");
// Idle condition, hint the MCU to sleep if (!g_next_time_slice)
// CMSIS suggests GCC reorders memory and is undesirable // Idle condition, hint the MCU to sleep
__asm volatile ("wfi":::"memory"); // CMSIS suggests GCC reorders memory and is undesirable
// Unmask interrupts __asm volatile ("wfi":::"memory");
__asm volatile ("cpsie i"); // Unmask interrupts
__asm volatile ("cpsie i");
#endif
APP_process(); APP_process();