From d53551fb38418a063dcca0898c92349006c0e3e4 Mon Sep 17 00:00:00 2001 From: Tectu Date: Wed, 13 Jun 2012 10:14:02 +0200 Subject: [PATCH] added demos folder --- demos/README | 18 ++++++++++++++++++ demos/drawing/main.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 demos/README create mode 100755 demos/drawing/main.c diff --git a/demos/README b/demos/README new file mode 100644 index 00000000..e95314f7 --- /dev/null +++ b/demos/README @@ -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 + diff --git a/demos/drawing/main.c b/demos/drawing/main.c new file mode 100755 index 00000000..d38166fe --- /dev/null +++ b/demos/drawing/main.c @@ -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; +}