mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-31 18:18:27 +02: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:
@@ -85,14 +85,14 @@ void HOT PCD8544::display() {
|
||||
this->command(this->PCD8544_SETYADDR);
|
||||
}
|
||||
|
||||
void HOT PCD8544::draw_absolute_pixel_internal(int x, int y, int color) {
|
||||
void HOT PCD8544::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;
|
||||
}
|
||||
|
||||
uint16_t pos = x + (y / 8) * this->get_width_internal();
|
||||
uint8_t subpos = y % 8;
|
||||
if (color) {
|
||||
if (color.is_on()) {
|
||||
this->buffer_[pos] |= (1 << subpos);
|
||||
} else {
|
||||
this->buffer_[pos] &= ~(1 << subpos);
|
||||
@@ -117,8 +117,8 @@ void PCD8544::update() {
|
||||
this->display();
|
||||
}
|
||||
|
||||
void PCD8544::fill(int color) {
|
||||
uint8_t fill = color ? 0xFF : 0x00;
|
||||
void PCD8544::fill(Color color) {
|
||||
uint8_t fill = color.is_on() ? 0xFF : 0x00;
|
||||
for (uint32_t i = 0; i < this->get_buffer_length_(); i++)
|
||||
this->buffer_[i] = fill;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user