From c0eb6b0794849434cba7fc1c425a839635f58a2a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 11 Dec 2021 21:29:25 -0600 Subject: [PATCH] PINS_COUNT => NUMBER_PINS_TOTAL --- Marlin/src/HAL/DUE/pinsDebug.h | 2 -- Marlin/src/HAL/SAMD51/pinsDebug.h | 2 +- buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/variant.cpp | 4 ++-- buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/variant.h | 4 ++-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Marlin/src/HAL/DUE/pinsDebug.h b/Marlin/src/HAL/DUE/pinsDebug.h index f01c53c8ce067..f3aa84bd90473 100644 --- a/Marlin/src/HAL/DUE/pinsDebug.h +++ b/Marlin/src/HAL/DUE/pinsDebug.h @@ -61,8 +61,6 @@ * included just in case. */ -#define NUMBER_PINS_TOTAL PINS_COUNT - #define digitalRead_mod(p) extDigitalRead(p) // AVR digitalRead disabled PWM before it read the pin #define PRINT_PORT(p) #define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) diff --git a/Marlin/src/HAL/SAMD51/pinsDebug.h b/Marlin/src/HAL/SAMD51/pinsDebug.h index f0a46fd7c567c..934b98a2090e5 100644 --- a/Marlin/src/HAL/SAMD51/pinsDebug.h +++ b/Marlin/src/HAL/SAMD51/pinsDebug.h @@ -20,7 +20,7 @@ */ #pragma once -#define NUMBER_PINS_TOTAL PINS_COUNT +#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS #define digitalRead_mod(p) extDigitalRead(p) #define PRINT_PORT(p) do{ SERIAL_ECHOPGM(" Port: "); sprintf_P(buffer, PSTR("%c%02ld"), 'A' + g_APinDescription[p].ulPort, g_APinDescription[p].ulPin); SERIAL_ECHO(buffer); }while (0) diff --git a/buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/variant.cpp b/buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/variant.cpp index 72ad45ef46028..2e4b5ee9d144b 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/variant.cpp +++ b/buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/variant.cpp @@ -320,7 +320,7 @@ extern const PinDescription g_APinDescription[]= } ; -uint8_t g_pinStatus[PINS_COUNT] = {0}; +uint8_t g_pinStatus[NUMBER_PINS_TOTAL] = {0}; #ifdef __cplusplus } @@ -412,7 +412,7 @@ void init( void ) __libc_init_array(); // Disable pull-up on every pin - for (unsigned i = 0; i < PINS_COUNT; i++) + for (unsigned i = 0; i < NUMBER_PINS_TOTAL; i++) digitalWrite(i, LOW); // Enable parallel access on PIO output data registers diff --git a/buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/variant.h index 11f8f63bfb59e..357735a9c4fc2 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/variant.h @@ -55,10 +55,10 @@ extern "C"{ *----------------------------------------------------------------------------*/ // Number of pins defined in PinDescription array -#define PINS_COUNT 79 +#define NUMBER_PINS_TOTAL 79 #define NUM_DIGITAL_PINS 66 #define NUM_ANALOG_INPUTS 12 -#define analogInputToDigitalPin(p) ((p < 12) ? (p) + 54 : -1) +#define analogInputToDigitalPin(p) ((p < NUM_ANALOG_INPUTS) ? (p) + 54 : -1) #define digitalPinToPort(P) ( g_APinDescription[P].pPort ) #define digitalPinToBitMask(P) ( g_APinDescription[P].ulPin )