From 4a7ff4135c3c30525b9f678cba0ccf9b59c4ebc7 Mon Sep 17 00:00:00 2001 From: mvturnho Date: Wed, 10 Jul 2019 17:15:34 +0200 Subject: [PATCH] make ledpin optional busy pin is not needed --- esphome/components/ili9341/ili9341.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/esphome/components/ili9341/ili9341.cpp b/esphome/components/ili9341/ili9341.cpp index c691947b08..94dd44bff2 100644 --- a/esphome/components/ili9341/ili9341.cpp +++ b/esphome/components/ili9341/ili9341.cpp @@ -16,8 +16,9 @@ void ili9341::setup_pins_() { this->reset_pin_->setup(); // OUTPUT this->reset_pin_->digital_write(true); } - if (this->busy_pin_ != nullptr) { - this->busy_pin_->setup(); // INPUT + if (this->led_pin_ != nullptr) { + this->led_pin_->setup(); + this->led_pin_->digital_write(true); } this->spi_setup(); @@ -82,7 +83,7 @@ uint8_t ili9341::read_command_(uint8_t commandByte, uint8_t index) { void ili9341::update() { this->do_update_(); // this->display(); - //ESP_LOGD(TAG, "xlow: %d, ylow: %d, xhigh: %d, Yhigh: %d", x_low_, y_low_, x_high_, y_high_); + // ESP_LOGD(TAG, "xlow: %d, ylow: %d, xhigh: %d, Yhigh: %d", x_low_, y_low_, x_high_, y_high_); this->x_low_ = this->width_; this->y_low_ = this->height_; this->x_high_ = 0; @@ -169,14 +170,11 @@ void ili9341::set_addr_window_(uint16_t x1, uint16_t y1, uint16_t w, uint16_t h) void ili9341::invert_display_(bool invert) { this->command(invert ? ILI9341_INVON : ILI9341_INVOFF); } - int ili9341::get_width_internal() { return this->width_; } int ili9341::get_height_internal() { return this->height_; } // M5Stack display void ili9341_M5Stack::initialize() { - this->led_pin_->pin_mode(OUTPUT); - this->led_pin_->digital_write(true); this->init_lcd_(initcmd_m5stack); this->width_ = 320; this->height_ = 240; @@ -185,8 +183,6 @@ void ili9341_M5Stack::initialize() { // 24_TFT display void ili9341_24_TFT::initialize() { - this->led_pin_->pin_mode(OUTPUT); - this->led_pin_->digital_write(true); this->init_lcd_(initcmd_tft); this->width_ = 240; this->height_ = 320;