Replace digitalPinHasPWM with HAS_TIMER (#13520)

This commit is contained in:
Alexander Amelkin
2019-03-29 20:21:14 +03:00
committed by Scott Lahteine
parent 5a2c68e995
commit e40636a7c1
11 changed files with 49 additions and 49 deletions

View File

@ -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)