diff --git a/README.md b/README.md index 826b39fcb..3f4a6e83b 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ This project brings support for ESP8266 chip to the Arduino environment. ESP8266 ### Downloads ### -| OS | Build status | Latest release | -| --- | ------------ | -------------- | -| Linux | [![Linux build status](http://img.shields.io/travis/igrr/Arduino.svg)](https://travis-ci.org/igrr/Arduino) | [arduino-1.6.1-linux64.tar.xz](../../releases/download/1.6.1-esp8266-1/arduino-1.6.1-linux64.tar.xz) | -| Windows | [![Windows build status](http://img.shields.io/appveyor/ci/igrr/Arduino.svg)](https://ci.appveyor.com/project/igrr/Arduino) | [arduino-1.6.1-p1-windows.zip](https://github.com/igrr/Arduino/releases/download/1.6.1-esp8266-1/arduino-1.6.1-p1-windows.zip) | -| OS X | | [arduino-1.6.1-macosx-java-latest-signed.zip](../../releases/download/1.6.1-esp8266-1/arduino-1.6.1-macosx-java-latest-signed.zip) | +| OS | Build status | Latest release | Alpha Version | +| --- | ------------ | -------------- | --------------- | +| Linux | [![Linux build status](http://img.shields.io/travis/igrr/Arduino.svg)](https://travis-ci.org/igrr/Arduino) | [arduino-1.6.1-linux64.tar.xz](../../releases/download/1.6.1-esp8266-1/arduino-1.6.1-linux64.tar.xz) | | +| Windows | [![Windows build status](http://img.shields.io/appveyor/ci/igrr/Arduino.svg)](https://ci.appveyor.com/project/igrr/Arduino) | [arduino-1.6.1-p1-windows.zip](https://github.com/igrr/Arduino/releases/download/1.6.1-esp8266-1/arduino-1.6.1-p1-windows.zip) | [appveyor Build](https://ci.appveyor.com/project/igrr/Arduino/build/artifacts) | +| OS X | | [arduino-1.6.1-macosx-java-latest-signed.zip](../../releases/download/1.6.1-esp8266-1/arduino-1.6.1-macosx-java-latest-signed.zip) | | ### Building from source ### @@ -44,6 +44,10 @@ Pin interrupts are supported through ```attachInterrupt```, ```detachInterrupt`` Interrupts may be attached to any GPIO pin, except GPIO16. Standard Arduino interrupt types are supported: ```CHANGE```, ```RISING```, ```FALLING```. +#### Pin Functions #### + +![Pin Functions](https://raw.githubusercontent.com/Links2004/Arduino/esp8266/docs/pin_functions.png) + #### Timing and delays #### ```millis``` and ```micros``` return the number of milliseconds and microseconds elapsed after reset, respectively. diff --git a/docs/ESP01_connect.jpg b/docs/ESP01_connect.jpg new file mode 100644 index 000000000..6b0c24088 Binary files /dev/null and b/docs/ESP01_connect.jpg differ diff --git a/docs/pin_functions.png b/docs/pin_functions.png new file mode 100644 index 000000000..ac7fc0f9c Binary files /dev/null and b/docs/pin_functions.png differ diff --git a/hardware/esp8266com/esp8266/cores/esp8266/Esp.h b/hardware/esp8266com/esp8266/cores/esp8266/Esp.h index 78b468163..b3d836c79 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/Esp.h +++ b/hardware/esp8266com/esp8266/cores/esp8266/Esp.h @@ -42,6 +42,9 @@ typedef enum { #define wdt_disable() ESP.wdtDisable() #define wdt_reset() ESP.wdtFeed() +#define cli() ets_intr_lock() // IRQ Disable +#define sei() ets_intr_unlock() // IRQ Enable + enum WakeMode { WAKE_RF_DEFAULT = 0, // RF_CAL or not after deep-sleep wake up, depends on init data byte 108. WAKE_RFCAL = 1, // RF_CAL after deep-sleep wake up, there will be large current. diff --git a/hardware/esp8266com/esp8266/libraries/SPI/SPI.cpp b/hardware/esp8266com/esp8266/libraries/SPI/SPI.cpp index fefd5ce2b..347259f4d 100644 --- a/hardware/esp8266com/esp8266/libraries/SPI/SPI.cpp +++ b/hardware/esp8266com/esp8266/libraries/SPI/SPI.cpp @@ -57,7 +57,7 @@ void SPIClass::setDataMode(uint8_t dataMode) { } void SPIClass::setBitOrder(uint8_t bitOrder) { - if (bitOrder == MSBFIRST){ + if (bitOrder == MSBFIRST) { SPI1C &= ~(SPICWBO | SPICRBO); } else { SPI1C |= (SPICWBO | SPICRBO); @@ -76,3 +76,25 @@ uint8_t SPIClass::transfer(uint8_t data) { return (uint8_t)(SPI1W0 & 0xff); } +uint16_t SPIClass::transfer16(uint16_t data) { + union { + uint16_t val; + struct { + uint8_t lsb; + uint8_t msb; + }; + } in, out; + in.val = data; + + if((SPI1C & (SPICWBO | SPICRBO))) { + //MSBFIRST + out.msb = transfer(in.msb); + out.lsb = transfer(in.lsb); + } else { + //LSBFIRST + out.lsb = transfer(in.lsb); + out.msb = transfer(in.msb); + } + return out.val; +} + diff --git a/hardware/esp8266com/esp8266/libraries/SPI/SPI.h b/hardware/esp8266com/esp8266/libraries/SPI/SPI.h index d62d96df3..5ff10d3a3 100644 --- a/hardware/esp8266com/esp8266/libraries/SPI/SPI.h +++ b/hardware/esp8266com/esp8266/libraries/SPI/SPI.h @@ -80,6 +80,7 @@ public: void setClockDivider(uint32_t clockDiv); void beginTransaction(SPISettings settings); uint8_t transfer(uint8_t data); + uint16_t transfer16(uint16_t data); void endTransaction(void); }; diff --git a/libraries/OneWire/OneWire.cpp b/libraries/OneWire/OneWire.cpp index 631813f8e..593053794 100644 --- a/libraries/OneWire/OneWire.cpp +++ b/libraries/OneWire/OneWire.cpp @@ -119,7 +119,7 @@ sample code bearing this copyright. OneWire::OneWire(uint8_t pin) { - pinMode(pin, INPUT); + pinMode(pin, INPUT_PULLUP); bitmask = PIN_TO_BITMASK(pin); baseReg = PIN_TO_BASEREG(pin); #if ONEWIRE_SEARCH