Added support for ESP8266

Fixes #262
This commit is contained in:
Kristian Sloth Lauszus 2016-10-24 23:01:19 -05:00
parent 1faec0f6f9
commit f087a57895
4 changed files with 51 additions and 2 deletions

View file

@ -74,4 +74,4 @@ install:
- platformio lib install 62 416 417
script:
- platformio ci --board=uno --board=teensy31 --board=due --lib="."
- platformio ci --board=uno --board=teensy31 --board=due --board=esp12e --board=nodemcu --lib="."

View file

@ -1242,6 +1242,52 @@ MAKE_PIN(P13, 13); //
#undef MAKE_PIN
#elif defined(ESP8266)
#define pgm_read_pointer(p) pgm_read_ptr(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); \
} \
};
// Pinout for ESP-12 module
// 0 .. 16 - Digital pins
MAKE_PIN(P0, 0);
MAKE_PIN(P1, 1); // TX0
MAKE_PIN(P2, 2); // TX1
MAKE_PIN(P3, 3); // RX0
MAKE_PIN(P4, 4); // SDA
MAKE_PIN(P5, 5); // SCL
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); // MISO
MAKE_PIN(P13, 13); // MOSI
MAKE_PIN(P14, 14); // SCK
MAKE_PIN(P15, 15); // SS
MAKE_PIN(P16, 16);
#undef MAKE_PIN
#else
#error "Please define board in avrpins.h"

View file

@ -49,6 +49,7 @@
"teensy",
"atmelsam",
"nordicnrf51",
"ststm32"
"ststm32",
"espressif8266"
]
}

View file

@ -97,6 +97,8 @@ typedef SPi< P13, P11, P12, P10 > spi;
typedef SPi< P76, P75, P74, P10 > spi;
#elif defined(RBL_NRF51822)
typedef SPi< P16, P18, P17, P10 > spi;
#elif defined(ESP8266)
typedef SPi< P14, P13, P12, P15 > spi;
#else
#error "No SPI entry in usbhost.h"
#endif