Test code for interfacing to megasquirt ECU.

Dependencies:   jtlcd mbed

Counter/Counter.h

Committer:
jont
Date:
2015-02-16
Revision:
4:50203a03ccd2
Parent:
0:cf99a7b873b3

File content as of revision 4:50203a03ccd2:

#ifndef COUNTER_
#define COUNTER_

#define DEBOUNCING_INTERVAL  200    //  Debouncing interval (in mili-seconds)
/*=====================================================================================*/
// Counter object, which also setups up irq
/*=====================================================================================*/

//from http://mbed.org/handbook/InterruptIn, modified to add debouncing
class Counter
{
public:
    Counter(PinName pin, void (*function)(void));

void increment();

int read();

int set(int val);

void reset();

private:
    InterruptIn _interrupt;
    volatile int _count;
    Timer             t;               //  To manage debounce by menchanical switch
protected:
    //the callback
    FunctionPointer jim;
};



#endif