Bare Metal Programming Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Static Public Member Functions | List of all members
bmptk::hardware::debounce< arg_pin > Struct Template Reference

debounce a pin_in More...

#include <pins.h>

Inheritance diagram for bmptk::hardware::debounce< arg_pin >:
bmptk::hardware::pin_in

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
 

Detailed Description

template<class arg_pin>
struct bmptk::hardware::debounce< arg_pin >

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.

Definition at line 715 of file pins.h.

Member Function Documentation

template<class arg_pin >
static bool bmptk::hardware::debounce< arg_pin >::get ( bmptk::time  interval = 50 * bmptk::ms)
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.

Definition at line 742 of file pins.h.

template<class arg_pin >
static void bmptk::hardware::debounce< arg_pin >::init ( )
inlinestatic

initialize the pin as input

This method initializes the pin as input pin. This might involve configuring the pin as gpio, and disabling analog or other special functions.

Definition at line 730 of file pins.h.


The documentation for this struct was generated from the following file: