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.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. typedef uint8_t byte;
  40. #define PROGMEM
  41. #define PSTR(v) (v)
  42. #define PGM_P const char *
  43. // Used for libraries, preprocessor, and constants
  44. #define abs(x) ((x)>0?(x):-(x))
  45. #ifndef isnan
  46. #define isnan std::isnan
  47. #endif
  48. #ifndef isinf
  49. #define isinf std::isinf
  50. #endif
  51. #define sq(v) ((v) * (v))
  52. #define square(v) sq(v)
  53. #define constrain(value, arg_min, arg_max) ((value) < (arg_min) ? (arg_min) :((value) > (arg_max) ? (arg_max) : (value)))
  54. //Interrupts
  55. void cli(void); // Disable
  56. void sei(void); // Enable
  57. void attachInterrupt(uint32_t pin, void (*callback)(void), uint32_t mode);
  58. void detachInterrupt(uint32_t pin);
  59. extern "C" void GpioEnableInt(uint32_t port, uint32_t pin, uint32_t mode);
  60. extern "C" void GpioDisableInt(uint32_t port, uint32_t pin);
  61. // Program Memory
  62. #define pgm_read_ptr(addr) (*((void**)(addr)))
  63. #define pgm_read_byte_near(addr) (*((uint8_t*)(addr)))
  64. #define pgm_read_float_near(addr) (*((float*)(addr)))
  65. #define pgm_read_word_near(addr) (*((uint16_t*)(addr)))
  66. #define pgm_read_dword_near(addr) (*((uint32_t*)(addr)))
  67. #define pgm_read_byte(addr) pgm_read_byte_near(addr)
  68. #define pgm_read_float(addr) pgm_read_float_near(addr)
  69. #define pgm_read_word(addr) pgm_read_word_near(addr)
  70. #define pgm_read_dword(addr) pgm_read_dword_near(addr)
  71. using std::memcpy;
  72. #define memcpy_P memcpy
  73. #define sprintf_P sprintf
  74. #define strstr_P strstr
  75. #define strncpy_P strncpy
  76. #define vsnprintf_P vsnprintf
  77. #define strcpy_P strcpy
  78. #define snprintf_P snprintf
  79. #define strlen_P strlen
  80. // Time functions
  81. extern "C" {
  82. void delay(const int milis);
  83. }
  84. void _delay_ms(const int delay);
  85. void delayMicroseconds(unsigned long);
  86. uint32_t millis();
  87. //IO functions
  88. void pinMode(const pin_t, const uint8_t);
  89. void digitalWrite(pin_t, uint8_t);
  90. bool digitalRead(pin_t);
  91. void analogWrite(pin_t, int);
  92. uint16_t analogRead(pin_t);
  93. // EEPROM
  94. void eeprom_write_byte(unsigned char *pos, unsigned char value);
  95. unsigned char eeprom_read_byte(unsigned char *pos);
  96. void eeprom_read_block(void *__dst, const void *__src, size_t __n);
  97. void eeprom_update_block(const void *__src, void *__dst, size_t __n);
  98. int32_t random(int32_t);
  99. int32_t random(int32_t, int32_t);
  100. void randomSeed(uint32_t);
  101. char *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s);
  102. int map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max);