Fixes and improvements for PWM pins (#13383)

This commit is contained in:
Scott Lahteine
2019-03-13 06:51:15 -05:00
committed by GitHub
parent 87162658c4
commit f89b375fb9
26 changed files with 196 additions and 193 deletions

View File

@ -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
*/