Open tcurdt opened 5 years ago
changing the file
~/.platformio/packages/framework-arduinoavr/libraries/__cores__/digispark/DigisparkKeyboard/DigiKeyboard.h
explicitly casting to char
is a hack/workaround for at least error 3)
Many thanks for your tip. I was able to compile and deploy the coded after I modified the code as follows.
const PROGMEM char usbHidReportDescriptor[USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH] = { /* USB report descriptor */
(char) 0x05, (char) 0x01, // USAGE_PAGE (Generic Desktop)
(char) 0x09, (char) 0x06, // USAGE (Keyboard)
(char) 0xa1, (char) 0x01, // COLLECTION (Application)
(char) 0x05, (char) 0x07, // USAGE_PAGE (Keyboard)
(char) 0x19, (char) 0xe0, // USAGE_MINIMUM (Keyboard LeftControl)
(char) 0x29, (char) 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI)
(char) 0x15, (char) 0x00, // LOGICAL_MINIMUM (0)
(char) 0x25, (char) 0x01, // LOGICAL_MAXIMUM (1)
(char) 0x75, (char) 0x01, // REPORT_SIZE (1)
(char) 0x95, (char) 0x08, // REPORT_COUNT (8)
(char) 0x81, (char) 0x02, // INPUT (Data,Var,Abs)
(char) 0x95, (char) 0x01, // REPORT_COUNT (simultaneous keystrokes)
(char) 0x75, (char) 0x08, // REPORT_SIZE (8)
(char) 0x25, (char) 0x65, // LOGICAL_MAXIMUM (101)
(char) 0x19, (char) 0x00, // USAGE_MINIMUM (Reserved (no event indicated))
(char) 0x29, (char) 0x65, // USAGE_MAXIMUM (Keyboard Application)
(char) 0x81, (char) 0x00, // INPUT (Data,Ary,Abs)
(char) 0xc0 // END_COLLECTION
};
I have an error : "too many initializers for 'const char [22]'" on the same part of the lib, can you help me ?
I have create a pull request: https://github.com/digistump/DigistumpArduino/pull/93
I change to unsigned char
also work, I am not good at C? will (char) 0x80
overflow?
// .platformio\packages\framework-arduinoavr\libraries\__cores__\digispark\DigisparkKeyboard\DigiKeyboard.h
const PROGMEM unsigned char usbHidReportDescriptor[USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH]
// .platformio\packages\framework-arduinoavr\libraries\__cores__\digispark\DigisparkKeyboard\usbdrv.h
unsigned char usbDescriptorHidReport[];
I guess it's NOT a Digistump thing, because that code compiles fine on Arduino IDE.
That made me look at root cause, it's because atmelavr
sets other flags for compilation.
Specifically, builder/frameworks/arduino.py
should read:
CXXFLAGS=[
"-Wno-error=narrowing",
just fyi, as of 2020-01-06, still had to apply the proposed fix by @bryanjhv manually to work with DigiSpark USB.
As of 2020-08-14, having the same issue 😂
alternative fix besides @bryanjhv 's, add this line to platformio.ini
build_flags = -Wno-error=narrowing
Thnx @zaypen that did the trick for me!
src/keyboard.cpp:
Which looks like 3 issues:
BIN
with different valuesdelay.h
which should beutil/delay.h