Clean up fastIO ahead of PWM patch

This commit is contained in:
Scott Lahteine 2019-03-12 20:39:55 -05:00
parent 388babbcea
commit 51ff5b68fa
9 changed files with 89 additions and 92 deletions

View file

@ -30,7 +30,7 @@
#include <avr/io.h> #include <avr/io.h>
#include "../../core/macros.h" #include "../../core/macros.h"
#define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__)) #define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__))
#define AVR_ATmega1284_FAMILY (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__)) #define AVR_ATmega1284_FAMILY (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__))
#define AVR_ATmega2560_FAMILY (defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)) #define AVR_ATmega2560_FAMILY (defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__))
#define AVR_ATmega2561_FAMILY (defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)) #define AVR_ATmega2561_FAMILY (defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__))
@ -273,16 +273,15 @@ enum ClockSource2 : char {
#define SET_FOCB(T,V) SET_FOC(T,B,V) #define SET_FOCB(T,V) SET_FOC(T,B,V)
#define SET_FOCC(T,V) SET_FOC(T,C,V) #define SET_FOCC(T,V) SET_FOC(T,C,V)
/** /**
* PWM availability macros * PWM availability macros
*/ */
// Determine which harware PWMs are already in use // Determine which harware PWMs are already in use
#if PIN_EXISTS(CONTROLLER_FAN) #if PIN_EXISTS(CONTROLLER_FAN)
#define PWM_CHK_FAN_B(p) (p == CONTROLLER_FAN_PIN || p == E0_AUTO_FAN_PIN || p == E1_AUTO_FAN_PIN || p == E2_AUTO_FAN_PIN || p == E3_AUTO_FAN_PIN || p == E4_AUTO_FAN_PIN || p == CHAMBER_AUTO_FAN_PIN) #define PWM_CHK_FAN_B(p) (p == CONTROLLER_FAN_PIN || p == E0_AUTO_FAN_PIN || p == E1_AUTO_FAN_PIN || p == E2_AUTO_FAN_PIN || p == E3_AUTO_FAN_PIN || p == E4_AUTO_FAN_PIN || p == E5_AUTO_FAN_PIN || p == CHAMBER_AUTO_FAN_PIN)
#else #else
#define PWM_CHK_FAN_B(p) (p == E0_AUTO_FAN_PIN || p == E1_AUTO_FAN_PIN || p == E2_AUTO_FAN_PIN || p == E3_AUTO_FAN_PIN || p == E4_AUTO_FAN_PIN || p == CHAMBER_AUTO_FAN_PIN) #define PWM_CHK_FAN_B(p) (p == E0_AUTO_FAN_PIN || p == E1_AUTO_FAN_PIN || p == E2_AUTO_FAN_PIN || p == E3_AUTO_FAN_PIN || p == E4_AUTO_FAN_PIN || p == E5_AUTO_FAN_PIN || p == CHAMBER_AUTO_FAN_PIN)
#endif #endif
#if PIN_EXISTS(FAN) || PIN_EXISTS(FAN1) || PIN_EXISTS(FAN2) #if PIN_EXISTS(FAN) || PIN_EXISTS(FAN1) || PIN_EXISTS(FAN2)
@ -335,24 +334,22 @@ enum ClockSource2 : char {
#define PWM_CHK_HEATER(p) false #define PWM_CHK_HEATER(p) false
#endif #endif
#define PWM_CHK(p) (PWM_CHK_HEATER(p) || PWM_CHK_SERVO(p) || PWM_CHK_MOTOR_CURRENT(p)\ #define PWM_CHK(p) (PWM_CHK_HEATER(p) || PWM_CHK_SERVO(p) || PWM_CHK_MOTOR_CURRENT(p) || PWM_CHK_FAN_A(p) || PWM_CHK_FAN_B(p))
|| PWM_CHK_FAN_A(p) || PWM_CHK_FAN_B(p))
// define which hardware PWMs are available for the current CPU // define which hardware PWMs are available for the current CPU
// all timer 1 PWMS deleted from this list because they are never available // all timer 1 PWMS deleted from this list because they are never available
#if AVR_ATmega2560_FAMILY #if AVR_ATmega2560_FAMILY
#define PWM_PINS(p) ((p >= 2 && p <= 10) || p == 13 || p == 44 || p == 45 || p == 46) #define PWM_PIN(p) ((p >= 2 && p <= 10) || p == 13 || p == 44 || p == 45 || p == 46)
#elif AVR_ATmega2561_FAMILY #elif AVR_ATmega2561_FAMILY
#define PWM_PINS(p) ((p >= 2 && p <= 6) || p == 9) #define PWM_PIN(p) ((p >= 2 && p <= 6) || p == 9)
#elif AVR_ATmega1284_FAMILY #elif AVR_ATmega1284_FAMILY
#define PWM_PINS(p) (p == 3 || p == 4 || p == 14 || p == 15) #define PWM_PIN(p) (p == 3 || p == 4 || p == 14 || p == 15)
#elif AVR_AT90USB1286_FAMILY #elif AVR_AT90USB1286_FAMILY
#define PWM_PINS(p) (p == 0 || p == 1 || p == 14 || p == 15 || p == 16 || p == 24) #define PWM_PIN(p) (p == 0 || p == 1 || p == 14 || p == 15 || p == 16 || p == 24)
#elif AVR_ATmega328_FAMILY #elif AVR_ATmega328_FAMILY
#define PWM_PINS(p) (p == 3 || p == 5 || p == 6 || p == 11) #define PWM_PIN(p) (p == 3 || p == 5 || p == 6 || p == 11)
#else #else
#error "unknown CPU" #error "unknown CPU"
#endif #endif
// finally - the macro that tells us if a pin is an available hardware PWM #define USEABLE_HARDWARE_PWM(P) (PWM_PIN(P) && !PWM_CHK(p))
#define USEABLE_HARDWARE_PWM(p) (PWM_PINS(p) && !PWM_CHK(p))

View file

@ -154,34 +154,34 @@
#endif #endif
// Set pin as input with pullup mode // Set pin as input with pullup mode
#define _PULLUP(IO,V) pinMode(IO, (V) ? INPUT_PULLUP : INPUT) #define _PULLUP(IO,V) pinMode(IO, (V) ? INPUT_PULLUP : INPUT)
// Read a pin (wrapper) // Read a pin (wrapper)
#define READ(IO) _READ(IO) #define READ(IO) _READ(IO)
// Write to a pin (wrapper) // Write to a pin (wrapper)
#define WRITE_VAR(IO,V) _WRITE_VAR(IO,V) #define WRITE_VAR(IO,V) _WRITE_VAR(IO,V)
#define WRITE(IO,V) _WRITE(IO,V) #define WRITE(IO,V) _WRITE(IO,V)
// Toggle a pin (wrapper) // Toggle a pin (wrapper)
#define TOGGLE(IO) _TOGGLE(IO) #define TOGGLE(IO) _TOGGLE(IO)
// Set pin as input (wrapper) // Set pin as input (wrapper)
#define SET_INPUT(IO) _SET_INPUT(IO) #define SET_INPUT(IO) _SET_INPUT(IO)
// Set pin as input with pullup (wrapper) // Set pin as input with pullup (wrapper)
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0) #define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
// Set pin as output (wrapper) - reads the pin and sets the output to that value // Set pin as output (wrapper) - reads the pin and sets the output to that value
#define SET_OUTPUT(IO) _SET_OUTPUT(IO) #define SET_OUTPUT(IO) _SET_OUTPUT(IO)
// Check if pin is an input // Check if pin is an input
#define GET_INPUT(IO) !(digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) #define GET_INPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0)
// Check if pin is an output // Check if pin is an output
#define GET_OUTPUT(IO) !!(digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) #define GET_OUTPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) != 0)
// Check if pin is a timer - Must be a constexpr // Check if pin is a timer - Must be a constexpr
#define GET_TIMER(IO) ((IO) >= 2 && (IO) <= 13) #define GET_TIMER(IO) ((IO) >= 2 && (IO) <= 13)
// Shorthand // Shorthand
#define OUT_WRITE(IO,V) { SET_OUTPUT(IO); WRITE(IO,V); } #define OUT_WRITE(IO,V) { SET_OUTPUT(IO); WRITE(IO,V); }
// digitalRead/Write wrappers // digitalRead/Write wrappers
#define extDigitalRead(IO) digitalRead(IO) #define extDigitalRead(IO) digitalRead(IO)

