Initial support for Arduino Zero

This commit is contained in:
Kristian Sloth Lauszus 2016-01-19 15:52:17 +01:00
parent 0fce0106ed
commit 47375fa8a7
4 changed files with 63 additions and 4 deletions

View file

@ -106,7 +106,7 @@ By default serial debugging is disabled. To turn it on simply change ```ENABLE_U
Currently the following boards are supported by the library: Currently the following boards are supported by the library:
* All official Arduino AVR boards (Uno, Duemilanove, Mega, Mega 2560, Mega ADK, Leonardo etc.) * All official Arduino AVR boards (Uno, Duemilanove, Mega, Mega 2560, Mega ADK, Leonardo etc.)
* Arduino Due, Intel Galileo, Intel Galileo 2, and Intel Edison * Arduino Due, Arduino Zero, 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://www.circuitsathome.com/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://www.circuitsathome.com/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, and Teensy LC)

View file

@ -899,7 +899,7 @@ MAKE_PIN(P26, CORE_PIN26_PORTREG, 26, CORE_PIN26_CONFIG);
#undef MAKE_PIN #undef MAKE_PIN
#elif defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__) #elif defined(ARDUINO_SAM_DUE)
// SetDirRead: // SetDirRead:
// Disable interrupts // Disable interrupts
@ -1023,6 +1023,63 @@ MAKE_PIN(P78, PIOB, PIO_PB23); // Unconnected
#undef MAKE_PIN #undef MAKE_PIN
#elif defined(ARDUINO_SAMD_ZERO)
// For now, to keep stuff simple.
#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); \
} \
};
// 0 .. 13 - Digital pins
MAKE_PIN(P0, 0); // RX
MAKE_PIN(P1, 1); // TX
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); // LED
// 14..19 - Analog pins
MAKE_PIN(P14, 14); // A0
MAKE_PIN(P15, 15); // A1
MAKE_PIN(P16, 16); // A2
MAKE_PIN(P17, 17); // A3
MAKE_PIN(P18, 18); // A4
MAKE_PIN(P19, 19); // A5
// 20..21 I2C pins (SDA/SCL and also EDBG:SDA/SCL)
MAKE_PIN(P20, 20); // SDA
MAKE_PIN(P21, 21); // SCL
// 22, 23, 24 - SPI pins (ICSP:MISO,SCK,MOSI)
MAKE_PIN(P22, 22); // MISO
MAKE_PIN(P23, 23); // MOSI
MAKE_PIN(P24, 24); // SCK
#undef MAKE_PIN
#elif defined(RBL_NRF51822) #elif defined(RBL_NRF51822)
#define MAKE_PIN(className, pin) \ #define MAKE_PIN(className, pin) \

View file

@ -135,7 +135,7 @@ e-mail : support@circuitsathome.com
#define USING_SPI4TEENSY3 0 #define USING_SPI4TEENSY3 0
#endif #endif
#if ((defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)) || defined(RBL_NRF51822) || defined(__ARDUINO_X86__) || ARDUINO >= 10600) && !USING_SPI4TEENSY3 #if (defined(ARDUINO_SAM_DUE) || defined(ARDUINO_SAMD_ZERO) || defined(RBL_NRF51822) || defined(__ARDUINO_X86__) || ARDUINO >= 10600) && !USING_SPI4TEENSY3
#include <SPI.h> // Use the Arduino SPI library for the Arduino Due, RedBearLab nRF51822, Intel Galileo 1 & 2, Intel Edison or if the SPI library with transaction is available #include <SPI.h> // Use the Arduino SPI library for the Arduino Due, RedBearLab nRF51822, Intel Galileo 1 & 2, Intel Edison or if the SPI library with transaction is available
#endif #endif
#if defined(__PIC32MX__) || defined(__PIC32MZ__) #if defined(__PIC32MX__) || defined(__PIC32MZ__)

View file

@ -93,8 +93,10 @@ typedef SPi< Pb5, Pb3, Pb4, Pb2 > spi;
typedef SPi< Pb7, Pb5, Pb6, Pb4 > spi; typedef SPi< Pb7, Pb5, Pb6, Pb4 > spi;
#elif (defined(CORE_TEENSY) && (defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__))) || defined(__ARDUINO_X86__) || defined(__MIPSEL__) || defined(STM32F4) #elif (defined(CORE_TEENSY) && (defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__))) || defined(__ARDUINO_X86__) || defined(__MIPSEL__) || defined(STM32F4)
typedef SPi< P13, P11, P12, P10 > spi; typedef SPi< P13, P11, P12, P10 > spi;
#elif defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__) #elif defined(ARDUINO_SAM_DUE)
typedef SPi< P76, P75, P74, P10 > spi; typedef SPi< P76, P75, P74, P10 > spi;
#elif defined(ARDUINO_SAMD_ZERO)
typedef SPi< P24, P23, P22, P10 > spi;
#elif defined(RBL_NRF51822) #elif defined(RBL_NRF51822)
typedef SPi< P16, P18, P17, P10 > spi; typedef SPi< P16, P18, P17, P10 > spi;
#else #else