summaryrefslogtreecommitdiff
path: root/src/display.h
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-01-28 15:05:15 +0100
committerDaniel Friesel <derf@finalrewind.org>2016-01-28 15:05:15 +0100
commitedf5f5ab92520b6af3151bca2b97c618a9d1d7f9 (patch)
tree29f710563194c1fbe6fcfc5dffa892bb6e204710 /src/display.h
parentc079af446d61c892b867a9ab4efd2e496dfb9cce (diff)
merge text_t and animation_t into single animation type to reduce code and memory overhead
Diffstat (limited to 'src/display.h')
-rw-r--r--src/display.h30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/display.h b/src/display.h
index 70939ca..abea377 100644
--- a/src/display.h
+++ b/src/display.h
@@ -4,39 +4,33 @@
#include <util/delay.h>
#include <stdlib.h>
-struct __text {
- uint8_t speed;
- uint8_t delay;
- uint8_t direction;
- uint8_t *str;
+enum class AnimationType : uint8_t {
+ TEXT = 1,
+ FRAMES = 2
};
-struct __animation {
+struct animation {
+ AnimationType mode;
+ uint8_t length;
uint8_t speed;
uint8_t delay;
+ uint8_t direction;
uint8_t *data;
};
-typedef struct __text text_t;
-typedef struct __animation animation_t;
+typedef struct animation animation_t;
class Display {
private:
- text_t active_text;
- animation_t active_anim;
+ 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;
- uint8_t data_buf[128];
- enum DisplayMode : uint8_t {
- TEXT = 1,
- ANIMATION = 2
- };
- DisplayMode mode;
public:
Display();
+
void enable(void);
void disable(void);
@@ -44,9 +38,7 @@ class Display {
void reset(void);
void update(void);
- void show(text_t text);
- void show(animation_t anim);
- void show(uint8_t *str);
+ void show(animation_t *anim);
};
extern Display display;