DIY fertilizer mixer and plant watering machine https://www.xythobuz.de/giessomat.html
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

GPIOBank.h 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) 2021 Thomas Buck <thomas@xythobuz.de>
  3. *
  4. * This file is part of Giess-o-mat.
  5. *
  6. * Giess-o-mat is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Giess-o-mat is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Giess-o-mat. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. #ifndef _GPIO_BANK_H_
  20. #define _GPIO_BANK_H_
  21. void gpio_i2c_init(void);
  22. class GPIOBank {
  23. public:
  24. GPIOBank(int _size);
  25. ~GPIOBank(void);
  26. void setPinNumbers(int _pins[]);
  27. int getPinNumber(int pin);
  28. void setOutput(void);
  29. void setInput(bool pullup);
  30. int getSize(void);
  31. void setPin(int n, bool state);
  32. void setAll(bool state);
  33. bool getPin(int n);
  34. private:
  35. int size;
  36. int *pins;
  37. bool *out_state;
  38. bool is_output;
  39. };
  40. #endif // _GPIO_BANK_H_