Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8952379

Browse files
committed
USBMSD: greatly reduce CPU occupation
1 parent 6c36b42 commit 8952379

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

‎libraries/USBMSD/PluggableUSBMSD.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ class USBMSD: public internal::PluggableUSBModule {
268268

269269
// Interrupt to thread deferral
270270
events::PolledQueue _queue;
271+
rtos::EventFlags _data_available;
271272
events::Task<void()> _in_task;
272273
events::Task<void()> _out_task;
273274
mbed::Callback<void()> _reset_task;

‎libraries/USBMSD/USBMSD.cpp‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ void USBMSD::process()
185185
{
186186
while (1) {
187187
if (_initialized) {
188+
_data_available.wait_any(0xFF, 10);
188189
_queue.dispatch();
189190
//yield();
190191
}
@@ -249,11 +250,13 @@ int USBMSD::disk_status()
249250

250251
void USBMSD::_isr_out()
251252
{
253+
_data_available.set(1);
252254
_out_task.call();
253255
}
254256

255257
void USBMSD::_isr_in()
256258
{
259+
_data_available.set(1);
257260
_in_task.call();
258261
}
259262

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /