diff --git a/library.json b/library.json index 5011c8a..686635c 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "Mini Grafx", - "version": "0.0.19", + "version": "1.0.0", "keywords": "embedded, graphics, tft, oled, e-paper", "description": "A generic graphics library containing several drivers for TFT, OLED and e-paper displays", "repository": diff --git a/library.properties b/library.properties index bacf7da..8c0a681 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Mini Grafx -version=0.0.19 +version=1.0.0 author=Daniel Eichhorn maintainer=Daniel Eichhorn sentence=Graphics Library for embedded devices with a framebuffer diff --git a/src/EPD_WaveShare_42.cpp b/src/EPD_WaveShare_42.cpp index a722cae..1d7be92 100644 --- a/src/EPD_WaveShare_42.cpp +++ b/src/EPD_WaveShare_42.cpp @@ -122,12 +122,20 @@ void EPD_WaveShare42::SpiTransfer(unsigned char data) { } int EPD_WaveShare42::IfInit(void) { + Serial.println("Setting pin modes"); + digitalWrite(this->csPin, HIGH); pinMode(this->csPin, OUTPUT); + digitalWrite(this->rstPin, HIGH); pinMode(this->rstPin, OUTPUT); + digitalWrite(this->dcPin, HIGH); pinMode(this->dcPin, OUTPUT); - pinMode(this->busyPin, INPUT); - SPI.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0)); + digitalWrite(this->busyPin, HIGH); + pinMode(this->busyPin, OUTPUT); + Serial.println("Starting SPI transaction"); SPI.begin(); + SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0)); + Serial.println("Beginning SPI"); + return 0; } diff --git a/src/ILI9341_SPI.cpp b/src/ILI9341_SPI.cpp index ca332db..f59dd39 100644 --- a/src/ILI9341_SPI.cpp +++ b/src/ILI9341_SPI.cpp @@ -408,6 +408,23 @@ void ILI9341_SPI::setRotation(uint8_t m) { if (hwSPI) spi_end(); } +void ILI9341_SPI::pushColor(uint16_t color) { + if (hwSPI) spi_begin(); + + digitalWrite(_dc, HIGH); + digitalWrite(_cs, LOW); + + + spiwrite(color >> 8); + spiwrite(color); + + + digitalWrite(_cs, HIGH); + + if (hwSPI) spi_end(); + +} + void ILI9341_SPI::writeBuffer(uint8_t *buffer, uint8_t bitsPerPixel, uint16_t *palette, uint16_t xPos, uint16_t yPos, uint16_t bufferWidth, uint16_t bufferHeight) { if (hwSPI) spi_begin(); diff --git a/src/ILI9341_SPI.h b/src/ILI9341_SPI.h index e4aed59..e3906bf 100644 --- a/src/ILI9341_SPI.h +++ b/src/ILI9341_SPI.h @@ -125,6 +125,7 @@ class ILI9341_SPI : public DisplayDriver { void setRotation(uint8_t r); void writeBuffer(uint8_t *buffer, uint8_t bitsPerPixel, uint16_t *palette, uint16_t x, uint16_t y, uint16_t bufferWidth, uint16_t bufferHeight); + void pushColor(uint16_t color); void setFastRefresh(boolean isFastRefreshEnabled); void spiwrite(uint8_t);