]>
Commit | Line | Data |
---|---|---|
72f58822 L |
1 | #include "common.h" |
2 | #include "background.h" | |
3 | ||
4 | ||
5 | #define BG_FUNC_MAX 5 | |
6 | ||
7 | static bg_func func_tab[BG_FUNC_MAX]; | |
8 | static int_fast8_t fcount; | |
9 | ||
10 | int 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 | ||
20 | void 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 |