Bare Metal Programming Tool Kit
|
#include <pins.h>
Static Public Member Functions | |
static void | init () |
initialize the pin as input | |
static bool | get (bmptk::time interval=50 *bmptk::ms) |
get the debounced state of a pine | |
Static Public Member Functions inherited from bmptk::hardware::pin_in | |
static void | init () |
initialize the pin as input | |
static bool | get () |
get the current level on the pin | |
Additional Inherited Members | |
Public Types inherited from bmptk::hardware::pin_in | |
enum | { type = type_pin_in } |
identify this type as a type_pin_in | |
enum | { features = has_none } |
this type has no additional fatures | |
debounce a pin_in
This template debounces a pin by keeping at least intreval time between reading the underlying pin. In other words: when the pin has been read less than interval time ago, it is not read again but the old value is returned.
|
inlinestatic |
get the debounced state of a pine
If the previous reading of the underlying pin has been more than interval ago, this method will read and return the pin value. If not, it will rerturn the last value read from the pin.
The default interval of 50 ms will effectively debounce all switches and buttons, while still being unnoticable by humans.
|
inlinestatic |