+#include "common.h"
+#include "background.h"
+
+
+#define BG_FUNC_MAX 5
+
+static bg_func func_tab[BG_FUNC_MAX];
+static int_fast8_t fcount;
+
+int bg_register(bg_func f)
+{
+ if (fcount < BG_FUNC_MAX) {
+ func_tab[fcount++] = f;
+ return 1;
+ }
+ return 0;
+}
+
+
+void bg_shed(void)
+{
+ static int_fast8_t current;
+
+ if (func_tab[current]) {
+ func_tab[current](0);
+ }
+ if (++current >= fcount)
+ current = 0;
+}
+
+