From 57315f02cbacea6a90c56349dc7e571e53692740 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Dec 2021 21:25:47 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20missing=20ADC=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/DUE/HAL.h | 2 -- Marlin/src/HAL/ESP32/HAL.h | 3 --- Marlin/src/HAL/LINUX/HAL.h | 1 - Marlin/src/HAL/LPC1768/HAL.h | 2 -- Marlin/src/HAL/NATIVE_SIM/HAL.h | 1 - Marlin/src/HAL/SAMD51/HAL.h | 2 -- Marlin/src/HAL/STM32/HAL.h | 4 +--- Marlin/src/HAL/STM32F1/HAL.h | 2 -- Marlin/src/HAL/TEENSY31_32/HAL.h | 2 -- Marlin/src/HAL/TEENSY35_36/HAL.h | 2 -- Marlin/src/HAL/TEENSY40_41/HAL.h | 2 -- 11 files changed, 1 insertion(+), 22 deletions(-) diff --git a/Marlin/src/HAL/DUE/HAL.h b/Marlin/src/HAL/DUE/HAL.h index 5d1d2cf236..96a59fcf3c 100644 --- a/Marlin/src/HAL/DUE/HAL.h +++ b/Marlin/src/HAL/DUE/HAL.h @@ -131,8 +131,6 @@ typedef Servo hal_servo_t; #define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1) #endif -#define HAL_ANALOG_SELECT(ch) - // // Pin Mapping for M42, M43, M226 // diff --git a/Marlin/src/HAL/ESP32/HAL.h b/Marlin/src/HAL/ESP32/HAL.h index 361c903231..138346b950 100644 --- a/Marlin/src/HAL/ESP32/HAL.h +++ b/Marlin/src/HAL/ESP32/HAL.h @@ -85,9 +85,6 @@ void noTone(const pin_t _pin); void analogWrite(pin_t pin, int value); -// ADC -#define HAL_ANALOG_SELECT(pin) - // // Pin Mapping for M42, M43, M226 // diff --git a/Marlin/src/HAL/LINUX/HAL.h b/Marlin/src/HAL/LINUX/HAL.h index c1b7a54997..a2a9692cbd 100644 --- a/Marlin/src/HAL/LINUX/HAL.h +++ b/Marlin/src/HAL/LINUX/HAL.h @@ -82,7 +82,6 @@ extern MSerialT usb_serial; // ADC #define HAL_ADC_VREF 5.0 #define HAL_ADC_RESOLUTION 10 -#define HAL_ANALOG_SELECT(ch) hal.adc_enable(ch) // ------------------------ // Class Utilities diff --git a/Marlin/src/HAL/LPC1768/HAL.h b/Marlin/src/HAL/LPC1768/HAL.h index f1cdbe6f07..e1ade3d9a7 100644 --- a/Marlin/src/HAL/LPC1768/HAL.h +++ b/Marlin/src/HAL/LPC1768/HAL.h @@ -133,8 +133,6 @@ extern DefaultSerial1 USBSerial; #define HAL_ADC_RESOLUTION 12 // 15 bit maximum, raw temperature is stored as int16_t #define HAL_ADC_FILTERED // Disable oversampling done in Marlin as ADC values already filtered in HAL -#define HAL_ANALOG_SELECT(pin) hal.adc_enable(pin) - // // Pin Mapping for M42, M43, M226 // diff --git a/Marlin/src/HAL/NATIVE_SIM/HAL.h b/Marlin/src/HAL/NATIVE_SIM/HAL.h index 0798bdde39..50da5af2eb 100644 --- a/Marlin/src/HAL/NATIVE_SIM/HAL.h +++ b/Marlin/src/HAL/NATIVE_SIM/HAL.h @@ -117,7 +117,6 @@ extern MSerialT serial_stream_3; #define HAL_ADC_VREF 5.0 #define HAL_ADC_RESOLUTION 10 -#define HAL_ANALOG_SELECT(ch) hal.adc_enable(ch) /* ---------------- Delay in cycles */ diff --git a/Marlin/src/HAL/SAMD51/HAL.h b/Marlin/src/HAL/SAMD51/HAL.h index 9fcd73e9b6..e9d4a70c3f 100644 --- a/Marlin/src/HAL/SAMD51/HAL.h +++ b/Marlin/src/HAL/SAMD51/HAL.h @@ -106,8 +106,6 @@ typedef Servo hal_servo_t; // ADC // -#define HAL_ANALOG_SELECT(pin) - //#define HAL_ADC_FILTERED // Disable Marlin's oversampling. The HAL filters ADC values. #define HAL_ADC_VREF 3.3 #define HAL_ADC_RESOLUTION 10 // ... 12 diff --git a/Marlin/src/HAL/STM32/HAL.h b/Marlin/src/HAL/STM32/HAL.h index c23ddf69bd..f9bf1c938a 100644 --- a/Marlin/src/HAL/STM32/HAL.h +++ b/Marlin/src/HAL/STM32/HAL.h @@ -142,8 +142,6 @@ typedef libServo hal_servo_t; // ADC // ------------------------ -#define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT) - #ifdef ADC_RESOLUTION #define HAL_ADC_RESOLUTION ADC_RESOLUTION #else @@ -240,7 +238,7 @@ public: } // Called by Temperature::init for each sensor at startup - static void adc_enable(const pin_t pin); + static inline void adc_enable(const pin_t pin) { pinMode(pin, INPUT); } // Begin ADC sampling on the given channel static void adc_start(const pin_t pin) { adc_result = analogRead(pin); } diff --git a/Marlin/src/HAL/STM32F1/HAL.h b/Marlin/src/HAL/STM32F1/HAL.h index 8fb4c9299f..bdbf4a1885 100644 --- a/Marlin/src/HAL/STM32F1/HAL.h +++ b/Marlin/src/HAL/STM32F1/HAL.h @@ -188,8 +188,6 @@ extern uint16_t HAL_adc_result; // ADC // ------------------------ -#define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT_ANALOG); - #ifdef ADC_RESOLUTION #define HAL_ADC_RESOLUTION ADC_RESOLUTION #else diff --git a/Marlin/src/HAL/TEENSY31_32/HAL.h b/Marlin/src/HAL/TEENSY31_32/HAL.h index a5f67a50f0..0661b55f53 100644 --- a/Marlin/src/HAL/TEENSY31_32/HAL.h +++ b/Marlin/src/HAL/TEENSY31_32/HAL.h @@ -105,8 +105,6 @@ uint32_t __get_PRIMASK(void); // CMSIS #define HAL_ADC_VREF 3.3 #define HAL_ADC_RESOLUTION 10 -#define HAL_ANALOG_SELECT(pin) - // // Pin Mapping for M42, M43, M226 // diff --git a/Marlin/src/HAL/TEENSY35_36/HAL.h b/Marlin/src/HAL/TEENSY35_36/HAL.h index 8ca76dc636..1cc465c4bb 100644 --- a/Marlin/src/HAL/TEENSY35_36/HAL.h +++ b/Marlin/src/HAL/TEENSY35_36/HAL.h @@ -110,8 +110,6 @@ typedef int8_t pin_t; #define HAL_ADC_VREF 3.3 #define HAL_ADC_RESOLUTION 10 -#define HAL_ANALOG_SELECT(pin) - // // Pin Mapping for M42, M43, M226 // diff --git a/Marlin/src/HAL/TEENSY40_41/HAL.h b/Marlin/src/HAL/TEENSY40_41/HAL.h index 10263ecb39..7bad143179 100644 --- a/Marlin/src/HAL/TEENSY40_41/HAL.h +++ b/Marlin/src/HAL/TEENSY40_41/HAL.h @@ -129,8 +129,6 @@ typedef int8_t pin_t; #define HAL_ADC_RESOLUTION 10 #define HAL_ADC_FILTERED // turn off ADC oversampling -#define HAL_ANALOG_SELECT(pin) - // // Pin Mapping for M42, M43, M226 //