added power modes demo
This commit is contained in:
parent
de71035ce4
commit
d2471ca6f3
1 changed files with 34 additions and 0 deletions
34
demos/powermodes/main.c
Executable file
34
demos/powermodes/main.c
Executable file
|
@ -0,0 +1,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;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue