button procedure library
button.cpp
- Committer:
- ChuckTimber
- Date:
- 2014-07-13
- Revision:
- 0:f57033bb0e05
- Child:
- 1:20c8438edaee
File content as of revision 0:f57033bb0e05:
#include "button.h" #include "mbed.h" /** class to make sound with a buzzer, based on a PwmOut * The class use a timeout to switch off the sound - it is not blocking while making noise * * Example: * @code * @endcode */ using namespace mbed; // constructor /** Create a Beep object connected to the specified PwmOut pin * * @param pin PwmOut pin to connect to */ void BTN::sample_btn() { unsigned char a, b; a = _Pin; if (a == FIL) { b = STAT; STAT = a; b = (b ^ a) & a; if (b) CMD = b; } FIL = a; } BTN::BTN(PinName pin) : _Pin(pin) { CMD = STAT = FIL = 0; _Tick.attach(this, &BTN::sample_btn, 0.01); }