From ed8e49755d6641da60d5797c9ee02604d1834b37 Mon Sep 17 00:00:00 2001 From: David Madison Date: Fri, 10 Jul 2026 13:04:21 -0400 Subject: [PATCH 1/5] Teensyduino 1.60 Compatibility --- teensy/avr/boards.txt | 36 ++++++++++++++--------------- teensy/avr/cores/teensy4/WProgram.h | 2 +- teensy/avr/cores/teensy4/usb.c | 32 ++++++++++++++++++++++++- teensy/avr/cores/teensy4/usb_desc.c | 13 +++++++++++ teensy/avr/cores/teensy4/usb_desc.h | 12 +++++----- 5 files changed, 69 insertions(+), 26 deletions(-) diff --git a/teensy/avr/boards.txt b/teensy/avr/boards.txt index 1cec7e5..4e044f0 100644 --- a/teensy/avr/boards.txt +++ b/teensy/avr/boards.txt @@ -41,8 +41,8 @@ teensy41.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdl teensy41.build.flags.dep=-MMD teensy41.build.flags.optimize=-Os teensy41.build.flags.cpu=-mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -teensy41.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=159 -teensy41.build.flags.cpp=-std=gnu++17 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing +teensy41.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=160 +teensy41.build.flags.cpp=-std=gnu++17 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -Wno-psabi teensy41.build.flags.c= teensy41.build.flags.S=-x assembler-with-cpp teensy41.build.flags.libs=-larm_cortexM7lfsp_math -lm -lstdc++ @@ -271,8 +271,8 @@ teensyMM.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdl teensyMM.build.flags.dep=-MMD teensyMM.build.flags.optimize=-Os teensyMM.build.flags.cpu=-mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -teensyMM.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=159 -teensyMM.build.flags.cpp=-std=gnu++17 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing +teensyMM.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=160 +teensyMM.build.flags.cpp=-std=gnu++17 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -Wno-psabi teensyMM.build.flags.c= teensyMM.build.flags.S=-x assembler-with-cpp teensyMM.build.flags.libs=-larm_cortexM7lfsp_math -lm -lstdc++ @@ -501,8 +501,8 @@ teensy40.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdl teensy40.build.flags.dep=-MMD teensy40.build.flags.optimize=-Os teensy40.build.flags.cpu=-mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -teensy40.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=159 -teensy40.build.flags.cpp=-std=gnu++17 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing +teensy40.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=160 +teensy40.build.flags.cpp=-std=gnu++17 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -Wno-psabi teensy40.build.flags.c= teensy40.build.flags.S=-x assembler-with-cpp teensy40.build.flags.libs=-larm_cortexM7lfsp_math -lm -lstdc++ @@ -727,8 +727,8 @@ teensy36.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdl teensy36.build.flags.dep=-MMD teensy36.build.flags.optimize=-Os teensy36.build.flags.cpu=-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -teensy36.build.flags.defs=-D__MK66FX1M0__ -DTEENSYDUINO=159 -teensy36.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++17 -Wno-error=narrowing -fno-rtti +teensy36.build.flags.defs=-D__MK66FX1M0__ -DTEENSYDUINO=160 +teensy36.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++17 -Wno-error=narrowing -fno-rtti -Wno-psabi teensy36.build.flags.c= teensy36.build.flags.S=-x assembler-with-cpp teensy36.build.flags.ld=-Wl,--gc-sections,--relax,--defsym=__rtc_localtime={extra.time.local} "-T{build.core.path}/mk66fx1m0.ld" @@ -967,8 +967,8 @@ teensy35.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdl teensy35.build.flags.dep=-MMD teensy35.build.flags.optimize=-Os teensy35.build.flags.cpu=-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -teensy35.build.flags.defs=-D__MK64FX512__ -DTEENSYDUINO=159 -teensy35.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++17 -Wno-error=narrowing -fno-rtti +teensy35.build.flags.defs=-D__MK64FX512__ -DTEENSYDUINO=160 +teensy35.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++17 -Wno-error=narrowing -fno-rtti -Wno-psabi teensy35.build.flags.c= teensy35.build.flags.S=-x assembler-with-cpp teensy35.build.flags.ld=-Wl,--gc-sections,--relax,--defsym=__rtc_localtime={extra.time.local} "-T{build.core.path}/mk64fx512.ld" @@ -1198,8 +1198,8 @@ teensy31.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdl teensy31.build.flags.dep=-MMD teensy31.build.flags.optimize=-Os teensy31.build.flags.cpu=-mthumb -mcpu=cortex-m4 -fsingle-precision-constant -teensy31.build.flags.defs=-D__MK20DX256__ -DTEENSYDUINO=159 -teensy31.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++17 -Wno-error=narrowing -fno-rtti +teensy31.build.flags.defs=-D__MK20DX256__ -DTEENSYDUINO=160 +teensy31.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++17 -Wno-error=narrowing -fno-rtti -Wno-psabi teensy31.build.flags.c= teensy31.build.flags.S=-x assembler-with-cpp teensy31.build.flags.ld=-Wl,--gc-sections,--relax,--defsym=__rtc_localtime={extra.time.local} "-T{build.core.path}/mk20dx256.ld" @@ -1439,8 +1439,8 @@ teensy30.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdl teensy30.build.flags.dep=-MMD teensy30.build.flags.optimize=-Os teensy30.build.flags.cpu=-mthumb -mcpu=cortex-m4 -fsingle-precision-constant -teensy30.build.flags.defs=-D__MK20DX128__ -DTEENSYDUINO=159 -teensy30.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++17 -Wno-error=narrowing -fno-rtti +teensy30.build.flags.defs=-D__MK20DX128__ -DTEENSYDUINO=160 +teensy30.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++17 -Wno-error=narrowing -fno-rtti -Wno-psabi teensy30.build.flags.c= teensy30.build.flags.S=-x assembler-with-cpp teensy30.build.flags.ld=-Wl,--gc-sections,--relax,--defsym=__rtc_localtime={extra.time.local} "-T{build.core.path}/mk20dx128.ld" @@ -1615,8 +1615,8 @@ teensyLC.build.command.size=arm-none-eabi-size teensyLC.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdlib -mno-unaligned-access teensyLC.build.flags.dep=-MMD teensyLC.build.flags.cpu=-mthumb -mcpu=cortex-m0plus -fsingle-precision-constant -teensyLC.build.flags.defs=-D__MKL26Z64__ -DTEENSYDUINO=159 -teensyLC.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++17 -Wno-error=narrowing -fno-rtti +teensyLC.build.flags.defs=-D__MKL26Z64__ -DTEENSYDUINO=160 +teensyLC.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++17 -Wno-error=narrowing -fno-rtti -Wno-psabi teensyLC.build.flags.c= teensyLC.build.flags.S=-x assembler-with-cpp teensyLC.build.flags.ld=-Wl,--gc-sections,--relax,--defsym=__rtc_localtime={extra.time.local} "-T{build.core.path}/mkl26z64.ld" @@ -1790,7 +1790,7 @@ teensypp2.build.flags.common=-g -Wall -ffunction-sections -fdata-sections teensypp2.build.flags.dep=-MMD teensypp2.build.flags.optimize=-Os teensypp2.build.flags.cpu=-mmcu=at90usb1286 -teensypp2.build.flags.defs=-DTEENSYDUINO=159 -DARDUINO_ARCH_AVR +teensypp2.build.flags.defs=-DTEENSYDUINO=160 -DARDUINO_ARCH_AVR teensypp2.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++11 teensypp2.build.flags.c= teensypp2.build.flags.S=-x assembler-with-cpp @@ -1918,7 +1918,7 @@ teensy2.build.flags.common=-g -Wall -ffunction-sections -fdata-sections teensy2.build.flags.dep=-MMD teensy2.build.flags.optimize=-Os teensy2.build.flags.cpu=-mmcu=atmega32u4 -teensy2.build.flags.defs=-DTEENSYDUINO=159 -DARDUINO_ARCH_AVR +teensy2.build.flags.defs=-DTEENSYDUINO=160 -DARDUINO_ARCH_AVR teensy2.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++11 teensy2.build.flags.c= teensy2.build.flags.S=-x assembler-with-cpp diff --git a/teensy/avr/cores/teensy4/WProgram.h b/teensy/avr/cores/teensy4/WProgram.h index 3dde5c6..847bc06 100644 --- a/teensy/avr/cores/teensy4/WProgram.h +++ b/teensy/avr/cores/teensy4/WProgram.h @@ -58,7 +58,7 @@ #include "usb_midi.h" #include "usb_rawhid.h" #include "usb_flightsim.h" -//#include "usb_mtp.h" +#include "MTP_Teensy.h" #include "usb_audio.h" #include "usb_touch.h" //#include "usb_undef.h" // do not allow usb_desc.h stuff to leak to user programs diff --git a/teensy/avr/cores/teensy4/usb.c b/teensy/avr/cores/teensy4/usb.c index b5cdbe9..fb39061 100644 --- a/teensy/avr/cores/teensy4/usb.c +++ b/teensy/avr/cores/teensy4/usb.c @@ -1,3 +1,33 @@ +/* Teensyduino Core Library + * http://www.pjrc.com/teensy/ + * Copyright (c) 2019 PJRC.COM, LLC. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * 1. The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * 2. If the Software is incorporated into a build system that allows + * selection among a list of target devices, then similar target + * devices manufactured by PJRC.COM must be included in the list of + * target devices and selectable in the same manner. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + #include "usb_dev.h" #define USB_DESC_LIST_DEFINE #include "usb_desc.h" @@ -1097,7 +1127,7 @@ void usb_receive(int endpoint_number, transfer_t *transfer) uint32_t usb_transfer_status(const transfer_t *transfer) { -#if defined(USB_MTPDISK) || defined(USB_MTPDISK_SERIAL) +#if defined(MTP_INTERFACE) uint32_t status, cmd; //int count=0; cmd = USB1_USBCMD; diff --git a/teensy/avr/cores/teensy4/usb_desc.c b/teensy/avr/cores/teensy4/usb_desc.c index de3d500..a496e27 100644 --- a/teensy/avr/cores/teensy4/usb_desc.c +++ b/teensy/avr/cores/teensy4/usb_desc.c @@ -182,9 +182,11 @@ static uint8_t keyboard_report_desc[] = { 0x15, 0x00, // Logical Minimum (0), 0x25, 0x01, // Logical Maximum (1), 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier keys +#if KEYBOARD_SIZE == 8 0x95, 0x01, // Report Count (1), 0x75, 0x08, // Report Size (8), 0x81, 0x03, // Input (Constant), ;Reserved byte +#endif 0x95, 0x05, // Report Count (5), 0x75, 0x01, // Report Size (1), 0x05, 0x08, // Usage Page (LEDs), @@ -194,6 +196,7 @@ static uint8_t keyboard_report_desc[] = { 0x95, 0x01, // Report Count (1), 0x75, 0x03, // Report Size (3), 0x91, 0x03, // Output (Constant), ;LED report padding +#if KEYBOARD_SIZE == 8 0x95, 0x06, // Report Count (6), 0x75, 0x08, // Report Size (8), 0x15, 0x00, // Logical Minimum (0), @@ -202,6 +205,16 @@ static uint8_t keyboard_report_desc[] = { 0x19, 0x00, // Usage Minimum (0), 0x29, 0x7F, // Usage Maximum (104), 0x81, 0x00, // Input (Data, Array), ;Normal keys +#elif KEYBOARD_SIZE == 16 + 0x95, 0x78, // Report Count (120), + 0x75, 0x01, // Report Size (1), + 0x19, 0x00, // Usage Minimum (0), + 0x29, 0xE7, // Usage Maximum (119), + 0x05, 0x07, // Usage Page (Key Codes), + 0x15, 0x00, // Logical Minimum (0), + 0x25, 0x01, // Logical Maximum (1), + 0x81, 0x02, // Input (Data, Variable, Absolute), ;Normal keys NKRO +#endif 0xC0 // End Collection }; #endif diff --git a/teensy/avr/cores/teensy4/usb_desc.h b/teensy/avr/cores/teensy4/usb_desc.h index c7a2744..713a2dc 100644 --- a/teensy/avr/cores/teensy4/usb_desc.h +++ b/teensy/avr/cores/teensy4/usb_desc.h @@ -227,7 +227,7 @@ let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports #define SEREMU_RX_INTERVAL 2 // TODO: is this ok for 480 Mbit speed #define KEYBOARD_INTERFACE 0 // Keyboard #define KEYBOARD_ENDPOINT 3 - #define KEYBOARD_SIZE 8 + #define KEYBOARD_SIZE 8 // 8 = normal boot protocol, 16 = NKRO #define KEYBOARD_INTERVAL 1 // TODO: is this ok for 480 Mbit speed #define KEYMEDIA_INTERFACE 2 // Keyboard Media Keys #define KEYMEDIA_ENDPOINT 4 @@ -257,7 +257,7 @@ let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports #define SEREMU_RX_INTERVAL 2 #define KEYBOARD_INTERFACE 0 // Keyboard #define KEYBOARD_ENDPOINT 3 - #define KEYBOARD_SIZE 8 + #define KEYBOARD_SIZE 8 // 8 = normal boot protocol, 16 = NKRO #define KEYBOARD_INTERVAL 1 #define KEYMEDIA_INTERFACE 4 // Keyboard Media Keys #define KEYMEDIA_ENDPOINT 4 @@ -303,7 +303,7 @@ let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports #define CDC_TX_SIZE_12 64 #define KEYBOARD_INTERFACE 2 // Keyboard #define KEYBOARD_ENDPOINT 4 - #define KEYBOARD_SIZE 8 + #define KEYBOARD_SIZE 8 // 8 = normal boot protocol, 16 = NKRO #define KEYBOARD_INTERVAL 1 #define KEYMEDIA_INTERFACE 5 // Keyboard Media Keys #define KEYMEDIA_ENDPOINT 5 @@ -343,7 +343,7 @@ let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports #define SEREMU_RX_INTERVAL 2 #define KEYBOARD_INTERFACE 0 // Keyboard #define KEYBOARD_ENDPOINT 3 - #define KEYBOARD_SIZE 8 + #define KEYBOARD_SIZE 8 // 8 = normal boot protocol, 16 = NKRO #define KEYBOARD_INTERVAL 1 #define KEYMEDIA_INTERFACE 2 // Keyboard Media Keys #define KEYMEDIA_ENDPOINT 4 @@ -377,7 +377,7 @@ let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports #define SEREMU_RX_INTERVAL 2 #define KEYBOARD_INTERFACE 0 // Keyboard #define KEYBOARD_ENDPOINT 3 - #define KEYBOARD_SIZE 8 + #define KEYBOARD_SIZE 8 // 8 = normal boot protocol, 16 = NKRO #define KEYBOARD_INTERVAL 1 #define KEYMEDIA_INTERFACE 3 // Keyboard Media Keys #define KEYMEDIA_ENDPOINT 4 @@ -885,7 +885,7 @@ let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports #define MIDI_RX_SIZE 64 #define KEYBOARD_INTERFACE 3 // Keyboard #define KEYBOARD_ENDPOINT 4 - #define KEYBOARD_SIZE 8 + #define KEYBOARD_SIZE 8 // 8 = normal boot protocol, 16 = NKRO #define KEYBOARD_INTERVAL 1 #define MOUSE_INTERFACE 4 // Mouse #define MOUSE_ENDPOINT 5 From 6b00d6136d0c4a3f3965607384a2c1ab6b99f401 Mon Sep 17 00:00:00 2001 From: David Madison Date: Fri, 10 Jul 2026 13:11:13 -0400 Subject: [PATCH 2/5] Add serialEvent dummy comment --- teensy/avr/cores/teensy4/usb_serial.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/teensy/avr/cores/teensy4/usb_serial.h b/teensy/avr/cores/teensy4/usb_serial.h index 05d7869..1e395f1 100644 --- a/teensy/avr/cores/teensy4/usb_serial.h +++ b/teensy/avr/cores/teensy4/usb_serial.h @@ -223,7 +223,7 @@ class usb_serial_class : public Stream }; extern usb_serial_class Serial; -extern void serialEvent(void) __attribute__((weak)); +extern void serialEvent(void) __attribute__((weak)); // required for XInput compatibility #endif // __cplusplus #endif // !defined(USB_DISABLED) From 366fe9ceabfbff71ab07d13135859edcf0d67eed Mon Sep 17 00:00:00 2001 From: David Madison Date: Fri, 10 Jul 2026 13:06:49 -0400 Subject: [PATCH 3/5] Update CI software version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3649eb8..e68107d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ on: [push, pull_request, workflow_dispatch] env: IDE_VERSION: 1.8.19 - TEENSY_VERSION: 159 + TEENSY_VERSION: 160 IDE_LOCATION: /usr/local/share/arduino jobs: From bfddbc5f8aa29491ebc9902e2256b36b2aa4650d Mon Sep 17 00:00:00 2001 From: David Madison Date: Fri, 10 Jul 2026 13:07:38 -0400 Subject: [PATCH 4/5] Update Teensyduino version in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 985d7a6..6f5c9f6 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This is meant to be used in conjunction with the [ArduinoXInput library](https:/ You must have both [the Arduino IDE](https://www.arduino.cc/en/main/software) and [Teensyduino](https://www.pjrc.com/teensy/td_download.html) installed before proceeding. -Double-check that your installed Teensyduino version matches the files provided in this repository. This repository is currently using [**Teensyduino 1.59**](https://www.pjrc.com/teensy/td_159). You can download older versions on [the releases page](../../releases). +Double-check that your installed Teensyduino version matches the files provided in this repository. This repository is currently using [**Teensyduino 1.60**](https://www.pjrc.com/teensy/td_160). You can download older versions on [the releases page](../../releases). If you don't know your Teensyduino version, compile a blank sketch with a Teensy board selected and the Teensy Loader will open. In the Teensy Loader window select `Help -> About` and it will tell you the version number. If your version does not match you will have to reinstall or update the Teensyduino software. From 043e86abc009f5bfd4804785c18ab39951b785a0 Mon Sep 17 00:00:00 2001 From: David Madison Date: Fri, 10 Jul 2026 13:26:43 -0400 Subject: [PATCH 5/5] Update CI checkout dependency --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e68107d..be8632d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Install Arduino IDE run: |