DIY fertilizer mixer and plant watering machine https://www.xythobuz.de/giessomat.html
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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 _CONFIG_PINS_H_
  20. #define _CONFIG_PINS_H_
  21. // ----------------------------------------------------------------------------
  22. // ----------------------------------------------------------------------------
  23. #ifdef PLATFORM_AVR
  24. #define BUILTIN_LED_PIN 13
  25. // ----------------------------------------------------------------------------
  26. #ifdef FUNCTION_UI
  27. /*
  28. * AVR UI
  29. */
  30. #define SERIAL_LCD_TX_PIN 10
  31. #define KEYMATRIX_ROWS 4
  32. #define KEYMATRIX_COLS 3
  33. #define KEYMATRIX_ROW_PINS 5, 6, 7, 8
  34. #define KEYMATRIX_COL_PINS 2, 3, 4
  35. #endif // FUNCTION_UI
  36. // ----------------------------------------------------------------------------
  37. #ifdef FUNCTION_CONTROL
  38. /*
  39. * AVR Controller
  40. */
  41. #define I2C_GPIO_EXPANDER_COUNT 0
  42. //#define I2C_GPIO_EXPANDER_ADDR 0x20, 0x21
  43. // out 1, out 2, out 3, out 4, in
  44. #define VALVE_COUNT 5
  45. #define VALVE_PINS 10, 11, 12, 14, 15
  46. #define KICKSTART_PINS -1, -1, -1, -1
  47. // a, b, c
  48. #define PUMP_COUNT 3
  49. #define PUMP_PINS 16, 17, 18
  50. // ensure a default for each PUMP_COUNT
  51. #define AUTO_PUMP_RUNTIME { 20, 10, 10 }
  52. // bottom, top
  53. #define SWITCH_COUNT 2
  54. #define SWITCH_PINS 19, 20
  55. // stirrer
  56. #define STIRRER_COUNT 1
  57. #define LOCK_COUNT 0
  58. #define AUX_COUNT (STIRRER_COUNT + LOCK_COUNT)
  59. #define AUX_PINS 21
  60. #endif // FUNCTION_CONTROL
  61. #endif // PLATFORM_AVR
  62. // ----------------------------------------------------------------------------
  63. // ----------------------------------------------------------------------------
  64. #ifdef PLATFORM_ESP
  65. #define BUILTIN_LED_PIN 1
  66. // ----------------------------------------------------------------------------
  67. #ifdef FUNCTION_UI
  68. /*
  69. * ESP UI
  70. */
  71. #error configuration not supported
  72. #endif // FUNCTION_UI
  73. // ----------------------------------------------------------------------------
  74. #ifdef FUNCTION_CONTROL
  75. /*
  76. * ESP Controller
  77. */
  78. /*
  79. * I2C Port Expander PCF8574(A)
  80. *
  81. * Address ranges:
  82. * PCF8574: 0x20 - 0x27
  83. * PCF8574A: 0x38 - 0x3F
  84. */
  85. #define I2C_GPIO_EXPANDER_COUNT 2
  86. #define I2C_GPIO_EXPANDER_ADDR 0x20, 0x21
  87. /*
  88. * GPIO Numbering Scheme
  89. * 000 - 099: normal ESP32 GPIOs
  90. * 100 - 228: consecutive I2C Expander GPIOs
  91. */
  92. #define PLANT_COUNT 8
  93. #define PLANT_PINS 27, 14, 5, 18, 100, 101, 102, 103
  94. #define INLET_PIN 15
  95. // out 1, out 2, out 3, out 4, in
  96. #define VALVE_COUNT (PLANT_COUNT + 1)
  97. #define VALVE_PINS PLANT_PINS, INLET_PIN
  98. // kickstarting pumps, same count as plants!
  99. // set pin to -1 to disable kickstart for this plant.
  100. #define KICKSTART_PINS 112, 113, 114, 115, 108, 109, 110, 111
  101. // a, b, c
  102. #define PUMP_COUNT 3
  103. #define PUMP_PINS 2, 0, 4
  104. // ensure a default for each PUMP_COUNT
  105. #define AUTO_PUMP_RUNTIME { 20, 10, 10 }
  106. // stirrer, locks
  107. #define STIRRER_COUNT 1
  108. #define LOCK_COUNT 2
  109. #define AUX_COUNT (STIRRER_COUNT + LOCK_COUNT)
  110. #define AUX_PINS 19, 104, 105
  111. // bottom, top
  112. #define SWITCH_COUNT 2
  113. #define SWITCH_PINS 26, 25
  114. #define I2C_SDA_PIN 21
  115. #define I2C_SCL_PIN 22
  116. #endif // FUNCTION_CONTROL
  117. #endif // PLATFORM_ESP
  118. // ----------------------------------------------------------------------------
  119. // ----------------------------------------------------------------------------
  120. #endif // _CONFIG_PINS_H_