console example doc
This commit is contained in:
parent
1dd5de6e81
commit
c0cf584c85
1 changed files with 11 additions and 2 deletions
|
@ -34,7 +34,10 @@
|
||||||
#include "gdisp.h"
|
#include "gdisp.h"
|
||||||
#include "gwin.h"
|
#include "gwin.h"
|
||||||
|
|
||||||
|
/* The handles for our three consoles */
|
||||||
GHandle GW1, GW2, GW3;
|
GHandle GW1, GW2, GW3;
|
||||||
|
|
||||||
|
/* The streams for our three consoles */
|
||||||
BaseSequentialStream *S1, *S2, *S3;
|
BaseSequentialStream *S1, *S2, *S3;
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
|
@ -43,15 +46,16 @@ int main(void) {
|
||||||
halInit();
|
halInit();
|
||||||
chSysInit();
|
chSysInit();
|
||||||
|
|
||||||
|
/* initialize and clear the display */
|
||||||
gdispInit();
|
gdispInit();
|
||||||
//tsInit(&TSD1);
|
|
||||||
//gdispInit();
|
|
||||||
gdispClear(Black);
|
gdispClear(Black);
|
||||||
|
|
||||||
|
/* create the three console windows and set a font for each */
|
||||||
GW1 = gwinCreateConsole(NULL, 0, 0, gdispGetWidth(), gdispGetHeight()/2, &fontUI2Double);
|
GW1 = gwinCreateConsole(NULL, 0, 0, gdispGetWidth(), gdispGetHeight()/2, &fontUI2Double);
|
||||||
GW2 = gwinCreateConsole(NULL, 0, gdispGetHeight()/2, gdispGetWidth()/2, gdispGetHeight(), &fontSmall);
|
GW2 = gwinCreateConsole(NULL, 0, gdispGetHeight()/2, gdispGetWidth()/2, gdispGetHeight(), &fontSmall);
|
||||||
GW3 = gwinCreateConsole(NULL, gdispGetWidth()/2, gdispGetHeight()/2, gdispGetWidth(), gdispGetHeight(), &fontSmall);
|
GW3 = gwinCreateConsole(NULL, gdispGetWidth()/2, gdispGetHeight()/2, gdispGetWidth(), gdispGetHeight(), &fontSmall);
|
||||||
|
|
||||||
|
/* Set the fore- and background colors for each console */
|
||||||
gwinSetColor(GW1, Green);
|
gwinSetColor(GW1, Green);
|
||||||
gwinSetBgColor(GW1, Black);
|
gwinSetBgColor(GW1, Black);
|
||||||
gwinSetColor(GW2, White);
|
gwinSetColor(GW2, White);
|
||||||
|
@ -59,22 +63,27 @@ int main(void) {
|
||||||
gwinSetColor(GW3, Black);
|
gwinSetColor(GW3, Black);
|
||||||
gwinSetBgColor(GW3, Red);
|
gwinSetBgColor(GW3, Red);
|
||||||
|
|
||||||
|
/* clear all console windows - to set background */
|
||||||
gwinClear(GW1);
|
gwinClear(GW1);
|
||||||
gwinClear(GW2);
|
gwinClear(GW2);
|
||||||
gwinClear(GW3);
|
gwinClear(GW3);
|
||||||
|
|
||||||
|
/* receive the stream pointers of each console */
|
||||||
S1 = gwinGetConsoleStream(GW1);
|
S1 = gwinGetConsoleStream(GW1);
|
||||||
S2 = gwinGetConsoleStream(GW2);
|
S2 = gwinGetConsoleStream(GW2);
|
||||||
S3 = gwinGetConsoleStream(GW3);
|
S3 = gwinGetConsoleStream(GW3);
|
||||||
|
|
||||||
|
/* Output some data on the first console */
|
||||||
for(i = 0; i < 10; i++) {
|
for(i = 0; i < 10; i++) {
|
||||||
chprintf(S1, "Hello ChibiOS/GFX!\r\n");
|
chprintf(S1, "Hello ChibiOS/GFX!\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Output some data on the second console */
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 16; i++) {
|
||||||
chprintf(S2, "Message Nr.: %d\r\n", i+1);
|
chprintf(S2, "Message Nr.: %d\r\n", i+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Output some data on the third console */
|
||||||
for(i = 0; i < 18; i++) {
|
for(i = 0; i < 18; i++) {
|
||||||
chprintf(S3, "Message Nr.: %d\r\n", i+1);
|
chprintf(S3, "Message Nr.: %d\r\n", i+1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue