From 49fc1980fe636b399c3baee4f37bedd4e9399c26 Mon Sep 17 00:00:00 2001 From: Markus Sattler Date: Thu, 7 May 2015 22:16:51 +0200 Subject: [PATCH] add back SPI_CLOCK_DIVx defines may needed by some library Note: better use SPI.setFrequency() --- libraries/SPI/SPI.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libraries/SPI/SPI.h b/libraries/SPI/SPI.h index e8e9b2c92..a39f3d042 100644 --- a/libraries/SPI/SPI.h +++ b/libraries/SPI/SPI.h @@ -24,6 +24,25 @@ #include #include +// This defines are not representing the real Divider of the ESP8266 +// the Defines match to an AVR Arduino on 16MHz for better compatibility +#if F_CPU == 80000000L +#define SPI_CLOCK_DIV2 0x00101001 //8 MHz +#define SPI_CLOCK_DIV4 0x00241001 //4 MHz +#define SPI_CLOCK_DIV8 0x004c1001 //2 MHz +#define SPI_CLOCK_DIV16 0x009c1001 //1 MHz +#define SPI_CLOCK_DIV32 0x013c1001 //500 KHz +#define SPI_CLOCK_DIV64 0x027c1001 //250 KHz +#define SPI_CLOCK_DIV128 0x04fc1001 //125 KHz +#else +#define SPI_CLOCK_DIV2 0x00241001 //8 MHz +#define SPI_CLOCK_DIV4 0x004c1001 //4 MHz +#define SPI_CLOCK_DIV8 0x009c1001 //2 MHz +#define SPI_CLOCK_DIV16 0x013c1001 //1 MHz +#define SPI_CLOCK_DIV32 0x027c1001 //500 KHz +#define SPI_CLOCK_DIV64 0x04fc1001 //250 KHz +#endif + const uint8_t SPI_MODE0 = 0x00; ///< CPOL: 0 CPHA: 0 const uint8_t SPI_MODE1 = 0x01; ///< CPOL: 0 CPHA: 1 const uint8_t SPI_MODE2 = 0x10; ///< CPOL: 1 CPHA: 0