mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
[ili9xxx] Fix init for GC9A01A (#6913)
This commit is contained in:
parent
eb50f0eafd
commit
1e66241b26
2 changed files with 19 additions and 4 deletions
|
@ -34,8 +34,8 @@ void ILI9XXXDisplay::setup() {
|
||||||
ESP_LOGD(TAG, "Setting up ILI9xxx");
|
ESP_LOGD(TAG, "Setting up ILI9xxx");
|
||||||
|
|
||||||
this->setup_pins_();
|
this->setup_pins_();
|
||||||
this->init_lcd_(this->init_sequence_);
|
this->init_lcd(this->init_sequence_);
|
||||||
this->init_lcd_(this->extra_init_sequence_.data());
|
this->init_lcd(this->extra_init_sequence_.data());
|
||||||
switch (this->pixel_mode_) {
|
switch (this->pixel_mode_) {
|
||||||
case PIXEL_MODE_16:
|
case PIXEL_MODE_16:
|
||||||
if (this->is_18bitdisplay_) {
|
if (this->is_18bitdisplay_) {
|
||||||
|
@ -405,7 +405,7 @@ void ILI9XXXDisplay::reset_() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ILI9XXXDisplay::init_lcd_(const uint8_t *addr) {
|
void ILI9XXXDisplay::init_lcd(const uint8_t *addr) {
|
||||||
if (addr == nullptr)
|
if (addr == nullptr)
|
||||||
return;
|
return;
|
||||||
uint8_t cmd, x, num_args;
|
uint8_t cmd, x, num_args;
|
||||||
|
@ -427,6 +427,20 @@ void ILI9XXXDisplay::init_lcd_(const uint8_t *addr) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ILI9XXXGC9A01A::init_lcd(const uint8_t *addr) {
|
||||||
|
if (addr == nullptr)
|
||||||
|
return;
|
||||||
|
uint8_t cmd, x, num_args;
|
||||||
|
while ((cmd = *addr++) != 0) {
|
||||||
|
x = *addr++;
|
||||||
|
num_args = x & 0x7F;
|
||||||
|
this->send_command(cmd, addr, num_args);
|
||||||
|
addr += num_args;
|
||||||
|
if (x & 0x80)
|
||||||
|
delay(150); // NOLINT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Tell the display controller where we want to draw pixels.
|
// Tell the display controller where we want to draw pixels.
|
||||||
void ILI9XXXDisplay::set_addr_window_(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) {
|
void ILI9XXXDisplay::set_addr_window_(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) {
|
||||||
x1 += this->offset_x_;
|
x1 += this->offset_x_;
|
||||||
|
|
|
@ -109,7 +109,7 @@ class ILI9XXXDisplay : public display::DisplayBuffer,
|
||||||
|
|
||||||
virtual void set_madctl();
|
virtual void set_madctl();
|
||||||
void display_();
|
void display_();
|
||||||
void init_lcd_(const uint8_t *addr);
|
virtual void init_lcd(const uint8_t *addr);
|
||||||
void set_addr_window_(uint16_t x, uint16_t y, uint16_t x2, uint16_t y2);
|
void set_addr_window_(uint16_t x, uint16_t y, uint16_t x2, uint16_t y2);
|
||||||
void reset_();
|
void reset_();
|
||||||
|
|
||||||
|
@ -269,6 +269,7 @@ class ILI9XXXS3BoxLite : public ILI9XXXDisplay {
|
||||||
class ILI9XXXGC9A01A : public ILI9XXXDisplay {
|
class ILI9XXXGC9A01A : public ILI9XXXDisplay {
|
||||||
public:
|
public:
|
||||||
ILI9XXXGC9A01A() : ILI9XXXDisplay(INITCMD_GC9A01A, 240, 240, true) {}
|
ILI9XXXGC9A01A() : ILI9XXXDisplay(INITCMD_GC9A01A, 240, 240, true) {}
|
||||||
|
void init_lcd(const uint8_t *addr) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------- ILI9XXX_24_TFT display --------------
|
//----------- ILI9XXX_24_TFT display --------------
|
||||||
|
|
Loading…
Reference in a new issue