/*=====================================================================================================*/
void LCD_DrawRectangle( u16 CoordiX, u16 CoordiY, u16 Width, u16 Height, u16 Color )
{
  LCD_DrawLineX(CoordiX,         CoordiY,          Width,    Color);
  LCD_DrawLineX(CoordiX,         CoordiY+Height-1, Width,    Color);
  LCD_DrawLineY(CoordiX,         CoordiY+1,        Height-2, Color);
  LCD_DrawLineY(CoordiX+Width-1, CoordiY+1,        Height-2, Color);
}
/*=====================================================================================================*/
void WaveFormPrint( WaveForm_Struct* WaveForm )
{
  u16 i, j;
  s16 TempY[WaveChannelMax] = {0};
  s16 CoordiY[WaveChannelMax] = {0};

  static u16 WavePic[WaveChannelMax][WaveFormW] = {0};

  /* 更新顯示座標 */
  for(i=0; i<WaveForm->Channel; i++) {
    for(j=0; j<WaveFormW-1; j++)
      WavePic[i][j] = WavePic[i][j+1];
    TempY[i] = (s16)((double)WaveForm->Data[i]/WaveForm->Scale[i]+0.5);
    CoordiY[i] = WaveFormH - TempY[i];
    if(CoordiY[i]<0)
      WavePic[i][WaveFormW-1] = 0;
    else if(CoordiY[i]>WaveForm2H)
      WavePic[i][WaveFormW-1] = WaveForm2H;
    else
      WavePic[i][WaveFormW-1] = CoordiY[i];
  }
  /* 畫邊框 */
  LCD_DrawLineX(WaveWindowX,           WaveWindowY,            WaveFormW,	 WaveForm->WindowColor);
  LCD_DrawLineX(WaveWindowX,           WaveWindowY+WaveForm2H, WaveFormW,  WaveForm->WindowColor);
  LCD_DrawLineY(WaveWindowX,           WaveWindowY,            WaveForm2H, WaveForm->WindowColor);
  LCD_DrawLineY(WaveWindowX+WaveFormW, WaveWindowY,            WaveForm2H, WaveForm->WindowColor);
  /* 顯示 */
  for(i=0; i<WaveFormW-1; i++) {
    /* 清除上筆數據 */
    for(j=0; j<WaveForm->Channel; j++) {
      if(WavePic[j][i] == 0)
      LCD_DrawPixel(WaveWindowX+i+1, WaveWindowY+WavePic[j][i], WaveForm->WindowColor);
      else if(WavePic[j][i] == WaveForm2H)
      LCD_DrawPixel(WaveWindowX+i+1, WaveWindowY+WavePic[j][i], WaveForm->WindowColor);
      else
      LCD_DrawPixel(WaveWindowX+i+1, WaveWindowY+WavePic[j][i], WaveForm->BackColor);
    }
    /* 畫輔助線 */
    if((i%10) < 3) {
      for(j=0; j<=WaveFormH; j+=(WaveFormH/10)) {
        LCD_DrawPixel(WaveWindowX+i, WaveWindowY+WaveFormH+j, WaveForm->WindowColor);
        LCD_DrawPixel(WaveWindowX+i, WaveWindowY+WaveFormH-j, WaveForm->WindowColor);
      }
    }
    /* 畫中線 */
    LCD_DrawPixel(WaveWindowX+i, WaveWindowY+WaveFormH, WaveForm->WindowColor);
    /* 更新顯示新數據 */
    for(j=0; j<WaveForm->Channel; j++) {
      if(WavePic[j][i] == 0)
        LCD_DrawPixel(WaveWindowX+i, WaveWindowY+WavePic[j][i], WaveForm->WindowColor);
      else if(WavePic[j][i] == WaveForm2H)
        LCD_DrawPixel(WaveWindowX+i, WaveWindowY+WavePic[j][i], WaveForm->WindowColor);
      else
        LCD_DrawPixel(WaveWindowX+i, WaveWindowY+WavePic[j][i], WaveForm->PointColor[j]);
    }
  }
}
Exemplo n.º 3
0
/*=====================================================================================================*/
void WaveFormPrint( WaveForm_Struct *WaveForm, uint8_t display )
{
  int16_t i, j;
  int16_t TempY[WaveChannelMax] = {0};
  int16_t CoordiY[WaveChannelMax] = {0};

  static uint16_t WavePic[WaveChannelMax][WaveFormW] = {0};

  /* 更新顯示座標 */
  for(i = 0; i < WaveForm->Channel; i++) {
    for(j = 0; j < WaveFormW - 1; j++)
      WavePic[i][j] = WavePic[i][j+1];
    TempY[i] = (int16_t)((float)WaveForm->Data[i] / WaveForm->Scale[i] + 0.5f);
    CoordiY[i] = WaveFormH - TempY[i];
    if((CoordiY[i] > 0) && (CoordiY[i] < WaveForm2H))
      WavePic[i][WaveFormW-1] = CoordiY[i];
  }
  if(display == ENABLE) {
    /* 顯示 */
    for(i = 0; i < WaveFormW - 1; i++) {
      /* 清除上筆數據 */
      for(j = 0; j < WaveForm->Channel; j++)
        LCD_DrawPixel(WaveWindowX+i+1, WaveWindowY+WavePic[j][i], WaveForm->BackColor);
//      /* 畫輔助線 */
//      if((i % 10) < 3) {
//        for(j = 0; j <= WaveFormH; j += (WaveFormH / 10)) {
//          LCD_DrawPixel(WaveWindowX+i, WaveWindowY+WaveFormH+j, WaveForm->WindowColor);
//          LCD_DrawPixel(WaveWindowX+i, WaveWindowY+WaveFormH-j, WaveForm->WindowColor);
//        }
//      }
      /* 畫中線 */
      LCD_DrawPixel(WaveWindowX+i, WaveWindowY+WaveFormH, WaveForm->WindowColor);
      /* 更新顯示新數據 */
      for(j = 0; j < WaveForm->Channel; j++)
        LCD_DrawPixel(WaveWindowX+i, WaveWindowY+WavePic[j][i], WaveForm->PointColor[j]);
    }
    for(j = 0; j < WaveForm->Channel; j++)
      LCD_DrawPixel(WaveWindowX, WaveWindowY+WavePic[j][0], WaveForm->BackColor);
    /* 畫邊框 */
    LCD_DrawLineX(WaveWindowX,           WaveWindowY,            WaveFormW,	 WaveForm->WindowColor);
    LCD_DrawLineX(WaveWindowX,           WaveWindowY+WaveForm2H, WaveFormW,  WaveForm->WindowColor);
    LCD_DrawLineY(WaveWindowX,           WaveWindowY,            WaveForm2H, WaveForm->WindowColor);
    LCD_DrawLineY(WaveWindowX+WaveFormW, WaveWindowY,            WaveForm2H, WaveForm->WindowColor);
  }
}
Exemplo n.º 4
0
void Windows_SelMenu( u8 menuType )
{
  u16 StartCoordi = SelMenu_1+2;
  static u16 last_Coordi = SelMenu_1+2;
  
  switch(menuType){
    case Menu_INIT:
      StartCoordi = SelMenu_1+2;
      break;
    case Menu_SDCARD:
      StartCoordi = SelMenu_2+2;
      break;
    case Menu_WAVE:
      StartCoordi = SelMenu_3+2;
      break;
    case Menu_INFO:
      StartCoordi = SelMenu_4+2;
      break;
  }

  //Redraw last line
  LCD_DrawLineX(last_Coordi,Frame_H-1, ButMenu_W-3, WHITE);
	LCD_DrawLineX(last_Coordi,Frame_H-2, ButMenu_W-3, WHITE);
  LCD_DrawLineX(last_Coordi,Frame_H+2, ButMenu_W-3, WHITE);
  LCD_DrawLineX(last_Coordi,Frame_H+3, ButMenu_W-3, WHITE);
  
  //Clear line segment to black
  LCD_DrawLineX(StartCoordi,Frame_H-1, ButMenu_W-3, BLACK);
	LCD_DrawLineX(StartCoordi,Frame_H-2, ButMenu_W-3, BLACK);
  LCD_DrawLineX(StartCoordi,Frame_H+2, ButMenu_W-3, BLACK);
  LCD_DrawLineX(StartCoordi,Frame_H+3, ButMenu_W-3, BLACK);
  
  LCD_DrawLineY(last_Coordi-2,Frame_H, 2, BLACK);
	LCD_DrawLineY(last_Coordi-1,Frame_H, 2, BLACK);
  LCD_DrawLineY(last_Coordi-2+ButMenu_W,Frame_H, 2, BLACK);
  LCD_DrawLineY(last_Coordi-2+ButMenu_W-1,Frame_H, 2, BLACK);
  
  LCD_DrawLineY(StartCoordi-2,Frame_H, 2, WHITE);
	LCD_DrawLineY(StartCoordi-1,Frame_H, 2, WHITE);
  LCD_DrawLineY(StartCoordi-2+ButMenu_W,Frame_H, 2, WHITE);
  LCD_DrawLineY(StartCoordi-2+ButMenu_W-1,Frame_H, 2, WHITE);

  //store the current Coordi
  last_Coordi = StartCoordi;
  
  switch(menuType){

/************************** FSM CONF **************************************/
		case Menu_INIT:
      LCD_DrawRectangleFull(2, 2, RealFrame_L, RealFrame_H, BLACK);
			break;
    
/************************** FSM EVENT **************************************/
		case Menu_SDCARD:
			LCD_DrawRectangleFull(2, 2, RealFrame_L, RealFrame_H, BLACK);
			break;
    
/************************** FSM INFO **************************************/
		case Menu_WAVE:
      LCD_DrawRectangleFull(2, 2, RealFrame_L, RealFrame_H, BLACK);
      LCD_PutStr(WaveFromNum_X, WaveFromNum_Y+8*0,  (u8*)"------", ASCII1608, WHITE, BLACK);
      LCD_PutStr(WaveFromNum_X, WaveFromNum_Y+8*2,  (u8*)" SINE ", ASCII1608, WHITE, BLACK);
      LCD_PutStr(WaveFromNum_X, WaveFromNum_Y+8*4,  (u8*)"------", ASCII1608, WHITE, BLACK);
      LCD_PutStr(WaveFromNum_X, WaveFromNum_Y+8*7,  (u8*)"Axis-X", ASCII1608, RED, BLACK);
      LCD_PutStr(WaveFromNum_X, WaveFromNum_Y+8*12, (u8*)"Axis-Y", ASCII1608, GREEN, BLACK);
      LCD_PutStr(WaveFromNum_X, WaveFromNum_Y+8*17, (u8*)"Axis-Z", ASCII1608, BLUE, BLACK);
      LCD_PutStr(WaveFromNum_X, WaveFromNum_Y+8*22, (u8*)"------", ASCII1608, WHITE, BLACK);
			break;
    
/************************** FSM CTRL *************************************/
		case Menu_INFO:
			LCD_DrawRectangleFull(2, 2, RealFrame_L, RealFrame_H, BLACK);
			break;
	}
}