Pinscape Controller version 1 fork. This is a fork to allow for ongoing bug fixes to the original controller version, from before the major changes for the expansion board project.
Dependencies: FastIO FastPWM SimpleDMA mbed
Fork of Pinscape_Controller by
Revision 37:ed52738445fc, committed 2015-12-24
- Comitter:
- mjr
- Date:
- Thu Dec 24 01:37:40 2015 +0000
- Parent:
- 36:b9747461331e
- Child:
- 38:091e511ce8a0
- Commit message:
- Bug fixes to USB HAL
Changed in this revision
--- a/USBDevice.lib Sat Dec 19 06:50:23 2015 +0000 +++ b/USBDevice.lib Thu Dec 24 01:37:40 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mjr/code/USBDevice/#b0a3f6b27b07 +http://mbed.org/users/mjr/code/USBDevice/#884405d998bb
--- a/USBJoystick/USBJoystick.cpp Sat Dec 19 06:50:23 2015 +0000 +++ b/USBJoystick/USBJoystick.cpp Thu Dec 24 01:37:40 2015 +0000 @@ -588,12 +588,12 @@ // Handle messages on endpoint 4 - this is the keyboard interface. // The host uses this to send updates for the keyboard indicator LEDs // (caps lock, num lock, etc). We don't do anything with these, but -// we at least need to read them to keep the pipe from clogging up. +// we have to read them to keep the pipe open. bool USBJoystick::EP4_OUT_callback() { // read this message uint32_t bytesRead = 0; - uint8_t led[65]; + uint8_t led[MAX_HID_REPORT_SIZE]; USBDevice::readEP(EP4OUT, led, &bytesRead, MAX_HID_REPORT_SIZE); // start the next read
--- a/main.cpp Sat Dec 19 06:50:23 2015 +0000 +++ b/main.cpp Thu Dec 24 01:37:40 2015 +0000 @@ -886,7 +886,7 @@ // start a new sticky period for debouncing this // state change - bs->t = 0.005; + bs->t = 0.075; } } @@ -2819,6 +2819,20 @@ // update the buttons bool buttonsChanged = readButtons(cfg); + + // send a keyboard report if we have new data to report + if (kbState.changed) + { + js.kbUpdate(kbState.data); + kbState.changed = false; + } + + // send the media control report, if applicable + if (mediaState.changed) + { + js.mediaUpdate(mediaState.data); + mediaState.changed = false; + } // If it's been long enough since our last USB status report, // send the new report. We throttle the report rate because @@ -2826,8 +2840,7 @@ // VP only wants to sync with the real world in 10ms intervals, // so reporting more frequently creates I/O overhead without // doing anything to improve the simulation. - if (cfg.joystickEnabled - && (reportTimer.read_ms() > 15 || buttonsChanged)) + if (cfg.joystickEnabled && reportTimer.read_ms() > 10) { // read the accelerometer int xa, ya; @@ -2856,26 +2869,6 @@ // send the joystick report js.update(x, y, zrep, jsButtons | simButtons, statusFlags); - // send the keyboard report(s), if applicable - bool waitBeforeMedia = false; - if (kbState.changed) - { - js.kbUpdate(kbState.data); - kbState.changed = false; - waitBeforeMedia = true; - } - if (mediaState.changed) - { - // just sent a key report - give the channel a moment to clear before - // sending another report on its heels, to avoid clogging the pipe - if (waitBeforeMedia) - wait_us(1); - - // send the media key report - js.mediaUpdate(mediaState.data); - mediaState.changed = false; - } - // we've just started a new report interval, so reset the timer reportTimer.reset(); }