mirror of
https://github.com/esphome/esphome.git
synced 2025-09-22 05:02:23 +01:00
[ektf2232] Rename rts_pin
to reset_pin
(#10720)
This commit is contained in:
@@ -2,7 +2,7 @@ from esphome import pins
|
|||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
from esphome.components import i2c, touchscreen
|
from esphome.components import i2c, touchscreen
|
||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
from esphome.const import CONF_ID, CONF_INTERRUPT_PIN
|
from esphome.const import CONF_ID, CONF_INTERRUPT_PIN, CONF_RESET_PIN
|
||||||
|
|
||||||
CODEOWNERS = ["@jesserockz"]
|
CODEOWNERS = ["@jesserockz"]
|
||||||
DEPENDENCIES = ["i2c"]
|
DEPENDENCIES = ["i2c"]
|
||||||
@@ -15,7 +15,7 @@ EKTF2232Touchscreen = ektf2232_ns.class_(
|
|||||||
)
|
)
|
||||||
|
|
||||||
CONF_EKTF2232_ID = "ektf2232_id"
|
CONF_EKTF2232_ID = "ektf2232_id"
|
||||||
CONF_RTS_PIN = "rts_pin"
|
CONF_RTS_PIN = "rts_pin" # To be removed before 2026.4.0
|
||||||
|
|
||||||
CONFIG_SCHEMA = touchscreen.TOUCHSCREEN_SCHEMA.extend(
|
CONFIG_SCHEMA = touchscreen.TOUCHSCREEN_SCHEMA.extend(
|
||||||
cv.Schema(
|
cv.Schema(
|
||||||
@@ -24,7 +24,10 @@ CONFIG_SCHEMA = touchscreen.TOUCHSCREEN_SCHEMA.extend(
|
|||||||
cv.Required(CONF_INTERRUPT_PIN): cv.All(
|
cv.Required(CONF_INTERRUPT_PIN): cv.All(
|
||||||
pins.internal_gpio_input_pin_schema
|
pins.internal_gpio_input_pin_schema
|
||||||
),
|
),
|
||||||
cv.Required(CONF_RTS_PIN): pins.gpio_output_pin_schema,
|
cv.Required(CONF_RESET_PIN): pins.gpio_output_pin_schema,
|
||||||
|
cv.Optional(CONF_RTS_PIN): cv.invalid(
|
||||||
|
f"{CONF_RTS_PIN} has been renamed to {CONF_RESET_PIN}"
|
||||||
|
),
|
||||||
}
|
}
|
||||||
).extend(i2c.i2c_device_schema(0x15))
|
).extend(i2c.i2c_device_schema(0x15))
|
||||||
)
|
)
|
||||||
@@ -37,5 +40,5 @@ async def to_code(config):
|
|||||||
|
|
||||||
interrupt_pin = await cg.gpio_pin_expression(config[CONF_INTERRUPT_PIN])
|
interrupt_pin = await cg.gpio_pin_expression(config[CONF_INTERRUPT_PIN])
|
||||||
cg.add(var.set_interrupt_pin(interrupt_pin))
|
cg.add(var.set_interrupt_pin(interrupt_pin))
|
||||||
rts_pin = await cg.gpio_pin_expression(config[CONF_RTS_PIN])
|
reset_pin = await cg.gpio_pin_expression(config[CONF_RESET_PIN])
|
||||||
cg.add(var.set_rts_pin(rts_pin))
|
cg.add(var.set_reset_pin(reset_pin))
|
||||||
|
@@ -21,7 +21,7 @@ void EKTF2232Touchscreen::setup() {
|
|||||||
|
|
||||||
this->attach_interrupt_(this->interrupt_pin_, gpio::INTERRUPT_FALLING_EDGE);
|
this->attach_interrupt_(this->interrupt_pin_, gpio::INTERRUPT_FALLING_EDGE);
|
||||||
|
|
||||||
this->rts_pin_->setup();
|
this->reset_pin_->setup();
|
||||||
|
|
||||||
this->hard_reset_();
|
this->hard_reset_();
|
||||||
if (!this->soft_reset_()) {
|
if (!this->soft_reset_()) {
|
||||||
@@ -98,9 +98,9 @@ bool EKTF2232Touchscreen::get_power_state() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EKTF2232Touchscreen::hard_reset_() {
|
void EKTF2232Touchscreen::hard_reset_() {
|
||||||
this->rts_pin_->digital_write(false);
|
this->reset_pin_->digital_write(false);
|
||||||
delay(15);
|
delay(15);
|
||||||
this->rts_pin_->digital_write(true);
|
this->reset_pin_->digital_write(true);
|
||||||
delay(15);
|
delay(15);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ void EKTF2232Touchscreen::dump_config() {
|
|||||||
ESP_LOGCONFIG(TAG, "EKT2232 Touchscreen:");
|
ESP_LOGCONFIG(TAG, "EKT2232 Touchscreen:");
|
||||||
LOG_I2C_DEVICE(this);
|
LOG_I2C_DEVICE(this);
|
||||||
LOG_PIN(" Interrupt Pin: ", this->interrupt_pin_);
|
LOG_PIN(" Interrupt Pin: ", this->interrupt_pin_);
|
||||||
LOG_PIN(" RTS Pin: ", this->rts_pin_);
|
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ektf2232
|
} // namespace ektf2232
|
||||||
|
@@ -17,7 +17,7 @@ class EKTF2232Touchscreen : public Touchscreen, public i2c::I2CDevice {
|
|||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
|
|
||||||
void set_interrupt_pin(InternalGPIOPin *pin) { this->interrupt_pin_ = pin; }
|
void set_interrupt_pin(InternalGPIOPin *pin) { this->interrupt_pin_ = pin; }
|
||||||
void set_rts_pin(GPIOPin *pin) { this->rts_pin_ = pin; }
|
void set_reset_pin(GPIOPin *pin) { this->reset_pin_ = pin; }
|
||||||
|
|
||||||
void set_power_state(bool enable);
|
void set_power_state(bool enable);
|
||||||
bool get_power_state();
|
bool get_power_state();
|
||||||
@@ -28,7 +28,7 @@ class EKTF2232Touchscreen : public Touchscreen, public i2c::I2CDevice {
|
|||||||
void update_touches() override;
|
void update_touches() override;
|
||||||
|
|
||||||
InternalGPIOPin *interrupt_pin_;
|
InternalGPIOPin *interrupt_pin_;
|
||||||
GPIOPin *rts_pin_;
|
GPIOPin *reset_pin_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ektf2232
|
} // namespace ektf2232
|
||||||
|
@@ -7,7 +7,7 @@ display:
|
|||||||
- platform: ssd1306_i2c
|
- platform: ssd1306_i2c
|
||||||
id: ssd1306_display
|
id: ssd1306_display
|
||||||
model: SSD1306_128X64
|
model: SSD1306_128X64
|
||||||
reset_pin: ${reset_pin}
|
reset_pin: ${display_reset_pin}
|
||||||
pages:
|
pages:
|
||||||
- id: page1
|
- id: page1
|
||||||
lambda: |-
|
lambda: |-
|
||||||
@@ -16,7 +16,7 @@ display:
|
|||||||
touchscreen:
|
touchscreen:
|
||||||
- platform: ektf2232
|
- platform: ektf2232
|
||||||
interrupt_pin: ${interrupt_pin}
|
interrupt_pin: ${interrupt_pin}
|
||||||
rts_pin: ${rts_pin}
|
reset_pin: ${touch_reset_pin}
|
||||||
display: ssd1306_display
|
display: ssd1306_display
|
||||||
on_touch:
|
on_touch:
|
||||||
- logger.log:
|
- logger.log:
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
scl_pin: GPIO16
|
scl_pin: GPIO16
|
||||||
sda_pin: GPIO17
|
sda_pin: GPIO17
|
||||||
reset_pin: GPIO13
|
display_reset_pin: GPIO13
|
||||||
interrupt_pin: GPIO14
|
interrupt_pin: GPIO14
|
||||||
rts_pin: GPIO15
|
touch_reset_pin: GPIO15
|
||||||
|
|
||||||
<<: !include common.yaml
|
<<: !include common.yaml
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
scl_pin: GPIO5
|
scl_pin: GPIO5
|
||||||
sda_pin: GPIO4
|
sda_pin: GPIO4
|
||||||
reset_pin: GPIO3
|
display_reset_pin: GPIO3
|
||||||
interrupt_pin: GPIO6
|
interrupt_pin: GPIO6
|
||||||
rts_pin: GPIO7
|
touch_reset_pin: GPIO7
|
||||||
|
|
||||||
<<: !include common.yaml
|
<<: !include common.yaml
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
scl_pin: GPIO5
|
scl_pin: GPIO5
|
||||||
sda_pin: GPIO4
|
sda_pin: GPIO4
|
||||||
reset_pin: GPIO3
|
display_reset_pin: GPIO3
|
||||||
interrupt_pin: GPIO6
|
interrupt_pin: GPIO6
|
||||||
rts_pin: GPIO7
|
touch_reset_pin: GPIO7
|
||||||
|
|
||||||
<<: !include common.yaml
|
<<: !include common.yaml
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
scl_pin: GPIO16
|
scl_pin: GPIO16
|
||||||
sda_pin: GPIO17
|
sda_pin: GPIO17
|
||||||
reset_pin: GPIO13
|
display_reset_pin: GPIO13
|
||||||
interrupt_pin: GPIO14
|
interrupt_pin: GPIO14
|
||||||
rts_pin: GPIO15
|
touch_reset_pin: GPIO15
|
||||||
|
|
||||||
<<: !include common.yaml
|
<<: !include common.yaml
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
scl_pin: GPIO5
|
scl_pin: GPIO5
|
||||||
sda_pin: GPIO4
|
sda_pin: GPIO4
|
||||||
reset_pin: GPIO3
|
display_reset_pin: GPIO3
|
||||||
interrupt_pin: GPIO12
|
interrupt_pin: GPIO12
|
||||||
rts_pin: GPIO13
|
touch_reset_pin: GPIO13
|
||||||
|
|
||||||
<<: !include common.yaml
|
<<: !include common.yaml
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
scl_pin: GPIO5
|
scl_pin: GPIO5
|
||||||
sda_pin: GPIO4
|
sda_pin: GPIO4
|
||||||
reset_pin: GPIO3
|
display_reset_pin: GPIO3
|
||||||
interrupt_pin: GPIO6
|
interrupt_pin: GPIO6
|
||||||
rts_pin: GPIO7
|
touch_reset_pin: GPIO7
|
||||||
|
|
||||||
<<: !include common.yaml
|
<<: !include common.yaml
|
||||||
|
Reference in New Issue
Block a user