dgarrett / BasicEPaperReader

0 stars 0 forks source link

help to try to understand #1

Open juanpabloaj opened 5 years ago

juanpabloaj commented 5 years ago

Hi Dylan, thanks for your example, is very interesting.

I'm trying to understand how I could use WaveShare EPaper Display with Adafruit HUZZAH32 ESP32 Feather Board.

I tried to make a simplification of your code with these connections

huzzah32

and with this code


#include <GxEPD.h>
#include <GxGDEP015OC1/GxGDEP015OC1.cpp>    // 1.54" b/w
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>
#include <Fonts/FreeSansBold24pt7b.h>

GxIO_Class io(SPI, 15, 33, 27);
GxEPD_Class display(io, 27, 32);

const char* name = "FreeSansBold24pt7b";
const GFXfont* f = &FreeSansBold24pt7b;

void setup() {
  randomSeed(analogRead(0));
  Serial.begin(9600);
  Serial.println("Starting...");
  display.init(9600);
  //display.setRotation(1);
  display.fillScreen(GxEPD_BLACK);
  display.setFont(f);
  display.update();
  delay(2000);
}

void loop() {
  Serial.println("showing randon number...");
  showRandomNumber();
  delay(2000);
}

void showRandomNumber() {
  String randomString = String(random(1, 60));

  uint16_t box_x = 60;
  uint16_t box_y = 60;
  uint16_t box_w = 90;
  uint16_t box_h = 100;
  uint16_t cursor_y = box_y + 16;

  display.setRotation(45);
  display.setFont(f);
  display.setTextColor(GxEPD_BLACK);

  display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  display.setCursor(box_x, cursor_y+38);
  display.print(randomString);
  display.updateWindow(box_x, box_y, box_w, box_h, true);

}

but I don't get any reaction from the display, do you see something wrong in the code or the connections?

thanks a lot for your help :)

dgarrett commented 4 years ago

Hi @juanpabloaj! Sorry I missed this when you posted it.

I think the issue is here:

GxIO_Class io(SPI, 15, 33, 27);
GxEPD_Class display(io, 27, 32);

The ESP32 has 4 SPI controllers, with two exposed to the Arduino library (HSPI and VSPI). If I remember correctly, SPI here is an alias for VSPI in the ESP32 Arduino library, however the Adafruit HUZZAH32 exposes HSPI on the board.

Try changing these lines to:

SPIClass s(VSPI); // VSPI or HSPI
GxIO_Class io(s, /*CS=*/ 15, /*DC=*/ 33, /*RST=*/ 27);
GxEPD_Class display(io, /*RST=*/ 27, /*BUSY=*/ 32);