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/data.h | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src/data.h') diff --git a/src/data.h b/src/data.h index 813176d..ebdf104 100644 --- a/src/data.h +++ b/src/data.h @@ -3,10 +3,10 @@ #include -#include "fb.h" +#include "bmlist.h" typedef struct { - uint8_t header[6]; + uint8_t header[6]; // magic uint8_t flash; uint8_t marquee; uint8_t modes[8]; @@ -24,6 +24,20 @@ typedef struct { #define LEGACY_TRANSFER_WIDTH (16) #define LEGACY_HEADER_SIZE (sizeof(data_legacy_t) - sizeof(uint8_t *)) +#define LEGACY_GET_SPEED(mode) ((mode) >> 4) +#define LEGACY_GET_ANIMATION(mode) ((mode) & 0x0F) + +enum ANIMATION_MODES { + LEFT = 0, + RIGHT, + UP, + DOWN, + FIXED, + ANIMATION, + SNOWFLAKE, + PICTURE, + LASER, +}; static inline uint16_t bswap16(uint16_t i) { return (i >> 8) | (i << 8); @@ -33,10 +47,12 @@ uint32_t bigendian16_sum(uint16_t *s, int len); uint32_t data_flatSave(uint8_t *data, uint32_t len); uint16_t data_flash2newmem(uint8_t **chunk, uint32_t n); +data_legacy_t *data_get_header(int read_anyway); + void chunk2buffer(uint8_t *chunk, uint16_t size, uint16_t *buf); -void chunk2fb(uint8_t *chunk, uint16_t size, fb_t *fb); +void chunk2bm(uint8_t *chunk, uint16_t size, bm_t *bm); -fb_t *chunk2newfb(uint8_t *chunk, uint16_t size); -fb_t *flash2newfb(uint32_t n); +bm_t *chunk2newbm(uint8_t *chunk, uint16_t size); +bm_t *flash2newbm(uint32_t n); #endif /* __DATA_H__ */ -- cgit v1.2.3