Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** TIMER ARRAYS **/
- #define MAX_TIMERS 255
- int Timer_Counter = 0;
- uint16_t BUFFER_PIN[1] = {0x00};
- typedef struct{
- long Duration;
- long Start;
- int PIN;
- boolean State;
- String ID;
- uint16_t Address;
- boolean Is_On = false;
- }Timer_Struct;
- Timer_Struct Timers[MAX_TIMERS];
- /** TIMER ARRAYS **/
- static const inline void Timer_Stop(int Nth){
- Timers[Nth].Is_On = false;
- }
- static const inline void Timer_Checker_Loop(){
- if(Timers[Timer_Counter].Is_On == true){
- if(millis() - Timers[Timer_Counter].Start >= Timers[Timer_Counter].Duration){
- // Fired!
- }
- }
- Timer_Counter++;
- }
- static const inline void Timer_Start(int Nth,long Duration,int PIN,String ID,uint16_t Address){
- Timers[Nth].Duration = Duration;
- Timers[Nth].PIN = PIN;
- Timers[Nth].ID = ID;
- Timers[Nth].Address = Address;
- Timers[Nth].Is_On = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement