summaryrefslogtreecommitdiff
path: root/src/display.h
blob: abea37762b1731f842135c8f263a2351a5faaf17 (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
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
#include <util/delay.h>
#include <stdlib.h>

enum class AnimationType : uint8_t {
	TEXT = 1,
	FRAMES = 2
};

struct animation {
	AnimationType mode;
	uint8_t length;
	uint8_t speed;
	uint8_t delay;
	uint8_t direction;
	uint8_t *data;
};

typedef struct animation animation_t;

class Display {
	private:
		animation_t *active_anim;
		uint8_t need_update;
		uint8_t active_col;
		uint8_t disp_buf[8];
		uint8_t str_pos;
		int8_t char_pos;
	public:
		Display();

		void enable(void);
		void disable(void);

		void multiplex(void);
		void reset(void);
		void update(void);

		void show(animation_t *anim);
};

extern Display display;