Pulldown for all FastIO headers

Co-Authored-By: borsegbr <borsegbr@users.noreply.github.com>
2.0.x
Scott Lahteine 5 years ago
parent 0ea26d538b
commit 96ab16a9dd

@ -98,9 +98,9 @@
#define SET_INPUT(IO) _SET_INPUT(IO) #define SET_INPUT(IO) _SET_INPUT(IO)
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _WRITE(IO, HIGH); }while(0) #define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _WRITE(IO, HIGH); }while(0)
#define SET_INPUT_PULLDOWN SET_INPUT
#define SET_OUTPUT(IO) _SET_OUTPUT(IO) #define SET_OUTPUT(IO) _SET_OUTPUT(IO)
#define SET_PWM SET_OUTPUT
#define SET_PWM(IO) SET_OUTPUT(IO)
#define IS_INPUT(IO) _IS_INPUT(IO) #define IS_INPUT(IO) _IS_INPUT(IO)
#define IS_OUTPUT(IO) _IS_OUTPUT(IO) #define IS_OUTPUT(IO) _IS_OUTPUT(IO)

@ -166,7 +166,7 @@
// 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)
// Set pin as PWM // Set pin as PWM
#define SET_PWM(IO) SET_OUTPUT(IO) #define SET_PWM SET_OUTPUT
// Check if pin is an input // Check if pin is an input
#define IS_INPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0) #define IS_INPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0)

@ -56,7 +56,7 @@
#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); }while(0) #define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); }while(0)
// Set pin as PWM // Set pin as PWM
#define SET_PWM(IO) SET_OUTPUT(IO) #define SET_PWM SET_OUTPUT
// Set pin as output and init // Set pin as output and init
#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)

@ -104,7 +104,7 @@
/// 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)
// set pin as PWM // set pin as PWM
#define SET_PWM(IO) SET_OUTPUT(IO) #define SET_PWM SET_OUTPUT
/// check if pin is an input wrapper /// check if pin is an input wrapper
#define IS_INPUT(IO) _IS_INPUT(IO) #define IS_INPUT(IO) _IS_INPUT(IO)

@ -100,9 +100,9 @@
PORT->Group[port].DIRCLR.reg = MASK(pin); \ PORT->Group[port].DIRCLR.reg = MASK(pin); \
}while(0) }while(0)
// Set pin as PWM (push pull) // Set pin as PWM (push pull)
#define SET_PWM(IO) SET_OUTPUT(IO) #define SET_PWM SET_OUTPUT
// Set pin as PWM (open drain) // Set pin as PWM (open drain)
#define SET_PWM_OD(IO) SET_OUTPUT_OD(IO) #define SET_PWM_OD SET_OUTPUT_OD
// check if pin is an output // check if pin is an output
#define IS_OUTPUT(IO) ((PORT->Group[(EPortType)GET_SAMD_PORT(IO)].DIR.reg & MASK(GET_SAMD_PIN(IO))) \ #define IS_OUTPUT(IO) ((PORT->Group[(EPortType)GET_SAMD_PORT(IO)].DIR.reg & MASK(GET_SAMD_PIN(IO))) \

@ -76,8 +76,9 @@
#define SET_INPUT(IO) _SET_INPUT(IO) #define SET_INPUT(IO) _SET_INPUT(IO)
#define SET_INPUT_PULLUP(IO) _SET_INPUT_PULLUP(IO) #define SET_INPUT_PULLUP(IO) _SET_INPUT_PULLUP(IO)
#define SET_INPUT_PULLDOWN SET_INPUT
#define SET_OUTPUT(IO) _SET_OUTPUT(IO) #define SET_OUTPUT(IO) _SET_OUTPUT(IO)
#define SET_PWM(IO) SET_OUTPUT(IO) #define SET_PWM SET_OUTPUT
#define IS_INPUT(IO) _IS_INPUT(IO) #define IS_INPUT(IO) _IS_INPUT(IO)
#define IS_OUTPUT(IO) _IS_OUTPUT(IO) #define IS_OUTPUT(IO) _IS_OUTPUT(IO)

@ -76,8 +76,9 @@
#define SET_INPUT(IO) _SET_INPUT(IO) #define SET_INPUT(IO) _SET_INPUT(IO)
#define SET_INPUT_PULLUP(IO) _SET_INPUT_PULLUP(IO) #define SET_INPUT_PULLUP(IO) _SET_INPUT_PULLUP(IO)
#define SET_INPUT_PULLDOWN SET_INPUT
#define SET_OUTPUT(IO) _SET_OUTPUT(IO) #define SET_OUTPUT(IO) _SET_OUTPUT(IO)
#define SET_PWM(IO) SET_OUTPUT(IO) #define SET_PWM SET_OUTPUT
#define IS_INPUT(IO) _IS_INPUT(IO) #define IS_INPUT(IO) _IS_INPUT(IO)
#define IS_OUTPUT(IO) _IS_OUTPUT(IO) #define IS_OUTPUT(IO) _IS_OUTPUT(IO)

@ -176,11 +176,12 @@
#undef MAKE_ARDUINO_PINS #undef MAKE_ARDUINO_PINS
} // namespace fast_io } // namespace fast_io
#define SET_INPUT(pin) fast_io::pin::set_input() #define SET_INPUT(pin) fast_io::pin::set_input()
#define SET_INPUT_PULLUP(pin) fast_io::pin::set_input(); fast_io::pin::set_high() #define SET_INPUT_PULLUP(pin) do{ fast_io::pin::set_input(); fast_io::pin::set_high(); }while(0)
#define SET_OUTPUT(pin) fast_io::pin::set_output() #define SET_INPUT_PULLDOWN SET_INPUT
#define READ(pin) fast_io::pin::read() #define SET_OUTPUT(pin) fast_io::pin::set_output()
#define WRITE(pin, value) fast_io::pin::write(value) #define READ(pin) fast_io::pin::read()
#define WRITE(pin, value) fast_io::pin::write(value)
#ifndef pgm_read_word_far #ifndef pgm_read_word_far
#define pgm_read_word_far pgm_read_word #define pgm_read_word_far pgm_read_word
@ -195,11 +196,11 @@
#endif #endif
#define SERIAL_ECHO_START() #define SERIAL_ECHO_START()
#define SERIAL_ECHOLNPGM(str) Serial.println(F(str)) #define SERIAL_ECHOLNPGM(str) Serial.println(F(str))
#define SERIAL_ECHOPGM(str) Serial.print(F(str)) #define SERIAL_ECHOPGM(str) Serial.print(F(str))
#define SERIAL_ECHO_MSG(str) Serial.println(str) #define SERIAL_ECHO_MSG(str) Serial.println(str)
#define SERIAL_ECHOLNPAIR(str, val) {Serial.print(F(str)); Serial.println(val);} #define SERIAL_ECHOLNPAIR(str, val) do{ Serial.print(F(str)); Serial.println(val); }while(0)
#define SERIAL_ECHOPAIR(str, val) {Serial.print(F(str)); Serial.print(val);} #define SERIAL_ECHOPAIR(str, val) do{ Serial.print(F(str)); Serial.print(val); }while(0)
#define safe_delay delay #define safe_delay delay

Loading…
Cancel
Save