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.

HAL.cpp 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. MSerialT usb_serial(TERN0(EMERGENCY_PARSER, true));
  26. // U8glib required functions
  27. extern "C" {
  28. void u8g_xMicroDelay(uint16_t val) { DELAY_US(val); }
  29. void u8g_MicroDelay() { u8g_xMicroDelay(1); }
  30. void u8g_10MicroDelay() { u8g_xMicroDelay(10); }
  31. void u8g_Delay(uint16_t val) { delay(val); }
  32. }
  33. //************************//
  34. // return free heap space
  35. int freeMemory() {
  36. return 0;
  37. }
  38. // ------------------------
  39. // ADC
  40. // ------------------------
  41. void HAL_adc_init() {
  42. }
  43. void HAL_adc_enable_channel(const uint8_t ch) {
  44. }
  45. uint8_t active_ch = 0;
  46. void HAL_adc_start_conversion(const uint8_t ch) {
  47. active_ch = ch;
  48. }
  49. bool HAL_adc_finished() {
  50. return true;
  51. }
  52. uint16_t HAL_adc_get_result() {
  53. pin_t pin = analogInputToDigitalPin(active_ch);
  54. if (!VALID_PIN(pin)) return 0;
  55. uint16_t data = ((Gpio::get(pin) >> 2) & 0x3FF);
  56. return data; // return 10bit value as Marlin expects
  57. }
  58. void HAL_pwm_init() {
  59. }
  60. void HAL_reboot() { /* Reset the application state and GPIO */ }
  61. #endif // __PLAT_LINUX__