diff options
author | Daniel Friesel <derf@finalrewind.org> | 2016-01-28 15:05:15 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2016-01-28 15:05:15 +0100 |
commit | edf5f5ab92520b6af3151bca2b97c618a9d1d7f9 (patch) | |
tree | 29f710563194c1fbe6fcfc5dffa892bb6e204710 /src/display.h | |
parent | c079af446d61c892b867a9ab4efd2e496dfb9cce (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.h | 30 |
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; |