aboutsummaryrefslogtreecommitdiff
path: root/src/fb.h
blob: 4e5cb43f4d5a8b0f660686fa24feee9ec3a5f236 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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__ */