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.

SerialLCD.h 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 _SERIAL_LCD_H_
  20. #define _SERIAL_LCD_H_
  21. #ifdef FUNCTION_UI
  22. #if defined(PLATFORM_AVR)
  23. #include <SendOnlySoftwareSerial.h>
  24. #elif defined(PLATFORM_ESP)
  25. #include <SoftwareSerial.h>
  26. #else
  27. #error platform not supported
  28. #endif
  29. class SerialLCD {
  30. public:
  31. SerialLCD(int tx_pin);
  32. ~SerialLCD(void);
  33. void init(void);
  34. void clear(void);
  35. void setBacklight(uint8_t val);
  36. void saveSplash(void);
  37. void enableSplash(void);
  38. void disableSplash(void);
  39. // 0 no cursor, 1 underline, 2 blinking, 3 both
  40. void cursor(int style);
  41. void position(int line, int col);
  42. void write(const char *text);
  43. void write(int line, const char *text);
  44. void write(int line, int col, const char *text);
  45. private:
  46. #if defined(PLATFORM_AVR)
  47. SendOnlySoftwareSerial *lcd;
  48. #elif defined(PLATFORM_ESP)
  49. SoftwareSerial *lcd;
  50. #endif
  51. };
  52. #endif // FUNCTION_UI
  53. #endif // _SERIAL_LCD_H_