From a74aad3b4a60a3e69f33afaea7f8680da705e83a Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Wed, 22 May 2019 01:28:12 +0200 Subject: [PATCH] Clean up HALs / FastIO (#14082) --- Marlin/src/HAL/HAL_AVR/fastio_AVR.h | 6 +---- Marlin/src/HAL/HAL_DUE/HAL.h | 15 ------------ Marlin/src/HAL/HAL_DUE/fastio_Due.h | 3 --- Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h | 1 - Marlin/src/HAL/HAL_LINUX/fastio.h | 15 ------------ Marlin/src/HAL/HAL_LINUX/watchdog.h | 5 ---- Marlin/src/HAL/HAL_LPC1768/fastio.h | 10 +------- Marlin/src/HAL/HAL_LPC1768/watchdog.h | 5 ---- Marlin/src/HAL/HAL_STM32/HAL.h | 8 ------- Marlin/src/HAL/HAL_STM32/fastio_STM32.h | 4 +--- Marlin/src/HAL/HAL_STM32F1/HAL.h | 15 ------------ Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h | 4 +--- Marlin/src/HAL/HAL_STM32F4/HAL.h | 23 ------------------ Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h | 4 +--- Marlin/src/HAL/HAL_STM32F7/HAL.h | 23 ------------------ Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h | 4 +--- Marlin/src/HAL/HAL_TEENSY31_32/HAL.h | 24 +------------------ .../src/HAL/HAL_TEENSY31_32/fastio_Teensy.h | 1 - Marlin/src/HAL/HAL_TEENSY35_36/HAL.h | 24 +------------------ .../src/HAL/HAL_TEENSY35_36/fastio_Teensy.h | 1 - Marlin/src/HAL/shared/Marduino.h | 9 +++++++ 21 files changed, 17 insertions(+), 187 deletions(-) diff --git a/Marlin/src/HAL/HAL_AVR/fastio_AVR.h b/Marlin/src/HAL/HAL_AVR/fastio_AVR.h index 8c1850e8a4..f0ef7af1c8 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_AVR.h @@ -81,9 +81,8 @@ #define _SET_INPUT(IO) CBI(DIO ## IO ## _DDR, DIO ## IO ## _PIN) #define _SET_OUTPUT(IO) SBI(DIO ## IO ## _DDR, DIO ## IO ## _PIN) -#define _IS_INPUT(IO) !TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN) +#define _IS_INPUT(IO) !TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN) #define _IS_OUTPUT(IO) TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN) -#define _HAS_TIMER(IO) bool(DIO ## IO ## _PWM) // digitalRead/Write wrappers #ifdef FASTIO_EXT_START @@ -106,7 +105,6 @@ #define IS_INPUT(IO) _IS_INPUT(IO) #define IS_OUTPUT(IO) _IS_OUTPUT(IO) -#define HAS_TIMER(IO) _HAS_TIMER(IO) #define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0) @@ -353,5 +351,3 @@ enum ClockSource2 : char { #else #error "unknown CPU" #endif - -#define USEABLE_HARDWARE_PWM(P) (PWM_PIN(P) && !PWM_CHK(P)) diff --git a/Marlin/src/HAL/HAL_DUE/HAL.h b/Marlin/src/HAL/HAL_DUE/HAL.h index 2fd9a0b0dd..af22119f17 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL.h +++ b/Marlin/src/HAL/HAL_DUE/HAL.h @@ -78,14 +78,6 @@ #undef pgm_read_word #define pgm_read_word(addr) (*((uint16_t*)(addr))) -#define RST_POWER_ON 1 -#define RST_EXTERNAL 2 -#define RST_BROWN_OUT 4 -#define RST_WATCHDOG 8 -#define RST_JTAG 16 -#define RST_SOFTWARE 32 -#define RST_BACKUP 64 - typedef int8_t pin_t; #define HAL_SERVO_LIB Servo @@ -143,13 +135,6 @@ inline void HAL_adc_init(void) {}//todo void HAL_adc_start_conversion(const uint8_t adc_pin); uint16_t HAL_adc_get_result(void); -uint16_t HAL_getAdcReading(uint8_t chan); -void HAL_startAdcConversion(uint8_t chan); -uint8_t HAL_pinToAdcChannel(int pin); -uint16_t HAL_getAdcFreerun(uint8_t chan, bool wait_for_conversion = false); -//uint16_t HAL_getAdcSuperSample(uint8_t chan); -void HAL_enable_AdcFreerun(void); -//void HAL_disable_AdcFreerun(uint8_t chan); // // Pin Map diff --git a/Marlin/src/HAL/HAL_DUE/fastio_Due.h b/Marlin/src/HAL/HAL_DUE/fastio_Due.h index 542469f65e..fd89a248e2 100644 --- a/Marlin/src/HAL/HAL_DUE/fastio_Due.h +++ b/Marlin/src/HAL/HAL_DUE/fastio_Due.h @@ -46,7 +46,6 @@ // Due has 12 PWMs assigned to logical pins 2-13. // 6, 7, 8 & 9 come from the PWM controller. The others come from the timers. #define PWM_PIN(P) WITHIN(P, 2, 13) -#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) #ifndef MASK #define MASK(PIN) (1 << PIN) @@ -180,8 +179,6 @@ #define IS_INPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0) // Check if pin is an output #define IS_OUTPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) != 0) -// Check if pin is a timer - Must be a constexpr -#define HAS_TIMER(IO) ((IO) >= 2 && (IO) <= 13) // Shorthand #define OUT_WRITE(IO,V) { SET_OUTPUT(IO); WRITE(IO,V); } diff --git a/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h b/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h index b71ca78418..c996d643a6 100644 --- a/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h +++ b/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h @@ -67,7 +67,6 @@ // PWM outputs #define PWM_PIN(P) (P < 34) // NOTE Pins >= 34 are input only on ESP32, so they can't be used for output. -#define USEABLE_HARDWARE_PWM(P) (!IS_I2S_EXPANDER_PIN(P) && PWM_PIN(P)) // Toggle pin value #define TOGGLE(IO) WRITE(IO, !READ(IO)) diff --git a/Marlin/src/HAL/HAL_LINUX/fastio.h b/Marlin/src/HAL/HAL_LINUX/fastio.h index d304c4b2a2..dcf9136f78 100644 --- a/Marlin/src/HAL/HAL_LINUX/fastio.h +++ b/Marlin/src/HAL/HAL_LINUX/fastio.h @@ -80,16 +80,6 @@ /// check if pin is an output #define _IS_OUTPUT(IO) (LPC1768_PIN_PIN(IO) >= 0) -// hg42: HAS_TIMER is used only to check if it's a PWM pin -// hg42: we cannot use USEABLE_HARDWARE_PWM because it uses a function that cannot be used statically -// hg42: instead use PWM bit from the #define - -/// check if pin is a timer -#define _HAS_TIMER(IO) true // could be LPC1768_PIN_PWM(IO), but there -// hg42: could be this: -// #define _HAS_TIMER(IO) LPC1768_PIN_PWM(IO) -// but this is an incomplete check (12 pins are PWMable, but only 6 can be used at the same time) - /// Read a pin wrapper #define READ(IO) _READ(IO) @@ -116,14 +106,9 @@ /// check if pin is an output wrapper #define IS_OUTPUT(IO) _IS_OUTPUT(IO) -/// check if pin is a timer (wrapper) -#define HAS_TIMER(IO) _HAS_TIMER(IO) - // Shorthand #define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0) // digitalRead/Write wrappers #define extDigitalRead(IO) digitalRead(IO) #define extDigitalWrite(IO,V) digitalWrite(IO,V) - -#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) diff --git a/Marlin/src/HAL/HAL_LINUX/watchdog.h b/Marlin/src/HAL/HAL_LINUX/watchdog.h index 26a9f499fd..1355ea77ec 100644 --- a/Marlin/src/HAL/HAL_LINUX/watchdog.h +++ b/Marlin/src/HAL/HAL_LINUX/watchdog.h @@ -21,11 +21,6 @@ */ #pragma once -#define RST_POWER_ON 1 -#define RST_EXTERNAL 2 -#define RST_BROWN_OUT 4 -#define RST_WATCHDOG 8 - #define WDT_TIMEOUT 4000000 // 4 second timeout void watchdog_init(void); diff --git a/Marlin/src/HAL/HAL_LPC1768/fastio.h b/Marlin/src/HAL/HAL_LPC1768/fastio.h index 22bda795d0..3a47c3cadb 100644 --- a/Marlin/src/HAL/HAL_LPC1768/fastio.h +++ b/Marlin/src/HAL/HAL_LPC1768/fastio.h @@ -35,8 +35,7 @@ #include "../shared/Marduino.h" -#define PWM_PIN(P) true // all pins are PWM capable -#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) +#define PWM_PIN(P) true // all pins are PWM capable #define LPC_PIN(pin) gpio_pin(pin) #define LPC_GPIO(port) gpio_port(port) @@ -89,10 +88,6 @@ /// check if pin is an output #define _IS_OUTPUT(IO) (gpio_get_dir(IO)) -/// check if pin is a timer -/// all gpio pins are pwm capable, either interrupt or hardware pwm controlled -#define _HAS_TIMER(IO) true - /// Read a pin wrapper #define READ(IO) _READ(IO) @@ -119,9 +114,6 @@ /// check if pin is an output wrapper #define IS_OUTPUT(IO) _IS_OUTPUT(IO) -/// check if pin is a timer (wrapper) -#define HAS_TIMER(IO) _HAS_TIMER(IO) - // Shorthand #define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0) diff --git a/Marlin/src/HAL/HAL_LPC1768/watchdog.h b/Marlin/src/HAL/HAL_LPC1768/watchdog.h index 26a9f499fd..1355ea77ec 100644 --- a/Marlin/src/HAL/HAL_LPC1768/watchdog.h +++ b/Marlin/src/HAL/HAL_LPC1768/watchdog.h @@ -21,11 +21,6 @@ */ #pragma once -#define RST_POWER_ON 1 -#define RST_EXTERNAL 2 -#define RST_BROWN_OUT 4 -#define RST_WATCHDOG 8 - #define WDT_TIMEOUT 4000000 // 4 second timeout void watchdog_init(void); diff --git a/Marlin/src/HAL/HAL_STM32/HAL.h b/Marlin/src/HAL/HAL_STM32/HAL.h index 44cc96957b..c84fe325a2 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL.h +++ b/Marlin/src/HAL/HAL_STM32/HAL.h @@ -127,14 +127,6 @@ #undef pgm_read_ptr #define pgm_read_ptr(addr) (*(addr)) -#define RST_POWER_ON 1 -#define RST_EXTERNAL 2 -#define RST_BROWN_OUT 4 -#define RST_WATCHDOG 8 -#define RST_JTAG 16 -#define RST_SOFTWARE 32 -#define RST_BACKUP 64 - // -------------------------------------------------------------------------- // Types // -------------------------------------------------------------------------- diff --git a/Marlin/src/HAL/HAL_STM32/fastio_STM32.h b/Marlin/src/HAL/HAL_STM32/fastio_STM32.h index bd2edb4495..77c2eaf4fe 100644 --- a/Marlin/src/HAL/HAL_STM32/fastio_STM32.h +++ b/Marlin/src/HAL/HAL_STM32/fastio_STM32.h @@ -80,10 +80,8 @@ void FastIO_init(); // Must be called before using fast io macros #define IS_INPUT(IO) #define IS_OUTPUT(IO) -#define HAS_TIMER(IO) digitalPinHasPWM(IO) -#define PWM_PIN(P) HAS_TIMER(P) -#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) +#define PWM_PIN(P) digitalPinHasPWM(P) // digitalRead/Write wrappers #define extDigitalRead(IO) digitalRead(IO) diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL.h b/Marlin/src/HAL/HAL_STM32F1/HAL.h index 137d213d97..f47c38a163 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL.h @@ -253,23 +253,8 @@ void HAL_adc_init(void); #define HAL_ADC_READY() true void HAL_adc_start_conversion(const uint8_t adc_pin); - uint16_t HAL_adc_get_result(void); -/* Todo: Confirm none of this is needed. -uint16_t HAL_getAdcReading(uint8_t chan); - -void HAL_startAdcConversion(uint8_t chan); -uint8_t HAL_pinToAdcChannel(int pin); - -uint16_t HAL_getAdcFreerun(uint8_t chan, bool wait_for_conversion = false); -//uint16_t HAL_getAdcSuperSample(uint8_t chan); - -void HAL_enable_AdcFreerun(void); -//void HAL_disable_AdcFreerun(uint8_t chan); - -*/ - #define GET_PIN_MAP_PIN(index) index #define GET_PIN_MAP_INDEX(pin) pin #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) diff --git a/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h b/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h index 12cda51459..3ca2dfdd9d 100644 --- a/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h +++ b/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h @@ -50,10 +50,8 @@ #define IS_INPUT(IO) (_GET_MODE(IO) == GPIO_INPUT_FLOATING || _GET_MODE(IO) == GPIO_INPUT_ANALOG || _GET_MODE(IO) == GPIO_INPUT_PU || _GET_MODE(IO) == GPIO_INPUT_PD) #define IS_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP) -#define HAS_TIMER(IO) (PIN_MAP[IO].timer_device != nullptr) -#define PWM_PIN(P) HAS_TIMER(P) -#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) +#define PWM_PIN(P) (PIN_MAP[IO].timer_device != nullptr) // digitalRead/Write wrappers #define extDigitalRead(IO) digitalRead(IO) diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL.h b/Marlin/src/HAL/HAL_STM32F4/HAL.h index 6f2d22b8dd..4f621e348a 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F4/HAL.h @@ -136,14 +136,6 @@ #undef pgm_read_ptr #define pgm_read_ptr(addr) (*(addr)) -#define RST_POWER_ON 1 -#define RST_EXTERNAL 2 -#define RST_BROWN_OUT 4 -#define RST_WATCHDOG 8 -#define RST_JTAG 16 -#define RST_SOFTWARE 32 -#define RST_BACKUP 64 - // -------------------------------------------------------------------------- // Types // -------------------------------------------------------------------------- @@ -232,23 +224,8 @@ inline void HAL_adc_init(void) {} #define HAL_ADC_READY() true void HAL_adc_start_conversion(const uint8_t adc_pin); - uint16_t HAL_adc_get_result(void); -/* Todo: Confirm none of this is needed. -uint16_t HAL_getAdcReading(uint8_t chan); - -void HAL_startAdcConversion(uint8_t chan); -uint8_t HAL_pinToAdcChannel(int pin); - -uint16_t HAL_getAdcFreerun(uint8_t chan, bool wait_for_conversion = false); -//uint16_t HAL_getAdcSuperSample(uint8_t chan); - -void HAL_enable_AdcFreerun(void); -//void HAL_disable_AdcFreerun(uint8_t chan); - -*/ - #define GET_PIN_MAP_PIN(index) index #define GET_PIN_MAP_INDEX(pin) pin #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) diff --git a/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h b/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h index bac5bdabca..1d548ca29e 100644 --- a/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h +++ b/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h @@ -50,10 +50,8 @@ #define IS_INPUT(IO) #define IS_OUTPUT(IO) -#define HAS_TIMER(IO) true -#define PWM_PIN(P) HAS_TIMER(P) -#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) +#define PWM_PIN(P) true // digitalRead/Write wrappers #define extDigitalRead(IO) digitalRead(IO) diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL.h b/Marlin/src/HAL/HAL_STM32F7/HAL.h index 878d933653..729547e94e 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL.h @@ -125,14 +125,6 @@ #undef pgm_read_ptr #define pgm_read_ptr(addr) (*(addr)) -#define RST_POWER_ON 1 -#define RST_EXTERNAL 2 -#define RST_BROWN_OUT 4 -#define RST_WATCHDOG 8 -#define RST_JTAG 16 -#define RST_SOFTWARE 32 -#define RST_BACKUP 64 - // -------------------------------------------------------------------------- // Types // -------------------------------------------------------------------------- @@ -211,23 +203,8 @@ inline void HAL_adc_init(void) {} #define HAL_ADC_READY() true void HAL_adc_start_conversion(const uint8_t adc_pin); - uint16_t HAL_adc_get_result(void); -/* Todo: Confirm none of this is needed. -uint16_t HAL_getAdcReading(uint8_t chan); - -void HAL_startAdcConversion(uint8_t chan); -uint8_t HAL_pinToAdcChannel(int pin); - -uint16_t HAL_getAdcFreerun(uint8_t chan, bool wait_for_conversion = false); -//uint16_t HAL_getAdcSuperSample(uint8_t chan); - -void HAL_enable_AdcFreerun(void); -//void HAL_disable_AdcFreerun(uint8_t chan); - -*/ - #define GET_PIN_MAP_PIN(index) index #define GET_PIN_MAP_INDEX(pin) pin #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) diff --git a/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h index 50b071ff30..a1b3056d80 100644 --- a/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h @@ -49,10 +49,8 @@ #define IS_INPUT(IO) #define IS_OUTPUT(IO) -#define HAS_TIMER(IO) true -#define PWM_PIN(P) HAS_TIMER(P) -#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) +#define PWM_PIN(P) true // digitalRead/Write wrappers #define extDigitalRead(IO) digitalRead(IO) diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h b/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h index 0fb1b551fc..dbc75540b3 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h @@ -89,14 +89,6 @@ typedef int8_t pin_t; #undef pgm_read_word #define pgm_read_word(addr) (*((uint16_t*)(addr))) -#define RST_POWER_ON 1 -#define RST_EXTERNAL 2 -#define RST_BROWN_OUT 4 -#define RST_WATCHDOG 8 -#define RST_JTAG 16 -#define RST_SOFTWARE 32 -#define RST_BACKUP 64 - // Clear the reset reason void HAL_clear_reset_source(void); @@ -128,25 +120,11 @@ void HAL_adc_init(); #define HAL_READ_ADC() HAL_adc_get_result() #define HAL_ADC_READY() true -#define HAL_ANALOG_SELECT(pin) NOOP; +#define HAL_ANALOG_SELECT(pin) void HAL_adc_start_conversion(const uint8_t adc_pin); - uint16_t HAL_adc_get_result(void); -/* -uint16_t HAL_getAdcReading(uint8_t chan); - -void HAL_startAdcConversion(uint8_t chan); -uint8_t HAL_pinToAdcChannel(int pin); - -uint16_t HAL_getAdcFreerun(uint8_t chan, bool wait_for_conversion = false); -//uint16_t HAL_getAdcSuperSample(uint8_t chan); - -void HAL_enable_AdcFreerun(void); -//void HAL_disable_AdcFreerun(uint8_t chan); -*/ - #define GET_PIN_MAP_PIN(index) index #define GET_PIN_MAP_INDEX(pin) pin #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h b/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h index 928cd758e7..96bbc93112 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h @@ -91,7 +91,6 @@ #define extDigitalWrite(IO,V) digitalWrite(IO,V) #define PWM_PIN(P) digitalPinHasPWM(P) -#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) /** * Ports, functions, and pins diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h index 0cd3ed8de5..9ead7405a7 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h @@ -97,14 +97,6 @@ typedef int8_t pin_t; #undef pgm_read_word #define pgm_read_word(addr) (*((uint16_t*)(addr))) -#define RST_POWER_ON 1 -#define RST_EXTERNAL 2 -#define RST_BROWN_OUT 4 -#define RST_WATCHDOG 8 -#define RST_JTAG 16 -#define RST_SOFTWARE 32 -#define RST_BACKUP 64 - /** clear reset reason */ void HAL_clear_reset_source(void); @@ -133,25 +125,11 @@ void HAL_adc_init(); #define HAL_READ_ADC() HAL_adc_get_result() #define HAL_ADC_READY() true -#define HAL_ANALOG_SELECT(pin) NOOP; +#define HAL_ANALOG_SELECT(pin) void HAL_adc_start_conversion(const uint8_t adc_pin); - uint16_t HAL_adc_get_result(void); -/* - uint16_t HAL_getAdcReading(uint8_t chan); - - void HAL_startAdcConversion(uint8_t chan); - uint8_t HAL_pinToAdcChannel(int pin); - - uint16_t HAL_getAdcFreerun(uint8_t chan, bool wait_for_conversion = false); - //uint16_t HAL_getAdcSuperSample(uint8_t chan); - - void HAL_enable_AdcFreerun(void); - //void HAL_disable_AdcFreerun(uint8_t chan); -*/ - #define GET_PIN_MAP_PIN(index) index #define GET_PIN_MAP_INDEX(pin) pin #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h index b9ddd957c1..5df7faffb9 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h @@ -90,7 +90,6 @@ #define extDigitalWrite(IO,V) digitalWrite(IO,V) #define PWM_PIN(P) digitalPinHasPWM(P) -#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) /** * Ports, functions, and pins diff --git a/Marlin/src/HAL/shared/Marduino.h b/Marlin/src/HAL/shared/Marduino.h index 8c840cd02d..78bddecd40 100644 --- a/Marlin/src/HAL/shared/Marduino.h +++ b/Marlin/src/HAL/shared/Marduino.h @@ -55,3 +55,12 @@ //#define strchr_P(s,c) strchr(s,c) #endif #endif + +// Restart causes +#define RST_POWER_ON 1 +#define RST_EXTERNAL 2 +#define RST_BROWN_OUT 4 +#define RST_WATCHDOG 8 +#define RST_JTAG 16 +#define RST_SOFTWARE 32 +#define RST_BACKUP 64