From c95faf32a6a98975828717d596ff51dedeecdf56 Mon Sep 17 00:00:00 2001 From: Dien-Nhung Nguyen Date: Tue, 27 Aug 2024 20:08:24 +0700 Subject: Add animations (#15) * animation: add xbm animations * refactor: correct framebuffer terminology * animation: add animations and effect * animation: timing with TMOS scheduler --- src/bmlist.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/bmlist.h (limited to 'src/bmlist.h') diff --git a/src/bmlist.h b/src/bmlist.h new file mode 100644 index 0000000..1a7cf1a --- /dev/null +++ b/src/bmlist.h @@ -0,0 +1,41 @@ +#ifndef __BMLIST_H__ +#define __BMLIST_H__ + +#include +#include + +typedef struct bm_st { + uint16_t *buf; + uint16_t width; + uint8_t modes; + int is_flash; + int is_marquee; + // TODO: feat: Brightness for each bm + int brightness; + // TODO: feat: Timeout for each bm to switch to next bm + uint32_t timeout; // zero mean no timeout + uint32_t anim_step; // Animation step, zero means restart animation + + struct bm_st *next; + struct bm_st *prev; +} bm_t; + +bm_t *bm_new(uint16_t width); +static inline void bm_free(bm_t *bm) +{ + free(bm->buf); + free(bm); +} + +bm_t *bmlist_insert(bm_t *at, bm_t *new); +bm_t *bmlist_append(bm_t *new); +bm_t *bmlist_drop(bm_t *bm); + +bm_t *bmlist_gonext(); +bm_t *bmlist_goprev() ; +bm_t *bmlist_gohead(); +bm_t *bmlist_current(); + +void bmlist_init(uint16_t first_bm_width); + +#endif /* __BMLIST_H__ */ -- cgit v1.2.3