WFI with interrupt-driven wakeup for USB and W6300
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "timer_queue.h"
|
||||
#include "net.h"
|
||||
#include "debug_log.h"
|
||||
#include "hardware/sync.h"
|
||||
|
||||
static timer_queue timers;
|
||||
|
||||
@@ -39,6 +40,8 @@ void dispatch_schedule_ms(uint32_t ms, std::function<void()> fn) {
|
||||
});
|
||||
|
||||
while (true) {
|
||||
uint32_t save = save_and_disable_interrupts();
|
||||
|
||||
dlog_if_slow("tud_task", 1000, [&]{ tud_task(); });
|
||||
dlog_if_slow("drain", 1000, [&]{ usb.drain(); });
|
||||
dlog_if_slow("timers", 1000, [&]{ timers.run(); });
|
||||
@@ -76,6 +79,7 @@ void dispatch_schedule_ms(uint32_t ms, std::function<void()> fn) {
|
||||
}
|
||||
}
|
||||
|
||||
// __wfi();
|
||||
__wfi();
|
||||
restore_interrupts(save);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user