mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-31 10:08:27 +02:00
Add null GPIO pin (#6611)
This commit is contained in:
@@ -62,6 +62,24 @@ 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:
|
||||
|
||||
Reference in New Issue
Block a user