blob: 54734e52ecd4de45c432e06c2368cc758acfd676 (
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
|
/**
* Simple API for scrolling lines. Keeps things simple by not even assuming
* which screen is being drawn on.
*/
#ifndef DEVICE_SCREEN_H
#define DEVICE_SCREEN_H
#include <time.h>
#include <SSD1306Brzo.h>
#include <Wire.h>
#define SCREEN_WIDTH (128)
#define SCREEN_HEIGHT (32)
#define FONT_WIDTH (8)
#define SCREEN_MAX_CHARS (SCREEN_WIDTH / FONT_WIDTH)
/**
* Struct that keeps track of the lines on the screen.
*/
struct display_status {
SSD1306Brzo *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. */
};
/**
* Displays scrolling text on the screen.
*/
void display_update_scroll(struct display_status *status);
/**
* Initialises display_status structure so it can be used for
* display_update_scroll.
*
* screen - screen to draw on
*
* status - structure to Initialise
*
* msg - message to scroll on the screen
*/
void display_status_init(SSD1306Brzo *screen, struct display_status *status, char *msg);
#endif /* DEVICE_SCREEN_H */
|