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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /**
  2. * Marlin 3D Printer Firmware
  3. *
  4. * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  5. * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
  6. * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
  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. /**
  23. * HAL_LPC1768/HAL.h
  24. * Hardware Abstraction Layer for NXP LPC1768
  25. */
  26. #ifndef _HAL_LPC1768_H_
  27. #define _HAL_LPC1768_H_
  28. // --------------------------------------------------------------------------
  29. // Includes
  30. // --------------------------------------------------------------------------
  31. #include <stdint.h>
  32. #include <stdarg.h>
  33. #undef min
  34. #undef max
  35. #include <algorithm>
  36. void _printf (const char *format, ...);
  37. void _putc(uint8_t c);
  38. uint8_t _getc();
  39. extern "C" volatile uint32_t _millis;
  40. //arduino: Print.h
  41. #define DEC 10
  42. #define HEX 16
  43. #define OCT 8
  44. #define BIN 2
  45. //arduino: binary.h (weird defines)
  46. #define B01 1
  47. #define B10 2
  48. #include <Arduino.h>
  49. #include <pinmapping.h>
  50. #include "fastio.h"
  51. #include "watchdog.h"
  52. #include "serial.h"
  53. #include "HAL_timers.h"
  54. #include "HardwareSerial.h"
  55. #define ST7920_DELAY_1 DELAY_20_NOP;DELAY_20_NOP;DELAY_20_NOP
  56. #define ST7920_DELAY_2 DELAY_20_NOP;DELAY_20_NOP;DELAY_20_NOP;DELAY_10_NOP;DELAY_5_NOP
  57. #define ST7920_DELAY_3 DELAY_20_NOP;DELAY_20_NOP;DELAY_20_NOP;DELAY_10_NOP;DELAY_5_NOP
  58. extern HalSerial usb_serial;
  59. #if !WITHIN(SERIAL_PORT, -1, 3)
  60. #error "SERIAL_PORT must be from -1 to 3"
  61. #endif
  62. #if SERIAL_PORT == -1
  63. #define MYSERIAL0 usb_serial
  64. #elif SERIAL_PORT == 0
  65. extern HardwareSerial Serial;
  66. #define MYSERIAL0 Serial
  67. #elif SERIAL_PORT == 1
  68. extern HardwareSerial Serial1;
  69. #define MYSERIAL0 Serial1
  70. #elif SERIAL_PORT == 2
  71. extern HardwareSerial Serial2;
  72. #define MYSERIAL0 Serial2
  73. #elif SERIAL_PORT == 3
  74. #define MYSERIAL0 Serial3
  75. extern HardwareSerial Serial3;
  76. #endif
  77. #ifdef SERIAL_PORT_2
  78. #if !WITHIN(SERIAL_PORT_2, -1, 3)
  79. #error "SERIAL_PORT_2 must be from -1 to 3"
  80. #elif SERIAL_PORT_2 == SERIAL_PORT
  81. #error "SERIAL_PORT_2 must be different than SERIAL_PORT"
  82. #endif
  83. #define NUM_SERIAL 2
  84. #if SERIAL_PORT_2 == -1
  85. #define MYSERIAL1 usb_serial
  86. #elif SERIAL_PORT_2 == 0
  87. extern HardwareSerial Serial;
  88. #define MYSERIAL1 Serial
  89. #elif SERIAL_PORT_2 == 1
  90. extern HardwareSerial Serial1;
  91. #define MYSERIAL1 Serial1
  92. #elif SERIAL_PORT_2 == 2
  93. extern HardwareSerial Serial2;
  94. #define MYSERIAL1 Serial2
  95. #elif SERIAL_PORT_2 == 3
  96. extern HardwareSerial Serial3;
  97. #define MYSERIAL1 Serial3
  98. #endif
  99. #else
  100. #define NUM_SERIAL 1
  101. #endif
  102. #define CRITICAL_SECTION_START uint32_t primask = __get_PRIMASK(); __disable_irq();
  103. #define CRITICAL_SECTION_END if (!primask) __enable_irq();
  104. //Utility functions
  105. int freeMemory(void);
  106. // SPI: Extended functions which take a channel number (hardware SPI only)
  107. /** Write single byte to specified SPI channel */
  108. void spiSend(uint32_t chan, byte b);
  109. /** Write buffer to specified SPI channel */
  110. void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
  111. /** Read single byte from specified SPI channel */
  112. uint8_t spiRec(uint32_t chan);
  113. // ADC
  114. #define HAL_ANALOG_SELECT(pin) HAL_adc_enable_channel(pin)
  115. #define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
  116. #define HAL_READ_ADC HAL_adc_get_result()
  117. void HAL_adc_init(void);
  118. void HAL_adc_enable_channel(int pin);
  119. void HAL_adc_start_conversion(const uint8_t adc_pin);
  120. uint16_t HAL_adc_get_result(void);
  121. #endif // _HAL_LPC1768_H_