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: FastIO FastPWM SimpleDMA mbed
Fork of Pinscape_Controller by
Diff: USBJoystick/USBJoystick.cpp
- Revision:
- 25:e22b88bd783a
- Parent:
- 21:5048e16cc9ef
- Child:
- 29:582472d0bc57
--- a/USBJoystick/USBJoystick.cpp Wed Jun 03 18:52:22 2015 +0000
+++ b/USBJoystick/USBJoystick.cpp Tue Sep 01 04:27:15 2015 +0000
@@ -71,10 +71,20 @@
// low 11 bits are the current pixel index.
uint16_t s = idx | 0x8000;
put(0, s);
+
+ // start at the second byte
+ int ofs = 2;
+
+ // in the first report, add the total pixel count as the next two bytes
+ if (idx == 0)
+ {
+ put(ofs, npix);
+ ofs += 2;
+ }
// now fill out the remaining words with exposure values
report.length = reportLen;
- for (int ofs = 2 ; ofs + 1 < report.length ; ofs += 2)
+ for ( ; ofs + 1 < report.length ; ofs += 2)
{
uint16_t p = (idx < npix ? pix[idx++] : 0);
put(ofs, p);
