Mike R / Mbed 2 deprecated Pinscape_Controller_V2

Dependencies:   mbed FastIO FastPWM USBDevice

Fork of Pinscape_Controller by Mike R

Files at this revision

API Documentation at this revision

Comitter:
mjr
Date:
Wed Jan 04 20:14:12 2017 +0000
Parent:
71:5c0f6b60bf4f
Child:
73:4e8ce0b18915
Commit message:
Include shifted buttons when deciding whether or not to create a USB keyboard interface during initialization

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Jan 04 00:17:49 2017 +0000
+++ b/main.cpp	Wed Jan 04 20:14:12 2017 +0000
@@ -1674,14 +1674,15 @@
 Timer buttonTimer;
 
 // Count a button during the initial setup scan
-void countButton(uint8_t typ, bool &kbKeys)
+void countButton(uint8_t typ, uint8_t shiftTyp, bool &kbKeys)
 {
     // count it
     ++nButtons;
     
     // if it's a keyboard key or media key, note that we need a USB 
     // keyboard interface
-    if (typ == BtnTypeKey || typ == BtnTypeMedia)
+    if (typ == BtnTypeKey || typ == BtnTypeMedia
+        || shiftTyp == BtnTypeKey || shiftTyp == BtnTypeMedia)
         kbKeys = true;
 }
 
@@ -1702,7 +1703,7 @@
     {
         // it's valid if it's wired to a real input pin
         if (wirePinName(cfg.button[i].pin) != NC)
-            countButton(cfg.button[i].typ, kbKeys);
+            countButton(cfg.button[i].typ, cfg.button[i].typ2, kbKeys);
     }
     
     // Count virtual buttons
@@ -1714,7 +1715,7 @@
         zblButtonIndex = nButtons;
         
         // count it
-        countButton(cfg.plunger.zbLaunchBall.keytype, kbKeys);
+        countButton(cfg.plunger.zbLaunchBall.keytype, BtnTypeNone, kbKeys);
     }
 
     // Allocate the live button slots