void LedFont_Scroller(void *pdata) { INT8U err; char *p; short x, xStart; (void)pdata; /* avoid compiler warning */ OSFlagPost(LedFont_Flags, LEDFONT_FLAG_READY, OS_FLAG_SET, &err); /* announce that we are ready */ for(;;) { /* forever */ while (LedFont_Text[0] == '\0') { /* no text */ LedFont_Stop(); } for(xStart=GDisp1_GetWidth()-1;;xStart--) { GDisp1_Clear(); p = &LedFont_Text[0]; /* get character */ x = xStart; while(*p != '\0') { /* go through the text */ x += LedFont_PutChar(*p, x); p++; /* next character */ x++; /* add a space between characters */ } GDisp1_UpdateFull(); if (x <= 0) { /* reached end of text to scroll: start over again */ LedFont_Stop(); break; /* start again */ } (void)OSTimeDlyHMSM(0,0,0,60); /* delay specifies the scrolling speed */ if (OSFlagQuery(LedFont_Flags, &err)&LEDFONT_FLAG_QUIT) { /* E8 pressed: quit */ OSFlagPost(LedFont_Flags, LEDFONT_FLAG_QUIT, OS_FLAG_CLR, &err); /* clear flag */ LedFont_Stop(); break; /* start again */ } } /* for */ } }
static void DrawFont(void) { FDisp1_PixelDim x, y; GDisp1_Clear(); GDisp1_UpdateFull(); x = 0; y = 0; FDisp1_WriteString("Helv8", GDisp1_COLOR_BLACK, &x, &y, Helv8_GetFont()); FDisp1_WriteString(" Helv8 BOLD", GDisp1_COLOR_BLACK, &x, &y, Helv8Bold_GetFont()); x = 0; y += Helv8_GetBoxHeight(); FDisp1_WriteString("Helv10", GDisp1_COLOR_BLACK, &x, &y, Helv10_GetFont()); x = 0; y += Helv10_GetBoxHeight(); FDisp1_WriteString("Helv12", GDisp1_COLOR_BLACK, &x, &y, Helv12_GetFont()); x = 0; y += Helv12_GetBoxHeight(); FDisp1_WriteString("Cour8", GDisp1_COLOR_BLACK, &x, &y, Cour8_GetFont()); FDisp1_WriteString(" Cour8 BOLD", GDisp1_COLOR_BLACK, &x, &y, Cour8Bold_GetFont()); x = 0; y += Cour8_GetBoxHeight(); FDisp1_WriteString("Cour10", GDisp1_COLOR_BLACK, &x, &y, Cour10_GetFont()); x = 0; y += Cour10_GetBoxHeight(); FDisp1_WriteString("Cour12", GDisp1_COLOR_BLACK, &x, &y, Cour12_GetFont()); GDisp1_UpdateFull(); WAIT1_Waitms(1000); }
static void SpeedTest(void) { /* update the display every 20 ms */ int i; uint8_t buf[16]; FDisp1_PixelDim x, y; GDisp1_Clear(); GDisp1_UpdateFull(); for(i=0; i<100; i++) { GDisp1_Clear(); UTIL1_Num32sToStr(buf, sizeof(buf), i); x = 0; y = 0; FDisp1_WriteString(buf, GDisp1_COLOR_BLACK, &x, &y, Helv8_GetFont()); GDisp1_UpdateFull(); WAIT1_Waitms(20); } }
static void DrawBoxes(void) { int i; GDisp1_PixelDim x, y, w, h; GDisp1_Clear(); GDisp1_DrawFilledBox(0, 0, GDisp1_GetWidth(), GDisp1_GetHeight(), GDisp1_COLOR_BLACK); GDisp1_DrawBox(20, 20, GDisp1_GetWidth()-40, GDisp1_GetHeight()-40, 1, GDisp1_COLOR_WHITE); // GDisp1_DrawFilledBox(0+20, 0+20, GDisp1_GetWidth()-40, GDisp1_GetHeight()-40, GDisp1_COLOR_WHITE); GDisp1_DrawFilledBox(0+40, 0+40, GDisp1_GetWidth()-80, GDisp1_GetHeight()-80, GDisp1_COLOR_BLACK); GDisp1_UpdateFull(); WAIT1_Waitms(500); }
static void DrawRectangles(void) { int i; GDisp1_PixelDim x, y, w, h; GDisp1_Clear(); GDisp1_UpdateFull(); GDisp1_DrawLine(0, 0, GDisp1_GetWidth()-1, GDisp1_GetHeight()-1, GDisp1_COLOR_BLACK); GDisp1_DrawLine(0, GDisp1_GetHeight()-1, GDisp1_GetWidth()-1, 0, GDisp1_COLOR_BLACK); GDisp1_UpdateFull(); for(i=0;i<GDisp1_GetShorterSide(); i+=2) { GDisp1_DrawBox(((GDisp1_GetShorterSide()-1)/2)-i, ((GDisp1_GetShorterSide()-1)/2)-i, 2*(i+1), 2*(i+1), 1, GDisp1_COLOR_BLACK); GDisp1_UpdateFull(); } WAIT1_Waitms(500); }
static void DrawLines(void) { int i; GDisp1_PixelDim x, y, w, h; GDisp1_Clear(); GDisp1_UpdateFull(); GDisp1_DrawBox(0, 0, 10, 10, 1, GDisp1_COLOR_BLACK); GDisp1_UpdateFull(); GDisp1_DrawBox(GDisp1_GetWidth()-10, 0, 10, 10, 1, GDisp1_COLOR_BLACK); GDisp1_UpdateFull(); GDisp1_DrawLine(0, 0, GDisp1_GetWidth()-1, GDisp1_GetHeight()-1, GDisp1_COLOR_BLACK); GDisp1_UpdateFull(); GDisp1_DrawLine(0, GDisp1_GetHeight()-1, GDisp1_GetWidth()-1, 0, GDisp1_COLOR_BLACK); GDisp1_UpdateFull(); for(i=0;i<20;i++) { GDisp1_DrawCircle((GDisp1_GetWidth()-1)/2, (GDisp1_GetHeight()-1)/2, 5+i*2, GDisp1_COLOR_BLACK); GDisp1_UpdateFull(); } WAIT1_Waitms(500); }
void APP_Run(void) { int i; FDisp1_PixelDim x, y; LCD1_Init(); LCD1_Clear(); #if 1 GDisp1_DrawFilledBox(0, 0, GDisp1_GetWidth()-1, GDisp1_GetHeight()-1, LCD1_COLOR_WHITE); GDisp1_UpdateFull(); GDisp1_DrawFilledBox(0, 0, GDisp1_GetWidth()-1, GDisp1_GetHeight()-1, LCD1_COLOR_RED); GDisp1_UpdateFull(); GDisp1_DrawFilledBox(0, 0, GDisp1_GetWidth()-1, GDisp1_GetHeight()-1, LCD1_COLOR_GREEN); GDisp1_UpdateFull(); GDisp1_DrawFilledBox(0, 0, GDisp1_GetWidth()-1, GDisp1_GetHeight()-1, LCD1_COLOR_BLUE); GDisp1_UpdateFull(); GDisp1_Clear(); GDisp1_UpdateFull(); GDisp1_DrawFilledBox(0, 0, 128, 128, LCD1_COLOR_RED); GDisp1_UpdateFull(); GDisp1_DrawFilledBox(0, 0, 50, 10, LCD1_COLOR_YELLOW); GDisp1_UpdateFull(); LCD1_SetDisplayOrientation(LCD1_ORIENTATION_PORTRAIT); GDisp1_DrawFilledBox(0, 0, 100, 20, LCD1_COLOR_YELLOW); GDisp1_UpdateFull(); x = 0; y = 0; FDisp1_WriteString("Portrait", LCD1_COLOR_RED, &x, &y, Helv14_GetFont()); GDisp1_UpdateFull(); LCD1_SetDisplayOrientation(LCD1_ORIENTATION_LANDSCAPE); GDisp1_DrawFilledBox(0, 0, 100, 20, LCD1_COLOR_ORANGE); x = 0; y = 0; FDisp1_WriteString("Landscape", LCD1_COLOR_GREEN, &x, &y, Helv14_GetFont()); GDisp1_UpdateFull(); LCD1_SetDisplayOrientation(LCD1_ORIENTATION_PORTRAIT180); GDisp1_DrawFilledBox(0, 0, 100, 20, LCD1_COLOR_RED); x = 0; y = 0; FDisp1_WriteString("Portrait180", LCD1_COLOR_BLUE, &x, &y, Helv14_GetFont()); GDisp1_UpdateFull(); LCD1_SetDisplayOrientation(LCD1_ORIENTATION_LANDSCAPE180); GDisp1_DrawFilledBox(0, 0, 100, 20, LCD1_COLOR_BRIGHT_GREEN); x = 0; y = 0; FDisp1_WriteString("Landscape180", LCD1_COLOR_WHITE, &x, &y, Helv14_GetFont()); GDisp1_UpdateFull(); #if 0 LCD1_OpenWindow(0, 0, (LCD1_PixelDim)(LCD1_GetWidth()-1), (LCD1_PixelDim)(LCD1_GetHeight()-1)); /* window for whole display */ for(i=0;i<500;i++) { LCD1_WriteDataWord(LCD1_COLOR_YELLOW); } LCD1_CloseWindow(); #endif LCD1_Clear(); LCD1_SetDisplayOrientation(LCD1_ORIENTATION_PORTRAIT); GDisp1_DrawLine(0, 0, 10, 50, LCD1_COLOR_RED); GDisp1_UpdateFull(); LCD1_SetDisplayOrientation(LCD1_ORIENTATION_LANDSCAPE); GDisp1_DrawLine(0, 0, 10, 50, LCD1_COLOR_GREEN); GDisp1_UpdateFull(); LCD1_SetDisplayOrientation(LCD1_ORIENTATION_LANDSCAPE180); GDisp1_DrawLine(0, 0, 10, 50, LCD1_COLOR_BLUE); GDisp1_UpdateFull(); LCD1_SetDisplayOrientation(LCD1_ORIENTATION_PORTRAIT180); GDisp1_DrawLine(0, 0, 10, 50, LCD1_COLOR_WHITE); LCD1_Clear(); //GDisp1_DrawFilledBox(0, 0, 20, 40, LCD1_COLOR_WHITE); LCD1_SetDisplayOrientation(LCD1_ORIENTATION_PORTRAIT180); GDisp1_DrawFilledBox(0, 0, 20, 40, LCD1_COLOR_RED); GDisp1_UpdateFull(); LCD1_SetDisplayOrientation(LCD1_ORIENTATION_LANDSCAPE); GDisp1_DrawFilledBox(0, 0, 20, 40, LCD1_COLOR_GREEN); GDisp1_UpdateFull(); LCD1_SetDisplayOrientation(LCD1_ORIENTATION_LANDSCAPE180); GDisp1_DrawFilledBox(0, 0, 20, 40, LCD1_COLOR_BLUE); GDisp1_UpdateFull(); GDisp1_DrawFilledBox(50, 50, 20, 30, LCD1_COLOR_RED); GDisp1_DrawFilledBox(0, 0, 96, 96, LCD1_COLOR_BLUE); GDisp1_DrawBox(0, 0, GDisp1_GetWidth(), GDisp1_GetHeight(), 1, LCD1_COLOR_GREEN); x = 0; y = 0; FDisp1_WriteString("Hello", LCD1_COLOR_GREEN, &x, &y, Helv14_GetFont()); GDisp1_UpdateFull(); float f = sin(f+1); EYES_Init(); for(;;) { EYES_Run(); // SpeedTest(); LED1_Neg(); WAIT1_Waitms(100); LED2_Neg(); WAIT1_Waitms(100); LED3_Neg(); WAIT1_Waitms(100); } #endif }