added demos folder

This commit is contained in:
Tectu 2012-06-13 10:14:02 +02:00
parent cb0cbb29e8
commit d53551fb38
2 changed files with 51 additions and 0 deletions

18
demos/README Normal file
View File

@ -0,0 +1,18 @@
This are a few demos, showing how to use the library.
Please note that this are not compilable projects.
Your boarfile do need to contain the following informations:
#define TP_PORT GPIOC
#define TP_IRQ 4
#define TP_CS 6
#define LCD_DATA_PORT GPIOE
#define LCD_CMD_PORT GPIOD
#define LCD_CS 12
#define LCD_RS 13
#define LCD_WR 14
#define LCD_RD 15

33
demos/drawing/main.c Executable file
View File

@ -0,0 +1,33 @@
#include "ch.h"
#include "hal.h"
#include "glcd.h"
static WORKING_AREA(waThread1, 128);
static void Thread1(void *arg) {
(void)arg;
while (TRUE) {
palTogglePad(GPIOD, GPIOD_LED1);
chThdSleepMilliseconds(500);
}
}
int main(void) {
halInit();
chSysInit();
lcdInit();
lcdClear(Black);
lcdDrawString(100, 100, "Hello World", White, Black);
lcdDrawCircle(150, 150, 10, filled, Green);
lcdDrawLine(0, 0, lcdGetWidth(), lcdGetHeight(), Yellow);
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
while (TRUE) {
chThdSleepMilliseconds(200);
}
return 0;
}