aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2012-11-21 09:54:23 +0100
committerJoel Bodenmann <joel@unormal.org>2012-11-21 09:54:23 +0100
commitc0cf584c85d2a9ee31adccb23d307b1955e3d8fc (patch)
tree022d0168089cff94d3fe5bab16342175bfe90274 /demos
parent1dd5de6e81b645e9765da1a3f00f3c399462837e (diff)
downloaduGFX-c0cf584c85d2a9ee31adccb23d307b1955e3d8fc.tar.gz
uGFX-c0cf584c85d2a9ee31adccb23d307b1955e3d8fc.tar.bz2
uGFX-c0cf584c85d2a9ee31adccb23d307b1955e3d8fc.zip
console example doc
Diffstat (limited to 'demos')
-rw-r--r--demos/modules/console/main.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/demos/modules/console/main.c b/demos/modules/console/main.c
index f8ef6338..fd329f95 100644
--- a/demos/modules/console/main.c
+++ b/demos/modules/console/main.c
@@ -34,7 +34,10 @@
#include "gdisp.h"
#include "gwin.h"
+/* The handles for our three consoles */
GHandle GW1, GW2, GW3;
+
+/* The streams for our three consoles */
BaseSequentialStream *S1, *S2, *S3;
int main(void) {
@@ -43,15 +46,16 @@ int main(void) {
halInit();
chSysInit();
+ /* initialize and clear the display */
gdispInit();
- //tsInit(&TSD1);
- //gdispInit();
gdispClear(Black);
+ /* create the three console windows and set a font for each */
GW1 = gwinCreateConsole(NULL, 0, 0, gdispGetWidth(), gdispGetHeight()/2, &fontUI2Double);
GW2 = gwinCreateConsole(NULL, 0, gdispGetHeight()/2, gdispGetWidth()/2, gdispGetHeight(), &fontSmall);
GW3 = gwinCreateConsole(NULL, gdispGetWidth()/2, gdispGetHeight()/2, gdispGetWidth(), gdispGetHeight(), &fontSmall);
+ /* Set the fore- and background colors for each console */
gwinSetColor(GW1, Green);
gwinSetBgColor(GW1, Black);
gwinSetColor(GW2, White);
@@ -59,22 +63,27 @@ int main(void) {
gwinSetColor(GW3, Black);
gwinSetBgColor(GW3, Red);
+ /* clear all console windows - to set background */
gwinClear(GW1);
gwinClear(GW2);
gwinClear(GW3);
+ /* receive the stream pointers of each console */
S1 = gwinGetConsoleStream(GW1);
S2 = gwinGetConsoleStream(GW2);
S3 = gwinGetConsoleStream(GW3);
+ /* Output some data on the first console */
for(i = 0; i < 10; i++) {
chprintf(S1, "Hello ChibiOS/GFX!\r\n");
}
+ /* Output some data on the second console */
for(i = 0; i < 16; i++) {
chprintf(S2, "Message Nr.: %d\r\n", i+1);
}
+ /* Output some data on the third console */
for(i = 0; i < 18; i++) {
chprintf(S3, "Message Nr.: %d\r\n", i+1);
}