Fixes and improvements for PWM pins (#13383)
This commit is contained in:
@ -94,6 +94,8 @@
|
||||
#define extDigitalRead(IO) digitalRead(IO)
|
||||
#endif
|
||||
|
||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
||||
|
||||
#define READ(IO) _READ(IO)
|
||||
#define WRITE(IO,V) _WRITE(IO,V)
|
||||
#define TOGGLE(IO) _TOGGLE(IO)
|
||||
@ -102,6 +104,8 @@
|
||||
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _WRITE(IO, HIGH); }while(0)
|
||||
#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 GET_TIMER(IO) _GET_TIMER(IO)
|
||||
@ -279,75 +283,75 @@ enum ClockSource2 : char {
|
||||
|
||||
// Determine which harware PWMs are already in use
|
||||
#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 == E5_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
|
||||
#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)
|
||||
#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
|
||||
|
||||
#if PIN_EXISTS(FAN) || PIN_EXISTS(FAN1) || PIN_EXISTS(FAN2)
|
||||
#if PIN_EXISTS(FAN2)
|
||||
#define PWM_CHK_FAN_A(p) (p == FAN_PIN || p == FAN1_PIN || p == FAN2_PIN)
|
||||
#define PWM_CHK_FAN_A(P) (P == FAN_PIN || P == FAN1_PIN || P == FAN2_PIN)
|
||||
#elif PIN_EXISTS(FAN1)
|
||||
#define PWM_CHK_FAN_A(p) (p == FAN_PIN || p == FAN1_PIN)
|
||||
#define PWM_CHK_FAN_A(P) (P == FAN_PIN || P == FAN1_PIN)
|
||||
#else
|
||||
#define PWM_CHK_FAN_A(p) (p == FAN_PIN)
|
||||
#define PWM_CHK_FAN_A(P) (P == FAN_PIN)
|
||||
#endif
|
||||
#else
|
||||
#define PWM_CHK_FAN_A(p) false
|
||||
#define PWM_CHK_FAN_A(P) false
|
||||
#endif
|
||||
|
||||
#if HAS_MOTOR_CURRENT_PWM
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
|
||||
#define PWM_CHK_MOTOR_CURRENT(p) (p == MOTOR_CURRENT_PWM_E || p == MOTOR_CURRENT_PWM_Z || p == MOTOR_CURRENT_PWM_XY)
|
||||
#define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_Z || P == MOTOR_CURRENT_PWM_XY)
|
||||
#elif PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
||||
#define PWM_CHK_MOTOR_CURRENT(p) (p == MOTOR_CURRENT_PWM_E || p == MOTOR_CURRENT_PWM_Z)
|
||||
#define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_Z)
|
||||
#else
|
||||
#define PWM_CHK_MOTOR_CURRENT(p) (p == MOTOR_CURRENT_PWM_E)
|
||||
#define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E)
|
||||
#endif
|
||||
#else
|
||||
#define PWM_CHK_MOTOR_CURRENT(p) false
|
||||
#define PWM_CHK_MOTOR_CURRENT(P) false
|
||||
#endif
|
||||
|
||||
#ifdef NUM_SERVOS
|
||||
#if AVR_ATmega2560_FAMILY
|
||||
#define PWM_CHK_SERVO(p) (p == 5 || (NUM_SERVOS > 12 && p == 6) || (NUM_SERVOS > 24 && p == 46)) // PWMS 3A, 4A & 5A
|
||||
#define PWM_CHK_SERVO(P) (P == 5 || (NUM_SERVOS > 12 && P == 6) || (NUM_SERVOS > 24 && P == 46)) // PWMS 3A, 4A & 5A
|
||||
#elif AVR_ATmega2561_FAMILY
|
||||
#define PWM_CHK_SERVO(p) (p == 5) // PWM3A
|
||||
#define PWM_CHK_SERVO(P) (P == 5) // PWM3A
|
||||
#elif AVR_ATmega1284_FAMILY
|
||||
#define PWM_CHK_SERVO(p) false
|
||||
#define PWM_CHK_SERVO(P) false
|
||||
#elif AVR_AT90USB1286_FAMILY
|
||||
#define PWM_CHK_SERVO(p) (p == 16) // PWM3A
|
||||
#define PWM_CHK_SERVO(P) (P == 16) // PWM3A
|
||||
#elif AVR_ATmega328_FAMILY
|
||||
#define PWM_CHK_SERVO(p) false
|
||||
#define PWM_CHK_SERVO(P) false
|
||||
#endif
|
||||
#else
|
||||
#define PWM_CHK_SERVO(p) false
|
||||
#define PWM_CHK_SERVO(P) false
|
||||
#endif
|
||||
|
||||
#if ENABLED(BARICUDA)
|
||||
#if HAS_HEATER_1 && HAS_HEATER_2
|
||||
#define PWM_CHK_HEATER(p) (p == HEATER_1_PIN || p == HEATER_2_PIN)
|
||||
#define PWM_CHK_HEATER(P) (P == HEATER_1_PIN || P == HEATER_2_PIN)
|
||||
#elif HAS_HEATER_1
|
||||
#define PWM_CHK_HEATER(p) (p == HEATER_1_PIN)
|
||||
#define PWM_CHK_HEATER(P) (P == HEATER_1_PIN)
|
||||
#endif
|
||||
#else
|
||||
#define PWM_CHK_HEATER(p) false
|
||||
#define PWM_CHK_HEATER(P) false
|
||||
#endif
|
||||
|
||||
#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))
|
||||
#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))
|
||||
|
||||
// define which hardware PWMs are available for the current CPU
|
||||
// all timer 1 PWMS deleted from this list because they are never available
|
||||
#if AVR_ATmega2560_FAMILY
|
||||
#define PWM_PIN(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
|
||||
#define PWM_PIN(p) ((p >= 2 && p <= 6) || p == 9)
|
||||
#define PWM_PIN(P) ((P >= 2 && P <= 6) || P == 9)
|
||||
#elif AVR_ATmega1284_FAMILY
|
||||
#define PWM_PIN(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
|
||||
#define PWM_PIN(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
|
||||
#define PWM_PIN(p) (p == 3 || p == 5 || p == 6 || p == 11)
|
||||
#define PWM_PIN(P) (P == 3 || P == 5 || P == 6 || P == 11)
|
||||
#else
|
||||
#error "unknown CPU"
|
||||
#endif
|
||||
|
@ -45,7 +45,8 @@
|
||||
|
||||
// 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 USEABLE_HARDWARE_PWM(p) WITHIN(p, 2, 13)
|
||||
#define PWM_PIN(P) WITHIN(P, 2, 13)
|
||||
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
||||
|
||||
#ifndef MASK
|
||||
#define MASK(PIN) (1 << PIN)
|
||||
@ -172,6 +173,8 @@
|
||||
#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
|
||||
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
|
||||
// Set pin as PWM
|
||||
#define SET_PWM(IO) SET_OUTPUT(IO)
|
||||
|
||||
// Check if pin is an input
|
||||
#define GET_INPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0)
|
||||
@ -187,6 +190,8 @@
|
||||
#define extDigitalRead(IO) digitalRead(IO)
|
||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||
|
||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
||||
|
||||
/**
|
||||
* Ports and functions
|
||||
* Added as necessary or if I feel like it- not a comprehensive list!
|
||||
|
@ -28,34 +28,43 @@
|
||||
*/
|
||||
|
||||
// Set pin as input
|
||||
#define _SET_INPUT(IO) pinMode(IO, INPUT)
|
||||
#define _SET_INPUT(IO) pinMode(IO, INPUT)
|
||||
|
||||
// Set pin as output
|
||||
#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT)
|
||||
#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT)
|
||||
|
||||
// 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
|
||||
#define READ(IO) digitalRead(IO)
|
||||
#define READ(IO) digitalRead(IO)
|
||||
|
||||
// Write to a pin wrapper
|
||||
#define WRITE(IO, v) (TEST(IO, 7) ? i2s_write(IO & 0x7F, v) : digitalWrite(IO, v))
|
||||
#define WRITE(IO, v) (TEST(IO, 7) ? i2s_write(IO & 0x7F, v) : digitalWrite(IO, v))
|
||||
|
||||
// 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
|
||||
#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
|
||||
#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); WRITE(IO, LOW); }while(0)
|
||||
#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); }while(0)
|
||||
|
||||
#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
|
||||
// Set pin as PWM
|
||||
#define SET_PWM(IO) SET_OUTPUT(IO)
|
||||
|
||||
// Set pin as output and init
|
||||
#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 extDigitalRead(IO) digitalRead(IO)
|
||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||
|
||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
||||
|
||||
#define PWM_PIN(P) true
|
||||
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
||||
|
||||
//
|
||||
// Ports and functions
|
||||
|
@ -28,8 +28,6 @@
|
||||
#include <Arduino.h>
|
||||
#include <pinmapping.h>
|
||||
|
||||
#define USEABLE_HARDWARE_PWM(pin) false
|
||||
|
||||
#define SET_DIR_INPUT(IO) Gpio::setDir(IO, 1)
|
||||
#define SET_DIR_OUTPUT(IO) Gpio::setDir(IO, 0)
|
||||
|
||||
@ -110,6 +108,8 @@
|
||||
#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
|
||||
#define SET_OUTPUT(IO) do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0)
|
||||
// set pin as PWM
|
||||
#define SET_PWM(IO) SET_OUTPUT(IO)
|
||||
|
||||
/// check if pin is an input wrapper
|
||||
#define GET_INPUT(IO) _GET_INPUT(IO)
|
||||
@ -125,3 +125,7 @@
|
||||
// digitalRead/Write wrappers
|
||||
#define extDigitalRead(IO) digitalRead(IO)
|
||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||
|
||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
||||
|
||||
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
||||
|
@ -111,6 +111,8 @@
|
||||
#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
|
||||
#define SET_OUTPUT(IO) do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0)
|
||||
// set pin as PWM
|
||||
#define SET_PWM(IO) SET_OUTPUT(IO)
|
||||
|
||||
/// check if pin is an input wrapper
|
||||
#define GET_INPUT(IO) _GET_INPUT(IO)
|
||||
@ -126,3 +128,5 @@
|
||||
// digitalRead/Write wrappers
|
||||
#define extDigitalRead(IO) digitalRead(IO)
|
||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||
|
||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
||||
|
@ -72,14 +72,17 @@ void FastIO_init(); // Must be called before using fast io macros
|
||||
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) /*!< Input with Pull-up activation */
|
||||
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) /*!< Input with Pull-down activation */
|
||||
#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 PWM_PIN(p) digitalPinHasPWM(p)
|
||||
#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p)
|
||||
#define PWM_PIN(P) digitalPinHasPWM(P)
|
||||
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
||||
|
||||
// digitalRead/Write wrappers
|
||||
#define extDigitalRead(IO) digitalRead(IO)
|
||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||
|
||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
||||
|
@ -43,14 +43,17 @@
|
||||
#define SET_INPUT(IO) _SET_MODE(IO, GPIO_INPUT_FLOATING)
|
||||
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, GPIO_INPUT_PU)
|
||||
#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 PWM_PIN(p) true
|
||||
#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p)
|
||||
#define PWM_PIN(P) digitalPinHasPWM(P)
|
||||
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
||||
|
||||
// digitalRead/Write wrappers
|
||||
#define extDigitalRead(IO) digitalRead(IO)
|
||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||
|
||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,(V)*65535/255)
|
||||
|
@ -44,6 +44,7 @@
|
||||
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) /*!< Input with Pull-up activation */
|
||||
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) /*!< Input with Pull-down activation */
|
||||
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
|
||||
#define SET_PWM(IO) pinMode(IO, PWM)
|
||||
|
||||
#define TOGGLE(IO) OUT_WRITE(IO, !READ(IO))
|
||||
|
||||
@ -51,13 +52,15 @@
|
||||
#define GET_OUTPUT(IO)
|
||||
#define GET_TIMER(IO)
|
||||
|
||||
#define PWM_PIN(p) true
|
||||
#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p)
|
||||
#define PWM_PIN(P) true
|
||||
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
||||
|
||||
// digitalRead/Write wrappers
|
||||
#define extDigitalRead(IO) digitalRead(IO)
|
||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||
|
||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,(V)*65535/255)
|
||||
|
||||
//
|
||||
// Pins Definitions
|
||||
//
|
||||
|
@ -43,6 +43,7 @@
|
||||
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) /*!< Input with Pull-up activation */
|
||||
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) /*!< Input with Pull-down activation */
|
||||
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
|
||||
#define SET_PWM(IO) _SET_MODE(IO, PWM)
|
||||
|
||||
#define TOGGLE(IO) OUT_WRITE(IO, !READ(IO))
|
||||
|
||||
@ -50,13 +51,15 @@
|
||||
#define GET_OUTPUT(IO)
|
||||
#define GET_TIMER(IO)
|
||||
|
||||
#define PWM_PIN(p) true
|
||||
#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p)
|
||||
#define PWM_PIN(P) true
|
||||
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
||||
|
||||
// digitalRead/Write wrappers
|
||||
#define extDigitalRead(IO) digitalRead(IO)
|
||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||
|
||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,(V)*65535/255)
|
||||
|
||||
//
|
||||
// Pins Definitions
|
||||
//
|
||||
|
@ -43,7 +43,7 @@
|
||||
* Why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
|
||||
*/
|
||||
|
||||
#define _READ(p) bool(CORE_PIN ## p ## _PINREG & CORE_PIN ## p ## _BITMASK)
|
||||
#define _READ(P) bool(CORE_PIN ## P ## _PINREG & CORE_PIN ## P ## _BITMASK)
|
||||
|
||||
#define _WRITE(P,V) do{ \
|
||||
if (V) CORE_PIN ## P ## _PORTSET = CORE_PIN ## P ## _BITMASK; \
|
||||
@ -79,6 +79,7 @@
|
||||
#define SET_INPUT(IO) _SET_INPUT(IO)
|
||||
#define SET_INPUT_PULLUP(IO) _SET_INPUT_PULLUP(IO)
|
||||
#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)
|
||||
@ -89,6 +90,11 @@
|
||||
#define extDigitalRead(IO) digitalRead(IO)
|
||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||
|
||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
||||
|
||||
#define PWM_PIN(P) digitalPinHasPWM(P)
|
||||
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
||||
|
||||
/**
|
||||
* Ports, functions, and pins
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@
|
||||
* Why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
|
||||
*/
|
||||
|
||||
#define _READ(p) bool(CORE_PIN ## p ## _PINREG & CORE_PIN ## p ## _BITMASK)
|
||||
#define _READ(P) bool(CORE_PIN ## P ## _PINREG & CORE_PIN ## P ## _BITMASK)
|
||||
|
||||
#define _WRITE(P,V) do{ \
|
||||
if (V) CORE_PIN ## P ## _PORTSET = CORE_PIN ## P ## _BITMASK; \
|
||||
@ -78,6 +78,7 @@
|
||||
#define SET_INPUT(IO) _SET_INPUT(IO)
|
||||
#define SET_INPUT_PULLUP(IO) _SET_INPUT_PULLUP(IO)
|
||||
#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)
|
||||
@ -88,6 +89,11 @@
|
||||
#define extDigitalRead(IO) digitalRead(IO)
|
||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||
|
||||
#define ANALOG_WRITE(IO,V) analogWrite(IO,V)
|
||||
|
||||
#define PWM_PIN(P) digitalPinHasPWM(P)
|
||||
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
|
||||
|
||||
/**
|
||||
* Ports, functions, and pins
|
||||
*/
|
||||
|
Reference in New Issue
Block a user