22 lines
510 B
C
22 lines
510 B
C
|
#ifndef _TIMERS_H
|
||
|
#define _TIMERS_H
|
||
|
|
||
|
#include <stdint.h>
|
||
|
|
||
|
#define SYSTICK_MS 1 // Systick interval in ms
|
||
|
enum TIMERS{TIMER_BUTTON,
|
||
|
TIMER_APP0,
|
||
|
TIMER_APP1,
|
||
|
TIMERS_COUNT};
|
||
|
|
||
|
extern volatile uint16_t timer[TIMERS_COUNT];
|
||
|
|
||
|
#define timer_ms(ms) (ms / SYSTICK_MS)
|
||
|
#define timer_set(channel, time_systicks) if (1) {timer[channel] = time_systicks;}
|
||
|
#define timer_expired(channel) (timer[channel] == 0)
|
||
|
|
||
|
void timers_init();
|
||
|
uint8_t block_for(uint8_t channel, uint16_t time_systicks);
|
||
|
|
||
|
#endif // _TIMERS_H
|