-
Building a Single-Switch spinoff version
03/23/2016 at 02:51 • 0 commentsAs mentioned in previous log I have built a spinoff version of the project. Here are the details:
Only 3 components were used to built the unit (besides the footswitch itself as well as the USB cable).
- A Digispark Clone
- A P10 jack
- A small box
The plastic flanges were trimmed and a hole was made for the P10 jack
Then another hole was made on the opposite side of the box for the USB connector. The board was attached to the bottom cover of the box using two threaded screws.
The plastic spacers were trimmed to match the height of the board with the window for the USB connector.
The Jack was then wired to the board. Since the switch is Normally Closed a bridge wire was used to keep the wires short circuited when the plug is not inserted.
The firmware was then uploaded and the pedal was tested using a web application from Microsoft from a page about keyboard ghosting (very interesting by the way).
A short video is shown here
-
Using NC switches
03/23/2016 at 02:07 • 0 commentsWhile developing a spinoff version using an electric keyboard footswitch I found that such footswitch is normaly closed, and opens when you step over it.
No problem. it is simply a matter of changing a compare value.
if ((digitalRead(_Pin_Left_footswitch) == 0)) footkeys |= (1 << _Pin_Left_footswitch); if ((digitalRead(_Pin_Middle_footswitch) == 0)) footkeys |= (1 << _Pin_Middle_footswitch); if ((digitalRead(_Pin_Right_footswitch) == 1)) footkeys |= (1 << _Pin_Right_footswitch); // use a NC contact
-
Running in Digispark
03/23/2016 at 00:41 • 0 commentsThe first tests have been performed using the #SILSpark board which has no pulldowns or pullups in pin 1 (PB1), but when using digispark it is necessary to change the pin connections:
#define _Pin_Left_footswitch 5 #define _Pin_Middle_footswitch 2 #define _Pin_Right_footswitch 0
Then the connections shall be like this:
-
Simultaneous Keystrokes
03/22/2016 at 05:32 • 1 commentSpent some time trying to figure out how to allow simultaneous keypresses using DigiKeyboard Library.
Both the problem and the solution were right in front of me but took some time until I figure out that the report size of only one keystroke was hardcoded in Digikeyboard.h file.
First step was to find the Digikeyboard.h file:
In Windows it is located in the following folder
c:\Users\username\AppData\Roaming\Arduino15\packages\digistump\hardware\avr\1.6.5\libraries\DigisparkKeyboard\
In Linux the file is on a hidden folder
/home/username/.arduino15/packages/digistump/hardware/avr/1.6.7/libraries/DigisparkKeyboard/
const PROGMEM char usbHidReportDescriptor[USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH] = { /* USB report descriptor */ 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 0x09, 0x06, // USAGE (Keyboard) 0xa1, 0x01, // COLLECTION (Application) 0x05, 0x07, // USAGE_PAGE (Keyboard) 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x25, 0x01, // LOGICAL_MAXIMUM (1) 0x75, 0x01, // REPORT_SIZE (1) 0x95, 0x08, // REPORT_COUNT (8) 0x81, 0x02, // INPUT (Data,Var,Abs) 0x95, 0x06, // REPORT_COUNT (6 simultaneous keystrokes) 0x75, 0x08, // REPORT_SIZE (8) 0x25, 0x65, // LOGICAL_MAXIMUM (101) 0x19, 0x00, // (Reserved (no event indicated)) 0x29, 0xE7, // USAGE_MAXIMUM (Right GUI) 0x81, 0x00, // INPUT (Data,Ary,Abs) 0xc0 // END_COLLECTION };
The 2nd parameter in the 12th line was changed to 0x06, to allow up to 6 simultaneous key presses.
0x95, 0x06, // REPORT_COUNT (6 simultaneous keystrokes)
The Buffer size was also updated to allow up to 6 keys (plus a modifier)
//private: TODO: Make friend? // maximum 6 keystrokes, defined in HID report uchar reportBuffer[7]; // buffer for HID reports [ 1 modifier byte + (len-1) key strokes] using Print::write;