]> cloudbase.mooo.com Git - z180-stamp.git/blame - avr/background.c
env in ram
[z180-stamp.git] / avr / background.c
CommitLineData
72f58822
L
1#include "common.h"
2#include "background.h"
3
4
5#define BG_FUNC_MAX 5
6
7static bg_func func_tab[BG_FUNC_MAX];
8static int_fast8_t fcount;
9
10int bg_register(bg_func f)
11{
12 if (fcount < BG_FUNC_MAX) {
13 func_tab[fcount++] = f;
14 return 1;
15 }
16 return 0;
17}
18
19
20void bg_shed(void)
21{
22 static int_fast8_t current;
23
24 if (func_tab[current]) {
25 func_tab[current](0);
26 }
27 if (++current >= fcount)
28 current = 0;
29}
30
31