From aa83fca438a42d4cb80bf2a563909ae2c1f8a96d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 28 Nov 2017 12:10:36 +0200 Subject: [PATCH 1/2] Update link to PIO Core (#877) --- docs/platformio.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platformio.md b/docs/platformio.md index afa5c931..660afa33 100644 --- a/docs/platformio.md +++ b/docs/platformio.md @@ -5,7 +5,7 @@ Installation instructions for using PlatformIO - [What is PlatformIO?](http://docs.platformio.org/page/what-is-platformio.html) - [PlatformIO IDE](http://platformio.org/platformio-ide) -- Quick Start with [PlatformIO IDE](http://docs.platformio.org/page/ide/atom.html#quick-start) or [PlatformIO Core](http://docs.platformio.org/page/core.html) +- [PlatformIO Core (CLI)](http://docs.platformio.org/page/core.html) - [Integration with Cloud and Standalone IDEs](http://docs.platformio.org/page/ide.html) - Cloud9, Codeanywehre, Eclipse Che (Codenvy), Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM and Visual Studio - [Project Examples](https://github.com/platformio/platform-espressif32/tree/develop/examples) From 3198f25c19105ff933da4fdb33f132304bb3afaf Mon Sep 17 00:00:00 2001 From: zipiju Date: Tue, 28 Nov 2017 11:12:39 +0100 Subject: [PATCH 2/2] Set HSPI ports by default when HSPI is selected (#874) When user selected HSPI with SPIClass name(HSPI) ESP was, by default, still using VSPI ports (the ones defined in pins_arduino.h). With this change when user selects HSPI then HSPI default ports will be used. If user won't specify HSPI then VSPI default ports will be used. If user will specify SCLK, MOSI, MISO and SS with SPI.begin() then user defined ports will be used no matter if VSPI or HSPI is selected. With this change fe. SD library can use default HSPI ports. It was possible to pass HSPI SPI instance to SD lib, however even then it was using VSPI ports which were (probably) GPIO matrixed to HSPI. --- libraries/SPI/src/SPI.cpp | 15 +++++++++++---- libraries/SPI/src/SPI.h | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/libraries/SPI/src/SPI.cpp b/libraries/SPI/src/SPI.cpp index 629b50bc..00698746 100644 --- a/libraries/SPI/src/SPI.cpp +++ b/libraries/SPI/src/SPI.cpp @@ -49,10 +49,17 @@ void SPIClass::begin(int8_t sck, int8_t miso, int8_t mosi, int8_t ss) return; } - _sck = sck; - _miso = miso; - _mosi = mosi; - _ss = ss; + if(sck == -1 && miso == -1 && mosi == -1 && ss == -1) { + _sck = (_spi_num == VSPI) ? SCK : 14; + _miso = (_spi_num == VSPI) ? MISO : 12; + _mosi = (_spi_num == VSPI) ? MOSI : 13; + _ss = (_spi_num == VSPI) ? SS : 15; + } else { + _sck = sck; + _miso = miso; + _mosi = mosi; + _ss = ss; + } spiAttachSCK(_spi, _sck); spiAttachMISO(_spi, _miso); diff --git a/libraries/SPI/src/SPI.h b/libraries/SPI/src/SPI.h index e232e162..0d1a83a8 100644 --- a/libraries/SPI/src/SPI.h +++ b/libraries/SPI/src/SPI.h @@ -52,7 +52,7 @@ private: public: SPIClass(uint8_t spi_bus=HSPI); - void begin(int8_t sck=SCK, int8_t miso=MISO, int8_t mosi=MOSI, int8_t ss=-1); + void begin(int8_t sck=-1, int8_t miso=-1, int8_t mosi=-1, int8_t ss=-1); void end(); void setHwCs(bool use);