1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-26 23:22:21 +01:00

Add support for ST7789V display module (as on TTGO T-Display) (#1050)

* TFT-LCD ST7789V of ESP32 TTGO.

This patch allows you to use TFT-LCD ST7789V of ESP32 TTGO

* Lots of polish and a few tweaks

* Add test

* Add color to core, take 1

* Where did those tabs come from?

* Fix lines too long

* Added color component

* Linted

* Rebase, SPI fix, test

* Shuffle bits

* One more thing...oops

* Image type fix...oops

* Make display_buffer use Color

* Fix BGR/RGB, remove predefined colors

* Fix all the things

* renamed colors to color

* migrate max7219

Co-authored-by: musk95 <musk95@naver.com>
Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
This commit is contained in:
Keith Burzinski
2020-06-28 16:37:36 -05:00
committed by GitHub
parent bfb9cb6732
commit 491f7e96f0
21 changed files with 843 additions and 85 deletions

View File

@@ -115,20 +115,20 @@ void WaveshareEPaper::update() {
this->do_update_();
this->display();
}
void WaveshareEPaper::fill(int color) {
void WaveshareEPaper::fill(Color color) {
// flip logic
const uint8_t fill = color ? 0x00 : 0xFF;
const uint8_t fill = color.is_on() ? 0x00 : 0xFF;
for (uint32_t i = 0; i < this->get_buffer_length_(); i++)
this->buffer_[i] = fill;
}
void HOT WaveshareEPaper::draw_absolute_pixel_internal(int x, int y, int color) {
void HOT WaveshareEPaper::draw_absolute_pixel_internal(int x, int y, Color color) {
if (x >= this->get_width_internal() || y >= this->get_height_internal() || x < 0 || y < 0)
return;
const uint32_t pos = (x + y * this->get_width_internal()) / 8u;
const uint8_t subpos = x & 0x07;
// flip logic
if (!color)
if (!color.is_on())
this->buffer_[pos] |= 0x80 >> subpos;
else
this->buffer_[pos] &= ~(0x80 >> subpos);

View File

@@ -26,7 +26,7 @@ class WaveshareEPaper : public PollingComponent,
void update() override;
void fill(int color) override;
void fill(Color color) override;
void setup() override {
this->setup_pins_();
@@ -36,7 +36,7 @@ class WaveshareEPaper : public PollingComponent,
void on_safe_shutdown() override;
protected:
void draw_absolute_pixel_internal(int x, int y, int color) override;
void draw_absolute_pixel_internal(int x, int y, Color color) override;
bool wait_until_idle_();