Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed FastIO FastPWM USBDevice
Diff: USBJoystick/USBJoystick.cpp
- Revision:
- 47:df7a88cd249c
- Parent:
- 40:cc0d9814522b
- Child:
- 48:058ace2aed1d
diff -r c42166b2878c -r df7a88cd249c USBJoystick/USBJoystick.cpp --- a/USBJoystick/USBJoystick.cpp Mon Feb 15 20:30:32 2016 +0000 +++ b/USBJoystick/USBJoystick.cpp Thu Feb 18 07:32:20 2016 +0000 @@ -88,7 +88,7 @@ return writeTO(EP4IN, report.data, report.length, MAX_PACKET_SIZE_EPINT, 100); } -bool USBJoystick::updateExposure(int &idx, int npix, const uint16_t *pix) +bool USBJoystick::updateExposure(int &idx, int npix, const uint8_t *pix) { HID_REPORT report; @@ -108,13 +108,10 @@ ofs += 2; } - // now fill out the remaining words with exposure values + // now fill out the remaining bytes with exposure values report.length = reportLen; - for ( ; ofs + 1 < report.length ; ofs += 2) - { - uint16_t p = (idx < npix ? pix[idx++] : 0); - put(ofs, p); - } + for ( ; ofs < report.length ; ++ofs) + report.data[ofs] = (idx < npix ? pix[idx++] : 0); // send the report return sendTO(&report, 100);