Add Lilygo T-Embed to st7789v display config. (#5337)

* Add Lilygo T-Embed to st7789v display config.

* Move all configuration into the Python code.
Add presets for TTGO.
All preset configuration can be overridden.

* Add Adafruit S2 pin presets

* Add test

* Add funhouse pins.

Co-authored-by: Keith Burzinski <kbx81x@gmail.com>

* Keep ordering of options consistent

* Remove unused declarations

---------

Co-authored-by: Keith Burzinski <kbx81x@gmail.com>
This commit is contained in:
Clyde Stubbs
2023-09-05 17:01:28 +10:00
committed by GitHub
parent 343278b291
commit 32b24726ed
4 changed files with 112 additions and 104 deletions
+2 -11
View File
@@ -10,14 +10,6 @@
namespace esphome {
namespace st7789v {
enum ST7789VModel {
ST7789V_MODEL_TTGO_TDISPLAY_135_240,
ST7789V_MODEL_ADAFRUIT_FUNHOUSE_240_240,
ST7789V_MODEL_ADAFRUIT_RR_280_240,
ST7789V_MODEL_ADAFRUIT_S2_TFT_FEATHER_240_135,
ST7789V_MODEL_CUSTOM
};
static const uint8_t ST7789_NOP = 0x00; // No Operation
static const uint8_t ST7789_SWRESET = 0x01; // Software Reset
static const uint8_t ST7789_RDDID = 0x04; // Read Display ID
@@ -120,7 +112,7 @@ class ST7789V : public PollingComponent,
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
spi::DATA_RATE_20MHZ> {
public:
void set_model(ST7789VModel model);
void set_model_str(const char *model_str);
void set_dc_pin(GPIOPin *dc_pin) { this->dc_pin_ = dc_pin; }
void set_reset_pin(GPIOPin *reset_pin) { this->reset_pin_ = reset_pin; }
void set_backlight_pin(GPIOPin *backlight_pin) { this->backlight_pin_ = backlight_pin; }
@@ -146,7 +138,6 @@ class ST7789V : public PollingComponent,
display::DisplayType get_display_type() override { return display::DisplayType::DISPLAY_TYPE_COLOR; }
protected:
ST7789VModel model_{ST7789V_MODEL_TTGO_TDISPLAY_135_240};
GPIOPin *dc_pin_{nullptr};
GPIOPin *reset_pin_{nullptr};
GPIOPin *backlight_pin_{nullptr};
@@ -175,7 +166,7 @@ class ST7789V : public PollingComponent,
void draw_absolute_pixel_internal(int x, int y, Color color) override;
const char *model_str_();
const char *model_str_;
};
} // namespace st7789v