Added support for Teensy 4.0 and 4.1

Fixes #529, fixes #560
This commit is contained in:
Kristian Sloth Lauszus 2020-11-17 15:20:13 +01:00
parent 23ba34da47
commit 71aeadeab1
4 changed files with 91 additions and 3 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
*.zip *.zip
*.rar *.rar
build/ build/
venv/

View file

@ -90,7 +90,7 @@ script:
- if [[ -z "$SKIP_UNO" ]]; then UNO="--board=uno"; fi - if [[ -z "$SKIP_UNO" ]]; then UNO="--board=uno"; fi
- if [[ -z "$SKIP_TEENSY35" ]]; then TEENSY35="--board=teensy35"; fi - if [[ -z "$SKIP_TEENSY35" ]]; then TEENSY35="--board=teensy35"; fi
- if [[ -z "$SKIP_TEENSY36" ]]; then TEENSY36="--board=teensy36"; fi - if [[ -z "$SKIP_TEENSY36" ]]; then TEENSY36="--board=teensy36"; fi
- platformio ci --lib="." $UNO --board=genuino101 --board=teensy30 --board=teensy31 $TEENSY35 $TEENSY36 --board=teensylc --board=esp12e --board=nodemcu --board=esp32dev - platformio ci --lib="." $UNO --board=genuino101 --board=teensy30 --board=teensy31 $TEENSY35 $TEENSY36 --board=teensylc --board=teensy40 --board=teensy41 --board=esp12e --board=nodemcu --board=esp32dev
- platformio ci --lib="." --board=due --project-option="build_flags=-Wno-misleading-indentation" # Workaround https://travis-ci.org/felis/USB_Host_Shield_2.0/jobs/569237654 and https://github.com/arduino/ArduinoCore-sam/issues/69 - platformio ci --lib="." --board=due --project-option="build_flags=-Wno-misleading-indentation" # Workaround https://travis-ci.org/felis/USB_Host_Shield_2.0/jobs/569237654 and https://github.com/arduino/ArduinoCore-sam/issues/69
before_deploy: before_deploy:

View file

