Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Add null GPIO pin " #6621

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 11 additions & 7 deletions esphome/components/cst226/touchscreen/cst226_touchscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ namespace cst226 {

void CST226Touchscreen::setup() {
esph_log_config(TAG, "Setting up CST226 Touchscreen...");
this->reset_pin_->setup();
this->reset_pin_->digital_write(true);
delay(5);
this->reset_pin_->digital_write(false);
delay(5);
this->reset_pin_->digital_write(true);
this->set_timeout(30, [this] { this->continue_setup_(); });
if (this->reset_pin_ != nullptr) {
this->reset_pin_->setup();
this->reset_pin_->digital_write(true);
delay(5);
this->reset_pin_->digital_write(false);
delay(5);
this->reset_pin_->digital_write(true);
this->set_timeout(30, [this] { this->continue_setup_(); });
} else {
this->continue_setup_();
}
}

void CST226Touchscreen::update_touches() {
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/cst226/touchscreen/cst226_touchscreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CST226Touchscreen : public touchscreen::Touchscreen, public i2c::I2CDevice
void continue_setup_();

InternalGPIOPin *interrupt_pin_{};
GPIOPin *reset_pin_{NULL_PIN};
GPIOPin *reset_pin_{};
uint8_t chip_id_{};
bool setup_complete_{};
};
Expand Down
18 changes: 0 additions & 18 deletions esphome/core/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,6 @@ class GPIOPin {
virtual bool is_internal() { return false; }
};

/**
* A pin to replace those that don't exist.
*/
class NullPin : public GPIOPin {
public:
void setup() override {}

void pin_mode(gpio::Flags _) override {}

bool digital_read() override { return false; }

void digital_write(bool _) override {}

std::string dump_summary() const override { return {"Not used"}; }
};

static GPIOPin *const NULL_PIN = new NullPin();

/// Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
class ISRInternalGPIOPin {
public:
Expand Down