diff --git a/Marlin/src/HAL/HAL_AVR/fastio_AVR.h b/Marlin/src/HAL/HAL_AVR/fastio_AVR.h index 14684d34d..a843f1ae7 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_AVR.h @@ -81,9 +81,9 @@ #define _SET_INPUT(IO) CBI(DIO ## IO ## _DDR, DIO ## IO ## _PIN) #define _SET_OUTPUT(IO) SBI(DIO ## IO ## _DDR, DIO ## IO ## _PIN) -#define _GET_INPUT(IO) !TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN) -#define _GET_OUTPUT(IO) TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN) -#define _GET_TIMER(IO) DIO ## IO ## _PWM +#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) DIO ## IO ## _PWM // digitalRead/Write wrappers #ifdef FASTIO_EXT_START @@ -104,9 +104,9 @@ #define SET_PWM(IO) SET_OUTPUT(IO) -#define GET_INPUT(IO) _GET_INPUT(IO) -#define GET_OUTPUT(IO) _GET_OUTPUT(IO) -#define GET_TIMER(IO) _GET_TIMER(IO) +#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) diff --git a/Marlin/src/HAL/HAL_DUE/fastio_Due.h b/Marlin/src/HAL/HAL_DUE/fastio_Due.h index 4c23a5816..542469f65 100644 --- a/Marlin/src/HAL/HAL_DUE/fastio_Due.h +++ b/Marlin/src/HAL/HAL_DUE/fastio_Due.h @@ -177,11 +177,11 @@ #define SET_PWM(IO) SET_OUTPUT(IO) // Check if pin is an input -#define GET_INPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0) +#define IS_INPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0) // Check if pin is an output -#define GET_OUTPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) != 0) +#define IS_OUTPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) != 0) // Check if pin is a timer - Must be a constexpr -#define GET_TIMER(IO) ((IO) >= 2 && (IO) <= 13) +#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_LINUX/fastio.h b/Marlin/src/HAL/HAL_LINUX/fastio.h index 23b19c878..8eae771a4 100644 --- a/Marlin/src/HAL/HAL_LINUX/fastio.h +++ b/Marlin/src/HAL/HAL_LINUX/fastio.h @@ -75,19 +75,19 @@ // hg42: currently not used, but was used by pinsDebug /// check if pin is an input -#define _GET_INPUT(IO) (LPC1768_PIN_PIN(IO) >= 0) +#define _IS_INPUT(IO) (LPC1768_PIN_PIN(IO) >= 0) /// check if pin is an output -#define _GET_OUTPUT(IO) (LPC1768_PIN_PIN(IO) >= 0) +#define _IS_OUTPUT(IO) (LPC1768_PIN_PIN(IO) >= 0) -// hg42: GET_TIMER is used only to check if it's a PWM pin +// 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 _GET_TIMER(IO) true // could be LPC1768_PIN_PWM(IO), but there +#define _HAS_TIMER(IO) true // could be LPC1768_PIN_PWM(IO), but there // hg42: could be this: -// #define _GET_TIMER(IO) LPC1768_PIN_PWM(IO) +// #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 @@ -112,12 +112,12 @@ #define SET_PWM(IO) SET_OUTPUT(IO) /// check if pin is an input wrapper -#define GET_INPUT(IO) _GET_INPUT(IO) +#define IS_INPUT(IO) _IS_INPUT(IO) /// check if pin is an output wrapper -#define GET_OUTPUT(IO) _GET_OUTPUT(IO) +#define IS_OUTPUT(IO) _IS_OUTPUT(IO) /// check if pin is a timer (wrapper) -#define GET_TIMER(IO) _GET_TIMER(IO) +#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/fastio.h b/Marlin/src/HAL/HAL_LPC1768/fastio.h index 1145c8054..49f8ec13c 100644 --- a/Marlin/src/HAL/HAL_LPC1768/fastio.h +++ b/Marlin/src/HAL/HAL_LPC1768/fastio.h @@ -84,14 +84,14 @@ #define _PULLDOWN(IO,V) pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT) /// check if pin is an input -#define _GET_INPUT(IO) (!gpio_get_dir(IO)) +#define _IS_INPUT(IO) (!gpio_get_dir(IO)) /// check if pin is an output -#define _GET_OUTPUT(IO) (gpio_get_dir(IO)) +#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 _GET_TIMER(IO) true +#define _HAS_TIMER(IO) true /// Read a pin wrapper #define READ(IO) _READ(IO) @@ -115,12 +115,12 @@ #define SET_PWM(IO) SET_OUTPUT(IO) /// check if pin is an input wrapper -#define GET_INPUT(IO) _GET_INPUT(IO) +#define IS_INPUT(IO) _IS_INPUT(IO) /// check if pin is an output wrapper -#define GET_OUTPUT(IO) _GET_OUTPUT(IO) +#define IS_OUTPUT(IO) _IS_OUTPUT(IO) /// check if pin is a timer (wrapper) -#define GET_TIMER(IO) _GET_TIMER(IO) +#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_STM32/fastio_STM32.h b/Marlin/src/HAL/HAL_STM32/fastio_STM32.h index 78a5cafa6..d575e9cf4 100644 --- a/Marlin/src/HAL/HAL_STM32/fastio_STM32.h +++ b/Marlin/src/HAL/HAL_STM32/fastio_STM32.h @@ -78,11 +78,11 @@ void FastIO_init(); // Must be called before using fast io macros #define SET_OUTPUT(IO) OUT_WRITE(IO, LOW) #define SET_PWM(IO) _SET_MODE(IO, PWM) -#define GET_INPUT(IO) -#define GET_OUTPUT(IO) -#define GET_TIMER(IO) +#define IS_INPUT(IO) +#define IS_OUTPUT(IO) +#define HAS_TIMER(IO) -#define PWM_PIN(P) digitalPinHasPWM(P) +#define PWM_PIN(P) HAS_TIMER(P) #define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) // digitalRead/Write wrappers diff --git a/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h b/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h index 8ed4fc48e..3994b3268 100644 --- a/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h +++ b/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h @@ -45,11 +45,11 @@ #define SET_OUTPUT(IO) OUT_WRITE(IO, LOW) #define SET_PWM(IO) pinMode(IO, PWM) // do{ gpio_set_mode(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_bit, GPIO_AF_OUTPUT_PP); timer_set_mode(PIN_MAP[pin].timer_device, PIN_MAP[pin].timer_channel, TIMER_PWM); }while(0) -#define GET_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 GET_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP) -#define GET_TIMER(IO) (PIN_MAP[IO].timer_device != NULL) +#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 != NULL) -#define PWM_PIN(P) digitalPinHasPWM(P) +#define PWM_PIN(P) HAS_TIMER(P) #define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) // digitalRead/Write wrappers diff --git a/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h b/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h index 3923f5199..5ad6227e2 100644 --- a/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h +++ b/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h @@ -48,9 +48,9 @@ #define TOGGLE(IO) OUT_WRITE(IO, !READ(IO)) -#define GET_INPUT(IO) -#define GET_OUTPUT(IO) -#define GET_TIMER(IO) +#define IS_INPUT(IO) +#define IS_OUTPUT(IO) +#define HAS_TIMER(IO) #define PWM_PIN(P) true #define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) diff --git a/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h index 946c04e89..1a19e1c3f 100644 --- a/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h @@ -47,9 +47,9 @@ #define TOGGLE(IO) OUT_WRITE(IO, !READ(IO)) -#define GET_INPUT(IO) -#define GET_OUTPUT(IO) -#define GET_TIMER(IO) +#define IS_INPUT(IO) +#define IS_OUTPUT(IO) +#define HAS_TIMER(IO) #define PWM_PIN(P) true #define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h b/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h index bebb1d9f5..928cd758e 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h @@ -67,8 +67,8 @@ GPIO_BITBAND(CORE_PIN ## P ## _DDRREG , CORE_PIN ## P ## _BIT) = 0; \ }while(0) -#define _GET_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) -#define _GET_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) +#define _IS_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) +#define _IS_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) #define READ(IO) _READ(IO) @@ -81,8 +81,8 @@ #define SET_OUTPUT(IO) _SET_OUTPUT(IO) #define SET_PWM(IO) SET_OUTPUT(IO) -#define GET_INPUT(IO) _GET_INPUT(IO) -#define GET_OUTPUT(IO) _GET_OUTPUT(IO) +#define IS_INPUT(IO) _IS_INPUT(IO) +#define IS_OUTPUT(IO) _IS_OUTPUT(IO) #define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0) diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h index e3c3c3a83..b9ddd957c 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h @@ -66,8 +66,8 @@ GPIO_BITBAND(CORE_PIN ## P ## _DDRREG , CORE_PIN ## P ## _BIT) = 0; \ }while(0) -#define _GET_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) -#define _GET_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) +#define _IS_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) +#define _IS_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) #define READ(IO) _READ(IO) @@ -80,8 +80,8 @@ #define SET_OUTPUT(IO) _SET_OUTPUT(IO) #define SET_PWM(IO) SET_OUTPUT(IO) -#define GET_INPUT(IO) _GET_INPUT(IO) -#define GET_OUTPUT(IO) _GET_OUTPUT(IO) +#define IS_INPUT(IO) _IS_INPUT(IO) +#define IS_OUTPUT(IO) _IS_OUTPUT(IO) #define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0) diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index cd963f87c..a8003fcd9 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -139,11 +139,11 @@ inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = fa #if AVR_AT90USB1286_FAMILY //Teensy IDEs don't know about these pins so must use FASTIO if (pin == 46 || pin == 47) { if (pin == 46) { - print_input_or_output(GET_OUTPUT(46)); + print_input_or_output(IS_OUTPUT(46)); SERIAL_CHAR('0' + READ(46)); } else if (pin == 47) { - print_input_or_output(GET_OUTPUT(47)); + print_input_or_output(IS_OUTPUT(47)); SERIAL_CHAR('0' + READ(47)); } } @@ -195,11 +195,11 @@ inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = fa if (pin == 46 || pin == 47) { SERIAL_ECHO_SP(12); if (pin == 46) { - print_input_or_output(GET_OUTPUT(46)); + print_input_or_output(IS_OUTPUT(46)); SERIAL_CHAR('0' + READ(46)); } else { - print_input_or_output(GET_OUTPUT(47)); + print_input_or_output(IS_OUTPUT(47)); SERIAL_CHAR('0' + READ(47)); } }