Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * TimerMultiTask.h
- *
- * Author: odilon
- * Created on: 27/11/2015
- * Modified 13/07/2016
- * code for ESP8266
- * based: http://www.switchdoc.com/2015/10/iot-esp8266-timer-tutorial-arduino-ide/
- */
- #ifndef TIMERMULTITASK_H
- #define TIMERMULTITASK_H
- #if defined (ARDUINO_ARCH_ESP8266)
- extern "C" {
- #include "user_interface.h"
- }
- #else
- #include <Arduino.h>
- #include <TimerOne.h>
- #endif
- #define TICTAC_SIZE 5 //taskArray size
- /*
- * task structure
- *
- */
- struct TicTac {
- int tic; //boom size
- int tac; //boom count
- void (*call)(); //user function()
- bool tictacEnabled; //task enabled
- };
- typedef struct TicTac tictac;
- class TimerMultiTask {
- public:
- /*
- * Constructor.
- *
- * @param boom - the period in microseconds to pause for
- *
- */
- TimerMultiTask();
- /**
- * Set the BOOM period
- *
- * @boom unsigned long
- */
- void setBOOM(unsigned long boom);
- /**
- * Add a tic stopper
- *
- * @tic integer
- */
- int add(int, void (*)());
- /**
- * Enable(or re-ebable) the task
- *
- * @taskId integer
- */
- bool enable(int taskId);
- /**
- * Disable the task
- *
- * @taskId integer
- */
- bool disable(int taskId);
- /**
- * Clear the TicTac struct of a task
- *
- * @taskId integer
- */
- bool clear(int taskId);
- };
- #endif /* TIMERMULTITASK_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement