Snooze works great, thanks for your work. I did hit a small issue when using a Teensy LC, and trying to use INPUT_PULLDOWN for waking with SnoozeDigital (for waking when a signal goes high, basically the inverse of button_hold_wakeup).
The other HALs implement INPUT, INPUT_PULLUP, and INPUT_PULLDOWN:
|
if ( pin_mode == INPUT || pin_mode == INPUT_PULLUP || pin_mode == INPUT_PULLDOWN ) { |
|
*portModeRegister( pinNumber ) = 0; |
|
*config = PORT_PCR_MUX( 1 ); |
|
if ( pin_mode == INPUT_PULLUP ) *config |= PORT_PCR_PE | PORT_PCR_PS;// pullup |
|
else if ( pin_mode == INPUT_PULLDOWN ) { |
|
*config |= ( PORT_PCR_PE ); // pulldown |
|
*config &= ~( PORT_PCR_PS ); |
|
} |
|
if ( pin_mode == INPUT || pin_mode == INPUT_PULLUP || pin_mode == INPUT_PULLDOWN ) { |
|
*portModeRegister( pinNumber ) = 0; |
|
*config = PORT_PCR_MUX( 1 ); |
|
if ( pin_mode == INPUT_PULLUP ) *config |= PORT_PCR_PE | PORT_PCR_PS;// pullup |
|
else if ( pin_mode == INPUT_PULLDOWN ) { |
|
*config |= ( PORT_PCR_PE ); // pulldown |
|
*config &= ~( PORT_PCR_PS ); |
|
} |
|
if ( pin_mode == INPUT || pin_mode == INPUT_PULLUP || pin_mode == INPUT_PULLDOWN ) { |
|
*portModeRegister( pinNumber ) = 0; |
|
*config = PORT_PCR_MUX( 1 ); |
|
if ( pin_mode == INPUT_PULLUP ) *config |= PORT_PCR_PE | PORT_PCR_PS;// pullup |
|
else if ( pin_mode == INPUT_PULLDOWN ) { |
|
*config |= ( PORT_PCR_PE ); // pulldown |
|
*config &= ~( PORT_PCR_PS ); |
|
} |
It looks like INPUT_PULLDOWN was intended to work with the Teensy LC?
|
if ( pin_mode == INPUT || pin_mode == INPUT_PULLUP ) {// setup pin mode/type/interrupt |
|
*portModeRegister( pinNumber ) &= ~digitalPinToBitMask( pinNumber ); |
|
*config = PORT_PCR_MUX( 1 ); |
|
if ( pin_mode == INPUT_PULLUP ) { |
|
*config = PORT_PCR_MUX( 1 ) | PORT_PCR_PE | PORT_PCR_PS;// pullup |
|
} |
|
else if ( pin_mode == INPUT_PULLDOWN ) { |
|
*config |= ( PORT_PCR_PE ); // pulldown |
|
*config &= ~( PORT_PCR_PS ); |
|
} |
After I modified line 88 to match the other HALs, waking seemed to work fine. So it seems like an omission, especially given the else if on line 94. I also looked in the datasheet and didn't find anything that would indicate INPUT_PULLDOWN is different in any way? If there's a a reason INPUT_PULLDOWN really isn't supported, it would be good to document that. In either case, I can cut a PR if you'd like.
Snooze works great, thanks for your work. I did hit a small issue when using a Teensy LC, and trying to use
INPUT_PULLDOWNfor waking withSnoozeDigital(for waking when a signal goes high, basically the inverse of button_hold_wakeup).The other HALs implement
INPUT,INPUT_PULLUP, andINPUT_PULLDOWN:Snooze/src/hal/TEENSY_32/SnoozeDigital.cpp
Lines 121 to 128 in 4ae33c6
Snooze/src/hal/TEENSY_35/SnoozeDigital.cpp
Lines 115 to 122 in 4ae33c6
Snooze/src/hal/TEENSY_36/SnoozeDigital.cpp
Lines 121 to 128 in 4ae33c6
It looks like
INPUT_PULLDOWNwas intended to work with the Teensy LC?Snooze/src/hal/TEENSY_LC/SnoozeDigital.cpp
Lines 88 to 97 in 4ae33c6
After I modified line 88 to match the other HALs, waking seemed to work fine. So it seems like an omission, especially given the
else ifon line 94. I also looked in the datasheet and didn't find anything that would indicateINPUT_PULLDOWNis different in any way? If there's a a reasonINPUT_PULLDOWNreally isn't supported, it would be good to document that. In either case, I can cut a PR if you'd like.