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.

29 lines
525 B

  1. /*
  2. Part of BUTTON module
  3. Copyright (C) 2020 by Maxim Prokhorov <prokhorov dot max at outlook dot com>
  4. */
  5. #pragma once
  6. #include <cstdint>
  7. #include "config/types.h"
  8. // base interface for generic pin handler.
  9. struct BasePin {
  10. explicit BasePin(unsigned char pin) :
  11. pin(pin)
  12. {}
  13. virtual operator bool() {
  14. return GPIO_NONE != pin;
  15. }
  16. virtual void pinMode(int8_t mode) = 0;
  17. virtual void digitalWrite(int8_t val) = 0;
  18. virtual int digitalRead() = 0;
  19. const unsigned char pin;
  20. };