Created
March 31, 2015 18:43
-
-
Save jenishah/283b63697e0f416492eb to your computer and use it in GitHub Desktop.
Timer library for arduino that uses timer ISR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef AllTimer_h | |
#define AllTimer_h | |
typedef void(*dofun)(); //to be used when functions are to be called after each timer runs out. | |
class AllTimer{ | |
public: | |
AllTimer(); | |
static bool timeout; | |
static float stopTimer(void); //returns the time passed in seconds after startTimer. | |
static void setTimer(int, dofun); //sets the time after which function f will keep executing. | |
static void startTimer(void); //starts the timer. helps to know the time between start and stop of timer. | |
static float knowTime(void); //doesn't stop the timer; simply lets you know the seconds that passed after timer started. | |
static void exitTimer(void); //simply stop the timer and do nothing else. | |
static void decideFun(void); | |
static void decCounter(void); //decrements counter for setTimer() and also executes the function f; | |
private: | |
static float timerCnt; | |
static int *ptrCounter; | |
static int *perCounter; | |
static int funToken; | |
static void incCount(void); //increments coutner for startTimer(); | |
}; | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment