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.

pinmapping.h 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #pragma once
  23. #include "../../../inc/MarlinConfigPre.h"
  24. #include <stdint.h>
  25. #include "../hardware/Gpio.h"
  26. typedef pin_type pin_t;
  27. #define P_NC -1
  28. constexpr uint16_t NUM_DIGITAL_PINS = Gpio::pin_count;
  29. constexpr uint8_t NUM_ANALOG_INPUTS = 16;
  30. #define HAL_SENSITIVE_PINS
  31. constexpr uint8_t analog_offset = NUM_DIGITAL_PINS - NUM_ANALOG_INPUTS;
  32. // Get the digital pin for an analog index
  33. constexpr pin_t analogInputToDigitalPin(const int8_t p) {
  34. return (WITHIN(p, 0, NUM_ANALOG_INPUTS) ? analog_offset + p : P_NC);
  35. }
  36. // Get the analog index for a digital pin
  37. constexpr int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t p) {
  38. return (WITHIN(p, analog_offset, NUM_DIGITAL_PINS) ? p - analog_offset : P_NC);
  39. }
  40. // Return the index of a pin number
  41. constexpr int16_t GET_PIN_MAP_INDEX(const pin_t pin) { return pin; }
  42. // Test whether the pin is valid
  43. constexpr bool VALID_PIN(const pin_t p) { return WITHIN(p, 0, NUM_DIGITAL_PINS); }
  44. // Test whether the pin is PWM
  45. constexpr bool PWM_PIN(const pin_t p) { return false; }
  46. // Test whether the pin is interruptible
  47. constexpr bool INTERRUPT_PIN(const pin_t p) { return false; }
  48. // Get the pin number at the given index
  49. constexpr pin_t GET_PIN_MAP_PIN(const int16_t ind) { return ind; }
  50. // Parse a G-code word into a pin index
  51. int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);