Skip to content

Commit ab80b40

Browse files
committed
add back SPI_CLOCK_DIVx defines may needed by some library
Note: better use SPI.setFrequency()
1 parent 3f5aab4 commit ab80b40

File tree

1 file changed

+19
-0
lines changed
  • hardware/esp8266com/esp8266/libraries/SPI

1 file changed

+19
-0
lines changed

hardware/esp8266com/esp8266/libraries/SPI/SPI.h

+19
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@
2424
#include <Arduino.h>
2525
#include <stdlib.h>
2626

27+
// This defines are not representing the real Divider of the ESP8266
28+
// the Defines match to an AVR Arduino on 16MHz for better compatibility
29+
#if F_CPU == 80000000L
30+
#define SPI_CLOCK_DIV2 0x00101001 //8 MHz
31+
#define SPI_CLOCK_DIV4 0x00241001 //4 MHz
32+
#define SPI_CLOCK_DIV8 0x004c1001 //2 MHz
33+
#define SPI_CLOCK_DIV16 0x009c1001 //1 MHz
34+
#define SPI_CLOCK_DIV32 0x013c1001 //500 KHz
35+
#define SPI_CLOCK_DIV64 0x027c1001 //250 KHz
36+
#define SPI_CLOCK_DIV128 0x04fc1001 //125 KHz
37+
#else
38+
#define SPI_CLOCK_DIV2 0x00241001 //8 MHz
39+
#define SPI_CLOCK_DIV4 0x004c1001 //4 MHz
40+
#define SPI_CLOCK_DIV8 0x009c1001 //2 MHz
41+
#define SPI_CLOCK_DIV16 0x013c1001 //1 MHz
42+
#define SPI_CLOCK_DIV32 0x027c1001 //500 KHz
43+
#define SPI_CLOCK_DIV64 0x04fc1001 //250 KHz
44+
#endif
45+
2746
const uint8_t SPI_MODE0 = 0x00; ///< CPOL: 0 CPHA: 0
2847
const uint8_t SPI_MODE1 = 0x01; ///< CPOL: 0 CPHA: 1
2948
const uint8_t SPI_MODE2 = 0x10; ///< CPOL: 1 CPHA: 0

0 commit comments

Comments
 (0)