Exemple #1
0
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);
}
Exemple #2
0
static void SpeedTest(void) {
  int i;

  GDisp1_DrawFilledBox(0, 0, GDisp1_GetWidth()-1, GDisp1_GetHeight()-1, LCD1_COLOR_RED);
  GDisp1_UpdateFull();
  for(i=0;i<25;i++) {
//    GDisp1_DrawFilledBox(0, i*10, 10, 10, LCD1_COLOR_BLUE);
//    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();
  }
}
Exemple #3
0
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 */
  }
}
Exemple #4
0
static GDisp1_PixelDim LedFont_PutChar(char ch, short x) {
  byte i, data;
  GDisp1_PixelDim y = 0;
  const LedFont_FontDesc *fontChar;
  
  if (ch < 0x20 || ch > 0x7E) { /* non-printable character */
    ch = ' '; /* convert to a blank */
  }
  fontChar = &LedFont_FontTable[ch-0x20];
  for(i=0;i<fontChar->size;i++) { /* process font elems */
    data = fontChar->data[i];
    y = 0;
    while(x>=0 && data!=0 && x<GDisp1_GetWidth()) {
      if (data&1) {
        GDisp1_SetPixel((GDisp1_PixelDim)x, y);
      } else {
        GDisp1_ClrPixel((GDisp1_PixelDim)x, y);
      }
      data >>= 1; /* next bit */
      y++;
    }
    x++;
  }
  return fontChar->size;
}
Exemple #5
0
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);
}
Exemple #6
0
void LCD_Run(void) {
  GDisp1_PixelDim x, y;
  short xOffset, yOffset;
  GDisp1_PixelColor color;
  unsigned char line;

  D4DLCDHW_Init_Flexbus_16b();
  
 
  LCD1_Init();
  
  GDisp1_DrawFilledBox(0, 0, GDisp1_GetWidth(), GDisp1_GetHeight(), GDisp1_COLOR_WHITE);
  color = GDisp1_COLOR_BLUE;
  yOffset = xOffset = OFFSET;
  x = y = 0;
  line = 1;
  for(;;) {
    /* toggle the LED's */
    LED2_Neg();
    LED3_Neg();
    LED4_Neg();
    /* show graphic routines */
    GDisp1_DrawBox(x, y, BOX_WIDTH, BOX_HEIGHT, 2, color);
    if (x>GDisp1_GetWidth()-BOX_WIDTH) {
      xOffset = -xOffset;
    }
    if (y>GDisp1_GetHeight()-BOX_HEIGHT) {
      yOffset = -yOffset;
    }
    color++; /* iterate through color */
    x += xOffset;
    y += yOffset;
    /* draw some text */
    PrintTouchText(line);
    line++;
    if (line>10) {
      /* clear text area */
      line = 1;
      GDisp1_DrawFilledBox(0, 0, 150, 160, color);
    }
    /* handling touch screen */
    TCHS1_Scan(); /* this will call TCHS1_OnEvent() */
  } /* for */}
Exemple #7
0
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);
}
Exemple #8
0
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
}