You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
664 B
28 lines
664 B
#ifndef __SOFTTIMER_H
|
|
#define __SOFTTIMER_H
|
|
|
|
#include <stdint.h>
|
|
#include "main.h"
|
|
|
|
#ifndef SOFTTIMERNUMS
|
|
#define SOFTTIMERNUMS 4 // random value
|
|
#endif
|
|
|
|
// NOTES:
|
|
// Please #define SOFTTIMERNUMS aNum before including this!
|
|
|
|
extern volatile uint16_t timer1_acc;
|
|
extern uint16_t softtimer_last[SOFTTIMERNUMS];
|
|
|
|
|
|
void softtimer_reset(uint8_t timernum);
|
|
uint8_t softtimer(uint8_t timernum, uint16_t interval);
|
|
|
|
// SOFTTIMER( <YOUR TIMER NUM>, <YOUR INTERVAL>);
|
|
#define SOFTTIMER(n,a) if(softtimer((n),(a*4)))
|
|
|
|
//TODO: use a static uint16 in the #define to store softtimer_last, and pass
|
|
//it by reference to softtimer(). That way SOFTTIMERNUMS is unnecessary
|
|
|
|
#endif
|