aboutsummaryrefslogtreecommitdiff
path: root/src/data.h
diff options
context:
space:
mode:
authorDien-Nhung Nguyen <kein@kienlab.com>2024-08-27 20:08:24 +0700
committerGitHub <noreply@github.com>2024-08-27 15:08:24 +0200
commitc95faf32a6a98975828717d596ff51dedeecdf56 (patch)
tree8fe52862e0c34bfe82509adf0c98a8e57056d4c7 /src/data.h
parentf5874d607315ff88b27414299089b8528b5bb07c (diff)
Add animations (#15)
* animation: add xbm animations * refactor: correct framebuffer terminology * animation: add animations and effect * animation: timing with TMOS scheduler
Diffstat (limited to 'src/data.h')
-rw-r--r--src/data.h26
1 files changed, 21 insertions, 5 deletions
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 <stdint.h>
-#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__ */