Skip to content

Commit

Permalink
Add push color to ILI9341 and prepare for release
Browse files Browse the repository at this point in the history
  • Loading branch information
squix78 committed Jun 23, 2018
1 parent 2cd69cd commit 641f162
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -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":
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Mini Grafx
version=0.0.19
version=1.0.0
author=Daniel Eichhorn
maintainer=Daniel Eichhorn <[email protected]>
sentence=Graphics Library for embedded devices with a framebuffer
Expand Down
12 changes: 10 additions & 2 deletions src/EPD_WaveShare_42.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
17 changes: 17 additions & 0 deletions src/ILI9341_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/ILI9341_SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 641f162

Please sign in to comment.