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.1KB

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