DIY fertilizer mixer and plant watering machine https://www.xythobuz.de/giessomat.html
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.

Plants.h 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 _PLANTS_H_
  20. #define _PLANTS_H_
  21. #include "GPIOBank.h"
  22. class Plants {
  23. public:
  24. enum Waterlevel {
  25. empty,
  26. inbetween,
  27. full,
  28. invalid
  29. };
  30. // valves: no of plants + 1 for water inlet
  31. // pumps: no of fertilizers
  32. // switches: 2, low and high level
  33. Plants(int valve_count, int pump_count, int switch_count);
  34. void setValvePins(int pins[]);
  35. void setPumpPins(int pins[]);
  36. void setSwitchPins(int pins[], bool pullup);
  37. void abort(void);
  38. Waterlevel getWaterlevel(void);
  39. void openWaterInlet(void);
  40. void closeWaterInlet(void);
  41. int countFertilizers(void);
  42. void startFertilizer(int id);
  43. void stopFertilizer(int id);
  44. void stopAllFertilizers(void);
  45. int countPlants(void);
  46. void startPlant(int id);
  47. void stopPlant(int id);
  48. void stopAllPlants(void);
  49. GPIOBank *getValves(void);
  50. GPIOBank *getPumps(void);
  51. GPIOBank *getSwitches(void);
  52. private:
  53. GPIOBank valves;
  54. GPIOBank pumps;
  55. GPIOBank switches;
  56. };
  57. extern Plants plants;
  58. #endif // _PLANTS_H_