Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ports/atmel-samd/supervisor/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
#include "samd/events.h"
#include "samd/external_interrupts.h"
#include "samd/dma.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/rtc/__init__.h"
#include "reset.h"

Expand Down Expand Up @@ -496,7 +497,12 @@ void port_sleep_until_interrupt(void) {
(void) __get_FPSCR();
}
#endif
__WFI();
common_hal_mcu_disable_interrupts();
if (!tud_task_event_ready()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tannewt Are there more cases here when we wouldn't want to go into WFI? Other pending tasks? This relates to trying to redo the background task stuff to add flags to indicate pending work.

But I think this is a good change for now to get things working better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I can think of immediately. We should rethink it with the background work.

__DSB();
__WFI();
}
common_hal_mcu_enable_interrupts();
}

/**
Expand Down