Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
687 B

  1. /*
  2. Part of the GPIO MODULE
  3. Copyright (C) 2017-2019 by Xose Pérez <xose dot perez at gmail dot com>
  4. */
  5. #pragma once
  6. #include "gpio.h"
  7. #include <cstdint>
  8. class GpioPin final : public BasePin {
  9. public:
  10. explicit GpioPin(unsigned char pin_) :
  11. BasePin(pin_)
  12. {}
  13. void pinMode(int8_t mode) override {
  14. ::pinMode(this->pin, mode);
  15. }
  16. void digitalWrite(int8_t val) override {
  17. ::digitalWrite(this->pin, val);
  18. }
  19. String description() const override {
  20. static String desc(String(F("GpioPin @ GPIO")) + static_cast<int>(pin));
  21. return desc;
  22. }
  23. int digitalRead() {
  24. return ::digitalRead(this->pin);
  25. }
  26. };