mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Merge pull request #564 from felis/teensy4x
Added support for Teensy 4.0 and 4.1
This commit is contained in:
commit
718596a7f7
6 changed files with 161 additions and 120 deletions
65
.github/workflows/main.yml
vendored
Normal file
65
.github/workflows/main.yml
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
name: CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
# find examples -type f -name "*.ino" | rev | cut -d/ -f2- | rev | sort | sed -z 's/\n/, /g'
|
||||
example: [examples/acm/acm_terminal, examples/adk/adk_barcode, examples/adk/ArduinoBlinkLED, examples/adk/demokit_20, examples/adk/term_test, examples/adk/term_time, examples/Bluetooth/BTHID, examples/Bluetooth/PS3BT, examples/Bluetooth/PS3Multi, examples/Bluetooth/PS3SPP, examples/Bluetooth/PS4BT, examples/Bluetooth/SPP, examples/Bluetooth/SPPMulti, examples/Bluetooth/Wii, examples/Bluetooth/WiiBalanceBoard, examples/Bluetooth/WiiIRCamera, examples/Bluetooth/WiiMulti, examples/Bluetooth/WiiUProController, examples/board_qc, examples/cdc_XR21B1411/XR_terminal, examples/ftdi/USBFTDILoopback, examples/GPIO/Blink, examples/GPIO/Blink_LowLevel, examples/GPIO/Input, examples/HID/le3dp, examples/HID/scale, examples/HID/SRWS1, examples/HID/t16km, examples/HID/USBHIDBootKbd, examples/HID/USBHIDBootKbdAndMouse, examples/HID/USBHIDBootMouse, examples/HID/USBHID_desc, examples/HID/USBHIDJoystick, examples/HID/USBHIDMultimediaKbd, examples/hub_demo, examples/max_LCD, examples/pl2303/pl2303_gprs_terminal, examples/pl2303/pl2303_gps, examples/pl2303/pl2303_tinygps, examples/pl2303/pl2303_xbee_terminal, examples/PS3USB, examples/PS4USB, examples/PSBuzz, examples/USB_desc, examples/USBH_MIDI/bidirectional_converter, examples/USBH_MIDI/eVY1_sample, examples/USBH_MIDI/USBH_MIDI_dump, examples/USBH_MIDI/USB_MIDI_converter, examples/USBH_MIDI/USB_MIDI_converter_multi, examples/Xbox/XBOXOLD, examples/Xbox/XBOXONE, examples/Xbox/XBOXONESBT, examples/Xbox/XBOXRECV, examples/Xbox/XBOXUSB]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v2
|
||||
- name: Install PlatformIO
|
||||
run: |
|
||||
pip install -U pip setuptools wheel
|
||||
pip install platformio
|
||||
- name: Install MIDI library
|
||||
if: contains(matrix.example, 'MIDI')
|
||||
# https://platformio.org/lib/show/62/MIDI%20Library
|
||||
run: pio lib -g install 62
|
||||
- name: Install TinyGPS library
|
||||
if: contains(matrix.example, 'tinygps')
|
||||
# https://platformio.org/lib/show/416/TinyGPS
|
||||
run: pio lib -g install 416
|
||||
- name: Run PlatformIO
|
||||
run: |
|
||||
# Skip all Wii examples and the PS3SPP example on Uno, as they will not fit with debugging enabled
|
||||
if [[ "${{ matrix.example }}" != *"Wii"* && "${{ matrix.example }}" != *"PS3SPP" ]]; then UNO="--board=uno"; fi
|
||||
|
||||
# There is a conflict with the internal Teensy MIDI library, so skip this example on Teensy 3.x and 4.x
|
||||
# See: https://travis-ci.org/github/felis/USB_Host_Shield_2.0/jobs/743787235
|
||||
if [[ "${{ matrix.example }}" != *"bidirectional_converter" ]]; then TEENSY35="--board=teensy35"; TEENSY36="--board=teensy36"; TEENSY40="--board=teensy40"; TEENSY41="--board=teensy41"; fi
|
||||
|
||||
pio ci --lib="." $UNO --board=genuino101 --board=teensylc $TEENSY40 $TEENSY41 --board=esp12e --board=nodemcu --board=esp32dev
|
||||
|
||||
# Teensy 3.x depends on the SPI4Teensy3 library: https://platformio.org/lib/show/417/SPI4Teensy3
|
||||
pio ci --lib="." --board=teensy30 --board=teensy31 $TEENSY35 $TEENSY36 --project-option="lib_deps=SPI4Teensy3"
|
||||
|
||||
# Workaround https://github.com/arduino/ArduinoCore-sam/issues/69
|
||||
pio ci --lib="." --board=due --project-option="build_flags=-Wno-misleading-indentation"
|
||||
env:
|
||||
PLATFORMIO_CI_SRC: ${{ matrix.example }}
|
||||
PLATFORMIO_BUILD_FLAGS: -DWIICAMERA -DDEBUG_USB_HOST -Wall -Werror
|
||||
deploy:
|
||||
needs: [build]
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/master'
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
# We need GraphViz to draw figures and graphs
|
||||
# Doxygen is used for generating the documentation
|
||||
run: apt-get -y install doxygen graphviz
|
||||
- name: Generate documentation
|
||||
run: |
|
||||
# Fix error in the Doxygen Markdown parser and generate the documentation
|
||||
sed -i 's/@YuuichiAkagawa/\\@YuuichiAkagawa/' README.md
|
||||
doxygen doc/Doxyfile
|
||||
touch doc/html/.nojekyll
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./doc/html
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
|||
*.bak
|
||||
*.zip
|
||||
*.rar
|
||||
build/
|
||||
build/
|
||||
venv/
|
||||
|
|
110
.travis.yml
110
.travis.yml
|
@ -1,110 +0,0 @@
|
|||
language: python
|
||||
python:
|
||||
- "3.9"
|
||||
|
||||
# Cache PlatformIO packages using Travis CI container-based infrastructure
|
||||
sudo: false
|
||||
cache:
|
||||
directories:
|
||||
- "~/.platformio"
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
# We need GraphViz to draw figures and graphs
|
||||
- graphviz
|
||||
# Doxygen is used for generating the documentation
|
||||
- doxygen
|
||||
|
||||
# Generated using: find examples -type f -name "*.ino" | rev | cut -d/ -f2- | rev | sed 's/^/ - PLATFORMIO_CI_SRC=/' > tmp.yml
|
||||
env:
|
||||
- PLATFORMIO_CI_SRC=examples/acm/acm_terminal
|
||||
- PLATFORMIO_CI_SRC=examples/adk/adk_barcode
|
||||
- PLATFORMIO_CI_SRC=examples/adk/ArduinoBlinkLED
|
||||
- PLATFORMIO_CI_SRC=examples/adk/demokit_20
|
||||
- PLATFORMIO_CI_SRC=examples/adk/term_test
|
||||
- PLATFORMIO_CI_SRC=examples/adk/term_time
|
||||
- PLATFORMIO_CI_SRC=examples/Bluetooth/BTHID
|
||||
- PLATFORMIO_CI_SRC=examples/Bluetooth/PS3BT
|
||||
- PLATFORMIO_CI_SRC=examples/Bluetooth/PS3Multi
|
||||
- PLATFORMIO_CI_SRC=examples/Bluetooth/PS3SPP SKIP_UNO=true
|
||||
- PLATFORMIO_CI_SRC=examples/Bluetooth/PS4BT
|
||||
- PLATFORMIO_CI_SRC=examples/Bluetooth/SPP
|
||||
- PLATFORMIO_CI_SRC=examples/Bluetooth/SPPMulti
|
||||
- PLATFORMIO_CI_SRC=examples/Bluetooth/Wii SKIP_UNO=true
|
||||
- PLATFORMIO_CI_SRC=examples/Bluetooth/WiiBalanceBoard SKIP_UNO=true
|
||||
- PLATFORMIO_CI_SRC=examples/Bluetooth/WiiIRCamera PLATFORMIO_BUILD_FLAGS="-DWIICAMERA" SKIP_UNO=true
|
||||
- PLATFORMIO_CI_SRC=examples/Bluetooth/WiiMulti SKIP_UNO=true
|
||||
- PLATFORMIO_CI_SRC=examples/Bluetooth/WiiUProController SKIP_UNO=true
|
||||
- PLATFORMIO_CI_SRC=examples/board_qc
|
||||
- PLATFORMIO_CI_SRC=examples/cdc_XR21B1411/XR_terminal
|
||||
- PLATFORMIO_CI_SRC=examples/ftdi/USBFTDILoopback
|
||||
- PLATFORMIO_CI_SRC=examples/GPIO/Blink
|
||||
- PLATFORMIO_CI_SRC=examples/GPIO/Blink_LowLevel
|
||||
- PLATFORMIO_CI_SRC=examples/GPIO/Input
|
||||
- PLATFORMIO_CI_SRC=examples/HID/le3dp
|
||||
- PLATFORMIO_CI_SRC=examples/HID/scale
|
||||
- PLATFORMIO_CI_SRC=examples/HID/SRWS1
|
||||
- PLATFORMIO_CI_SRC=examples/HID/USBHID_desc
|
||||
- PLATFORMIO_CI_SRC=examples/HID/USBHIDBootKbd
|
||||
- PLATFORMIO_CI_SRC=examples/HID/USBHIDBootKbdAndMouse
|
||||
- PLATFORMIO_CI_SRC=examples/HID/USBHIDBootMouse
|
||||
- PLATFORMIO_CI_SRC=examples/HID/USBHIDJoystick
|
||||
- PLATFORMIO_CI_SRC=examples/HID/USBHIDMultimediaKbd
|
||||
- PLATFORMIO_CI_SRC=examples/hub_demo
|
||||
- PLATFORMIO_CI_SRC=examples/max_LCD
|
||||
- PLATFORMIO_CI_SRC=examples/pl2303/pl2303_gprs_terminal
|
||||
- PLATFORMIO_CI_SRC=examples/pl2303/pl2303_gps
|
||||
- PLATFORMIO_CI_SRC=examples/pl2303/pl2303_tinygps
|
||||
- PLATFORMIO_CI_SRC=examples/pl2303/pl2303_xbee_terminal
|
||||
- PLATFORMIO_CI_SRC=examples/PS3USB
|
||||
- PLATFORMIO_CI_SRC=examples/PS4USB
|
||||
- PLATFORMIO_CI_SRC=examples/PSBuzz
|
||||
# - PLATFORMIO_CI_SRC=examples/testusbhostFAT
|
||||
- PLATFORMIO_CI_SRC=examples/USB_desc
|
||||
# See: https://travis-ci.org/github/felis/USB_Host_Shield_2.0/jobs/743787235
|
||||
- PLATFORMIO_CI_SRC=examples/USBH_MIDI/bidirectional_converter SKIP_TEENSY35=true SKIP_TEENSY36=true
|
||||
- PLATFORMIO_CI_SRC=examples/USBH_MIDI/eVY1_sample
|
||||
- PLATFORMIO_CI_SRC=examples/USBH_MIDI/USB_MIDI_converter
|
||||
- PLATFORMIO_CI_SRC=examples/USBH_MIDI/USB_MIDI_converter_multi
|
||||
- PLATFORMIO_CI_SRC=examples/USBH_MIDI/USBH_MIDI_dump
|
||||
- PLATFORMIO_CI_SRC=examples/Xbox/XBOXOLD
|
||||
- PLATFORMIO_CI_SRC=examples/Xbox/XBOXONE
|
||||
- PLATFORMIO_CI_SRC=examples/Xbox/XBOXONESBT
|
||||
- PLATFORMIO_CI_SRC=examples/Xbox/XBOXRECV
|
||||
- PLATFORMIO_CI_SRC=examples/Xbox/XBOXUSB
|
||||
|
||||
install:
|
||||
- pip install -U platformio
|
||||
- export PLATFORMIO_BUILD_FLAGS="$PLATFORMIO_BUILD_FLAGS -DDEBUG_USB_HOST -Wall -Werror"
|
||||
|
||||
#
|
||||
# Libraries from PlatformIO Library Registry:
|
||||
#
|
||||
# http://platformio.org/lib/show/62/MIDI
|
||||
# http://platformio.org/lib/show/416/TinyGPS
|
||||
# http://platformio.org/lib/show/417/SPI4Teensy3
|
||||
- platformio lib install 62 416 417
|
||||
|
||||
script:
|
||||
- if [[ -z "$SKIP_UNO" ]]; then UNO="--board=uno"; fi
|
||||
- if [[ -z "$SKIP_TEENSY35" ]]; then TEENSY35="--board=teensy35"; 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="." --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:
|
||||
# Fix errors in the Doxygen Markdown parser and generate the docs
|
||||
- sed -i 's/Circuits@/Circuits\\@/' README.md
|
||||
- sed -i 's/@YuuichiAkagawa/\\@YuuichiAkagawa/' README.md
|
||||
- doxygen doc/Doxyfile
|
||||
- touch doc/html/.nojekyll
|
||||
|
||||
deploy:
|
||||
provider: pages
|
||||
github-token: $GITHUB_TOKEN
|
||||
local_dir: doc/html
|
||||
skip_cleanup: true
|
||||
keep-history: true
|
||||
on:
|
||||
branch: master
|
|
@ -1,8 +1,8 @@
|
|||
# USB Host Library Rev.2.0
|
||||
# USB Host Library Rev. 2.0
|
||||
|
||||
The code is released under the GNU General Public License.
|
||||
__________
|
||||
[![Build Status](https://travis-ci.org/felis/USB_Host_Shield_2.0.svg?branch=master)](https://travis-ci.org/felis/USB_Host_Shield_2.0)
|
||||
[![](https://github.com/felis/USB_Host_Shield_2.0/workflows/CI/badge.svg)](https://github.com/felis/USB_Host_Shield_2.0/actions?query=branch%3Amaster)
|
||||
|
||||
# Summary
|
||||
This is Revision 2.0 of MAX3421E-based USB Host Shield Library for AVR's.
|
||||
|
@ -109,7 +109,7 @@ Currently the following boards are supported by the library:
|
|||
* 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 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.
|
||||
* Balanduino
|
||||
* Sanguino
|
||||
|
|
87
avrpins.h
87
avrpins.h
|
@ -814,6 +814,7 @@ public:
|
|||
#define pgm_read_pointer(p) pgm_read_dword(p)
|
||||
|
||||
#if defined(CORE_TEENSY) && (defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__))
|
||||
// Teensy 3.x
|
||||
|
||||
#include "core_pins.h"
|
||||
#include "avr_emulation.h"
|
||||
|
@ -913,6 +914,7 @@ MAKE_PIN(P63, CORE_PIN63_PORTREG, CORE_PIN63_BIT, CORE_PIN63_CONFIG);
|
|||
#undef MAKE_PIN
|
||||
|
||||
#elif defined(CORE_TEENSY) && (defined(__MKL26Z64__))
|
||||
// Teensy-LC
|
||||
|
||||
// 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
|
||||
|
@ -976,6 +978,91 @@ MAKE_PIN(P26, CORE_PIN26_PORTREG, 26, CORE_PIN26_CONFIG);
|
|||
|
||||
#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__)
|
||||
|
||||
// SetDirRead:
|
||||
|
|
10
settings.h
10
settings.h
|
@ -80,17 +80,15 @@ e-mail : support@circuitsathome.com
|
|||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Set to 1 to use the faster spi4teensy3 driver.
|
||||
// Set to 1 to use the faster spi4teensy3 driver on Teensy 3.x
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef USE_SPI4TEENSY3
|
||||
#if defined(CORE_TEENSY) && (defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__))
|
||||
#define USE_SPI4TEENSY3 1
|
||||
#endif
|
||||
|
||||
// Disabled on the Teensy LC, as it is incompatible for now
|
||||
#if defined(__MKL26Z64__)
|
||||
#undef USE_SPI4TEENSY3
|
||||
#else
|
||||
#define USE_SPI4TEENSY3 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AUTOMATIC Settings
|
||||
|
|
Loading…
Reference in a new issue