Add null GPIO pin (#6611)

This commit is contained in:
Clyde Stubbs
2024-04-24 06:49:14 +10:00
committed by GitHub
parent 8027921ba3
commit b8f0182fc5
3 changed files with 26 additions and 12 deletions
+18
View File
@@ -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: