]>
cloudbase.mooo.com Git - z180-stamp.git/blob - avr/background.c
2 * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
4 * SPDX-License-Identifier: GPL-2.0+
8 #include "background.h"
16 } func_tab
[BG_FUNC_MAX
];
18 static int_fast8_t fcount
;
20 int bg_register(bg_func f
, int initval
)
22 if (fcount
< BG_FUNC_MAX
) {
23 func_tab
[fcount
].fct
= f
;
24 func_tab
[fcount
].param
= initval
;
30 int bg_setstat(int handle
, int val
)
32 if (handle
< fcount
) {
33 func_tab
[handle
].param
= val
;
41 int bg_getstat(int handle
)
43 if (handle
< fcount
) {
44 return func_tab
[handle
].param
;
52 static int_fast8_t current
;
54 if (func_tab
[current
].fct
) {
55 int v
= func_tab
[current
].fct(func_tab
[current
].param
);
56 func_tab
[current
].param
= v
;
58 if (++current
>= fcount
)