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.

Arduino.h 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2019 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 <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. #include <stddef.h>
  24. #include <stdint.h>
  25. #include <math.h>
  26. #include <cstring>
  27. #include <pinmapping.h>
  28. #define HIGH 0x01
  29. #define LOW 0x00
  30. #define INPUT 0x00
  31. #define OUTPUT 0x01
  32. #define INPUT_PULLUP 0x02
  33. #define INPUT_PULLDOWN 0x03
  34. #define LSBFIRST 0
  35. #define MSBFIRST 1
  36. #define CHANGE 0x02
  37. #define FALLING 0x03
  38. #define RISING 0x04
  39. #define E2END 0xFFF // EEPROM end address
  40. typedef uint8_t byte;
  41. #define PROGMEM
  42. #define PSTR(v) (v)
  43. #define PGM_P const char *
  44. // Used for libraries, preprocessor, and constants
  45. #define min(a,b) ((a)<(b)?(a):(b))
  46. #define max(a,b) ((a)>(b)?(a):(b))
  47. #define abs(x) ((x)>0?(x):-(x))
  48. #ifndef isnan
  49. #define isnan std::isnan
  50. #endif
  51. #ifndef isinf
  52. #define isinf std::isinf
  53. #endif
  54. #define sq(v) ((v) * (v))
  55. #define square(v) sq(v)
  56. #define constrain(value, arg_min, arg_max) ((value) < (arg_min) ? (arg_min) :((value) > (arg_max) ? (arg_max) : (value)))
  57. //Interrupts
  58. void cli(void); // Disable
  59. void sei(void); // Enable
  60. void attachInterrupt(uint32_t pin, void (*callback)(void), uint32_t mode);
  61. void detachInterrupt(uint32_t pin);
  62. extern "C" void GpioEnableInt(uint32_t port, uint32_t pin, uint32_t mode);
  63. extern "C" void GpioDisableInt(uint32_t port, uint32_t pin);
  64. // Program Memory
  65. #define pgm_read_ptr(addr) (*((void**)(addr)))
  66. #define pgm_read_byte_near(addr) (*((uint8_t*)(addr)))
  67. #define pgm_read_float_near(addr) (*((float*)(addr)))
  68. #define pgm_read_word_near(addr) (*((uint16_t*)(addr)))
  69. #define pgm_read_dword_near(addr) (*((uint32_t*)(addr)))
  70. #define pgm_read_byte(addr) pgm_read_byte_near(addr)
  71. #define pgm_read_float(addr) pgm_read_float_near(addr)
  72. #define pgm_read_word(addr) pgm_read_word_near(addr)
  73. #define pgm_read_dword(addr) pgm_read_dword_near(addr)
  74. using std::memcpy;
  75. #define memcpy_P memcpy
  76. #define sprintf_P sprintf
  77. #define strstr_P strstr
  78. #define strncpy_P strncpy
  79. #define vsnprintf_P vsnprintf
  80. #define strcpy_P strcpy
  81. #define snprintf_P snprintf
  82. #define strlen_P strlen
  83. // Time functions
  84. extern "C" {
  85. void delay(const int milis);
  86. }
  87. void _delay_ms(const int delay);
  88. void delayMicroseconds(unsigned long);
  89. uint32_t millis();
  90. //IO functions
  91. void pinMode(const pin_t, const uint8_t);
  92. void digitalWrite(pin_t, uint8_t);
  93. bool digitalRead(pin_t);
  94. void analogWrite(pin_t, int);
  95. uint16_t analogRead(pin_t);
  96. // EEPROM
  97. void eeprom_write_byte(unsigned char *pos, unsigned char value);
  98. unsigned char eeprom_read_byte(unsigned char *pos);
  99. void eeprom_read_block (void *__dst, const void *__src, size_t __n);
  100. void eeprom_update_block (const void *__src, void *__dst, size_t __n);
  101. int32_t random(int32_t);
  102. int32_t random(int32_t, int32_t);
  103. void randomSeed(uint32_t);
  104. char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s);
  105. int map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max);