View file

@ -30,16 +30,16 @@
#define USEABLE_HARDWARE_PWM(pin) false #define USEABLE_HARDWARE_PWM(pin) false
#define SET_DIR_INPUT(IO) Gpio::setDir(IO, 1) #define SET_DIR_INPUT(IO) Gpio::setDir(IO, 1)
#define SET_DIR_OUTPUT(IO) Gpio::setDir(IO, 0) #define SET_DIR_OUTPUT(IO) Gpio::setDir(IO, 0)
#define SET_MODE(IO, mode) Gpio::setMode(IO, mode) #define SET_MODE(IO, mode) Gpio::setMode(IO, mode)
#define WRITE_PIN_SET(IO) Gpio::set(IO) #define WRITE_PIN_SET(IO) Gpio::set(IO)
#define WRITE_PIN_CLR(IO) Gpio::clear(IO) #define WRITE_PIN_CLR(IO) Gpio::clear(IO)
#define READ_PIN(IO) Gpio::get(IO) #define READ_PIN(IO) Gpio::get(IO)
#define WRITE_PIN(IO,V) Gpio::set(IO, V) #define WRITE_PIN(IO,V) Gpio::set(IO, V)
/** /**
* Magic I/O routines * Magic I/O routines
@ -50,77 +50,77 @@
*/ */
/// Read a pin /// Read a pin
#define _READ(IO) READ_PIN(IO) #define _READ(IO) READ_PIN(IO)
/// Write to a pin /// Write to a pin
#define _WRITE_VAR(IO,V) digitalWrite(IO,V) #define _WRITE_VAR(IO,V) digitalWrite(IO,V)
#define _WRITE(IO,V) WRITE_PIN(IO,V) #define _WRITE(IO,V) WRITE_PIN(IO,V)
/// toggle a pin /// toggle a pin
#define _TOGGLE(IO) _WRITE(IO, !READ(IO)) #define _TOGGLE(IO) _WRITE(IO, !READ(IO))
/// set pin as input /// set pin as input
#define _SET_INPUT(IO) SET_DIR_INPUT(IO) #define _SET_INPUT(IO) SET_DIR_INPUT(IO)
/// set pin as output /// set pin as output
#define _SET_OUTPUT(IO) SET_DIR_OUTPUT(IO) #define _SET_OUTPUT(IO) SET_DIR_OUTPUT(IO)
/// set pin as input with pullup mode /// set pin as input with pullup mode
#define _PULLUP(IO,V) pinMode(IO, (V) ? INPUT_PULLUP : INPUT) #define _PULLUP(IO,V) pinMode(IO, (V) ? INPUT_PULLUP : INPUT)
/// set pin as input with pulldown mode /// set pin as input with pulldown mode
#define _PULLDOWN(IO,V) pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT) #define _PULLDOWN(IO,V) pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT)
// hg42: all pins can be input or output (I hope) // hg42: all pins can be input or output (I hope)
// hg42: undefined pins create compile error (IO, is no pin) // hg42: undefined pins create compile error (IO, is no pin)
// hg42: currently not used, but was used by pinsDebug // hg42: currently not used, but was used by pinsDebug
/// check if pin is an input /// check if pin is an input
#define _GET_INPUT(IO) (LPC1768_PIN_PIN(IO) >= 0) #define _GET_INPUT(IO) (LPC1768_PIN_PIN(IO) >= 0)
/// check if pin is an output /// check if pin is an output
#define _GET_OUTPUT(IO) (LPC1768_PIN_PIN(IO) >= 0) #define _GET_OUTPUT(IO) (LPC1768_PIN_PIN(IO) >= 0)
// hg42: GET_TIMER is used only to check if it's a PWM pin // hg42: GET_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: we cannot use USEABLE_HARDWARE_PWM because it uses a function that cannot be used statically
// hg42: instead use PWM bit from the #define // hg42: instead use PWM bit from the #define
/// check if pin is a timer /// check if pin is a timer
#define _GET_TIMER(IO) TRUE // could be LPC1768_PIN_PWM(IO), but there #define _GET_TIMER(IO) true // could be LPC1768_PIN_PWM(IO), but there
// hg42: could be this: // hg42: could be this:
// #define _GET_TIMER(IO) LPC1768_PIN_PWM(IO) // #define _GET_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) // but this is an incomplete check (12 pins are PWMable, but only 6 can be used at the same time)
/// Read a pin wrapper /// Read a pin wrapper
#define READ(IO) _READ(IO) #define READ(IO) _READ(IO)
/// Write to a pin wrapper /// Write to a pin wrapper
#define WRITE_VAR(IO,V) _WRITE_VAR(IO,V) #define WRITE_VAR(IO,V) _WRITE_VAR(IO,V)
#define WRITE(IO,V) _WRITE(IO,V) #define WRITE(IO,V) _WRITE(IO,V)
/// toggle a pin wrapper /// toggle a pin wrapper
#define TOGGLE(IO) _TOGGLE(IO) #define TOGGLE(IO) _TOGGLE(IO)
/// set pin as input wrapper /// set pin as input wrapper
#define SET_INPUT(IO) _SET_INPUT(IO) #define SET_INPUT(IO) _SET_INPUT(IO)
/// set pin as input with pullup wrapper /// set pin as input with pullup wrapper
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0) #define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
/// set pin as input with pulldown wrapper /// set pin as input with pulldown wrapper
#define SET_INPUT_PULLDOWN(IO) do{ _SET_INPUT(IO); _PULLDOWN(IO, HIGH); }while(0) #define SET_INPUT_PULLDOWN(IO) do{ _SET_INPUT(IO); _PULLDOWN(IO, HIGH); }while(0)
/// set pin as output wrapper - reads the pin and sets the output to that value /// set pin as output wrapper - reads the pin and sets the output to that value
#define SET_OUTPUT(IO) do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0) #define SET_OUTPUT(IO) do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0)
/// check if pin is an input wrapper /// check if pin is an input wrapper
#define GET_INPUT(IO) _GET_INPUT(IO) #define GET_INPUT(IO) _GET_INPUT(IO)
/// check if pin is an output wrapper /// check if pin is an output wrapper
#define GET_OUTPUT(IO) _GET_OUTPUT(IO) #define GET_OUTPUT(IO) _GET_OUTPUT(IO)
/// check if pin is a timer (wrapper) /// check if pin is a timer (wrapper)
#define GET_TIMER(IO) _GET_TIMER(IO) #define GET_TIMER(IO) _GET_TIMER(IO)
// Shorthand // Shorthand
#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0) #define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
// digitalRead/Write wrappers // digitalRead/Write wrappers
#define extDigitalRead(IO) digitalRead(IO) #define extDigitalRead(IO) digitalRead(IO)

