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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
  5. *
  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. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #pragma once
  20. /**
  21. * Description: HAL for Espressif ESP32 WiFi
  22. */
  23. #define CPU_32_BIT
  24. #include <stdint.h>
  25. #include "../shared/Marduino.h"
  26. #include "../shared/math_32bit.h"
  27. #include "../shared/HAL_SPI.h"
  28. #include "fastio.h"
  29. #include "watchdog.h"
  30. #include "i2s.h"
  31. #include "timers.h"
  32. #include "WebSocketSerial.h"
  33. #include "FlushableHardwareSerial.h"
  34. // ------------------------
  35. // Defines
  36. // ------------------------
  37. extern portMUX_TYPE spinlock;
  38. #define MYSERIAL0 flushableSerial
  39. #if ENABLED(WIFISUPPORT)
  40. #define MYSERIAL1 webSocketSerial
  41. #define NUM_SERIAL 2
  42. #else
  43. #define NUM_SERIAL 1
  44. #endif
  45. #define CRITICAL_SECTION_START portENTER_CRITICAL(&spinlock)
  46. #define CRITICAL_SECTION_END portEXIT_CRITICAL(&spinlock)
  47. #define ISRS_ENABLED() (spinlock.owner == portMUX_FREE_VAL)
  48. #define ENABLE_ISRS() if (spinlock.owner != portMUX_FREE_VAL) portEXIT_CRITICAL(&spinlock)
  49. #define DISABLE_ISRS() portENTER_CRITICAL(&spinlock)
  50. // Fix bug in pgm_read_ptr
  51. #undef pgm_read_ptr
  52. #define pgm_read_ptr(addr) (*(addr))
  53. // ------------------------
  54. // Types
  55. // ------------------------
  56. typedef int16_t pin_t;
  57. #define HAL_SERVO_LIB Servo
  58. // ------------------------
  59. // Public Variables
  60. // ------------------------
  61. /** result of last ADC conversion */
  62. extern uint16_t HAL_adc_result;
  63. // ------------------------
  64. // Public functions
  65. // ------------------------
  66. // clear reset reason
  67. void HAL_clear_reset_source();
  68. // reset reason
  69. uint8_t HAL_get_reset_source();
  70. void _delay_ms(int delay);
  71. #pragma GCC diagnostic push
  72. #pragma GCC diagnostic ignored "-Wunused-function"
  73. int freeMemory();
  74. #pragma GCC diagnostic pop
  75. void analogWrite(pin_t pin, int value);
  76. // EEPROM
  77. void eeprom_write_byte(uint8_t *pos, unsigned char value);
  78. uint8_t eeprom_read_byte(uint8_t *pos);
  79. void eeprom_read_block (void *__dst, const void *__src, size_t __n);
  80. void eeprom_update_block (const void *__src, void *__dst, size_t __n);
  81. // ADC
  82. #define HAL_ANALOG_SELECT(pin)
  83. void HAL_adc_init();
  84. #define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
  85. #define HAL_ADC_RESOLUTION 10
  86. #define HAL_READ_ADC() HAL_adc_result
  87. #define HAL_ADC_READY() true
  88. void HAL_adc_start_conversion(uint8_t adc_pin);
  89. #define GET_PIN_MAP_PIN(index) index
  90. #define GET_PIN_MAP_INDEX(pin) pin
  91. #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
  92. // Enable hooks into idle and setup for HAL
  93. #define HAL_IDLETASK 1
  94. #define BOARD_INIT() HAL_init_board();
  95. void HAL_idletask();
  96. void HAL_init();
  97. void HAL_init_board();