My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

HAL.cpp 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #ifdef __PLAT_LINUX__
  23. #include "../../inc/MarlinConfig.h"
  24. #include "../shared/Delay.h"
  25. // ------------------------
  26. // Serial ports
  27. // ------------------------
  28. MSerialT usb_serial(TERN0(EMERGENCY_PARSER, true));
  29. // U8glib required functions
  30. extern "C" {
  31. void u8g_xMicroDelay(uint16_t val) { DELAY_US(val); }
  32. void u8g_MicroDelay() { u8g_xMicroDelay(1); }
  33. void u8g_10MicroDelay() { u8g_xMicroDelay(10); }
  34. void u8g_Delay(uint16_t val) { delay(val); }
  35. }
  36. //************************//
  37. // return free heap space
  38. int freeMemory() { return 0; }
  39. // ------------------------
  40. // ADC
  41. // ------------------------
  42. uint8_t MarlinHAL::active_ch = 0;
  43. uint16_t MarlinHAL::adc_value() {
  44. const pin_t pin = analogInputToDigitalPin(active_ch);
  45. if (!VALID_PIN(pin)) return 0;
  46. const uint16_t data = ((Gpio::get(pin) >> 2) & 0x3FF);
  47. return data; // return 10bit value as Marlin expects
  48. }
  49. void MarlinHAL::reboot() { /* Reset the application state and GPIO */ }
  50. #endif // __PLAT_LINUX__