My Marlin configs for Fabrikator Mini and CTC i3 Pro B
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.

fastio_ESP32.h 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. #include "i2s.h"
  24. /**
  25. * Utility functions
  26. */
  27. // Set pin as input
  28. #define _SET_INPUT(IO) pinMode(IO, INPUT)
  29. // Set pin as output
  30. #define _SET_OUTPUT(IO) pinMode(IO, OUTPUT)
  31. // Set pin as input with pullup mode
  32. #define _PULLUP(IO, v) pinMode(IO, v ? INPUT_PULLUP : INPUT)
  33. // Read a pin wrapper
  34. #define READ(IO) digitalRead(IO)
  35. // Write to a pin wrapper
  36. #define WRITE(IO, v) (TEST(IO, 7) ? i2s_write(IO & 0x7F, v) : digitalWrite(IO, v))
  37. // Set pin as input wrapper
  38. #define SET_INPUT(IO) _SET_INPUT(IO)
  39. // Set pin as input with pullup wrapper
  40. #define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
  41. // Set pin as output wrapper
  42. #define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); WRITE(IO, LOW); }while(0)
  43. #define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
  44. //
  45. // Ports and functions
  46. //
  47. // UART
  48. #define RXD 3
  49. #define TXD 1
  50. // TWI (I2C)
  51. #define SCL 5
  52. #define SDA 4