aboutsummaryrefslogtreecommitdiff
path: root/src/inc/spi/dev/display_dogm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/inc/spi/dev/display_dogm.c')
-rwxr-xr-xsrc/inc/spi/dev/display_dogm.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/inc/spi/dev/display_dogm.c b/src/inc/spi/dev/display_dogm.c
new file mode 100755
index 0000000..a655769
--- /dev/null
+++ b/src/inc/spi/dev/display_dogm.c
@@ -0,0 +1,39 @@
1#include "display_dogm.h"
2
3void display_dogm_init()
4{
5 //DDRA |= (1<<PA7); // activate portA for display
6 //DDRC |= (1<<PC7); // activate portC for display
7 DDRD |= (1<<PD7) | (1<<PD6);
8 PORTD |= (1<<PD7) | (1<<PD6);
9
10 // Wait time >40mS after VDD stable
11 _delay_ms(50); // 10ms for safty
12
13 display_dogm_exec(CMD_FUNCTION_SET);
14 display_dogm_exec(CMD_FUNCTION_SET);
15 display_dogm_exec(CMD_CONTRAST_SET);
16 display_dogm_exec(CMD_POWER_CONTROL);
17 display_dogm_exec(CMD_FOLLOWER_CONTROL);
18 display_dogm_exec(CMD_DISPLAY_ONOFF);
19 display_dogm_exec(CMD_ENTRY_MODE_SET);
20 display_dogm_exec(CMD_DISPLAY_CLEAR);
21}
22
23void display_dogm_putc(char c)
24{
25 PORTD &= ~(1<<PD7); // chip select: activate display
26 PORTD |= (1<<PD6); // L=Commandmode, H=Datamode
27 spi_putc(c);
28 _delay_us(40); // try and error value (you get chinese chars? increase!)
29 PORTD |= (1<<PD7); // chip select: deactivate display
30}
31
32void display_dogm_exec(char c)
33{
34 PORTD &= ~(1<<PD7); // chip select: activate display
35 PORTD &= ~(1<<PD6); // L=Commandmode, H=Datamode
36 spi_putc(c);
37 _delay_ms(4); // time the longest command takes on display
38 PORTD |= (1<<PD7); // chip select: deactivate display
39}
..