Sleep with __wfi() between USB interrupts instead of busy-polling
This commit is contained in:
@@ -57,10 +57,9 @@ int main() {
|
|||||||
while (true) {
|
while (true) {
|
||||||
tud_task();
|
tud_task();
|
||||||
|
|
||||||
if (!tud_cdc_available()) continue;
|
while (tud_cdc_available()) {
|
||||||
|
|
||||||
uint8_t byte;
|
uint8_t byte;
|
||||||
if (tud_cdc_read(&byte, 1) != 1) continue;
|
if (tud_cdc_read(&byte, 1) != 1) break;
|
||||||
|
|
||||||
rx_buf.push_back(byte);
|
rx_buf.push_back(byte);
|
||||||
|
|
||||||
@@ -90,4 +89,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__wfi();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user