View file

@ -35,21 +35,22 @@
#include <Arduino.h> #include <Arduino.h>
#define USEABLE_HARDWARE_PWM(pin) TRUE // all pins are PWM capable #define PWM_PIN(P) true // all pins are PWM capable
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
#define LPC_PIN(pin) gpio_pin(pin) #define LPC_PIN(pin) gpio_pin(pin)
#define LPC_GPIO(port) gpio_port(port) #define LPC_GPIO(port) gpio_port(port)
#define SET_DIR_INPUT(IO) gpio_set_input(IO) #define SET_DIR_INPUT(IO) gpio_set_input(IO)
#define SET_DIR_OUTPUT(IO) gpio_set_output(IO) #define SET_DIR_OUTPUT(IO) gpio_set_output(IO)
#define SET_MODE(IO, mode) pinMode(IO, mode) #define SET_MODE(IO, mode) pinMode(IO, mode)
#define WRITE_PIN_SET(IO) gpio_set(IO) #define WRITE_PIN_SET(IO) gpio_set(IO)
#define WRITE_PIN_CLR(IO) gpio_clear(IO) #define WRITE_PIN_CLR(IO) gpio_clear(IO)
#define READ_PIN(IO) gpio_get(IO) #define READ_PIN(IO) gpio_get(IO)
#define WRITE_PIN(IO,V) gpio_set(IO, V) #define WRITE_PIN(IO,V) gpio_set(IO, V)
/** /**
* Magic I/O routines * Magic I/O routines
@ -60,67 +61,67 @@
*/ */
/// Read a pin /// Read a pin
#define _READ(IO) READ_PIN(IO) #define _READ(IO) READ_PIN(IO)
/// Write to a pin /// Write to a pin
#define _WRITE_VAR(IO,V) digitalWrite(IO,V) #define _WRITE_VAR(IO,V) digitalWrite(IO,V)
#define _WRITE(IO,V) WRITE_PIN(IO,V) #define _WRITE(IO,V) WRITE_PIN(IO,V)
/// toggle a pin /// toggle a pin
#define _TOGGLE(IO) _WRITE(IO, !READ(IO)) #define _TOGGLE(IO) _WRITE(IO, !READ(IO))
/// set pin as input /// set pin as input
#define _SET_INPUT(IO) SET_DIR_INPUT(IO) #define _SET_INPUT(IO) SET_DIR_INPUT(IO)
/// set pin as output /// set pin as output
#define _SET_OUTPUT(IO) SET_DIR_OUTPUT(IO) #define _SET_OUTPUT(IO) SET_DIR_OUTPUT(IO)
/// set pin as input with pullup mode /// set pin as input with pullup mode
#define _PULLUP(IO,V) pinMode(IO, (V) ? INPUT_PULLUP : INPUT) #define _PULLUP(IO,V) pinMode(IO, (V) ? INPUT_PULLUP : INPUT)
/// set pin as input with pulldown mode /// set pin as input with pulldown mode
#define _PULLDOWN(IO,V) pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT) #define _PULLDOWN(IO,V) pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT)
/// check if pin is an input /// check if pin is an input
#define _GET_INPUT(IO) (!gpio_get_dir(IO)) #define _GET_INPUT(IO) (!gpio_get_dir(IO))
/// check if pin is an output /// check if pin is an output
#define _GET_OUTPUT(IO) (gpio_get_dir(IO)) #define _GET_OUTPUT(IO) (gpio_get_dir(IO))
/// check if pin is a timer /// check if pin is a timer
/// all gpio pins are pwm capable, either interrupt or hardware pwm controlled /// all gpio pins are pwm capable, either interrupt or hardware pwm controlled
#define _GET_TIMER(IO) TRUE #define _GET_TIMER(IO) true
/// Read a pin wrapper /// Read a pin wrapper
#define READ(IO) _READ(IO) #define READ(IO) _READ(IO)
/// Write to a pin wrapper /// Write to a pin wrapper
#define WRITE_VAR(IO,V) _WRITE_VAR(IO,V) #define WRITE_VAR(IO,V) _WRITE_VAR(IO,V)
#define WRITE(IO,V) _WRITE(IO,V) #define WRITE(IO,V) _WRITE(IO,V)
/// toggle a pin wrapper /// toggle a pin wrapper
#define TOGGLE(IO) _TOGGLE(IO) #define TOGGLE(IO) _TOGGLE(IO)
/// set pin as input wrapper /// set pin as input wrapper
#define SET_INPUT(IO) _SET_INPUT(IO) #define SET_INPUT(IO) _SET_INPUT(IO)
/// set pin as input with pullup wrapper /// set pin as input with pullup wrapper
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0) #define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
/// set pin as input with pulldown wrapper /// set pin as input with pulldown wrapper
#define SET_INPUT_PULLDOWN(IO) do{ _SET_INPUT(IO); _PULLDOWN(IO, HIGH); }while(0) #define SET_INPUT_PULLDOWN(IO) do{ _SET_INPUT(IO); _PULLDOWN(IO, HIGH); }while(0)
/// set pin as output wrapper - reads the pin and sets the output to that value /// set pin as output wrapper - reads the pin and sets the output to that value
#define SET_OUTPUT(IO) do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0) #define SET_OUTPUT(IO) do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0)
/// check if pin is an input wrapper /// check if pin is an input wrapper
#define GET_INPUT(IO) _GET_INPUT(IO) #define GET_INPUT(IO) _GET_INPUT(IO)
/// check if pin is an output wrapper /// check if pin is an output wrapper
#define GET_OUTPUT(IO) _GET_OUTPUT(IO) #define GET_OUTPUT(IO) _GET_OUTPUT(IO)
/// check if pin is a timer (wrapper) /// check if pin is a timer (wrapper)
#define GET_TIMER(IO) _GET_TIMER(IO) #define GET_TIMER(IO) _GET_TIMER(IO)
// Shorthand // Shorthand
#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0) #define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
// digitalRead/Write wrappers // digitalRead/Write wrappers
#define extDigitalRead(IO) digitalRead(IO) #define extDigitalRead(IO) digitalRead(IO)

