summaryrefslogtreecommitdiffstats
path: root/src/device/screen.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/device/screen.h')
-rw-r--r--src/device/screen.h30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/device/screen.h b/src/device/screen.h
index 5d0e3b3..3efff6d 100644
--- a/src/device/screen.h
+++ b/src/device/screen.h
@@ -13,20 +13,24 @@
#define SCREEN_WIDTH (128)
#define SCREEN_HEIGHT (32)
#define FONT_WIDTH (8)
-#define SCREEN_MAX_CHARS (SCREEN_WIDTH / FONT_WIDTH)
+#define FONT_HEIGHT (16)
+#define SCREEN_LINE_COUNT (SCREEN_HEIGHT / FONT_HEIGHT)
+#define SCREEN_LINE_CHARS (SCREEN_WIDTH / FONT_WIDTH)
+#define SCREEN_TOTAL_CHARS (SCREEN_LINE_COUNT * SCREEN_LINE_CHARS)
+#define MESSAGE_MAX (1023)
/**
* Struct that keeps track of the lines on the screen.
*/
struct display_status {
- OLEDDisplay *screen; /* Screen to draw on. */
- time_t delta; /* Seconds/Line */
- time_t last_scroll_time; /* Last second the line was scrolled */
- char *message; /* Entire message to be shown */
- char *first_line; /* First line on display */
- char *second_line; /* Second line on display */
- size_t message_len; /* Length of the message */
- size_t line_cursor; /* Index of the first line being displayed. */
+ OLEDDisplay *screen;
+ unsigned long period; /* milliseconds/Line */
+ unsigned long last_scroll_time;
+ char message[MESSAGE_MAX + 1]; /* Entire message to be shown */
+ char lines[SCREEN_LINE_COUNT][SCREEN_LINE_CHARS + 1];
+ char *cursor; /* the begining of the *next* location in the message to be shown*/
+ size_t msg_len;
+ size_t remaining; /* offset of the next part of text to be shown */
};
/**
@@ -44,7 +48,11 @@ int display_update_scroll(struct display_status *status);
* status - structure to Initialise
*
* msg - message to scroll on the screen
+ *
+ * size - length of the message
+ *
+ * period - time between [elder] scrolls
*/
-void display_status_init(OLEDDisplay *screen, struct display_status *status, char *msg);
+void display_status_init(OLEDDisplay *screen, struct display_status *status, char *msg, size_t size, unsigned long int period);
-#endif /* DEVICE_SCREEN_H */ \ No newline at end of file
+#endif /* DEVICE_SCREEN_H */