1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

CS is now software controlled. Otherwise ESP has problems with receiving data over SPI

This commit is contained in:
Sermus
2015-04-02 09:50:01 +03:00
parent 4626a9df80
commit fd4215aa22
4 changed files with 17 additions and 14 deletions

View File

@ -26,7 +26,11 @@
void TFT::TFTinit (void)
{
pinMode(2, OUTPUT);
pinMode(4, OUTPUT);
pinMode(15, OUTPUT);
SPI.begin();
SPI.setClockDivider(2);
TFT_CS_HIGH;
TFT_DC_HIGH;

View File

@ -81,12 +81,12 @@ Modified by Sermus for ESP8266
#define XP 21 // can be a digital pin, this is A3
#else
#define TFT_CS_LOW //ESP8266 hspi has hardware controlled CS
#define TFT_CS_HIGH
#define TFT_DC_LOW pinMode(2, 0);
#define TFT_DC_HIGH pinMode(2, 1);
#define TFT_BL_OFF pinMode(0, 0);
#define TFT_BL_ON pinMode(0, 1);
#define TFT_CS_LOW digitalWrite(15, 0);
#define TFT_CS_HIGH digitalWrite(15, 1);
#define TFT_DC_LOW digitalWrite(2, 0);
#define TFT_DC_HIGH digitalWrite(2, 1);
#define TFT_BL_OFF digitalWrite(4, 0);
#define TFT_BL_ON digitalWrite(4, 1);
#define YP A2 // must be an analog pin, use "An" notation!
#define XM A1 // must be an analog pin, use "An" notation!