This commit is contained in:
Joe Bowbeer 2017-02-03 22:44:51 -08:00
parent f89593e4ce
commit 4158a501a9
2 changed files with 56 additions and 0 deletions

View file

@ -1167,6 +1167,58 @@ MAKE_PIN(P19, GPIOC, GPIO_PIN_0); // A5
#endif #endif
#elif defined(__ARDUINO_ARC__)
#include <avr/pgmspace.h>
// Pointers are 32 bits on arc
#define pgm_read_pointer(p) pgm_read_dword(p)
#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); \
} \
};
MAKE_PIN(P0, 0);
MAKE_PIN(P1, 1);
MAKE_PIN(P2, 2);
MAKE_PIN(P3, 3); //PWM
MAKE_PIN(P4, 4);
MAKE_PIN(P5, 5); //PWM
MAKE_PIN(P6, 6); //PWM
MAKE_PIN(P7, 7);
MAKE_PIN(P8, 8);
MAKE_PIN(P9, 9); //PWM
MAKE_PIN(P10, 10); //SPI SS
MAKE_PIN(P11, 11); //SPI MOSI
MAKE_PIN(P12, 12); //SPI MISO
MAKE_PIN(P13, 13); //SPI SCK / BUILTIN LED
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 SDA
MAKE_PIN(P19, 19); // A5 SCL
MAKE_PIN(P20, 20); // ATN
#undef MAKE_PIN
#elif defined(__ARDUINO_X86__) // Intel Galileo, Intel Galileo 2 and Intel Edison #elif defined(__ARDUINO_X86__) // Intel Galileo, Intel Galileo 2 and Intel Edison
#include <avr/pgmspace.h> #include <avr/pgmspace.h>

View file

@ -63,6 +63,8 @@ public:
#else #else
SPI.setClockDivider(SPI_CLOCK_DIV2); // This will set the SPI frequency to 8MHz - it could be higher, but it is not supported in the old API SPI.setClockDivider(SPI_CLOCK_DIV2); // This will set the SPI frequency to 8MHz - it could be higher, but it is not supported in the old API
#endif #endif
#elif defined(__ARDUINO_ARC__)
SPI.setClockDivider(SPI_CLOCK_DIV2);
#elif !defined(RBL_NRF51822) #elif !defined(RBL_NRF51822)
SPI.setClockDivider(4); // Set speed to 84MHz/4=21MHz - the MAX3421E can handle up to 26MHz SPI.setClockDivider(4); // Set speed to 84MHz/4=21MHz - the MAX3421E can handle up to 26MHz
#endif #endif
@ -97,6 +99,8 @@ typedef SPi< P13, P11, P12, P10 > spi;
typedef SPi< P76, P75, P74, P10 > spi; typedef SPi< P76, P75, P74, P10 > spi;
#elif defined(RBL_NRF51822) #elif defined(RBL_NRF51822)
typedef SPi< P16, P18, P17, P10 > spi; typedef SPi< P16, P18, P17, P10 > spi;
#elif defined(__ARDUINO_ARC__)
typedef SPi< P13, P11, P12, P10 > spi;
#else #else
#error "No SPI entry in usbhost.h" #error "No SPI entry in usbhost.h"
#endif #endif