DIY fertilizer mixer and plant watering machine https://www.xythobuz.de/giessomat.html
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

Plants.h 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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, int aux_count);
  34. void setValvePins(int pins[]);
  35. void setPumpPins(int pins[]);
  36. void setSwitchPins(int pins[], bool pullup);
  37. void setAuxPins(int pins[]);
  38. void abort(void);
  39. Waterlevel getWaterlevel(void);
  40. void openWaterInlet(void);
  41. void closeWaterInlet(void);
  42. int countFertilizers(void);
  43. void startFertilizer(int id);
  44. void stopFertilizer(int id);
  45. void stopAllFertilizers(void);
  46. int countPlants(void);
  47. void startPlant(int id);
  48. void stopPlant(int id);
  49. void stopAllPlants(void);
  50. int countAux(void);
  51. void startAux(int id);
  52. void stopAux(int id);
  53. void stopAllAux(void);
  54. GPIOBank *getValves(void);
  55. GPIOBank *getPumps(void);
  56. GPIOBank *getSwitches(void);
  57. GPIOBank *getAux(void);
  58. private:
  59. GPIOBank valves;
  60. GPIOBank pumps;
  61. GPIOBank switches;
  62. GPIOBank aux;
  63. };
  64. extern Plants plants;
  65. #endif // _PLANTS_H_