My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. *
  18. */
  19. #pragma once
  20. #include <stdint.h>
  21. // Relies on XPT2046-compatible mode of ADS7843,
  22. // hence no Z1 / Z2 measurements are possible.
  23. #define XPT2046_DFR_MODE 0x00
  24. #define XPT2046_SER_MODE 0x04
  25. #define XPT2046_CONTROL 0x80
  26. enum XPTCoordinate : uint8_t {
  27. XPT2046_X = 0x10,
  28. XPT2046_Y = 0x50,
  29. XPT2046_Z1 = 0x30,
  30. XPT2046_Z2 = 0x40
  31. };
  32. class XPT2046 {
  33. public:
  34. static void init();
  35. static uint8_t read_buttons();
  36. bool getTouchPoint(uint16_t &x, uint16_t &y);
  37. static bool isTouched();
  38. inline void waitForRelease() { while (isTouched()) { /* nada */ } }
  39. inline void waitForTouch(uint16_t &x, uint16_t &y) { while (!getTouchPoint(x, y)) { /* nada */ } }
  40. private:
  41. static uint16_t getInTouch(const XPTCoordinate coordinate);
  42. };
  43. extern XPT2046 touch;