aboutsummaryrefslogtreecommitdiff
path: root/src/fb.h
diff options
context:
space:
mode:
authorFrançois Cartegnie <281376+fcartegnie@users.noreply.github.com>2024-06-12 16:39:27 +0700
committerGitHub <noreply@github.com>2024-06-12 16:39:27 +0700
commit316ce879fd555d19d8a69b726f7c8fee7333f277 (patch)
tree2d8208a8b7e673ab1b4c296e6258474876d8b810 /src/fb.h
parent590c66ef682abc29bd6f10718ed192f047017600 (diff)
parenta69b87e0373dc003959d3222cff722c927bb2857 (diff)
Merge pull request #14 from kienvo/fb
Add dynamic framebuffer
Diffstat (limited to 'src/fb.h')
-rw-r--r--src/fb.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/fb.h b/src/fb.h
new file mode 100644
index 0000000..4e5cb43
--- /dev/null
+++ b/src/fb.h
@@ -0,0 +1,53 @@
+#ifndef __FB_H__
+#define __FB_H__
+
+#include <stdint.h>
+#include <stdlib.h>
+
+enum ANIMATION_MODES {
+ LEFT = 0,
+ RIGHT,
+ UP,
+ DOWN,
+ FIXED,
+ SNOWFLAKE,
+ PICTURE,
+ ANIMATION,
+ LASER,
+};
+
+typedef struct fb_st {
+ uint16_t *buf;
+ uint16_t width;
+ uint8_t modes;
+ int is_flash;
+ int is_marquee;
+ // TODO: feat: Brightness for each fb
+ int brightness;
+ // TODO: feat: Timeout for each fb to switch to next fb
+ uint32_t timeout; // zero mean no timeout
+ uint16_t scroll;
+
+ struct fb_st *next;
+ struct fb_st *prev;
+} fb_t;
+
+fb_t *fb_new(uint16_t width);
+static inline void fb_free(fb_t *fb)
+{
+ free((fb)->buf);
+ free((fb));
+}
+
+fb_t *fblist_insert(fb_t *at, fb_t *new);
+fb_t *fblist_append(fb_t *new);
+fb_t *fblist_drop(fb_t *fb);
+
+fb_t *fblist_gonext();
+fb_t *fblist_goprev() ;
+fb_t *fblist_gohead();
+fb_t *fblist_currentfb();
+
+void fblist_init(uint16_t first_fb_width);
+
+#endif /* __FB_H__ */