Add files via upload

Changes per https://github.com/felis/USB_Host_Shield_2.0/pull/654. 

Builds successfully for Sparkfun Redboar Artemis ATP
This commit is contained in:
Topo-png 2021-08-09 19:08:46 -04:00 committed by GitHub
parent ed536a0e3b
commit e5f8f68821
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 57 deletions

View file

@ -52,8 +52,6 @@ typedef MAX3421e<P15, P5> MAX3421E; // ESP8266 boards
typedef MAX3421e<P5, P17> MAX3421E; // ESP32 boards
#elif (defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__))
typedef MAX3421e<Pb4, Pb3> MAX3421E; // Sanguino
#elif defined(AM_PART_APOLLO3)
typedef MAX3421e<P10, P9> MAX3421E; // Sparkfun Redboard Artemis All the pins
#else
typedef MAX3421e<P10, P9> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo, Due etc.), Intel Edison, Intel Galileo 2 or Teensy 2.0 and 3.x
#endif

115
avrpins.h
View file

@ -1358,56 +1358,73 @@ MAKE_PIN(P33, (9));
#elif defined(AM_PART_APOLLO3)
// Sparkfun Artemis Redboard & ATP variant
#include "Arduino.h" \
#define MAKE_PIN(className, pin) \
class className { \
public: \
static void Set() { \
digitalWrite(pin, HIGH);\
} \
static void Clear() { \
digitalWrite(pin, LOW); \
} \
static void SetDirRead() { \
pinMode(pin, INPUT); \
} \
static void SetDirWrite() { \
pinMode(pin, OUTPUT); \
} \
static uint8_t IsSet() { \
return digitalRead(pin); \
} \
};
#define P0 0
#define P1 1
#define P2 2
#define P3 3
#define P4 4
#define P5 5
#define P6 6
#define P7 7
#define P8 8
#define P9 9
#define P10 10
#define P11 11
#define P12 12
#define P13 13
#define P14 14
#define P15 15
#define P16 16
#define P17 17
#define P18 18
#define P19 19
#define P20 20
#define P21 21
#define P22 22
#define P23 23
#define P24 24
#define P25 25
#define P26 26
#define P27 27
#define P28 28
#define P29 29
#define P30 30
#define P31 31
#define P32 32
#define P33 33
#define P34 34
#define P35 35
#define P36 36
#define P37 37
#if defined(AM_PACKAGE_BGA)
#define P38 38
#define P39 39
#define P40 40
#define P41 41
#define P42 42
#define P43 43
#define P44 44
#define P45 45
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 AM_PACKAGE_BGA // All The Pins (ATP) variant
MAKE_PIN(P40, 40);
MAKE_PIN(P41, 41);
MAKE_PIN(P42, 42);
MAKE_PIN(P43, 43);
MAKE_PIN(P44, 44);
MAKE_PIN(P45, 45);
#endif
#else

View file

@ -175,10 +175,6 @@ e-mail : support@circuitsathome.com
extern SPI_HandleTypeDef SPI_Handle; // Needed to be declared in your main.cpp
#endif
#ifdef AM_PART_APOLLO3
#include <SPI.h>
#endif
// Fix defines on Arduino Due
#ifdef ARDUINO_SAM_DUE
#ifdef tokSETUP

View file

@ -57,6 +57,11 @@ public:
static void init() {
// Should be initialized by the user manually for now
}
#elif defined(AM_PART_APOLLO3)
static void init() {
SPI::begin();
}
#elif !defined(SPDR)
static void init() {
SPI_SS::SetDirWrite();
@ -123,7 +128,7 @@ typedef SPi< P18, P23, P19, P5 > spi;
#elif defined(ARDUINO_NRF52840_FEATHER)
typedef SPi< P26, P25, P24, P5 > spi;
#elif defined(AM_PART_APOLLO3)
typedef SPi< P5, P7, P6, P13> spi;
typedef SPi< P13, P11, P12, P10 > spi;
#else
#error "No SPI entry in usbhost.h"
#endif
@ -430,8 +435,9 @@ int8_t MAX3421e< SPI_SS, INTR >::Init() {
// Also avoids the vbus flicker issue confusing some devices.
/* pin and peripheral setup */
SPI_SS::SetDirWrite();
SPI_SS::Set();
spi::init();
spi::init();
INTR::SetDirRead();
XMEM_RELEASE_SPI();
/* MAX3421E - full-duplex SPI, level interrupt */