aboutsummaryrefslogtreecommitdiffstats
path: root/demos/powermodes/main.c
blob: 5d71f60f2af1d3eb4a76a6091559507932bcd85f (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
#include "ch.h"
#include "hal.h"
#include "glcd.h"

static GLCDDriver GLCDD1;

int main(void) {
	halInit();
	chSysInit();
	
	lcdInit(&GLCDD1);
	lcdClear(Black);
	lcdDrawString(100, 100, "Hello World", White, Black);

	// wait two seconds to see current LCD content
	chThdSleepSeconds(2);

	// brings LCD to sleep mode
	lcdSetPowerMode(sleepOn);

	// wait two seconds to see current LCD content
	chThdSleepSeconds(2);

	// brings LCD back from sleep mode
	// content displayed before gets displayed again
	lcdSetPowerMode(sleepOff);

	while (TRUE) {
		
		chThdSleepMilliseconds(200);	
	}

	return 0;
}