View file

@ -77,7 +77,7 @@ void FastIO_init(); // Must be called before using fast io macros
#define GET_OUTPUT(IO) #define GET_OUTPUT(IO)
#define GET_TIMER(IO) #define GET_TIMER(IO)
#define PWM_PIN(p) digitalPinHasPWM(p) #define PWM_PIN(p) digitalPinHasPWM(p)
#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p) #define USEABLE_HARDWARE_PWM(p) PWM_PIN(p)
// digitalRead/Write wrappers // digitalRead/Write wrappers

View file

@ -207,7 +207,6 @@ static void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) {
} } } }
#endif #endif
void HAL_init(void) { void HAL_init(void) {
NVIC_SetPriorityGrouping(0x3); NVIC_SetPriorityGrouping(0x3);
} }

View file

@ -42,7 +42,7 @@
#define SET_INPUT(IO) _SET_MODE(IO, GPIO_INPUT_FLOATING) #define SET_INPUT(IO) _SET_MODE(IO, GPIO_INPUT_FLOATING)
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, GPIO_INPUT_PU) #define SET_INPUT_PULLUP(IO) _SET_MODE(IO, GPIO_INPUT_PU)
#define SET_OUTPUT(IO) OUT_WRITE(IO,LOW) #define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
#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_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_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP)

View file

@ -50,7 +50,7 @@
#define GET_OUTPUT(IO) #define GET_OUTPUT(IO)
#define GET_TIMER(IO) #define GET_TIMER(IO)
#define PWM_PIN(p) true #define PWM_PIN(p) true
#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p) #define USEABLE_HARDWARE_PWM(p) PWM_PIN(p)
// digitalRead/Write wrappers // digitalRead/Write wrappers

View file

@ -2014,7 +2014,7 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
#endif #endif
#if ENABLED(FAST_PWM_FAN) && !(defined(ARDUINO) && !defined(ARDUINO_ARCH_SAM)) #if ENABLED(FAST_PWM_FAN) && !(defined(ARDUINO) && !defined(ARDUINO_ARCH_SAM))
#error "FAST_PWM_FAN only supported by 8 bit CPUs." #error "FAST_PWM_FAN is only supported for ARDUINO and ARDUINO_ARCH_SAM."
#endif #endif
#if ENABLED(Z_STEPPER_AUTO_ALIGN) #if ENABLED(Z_STEPPER_AUTO_ALIGN)