From b0071c5070f6b4c932e703f2539c2eef74f09338 Mon Sep 17 00:00:00 2001 From: sodo Date: Tue, 2 Jan 2024 14:48:27 +0900 Subject: [PATCH] avr: sleep fix --- embassy-executor/src/arch/avr.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/embassy-executor/src/arch/avr.rs b/embassy-executor/src/arch/avr.rs index fa6afe762..11e81ed9a 100644 --- a/embassy-executor/src/arch/avr.rs +++ b/embassy-executor/src/arch/avr.rs @@ -57,10 +57,13 @@ mod thread { loop { unsafe { + avr_device::interrupt::disable(); if SIGNAL_WORK_THREAD_MODE.swap(false, Ordering::SeqCst) { - self.inner.poll(); - } else { + avr_device::interrupt::enable(); avr_device::asm::sleep(); + } else { + avr_device::interrupt::enable(); + self.inner.poll(); } } }