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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /* **************************************************************************
  2. Marlin 3D Printer Firmware
  3. Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
  5. Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
  6. This program is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  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. You should have received a copy of the GNU General Public License
  15. along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. ****************************************************************************/
  17. /**
  18. * Description: HAL for Teensy 3.5 and Teensy 3.6
  19. */
  20. #ifndef _HAL_TEENSY_H
  21. #define _HAL_TEENSY_H
  22. // --------------------------------------------------------------------------
  23. // Includes
  24. // --------------------------------------------------------------------------
  25. #include "Arduino.h"
  26. #include "fastio_Teensy.h"
  27. #include "watchdog_Teensy.h"
  28. #include "HAL_timers_Teensy.h"
  29. #include <stdint.h>
  30. // --------------------------------------------------------------------------
  31. // Defines
  32. // --------------------------------------------------------------------------
  33. #undef MOTHERBOARD
  34. #define MOTHERBOARD BOARD_TEENSY35_36
  35. #define IS_32BIT_TEENSY (defined(__MK64FX512__) || defined(__MK66FX1M0__))
  36. #define IS_TEENSY35 defined(__MK64FX512__)
  37. #define IS_TEENSY36 defined(__MK66FX1M0__)
  38. #if SERIAL_PORT == -1
  39. #define MYSERIAL SerialUSB
  40. #elif SERIAL_PORT == 0
  41. #define MYSERIAL Serial
  42. #elif SERIAL_PORT == 1
  43. #define MYSERIAL Serial1
  44. #elif SERIAL_PORT == 2
  45. #define MYSERIAL Serial2
  46. #elif SERIAL_PORT == 3
  47. #define MYSERIAL Serial3
  48. #endif
  49. #define HAL_SERVO_LIB libServo
  50. typedef int8_t pin_t;
  51. #ifndef analogInputToDigitalPin
  52. #define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
  53. #endif
  54. #define CRITICAL_SECTION_START unsigned char _sreg = SREG; cli();
  55. #define CRITICAL_SECTION_END SREG = _sreg;
  56. // On AVR this is in math.h?
  57. #define square(x) ((x)*(x))
  58. #ifndef strncpy_P
  59. #define strncpy_P(dest, src, num) strncpy((dest), (src), (num))
  60. #endif
  61. // Fix bug in pgm_read_ptr
  62. #undef pgm_read_ptr
  63. #define pgm_read_ptr(addr) (*((void**)(addr)))
  64. // Add type-checking to pgm_read_word
  65. #undef pgm_read_word
  66. #define pgm_read_word(addr) (*((uint16_t*)(addr)))
  67. #define RST_POWER_ON 1
  68. #define RST_EXTERNAL 2
  69. #define RST_BROWN_OUT 4
  70. #define RST_WATCHDOG 8
  71. #define RST_JTAG 16
  72. #define RST_SOFTWARE 32
  73. #define RST_BACKUP 64
  74. /** clear reset reason */
  75. void HAL_clear_reset_source(void);
  76. /** reset reason */
  77. uint8_t HAL_get_reset_source(void);
  78. FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
  79. extern "C" {
  80. int freeMemory(void);
  81. }
  82. // SPI: Extended functions which take a channel number (hardware SPI only)
  83. /** Write single byte to specified SPI channel */
  84. void spiSend(uint32_t chan, byte b);
  85. /** Write buffer to specified SPI channel */
  86. void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
  87. /** Read single byte from specified SPI channel */
  88. uint8_t spiRec(uint32_t chan);
  89. // ADC
  90. void HAL_adc_init();
  91. #define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
  92. #define HAL_READ_ADC HAL_adc_get_result()
  93. #define HAL_ANALOG_SELECT(pin) NOOP;
  94. void HAL_adc_start_conversion(const uint8_t adc_pin);
  95. uint16_t HAL_adc_get_result(void);
  96. /*
  97. uint16_t HAL_getAdcReading(uint8_t chan);
  98. void HAL_startAdcConversion(uint8_t chan);
  99. uint8_t HAL_pinToAdcChannel(int pin);
  100. uint16_t HAL_getAdcFreerun(uint8_t chan, bool wait_for_conversion = false);
  101. //uint16_t HAL_getAdcSuperSample(uint8_t chan);
  102. void HAL_enable_AdcFreerun(void);
  103. //void HAL_disable_AdcFreerun(uint8_t chan);
  104. */
  105. #define GET_PIN_MAP_PIN(index) index
  106. #define GET_PIN_MAP_INDEX(pin) pin
  107. #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
  108. // --------------------------------------------------------------------------
  109. //
  110. // --------------------------------------------------------------------------
  111. #endif // _HAL_TEENSY_H