@ -109,7 +109,7 @@ Currently the following boards are supported by the library:
* Arduino Due, Intel Galileo, Intel Galileo 2, and Intel Edison * Arduino Due, Intel Galileo, Intel Galileo 2, and Intel Edison
* Note that the Intel Galileo uses pin 2 and 3 as INT and SS pin respectively by default, so some modifications to the shield are needed. See the "Interface modifications" section in the [hardware manual](https://chome.nerpa.tech/usb-host-shield-hardware-manual) for more information. * Note that the Intel Galileo uses pin 2 and 3 as INT and SS pin respectively by default, so some modifications to the shield are needed. See the "Interface modifications" section in the [hardware manual](https://chome.nerpa.tech/usb-host-shield-hardware-manual) for more information.
* Note native USB host is not supported on any of these platforms. You will have to use the shield for now. * Note native USB host is not supported on any of these platforms. You will have to use the shield for now.
* Teensy (Teensy++ 1.0, Teensy 2.0, Teensy++ 2.0, Teensy 3.x, and Teensy LC) * Teensy (Teensy++ 1.0, Teensy 2.0, Teensy++ 2.0, Teensy 3.x, Teensy LC and Teensy 4.x)
* Note if you are using the Teensy 3.x you should download this SPI library as well: <https://github.com/xxxajk/spi4teensy3>. You should then add ```#include <spi4teensy3.h>``` to your .ino file. * Note if you are using the Teensy 3.x you should download this SPI library as well: <https://github.com/xxxajk/spi4teensy3>. You should then add ```#include <spi4teensy3.h>``` to your .ino file.
* Balanduino * Balanduino
* Sanguino * Sanguino

View file

@ -814,6 +814,7 @@ public:
#define pgm_read_pointer(p) pgm_read_dword(p) #define pgm_read_pointer(p) pgm_read_dword(p)
#if defined(CORE_TEENSY) && (defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)) #if defined(CORE_TEENSY) && (defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__))
// Teensy 3.x
#include "core_pins.h" #include "core_pins.h"
#include "avr_emulation.h" #include "avr_emulation.h"
@ -913,6 +914,7 @@ MAKE_PIN(P63, CORE_PIN63_PORTREG, CORE_PIN63_BIT, CORE_PIN63_CONFIG);
#undef MAKE_PIN #undef MAKE_PIN
#elif defined(CORE_TEENSY) && (defined(__MKL26Z64__)) #elif defined(CORE_TEENSY) && (defined(__MKL26Z64__))
// Teensy-LC
// we could get lower level by making these macros work properly. // we could get lower level by making these macros work properly.
// for now just use the semi optimised version, it costs a lookup in the pin pgm table per op // for now just use the semi optimised version, it costs a lookup in the pin pgm table per op
@ -976,6 +978,91 @@ MAKE_PIN(P26, CORE_PIN26_PORTREG, 26, CORE_PIN26_CONFIG);
#undef MAKE_PIN #undef MAKE_PIN
#elif defined(__IMXRT1062__) && (defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41))
// Teensy 4.x
#include "core_pins.h"
#define MAKE_PIN(className, pin) \
class className { \
public: \
static void Set() { \
digitalWriteFast(pin, HIGH);\
} \
static void Clear() { \
digitalWriteFast(pin, LOW); \
} \
static void SetDirRead() { \
pinMode(pin, INPUT); \
} \
static void SetDirWrite() { \
pinMode(pin, OUTPUT); \
} \
static uint8_t IsSet() { \
return digitalReadFast(pin); \
} \
};
MAKE_PIN(P0, 0);
MAKE_PIN(P1, 1);
MAKE_PIN(P2, 2);
MAKE_PIN(P3, 3);
MAKE_PIN(P4, 4);
MAKE_PIN(P5, 5);
MAKE_PIN(P6, 6);
MAKE_PIN(P7, 7);
MAKE_PIN(P8, 8);
MAKE_PIN(P9, 9);
MAKE_PIN(P10, 10);
MAKE_PIN(P11, 11);
MAKE_PIN(P12, 12);
MAKE_PIN(P13, 13);
MAKE_PIN(P14, 14);
MAKE_PIN(P15, 15);
MAKE_PIN(P16, 16);
MAKE_PIN(P17, 17);
MAKE_PIN(P18, 18);
MAKE_PIN(P19, 19);
MAKE_PIN(P20, 20);
MAKE_PIN(P21, 21);
MAKE_PIN(P22, 22);
MAKE_PIN(P23, 23);
MAKE_PIN(P24, 24);
MAKE_PIN(P25, 25);
MAKE_PIN(P26, 26);
MAKE_PIN(P27, 27);
MAKE_PIN(P28, 28);
MAKE_PIN(P29, 29);
MAKE_PIN(P30, 30);
MAKE_PIN(P31, 31);
MAKE_PIN(P32, 35);
MAKE_PIN(P33, 33);
MAKE_PIN(P34, 34);
MAKE_PIN(P35, 35);
MAKE_PIN(P36, 36);
MAKE_PIN(P37, 37);
MAKE_PIN(P38, 38);
MAKE_PIN(P39, 39);
#ifdef ARDUINO_TEENSY41
MAKE_PIN(P40, 40);
MAKE_PIN(P41, 41);
MAKE_PIN(P42, 42);
MAKE_PIN(P43, 43);
MAKE_PIN(P44, 44);
MAKE_PIN(P45, 45);
MAKE_PIN(P46, 46);
MAKE_PIN(P47, 47);
MAKE_PIN(P48, 48);
MAKE_PIN(P49, 49);
MAKE_PIN(P50, 50);
MAKE_PIN(P51, 51);
MAKE_PIN(P52, 52);
MAKE_PIN(P53, 53);
MAKE_PIN(P54, 54);
#endif
#undef MAKE_PIN
#elif defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__) #elif defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)
// SetDirRead: // SetDirRead: