forked from Traumflug/Teacup_Firmware
-
Notifications
You must be signed in to change notification settings - Fork 1
/
display.h
72 lines (48 loc) · 1.7 KB
/
display.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/** \file
\brief Display broker.
Here we map generic display calls to calls to the actually used display.
*/
#ifndef _DISPLAY_H
#define _DISPLAY_H
#include <stdint.h>
#include "config_wrapper.h"
#include "displaybus.h"
#ifdef DISPLAY_BUS
#if defined DISPLAY_TYPE_SSD1306
#define DISPLAY_I2C_ADDRESS 0x78
#define DISPLAY_LINES 4
#define DISPLAY_SYMBOLS_PER_LINE 32
#define DISPLAY
#elif defined DISPLAY_TYPE_HD44780
#define DISPLAY_LINES 2
#define DISPLAY_SYMBOLS_PER_LINE 16
#define DISPLAY
#else
#error Display type not yet supported.
#endif /* DISPLAY_TYPE_... */
#endif /* DISPLAY_BUS */
#define DISPLAY_BUFFER_SIZE 128
/**
Printable ASCII characters and our embedded fonts start at 0x20, so we can
use 0x00..0x1F for storing control commands in the character queue. That's
what genuine ASCII does, too, we just use our own code set.
Queueing up actions together with actual characters not only postpones
these actions to idle time, it's also necessary to keep them in the right
order. Without it, writing a few characters, moving the cursor elsewhere and
writing even more characters would result in all characters being written to
the second position, because characters would wait in the queue while cursor
movements were executed immediately.
*/
enum display_low_code {
low_code_clear = 0x01,
low_code_set_cursor
};
void display_init(void);
void display_tick(void);
void display_clear(void);
void display_greeting(void);
void display_clock(void);
void display_set_cursor(uint8_t line, uint8_t column);
void display_writechar(uint8_t data);
void display_writestr_P(PGM_P data_P);
#endif /* _DISPLAY_H */