static void _Show(const char* s0, const char* s1) {
  GUIDEMO_SetColor(GUI_WHITE);
  #if (LCD_YSIZE < 160)
    GUI_SetFont(&GUI_Font8_ASCII);
  #else
    GUI_SetFont(&GUI_Font13B_ASCII);
  #endif
  GUI_DispString("\n");
  #if (LCD_YSIZE < 128)
    GUIDEMO_Delay(200);
    GUI_GotoXY(0, LCD_YSIZE / 2 - 6);
    GUI_ClearRect(0, 24, LCD_XSIZE - 1, LCD_YSIZE - 1);
    GUIDEMO_Delay(200);
  #endif
  GUI_DispString(s0);
  GUIDEMO_Delay(500);
  #if GUIDEMO_LARGE
    GUI_GotoX(110);
    GUIDEMO_SetColor(GUI_GREEN);
  #else
    GUI_GotoX(100);
    GUIDEMO_SetColor(GUI_BLUE);
  #endif
  #if (LCD_XSIZE < 320)
    GUI_DispString("\n");
    #if (LCD_XSIZE < 200)
      GUI_GotoX(10);
    #else
      GUI_GotoX(LCD_XSIZE / 6);
    #endif
  #endif
  GUI_DispString(s1);
  GUIDEMO_Delay(1500);
}
/*********************************************************************
*
*       _PrintResult
*/
static void _PrintResult(int Cnt) {
  if (_NumPrimes != 168) {
    GUI_DispString("Error");
  } else {
    GUI_DispString("Loops/sec: ");
    _PrintDec(Cnt);
  }
  GUI_DispString("\n");
}
/*********************************************************************
*
*       _DispFillrate
*/
static void _DispFillrate(char * sPre, float FillratePPS, char * sPost) {
  unsigned int   i;
  char         * apLabel[] = {" KPixel/s", " MPixel/s"};

  GUI_DispString(sPre);
  for (i = 0; i < GUI_COUNTOF(apLabel); i++) {
    FillratePPS /= 1000;
    if (FillratePPS < 1000) {
      GUI_DispFloatFix((float)FillratePPS, 7, 3);
      GUI_DispString(apLabel[i]);
      break;
    }
  }
  GUI_DispString(sPost);
}
Esempio n. 4
0
/*********************************************************************
*
*       GUI_DispSDecShift
*/
void GUI_DispSDecShift(I32 v, U8 Len, U8 Shift) {
	char ac[12];
	char* s = ac;
  v = GUI_AddSign(v, &s);
  GUI_AddDecShift(v, --Len, Shift, &s);
  GUI_DispString(ac);
}
Esempio n. 5
0
static void _cbCmdWin(WM_MESSAGE* pMsg) {
  switch (pMsg->MsgId) {
  case WM_PAINT:
    /* Update info in command window */
    GUI_SetBkColor(GUI_GRAY);
    GUI_Clear();
    GUI_DispStringAt("Demo ", 0, 0);
    GUI_DispDecMin(_iTest + 1);
    GUI_DispString(".");
    GUI_DispDecMin(_iTestMinor);
    GUI_DispString("/");
    GUI_DispDecMin(countof(_apfTest));
  default:
    WM_DefaultProc(pMsg);
  }
}
Esempio n. 6
0
/*********************************************************************
*
*       GUI_Init
*
* Purpose:
*   Init of GUI internal data structures & variables
*/
int GUI_Init(void) {
    int r;
    GUI_DEBUG_LOG("\nGUI_Init()");
    /* Init system wide globals first */
    GUI_DecChar = '.';
    GUI_X_Init();
    /* Init context */
    _InitContext(&GUI_Context);
    GUITASK_INIT();
    r = LCD_Init();
#if GUI_WINSUPPORT
    WM_Init();
#endif
    GUITASK_COPY_CONTEXT();
#if defined(GUI_TRIAL_VERSION)
#if GUI_TRIAL_VERSION
    GUI_DispString(  "This software\n"
                     "contains an eval-\n"
                     "uC/GUI build.\n"
                     "\n"
                     "A license is\n"
                     "required to use\n"
                     "it in a product.\n\n"
                     "www.segger.com\n");
    GUI_GotoXY(0, 0);
    GUI_X_Delay(1000);
    GUI_Clear();
#endif
#endif
    return r;
}
Esempio n. 7
0
void DisplayArticle(const char* pArticle)
{
    int i,j;
    char  cString[51];
    const char* pIndex;
    
    GUI_GotoXY(0,0);
    GUI_DispString(pArticle);
    /*
    pIndex = pArticle;
    i=j=0;
    
    while(1)
    {
        if( strlen (&pIndex[i]))
        {
            memset(cString, 0, sizeof(cString));
            strncpy(cString, &pIndex[i], 50);
            GUI_DispStringAt(cString,0,j*24);
            i+=strlen(cString);
            if(++j >=25)
            {
                j = 0;
                GUI_Clear();
            }
        }
        else
        {
            break;
        }
    } 
     */
}
Esempio n. 8
0
void MainTask(void) {
  GUI_Init();
  GUI_DispString("Hello World!");
  while(1) {
    GUI_Delay(500);
  }
}
Esempio n. 9
0
/*********************************************************************
*
*       _DrawPart
*/
static void _DrawPart(const PROGBAR_Obj* pObj, int Index,
										  int xText, int yText, const char* pText) {
  LCD_SetBkColor(pObj->BarColor[Index]);
  LCD_SetColor(pObj->TextColor[Index]);
  GUI_Clear();
  GUI_GotoXY(xText, yText);
  GUI_DispString(pText);
}
/*********************************************************************
*
*       GUI_DispStringAt
*/
void GUI_DispStringAt(const char GUI_UNI_PTR *s, int x, int y)
{
  GUI_LOCK();
  GUI_Context.DispPosX = x;
  GUI_Context.DispPosY = y;
  GUI_DispString(s);
  GUI_UNLOCK();
}
/*********************************************************************
*
*       _ExecBigFont
*/
static void _ExecBigFont(void * p) {
  char * s;
  int    i;

  s = (char *)p;
  GUI_SetLBorder(0);
  GUI_DispStringAt(s, 0, 0);
  for (i = 0; i < 1; i++) {
    GUI_DispString(s);
  }
  GUI_SetLBorder(1);
  GUI_DispStringAt(s, 1, 0);
  for (i = 0; i < 1; i++) {
    GUI_DispString(s);
  }
  GUI_SetLBorder(0);
}
/*********************************************************************
*
*       _ShowEdgeWeights
*/
static void _ShowEdgeWeights(void) {
  const char * Weight_name[]    = { "\nlight:      ", "\nsemi-light: ", "\nregular:    ", "\nsemi-bold:  ", "\nbold:       " };
  const char   Chinese_string[] = { "\xe5\x9f\xba\xe6\x9c\xac\xe4\xb8\x8a\xe8\xae\xa1\xe7\xae\x97\xe6\x9c\xba\xe5\x8f\xaa\xe6\x98\xaf\xe5\xa4\x84\xe7\x90\x86\xe6\x95\xb0\xe5\xad\x97\xe5\xae\x83\xe4\xbb\xac\xe6\x8c\x87\xe5\xae\x9a\xe4\xb8\x80\xe4\xb8\xaa\n" };
  const char   Weight_order[]   = { 0, 3, 1, 2, 4 };
  int          i;
  int          j;

  GUI_Clear();
  i = 0;
  GUI_ITYPE_GetFamilyName(&_aFont[i], _acFamily, sizeof(_acFamily));
  GUI_ITYPE_GetStyleName(&_aFont[i],  _acStyle,  sizeof(_acStyle));
  GUI_SetFont(&GUI_Font20_1);
  GUI_DispString("     Edge font:  ");
  GUI_DispString(_acFamily);
  GUI_DispString(", ");
  GUI_DispString(_acStyle);
  GUI_DispNextLine();
  GUI_DrawHLine(GUI_GetDispPosY(), 0, 0xfff);
  GUI_SetFont(&_aFont[1]);
  GUI_ITYPE_SetOutputStyle(&_aFont[1], &_aCS[1], (long)ITYPE_NO_EFFECT);        // Turn off all effects
  GUI_ITYPE_SetOutputStyle(&_aFont[1], &_aCS[1], (long)ITYPE_GRAYMAP4);         // Edge graymap output
  GUI_DispString("** iType Edge CSM tuning, 5 weights in the same font **");
  for (j = 0; j < 5; j++){
    i = Weight_order[j];
    GUI_SetFont(&_aFont[i]);
    GUI_ITYPE_SetOutputStyle(&_aFont[i], &_aCS[i], (long)ITYPE_NO_EFFECT);      // Turn off all effects
    GUI_ITYPE_SetOutputStyle(&_aFont[i], &_aCS[i], (long)ITYPE_EDGE_GRAYMAP4);  // Edge graymap output
    GUI_DispNextLine();
    GUI_DispString(Weight_name[j]);
    GUI_UC_SetEncodeUTF8();
    GUI_DispString(Chinese_string);
    GUI_UC_SetEncodeNone();
  }
  GUI_Delay(PAGE_DELAY);
}
Esempio n. 13
0
static void _UpdateCmdWin(void) {
  #if GUI_WINSUPPORT && GUIDEMO_LARGE
    /* Update info in command window */
    WM_HWIN hWin;
    GUI_CONTEXT ContextOld;
    GUI_SaveContext(&ContextOld);
    hWin = WM_SelectWindow(_ahInfoWin[1]);
    GUI_SetDefault();
    GUI_SetBkColor(GUI_GRAY);
    GUI_Clear();
    GUI_DispStringAt("Demo ", 0, 0);
    GUI_DispDecMin(_iTest + 1);
    GUI_DispString(".");
    GUI_DispDecMin(_iTestMinor);
    GUI_DispString("/");
    GUI_DispDecMin(countof(_apfTest));
    WM_SelectWindow(hWin);
    GUI_RestoreContext(&ContextOld);
  #endif
}
Esempio n. 14
0
static void _ShowFonts(const char *s, const char *pMessage, const GUI_FONT **pPropFonts) {
  int i;
  _Label(s);
  GUI_GotoXY(0, _GetYPos());
  for (i=0;pPropFonts[i];i++) {
    GUI_SetFont(pPropFonts[i]);
    GUI_DispString(pMessage);
    GUI_DispNextLine();
  }
  GUIDEMO_Wait();
  GUIDEMO_NotifyStartNext();
}
Esempio n. 15
0
void MainTask(void) {
  int i=0;
/*
 ToDo:  Make sure hardware is initilized first!!
*/
  GUI_Init();
  GUI_DispString("Hello world!");
  while(1) {
    GUI_DispDecAt( i++, 20,20,4);
    if (i>9999) i=0;
  }
}
Esempio n. 16
0
int main(void)
{
    uint32_t i;
    DelayInit();
    GPIO_QuickInit(HW_GPIOE, 6, kGPIO_Mode_OPP);
    UART_QuickInit(UART0_RX_PD06_TX_PD07, 115200);
    
    printf("flexbus lcd test\r\n");
    GUI_Init();
    GUI_DispString("ucGUI");
    GUI_DispString(GUI_GetVersionString());
    GUI_DispString("\r\nHello world!");
    while(1) 
    {
        GUI_DispDecAt( i++, 20,20,4);
        if (i>9999)
        {
            i=0;
        }
    }
}
/*********************************************************************
*
*       在触摸校正的时候使用这个来读取ADC的值
*/
void Touch_MainTask(void) {
 
  GUI_CURSOR_Show();
  GUI_CURSOR_Select(&GUI_CursorCrossL);
  GUI_SetBkColor(GUI_WHITE);
  GUI_SetColor(GUI_BLACK);
  GUI_Clear();
  GUI_DispString("Measurement of\nA/D converter values");
  while (1) {
    GUI_PID_STATE TouchState;
    int xPhys, yPhys;
    GUI_TOUCH_GetState(&TouchState);  /* Get the touch position in pixel */
    xPhys = GUI_TOUCH_GetxPhys();     /* Get the A/D mesurement result in x */
    yPhys = GUI_TOUCH_GetyPhys();     /* Get the A/D mesurement result in y */
    /* Display the measurement result */
    GUI_SetColor(GUI_BLUE);
    GUI_DispStringAt("Analog input:\n", 0, 20);
    GUI_GotoY(GUI_GetDispPosY() + 2);
    GUI_DispString("x:");
    GUI_DispDec(xPhys, 4);
    GUI_DispString(", y:");
    GUI_DispDec(yPhys, 4);
    /* Display the according position */
    GUI_SetColor(GUI_RED);
    GUI_GotoY(GUI_GetDispPosY() + 4);
    GUI_DispString("\nPosition:\n");
    GUI_GotoY(GUI_GetDispPosY() + 2);
    GUI_DispString("x:");
    GUI_DispDec(TouchState.x,4);
    GUI_DispString(", y:");
    GUI_DispDec(TouchState.y,4);
    /* Wait a while */
    GUI_Delay(100);
  };
}
Esempio n. 18
0
int main(void)
{
    DelayInit();
    GPIO_QuickInit(HW_GPIOE, 6, kGPIO_Mode_OPP);
    SRAM_Init();
    UART_QuickInit(UART0_RX_PD06_TX_PD07, 115200);
    GUI_Init();
    GUI_DispString("BMP file test\r\n");
    GUI_DispString("please insert SD card...\r\n");
    SD_QuickInit(10*1000*1000);
    printf("SD size:%dMB\r\n", SD_GetSizeInMB());
    FATFS fs_sd;
    FATFS *fs = &fs_sd;
    /* 挂载文件系统 */
    f_mount(fs, "0:", 0);
    
    while(1)
    {
        scan_files("0:");
        GPIO_ToggleBit(HW_GPIOE, 6);
    }
}
Esempio n. 19
0
/********************************************************************
*
*       _Explain
*/
static void _Explain(void) {
  int i;
  GUI_SetTextMode(GUI_TM_XOR);
  GUI_SetFont(&GUI_Font16B_ASCII);
  GUI_DispStringHCenterAt("MEMDEV_Printing", 160, 0);
  GUI_GotoXY(0,20);
  GUI_SetFont(&GUI_Font6x8);
  for (i = 0; i < GUI_COUNTOF(_acText); i++) {
    GUI_DispString(_acText[i]);
    GUI_DispNextLine();
  }
  GUI_SetTextMode(GUI_TM_TRANS);
}
Esempio n. 20
0
void MainTask(void) {
  GUI_PID_STATE TouchState;
  GUI_Init();
  GUI_CURSOR_Show();
  GUI_Delay(1000);
  GUI_CURSOR_Select(&GUI_CursorCrossL);
  GUI_Delay(1000);
  while (1) {
    GUI_TOUCH_GetState(&TouchState);
    GUI_DispStringAt("Analog input: ", 0, 40);
    GUI_DispDec(GUI_TOUCH_GetxPhys(),4);
    GUI_DispString(",");
    GUI_DispDec(GUI_TOUCH_GetyPhys(),4);

    GUI_DispStringAt("TOUCH_X_MeasureX: ",0,60);
    GUI_DispDec(TouchState.x,4);
    GUI_DispString(",");
    GUI_DispDec(TouchState.y,4);
    
    GUI_Delay(100);
  };

}
/*********************************************************************
*
*       _ShowLanguages
*/
static void _ShowLanguages(void) {
  const char Bopomofo_string[]     = { "\nBopomofo: \xe3\x84\x85 \xe3\x84\x86 \xe3\x84\x87 \xe3\x84\x88 \xe3\x84\x89 \xe3\x84\x8a \xe3\x84\x8b \xe3\x84\x8c \xe3\x84\x8d \xe3\x84\x8e \xe3\x84\x8f \xe3\x84\x90 \xe3\x84\x91 \xe3\x84\x92 \xe3\x84\x93\n"                        };
  const char Simplified_Chinese[]  = { "\nSimplified: \xe5\x9f\xba\xe6\x9c\xac\xe4\xb8\x8a\xe8\xae\xa1\xe7\xae\x97\xe6\x9c\xba\xe5\x8f\xaa\xe6\x98\xaf\xe5\xa4\x84\xe7\x90\x86\xe6\x95\xb0\xe5\xad\x97\xe5\xae\x83\xe4\xbb\xac\xe6\x8c\x87\xe5\xae\x9a\n"                        };
  const char Traditional_Chinese[] = { "\nTraditional: \xe9\x80\x99\xe4\xba\x9b\xe7\xb7\xa8\xe7\xa2\xbc\xe7\xb3\xbb\xe7\xb5\xb1\xe4\xb9\x9f\xe6\x9c\x83\xe4\xba\x92\xe7\x9b\xb8\xe8\xa1\x9d\xe7\xaa\x81\xe4\xb9\x9f\xe5\xb0\xb1\xe6\x98\xaf\xe8\xaa\xaa\xe5\x85\xa9\xe7\xa8\xae" };
  int        i;

  GUI_Clear();
  i = 0;
  GUI_ITYPE_GetFamilyName(&_aFont[i], _acFamily, sizeof(_acFamily));
  GUI_ITYPE_GetStyleName(&_aFont[i],  _acStyle,  sizeof(_acStyle));
  GUI_SetFont(&GUI_Font20_1);
  GUI_DispString("     Linked font:  ");
  GUI_DispString(_acFamily);
  GUI_DispString(", ");
  GUI_DispString(_acStyle);
  GUI_DispNextLine();
  GUI_DrawHLine(GUI_GetDispPosY(), 0, 0xfff);
  //
  // Show alphabet strings
  //
  GUI_SetFont(&_aFont[i]);
  GUI_DispString("** iType User Defined Linked Font **");
  GUI_UC_SetEncodeUTF8();
  GUI_ITYPE_SetOutputStyle(&_aFont[i], &_aCS[i], (long)ITYPE_NO_EFFECT);  // Turn off all effects
  GUI_ITYPE_SetOutputStyle(&_aFont[i], &_aCS[i], (long)ITYPE_GRAYMAP4);   // Graymap output
  GUI_DispString("\nabcdefghijklmnopqrstuvwxyz\n");
  GUI_DispString("ABCDEFGHIJKLMNOPQRSTUVWXYZ\n");
  //
  // Show language strings
  //
  GUI_DispString(Bopomofo_string);
  GUI_DispString(Simplified_Chinese);
  GUI_DispString(Traditional_Chinese);
  GUI_UC_SetEncodeNone();

  GUI_Delay(PAGE_DELAY);
}
Esempio n. 22
0
/*********************************************************************
*
*       GUI_DispDecSpace
*/
void GUI_DispDecSpace(I32 v, U8 MaxDigits) {
	char ac[12];
	char* s = ac;
  U8 Len;
  if (v < 0) {
    v = GUI_AddSign(v, &s);
    MaxDigits--;
  }
  Len = GUI_Long2Len(v);
  while (Len++ < MaxDigits) {
    *s++ = ' ';
  }
  GUI_AddDecMin(v, &s);
  GUI_DispString(ac);
}
Esempio n. 23
0
int main(void)
{
	GUI_MEMDEV_Handle hMem0,hMem1;
	SysTick_Config(180000);
	SDRAM_Init();
	
	LCD_Config();
	
	GUI_Init();
	GUI_SetFont(&GUI_Font32B_ASCII);
	GUI_SetBkColor(GUI_BLUE);
	GUI_SetColor(GUI_YELLOW);
	GUI_Clear();

//	GUI_DispStringAt("blacklight",0,100);
	
//	GUIDEMO_Main();
	
	hMem0 = GUI_MEMDEV_CreateFixed(0,0,100,50,GUI_MEMDEV_NOTRANS,GUI_MEMDEV_APILIST_32,GUI_COLOR_CONV_888);
	hMem1 = GUI_MEMDEV_CreateFixed(0,0,100,50,GUI_MEMDEV_NOTRANS,GUI_MEMDEV_APILIST_32,GUI_COLOR_CONV_888);
	GUI_MEMDEV_Select(hMem0);
	GUI_Clear();
	GUI_DispString("Text");
	GUI_MEMDEV_CopyToLCDAt(hMem0,0,0);
	
	while(1)
	{	
		GUI_MEMDEV_Select(hMem1);
		GUI_MEMDEV_DrawPerspectiveX(hMem0,0,0,50,50-50*i/100,100-100*i/100,25*i/100);
		GUI_MEMDEV_CopyToLCDAt(hMem1,i,50+i);
		
		GUI_Delay(10);
		
		GUI_MEMDEV_Select(hMem1);
		GUI_Clear();
		GUI_MEMDEV_CopyToLCDAt(hMem1,i,50+i);
		
		i+=1;
		if(i>100)
		{
			i=0;
		}
	}
	
	while(1);
}
Esempio n. 24
0
int main(void)
{
    DelayInit();
    GPIO_QuickInit(HW_GPIOE, 6, kGPIO_Mode_OPP);
    UART_QuickInit(UART0_RX_PD06_TX_PD07, 115200);

    printf("spi touch screen test\r\n");

    /* 初始化SPI2 接口连接触控屏的触控芯片*/
    SPI_QuickInit(SPI2_SCK_PD12_SOUT_PD13_SIN_PD14, kSPI_CPOL0_CPHA0, 2*1000*1000);

    PORT_PinMuxConfig(HW_GPIOD, 11, kPinAlt2); /* SPI2_PCS0 */
    /* 初始化触控芯片 使用CS0片选 */
    ads7843_init(HW_SPI2, HW_SPI_CS0);

    GUI_Init();//液晶屏界面初始化
    GUI_SetBkColor(GUI_WHITE); //设置背景色
    GUI_SetColor(GUI_BLACK);   //设置前景色
    GUI_Clear();  //清屏
    GUI_SetPenSize(3); //设置点的大小
    GUI_DispString("Measurement of\nA/D converter values");
    while (1)
    {
        GUI_PID_STATE TouchState;
        int xPhys, yPhys;
        GUI_TOUCH_GetState(&TouchState);  /* 获得触控位置 */
        xPhys = GUI_TOUCH_GetxPhys();     /* 获得x轴的测量值 */
        yPhys = GUI_TOUCH_GetyPhys();     /* 获得y轴的测量值 */
        /* 显示测量结果 */
        GUI_SetColor(GUI_BLUE);
        GUI_DispStringAt("Analog input:\n", 0, 20);
        GUI_GotoY(GUI_GetDispPosY() + 2);
        GUI_DispString("x:");
        GUI_DispDec(xPhys, 4);
        GUI_DispString(", y:");
        GUI_DispDec(yPhys, 4);
        /* Display the according position */
        GUI_SetColor(GUI_RED);
        GUI_GotoY(GUI_GetDispPosY() + 4);
        GUI_DispString("\nPosition:\n");
        GUI_GotoY(GUI_GetDispPosY() + 2);
        GUI_DispString("x:");
        GUI_DispDec(TouchState.x,4);
        GUI_DispString(", y:");
        GUI_DispDec(TouchState.y,4);
        GUI_DrawPoint(TouchState.x, TouchState.y);
        GUI_TOUCH_Exec();
    }
}
/*********************************************************************
*
*       _ShowDynamicCSM
*
*  Function description
*    Shows 5 different weights of the same font by applying dynamic CSM adjustments.
*/
static void _ShowDynamicCSM(void) {
  double Alpha;
  double S0;
  double S1;
  double T0;
  double T1;
  double R;
  int    i;
  int    j;
  int    N;
  
  N = 5;
  GUI_Clear();
  i = 0;
  GUI_ITYPE_GetFamilyName(&_aFont[i], _acFamily, sizeof(_acFamily));
  GUI_ITYPE_GetStyleName(&_aFont[i],  _acStyle,  sizeof(_acStyle));
  GUI_SetFont(&GUI_Font20_1);
  GUI_DispString("     Edge font:  ");
  GUI_DispString(_acFamily);
  GUI_DispString(", ");
  GUI_DispString(_acStyle);
  GUI_DispNextLine();
  GUI_DrawHLine(GUI_GetDispPosY(), 0, 0xfff);
  GUI_UC_SetEncodeUTF8();
  GUI_SetFont(&_aFont[0]);
  GUI_ITYPE_SetOutputStyle(&_aFont[0], &_aCS[0], (long)ITYPE_NO_EFFECT);      // Turn off all effects
  GUI_ITYPE_SetOutputStyle(&_aFont[0], &_aCS[0], (long)ITYPE_EDGE_GRAYMAP4);  // Edge graymap output
  GUI_DispString("** iType Dynamic CSM tuning **\n");
  GUI_DispNextLine();
  //  
  // Parameters for adjustments
  //
  R  = 1.4;
  S0 = 0.0;
  S1 = -0.001;
  T0 = 0.01;
  T1 = 0.007;
  //
  // Make 5 sets of adjustments which range from -R to R.
  //
  for (j = 0; j < N; j++){
    Alpha = R * (2 * j / (N - 1) - 1);
    GUI_ITYPE_SetCSMAdjustments(&_aFont[i], &_aCS[i], (FS_FIXED)(Alpha*S0*65536), (FS_FIXED)(Alpha*S1*65536), (FS_FIXED)(Alpha*T0*65536), (FS_FIXED)(Alpha*T1*65536));
    GUI_DispString("\xe5\x9f\xba\xe6\x9c\xac\xe4\xb8\x8a\xe8\xae\xa1\xe7\xae\x97\xe6\x9c\xba\xe5\x8f\xaa\xe6\x98\xaf\xe5\xa4\x84\xe7\x90\x86\xe6\x95\xb0\xe5\xad\x97\xe5\xae\x83\xe4\xbb\xac\xe6\x8c\x87\xe5\xae\x9a\xe4\xb8\x80\xe4\xb8\xaa\n");
  }
  GUI_Delay(PAGE_DELAY);
}
Esempio n. 26
0
/* 显示BMP图片 */
static int _DrawBMPFile(char *path)
{
    FRESULT rc;
    uint32_t size;
    FIL fil;
    uint8_t *pFile = (uint8_t*)SRAM_START_ADDRESS;
    UINT br;
    /* 读取文件 */
    rc = f_open(&fil, path, FA_READ);
    ERROR_TRACE(rc);
    if(rc) return 1;
    size = f_size(&fil);
    printf("file size:%d\r\n", size);
    if(size > SRAM_SIZE)
    {
        printf("file size to large\r\n");
        rc = f_close(&fil);
        return 2;
    }
    rc = f_read(&fil, pFile, size, &br);
    if(rc || br != size)
    {
        printf("file data read failed\r\n");
        rc = f_close(&fil);
        return 3;
    }
    printf("Xsize:%d Ysize:%d\r\n", GUI_BMP_GetXSize(pFile), GUI_BMP_GetYSize(pFile));
    GUI_Clear();
    if(GUI_BMP_Draw(pFile, 0, 0))
    {
        GUI_DispString("BMP file display failed!");
    }
    rc = f_close(&fil);
    ERROR_TRACE(rc);
    return 0;
}
Esempio n. 27
0
/*********************************************************************
*
*       _ShowText
*/
static void _ShowText(void) {
  int i;
  GUI_Clear();
  i = 0;
  GUI_TTF_GetFamilyName(&_aFont[i], _acFamily, sizeof(_acFamily));
  GUI_TTF_GetStyleName(&_aFont[i],  _acStyle,  sizeof(_acStyle));
  GUI_SetFont(&GUI_Font20_1);
  GUI_DispString(_acFamily);
  GUI_DispString(", ");
  GUI_DispString(_acStyle);
  GUI_DispNextLine();
  GUI_DrawHLine(GUI_GetDispPosY(), 0, 0xfff);
  GUI_SetFont(&_aFont[i]);
  GUI_DispString("abcdefghijklmnopqrstuvwxyz\n");
  GUI_DispString("ABCDEFGHIJKLMNOPQRSTUVWXYZ\n");
  GUI_DispString("123456789.:,;(:*!?')\n");
  GUI_DrawHLine(GUI_GetDispPosY(), 0, 0xfff);
  for (i = 0; i < GUI_COUNTOF(_aHeight); i++) {
    GUI_SetFont(&_aFont[i]);
    GUI_DispString("The quick brown fox jumps over the lazy dog. 1234567890\n");
  }
  GUI_Delay(1000);
}
void _ExecCalibration(void) {
  int ax_Phys[2],ay_Phys[2];
/* calculate log. Positions */
  int ax[2] = { 15, LCD_XSIZE -1-15};
//  const int ay[2] = { 15, LCD_YSIZE-1-15};
  int ay[2] = { LCD_YSIZE-1-15, 15};

  CalibrationComplete = 0;
  GUI_TOUCH_SetDefaultCalibration();
/* _Calibrate upper left */
  GUI_SetBkColor(GUI_RED);  
  GUI_Clear();
  GUI_SetColor(GUI_WHITE);  GUI_FillCircle(ax[0], ay[0], 10);
  GUI_SetColor(GUI_RED);    GUI_FillCircle(ax[0], ay[0], 5);
  GUI_SetColor(GUI_WHITE);
  GUI_DispStringAt("Press here", ax[0]+20, ay[0]);
  do {
    GUI_PID_STATE State;
    GUI_TOUCH_GetState(&State);
    if (State.Pressed) {
      ax_Phys[0] = GUI_TOUCH_GetxPhys();
      ay_Phys[0] = GUI_TOUCH_GetyPhys();
      break;
    }
    GUI_Delay (100);
  } while (1);
/* Tell user to release */
  GUI_Clear();
  GUI_DispStringAt("OK", ax[0]+20, ay[0]);
  do {
    GUI_PID_STATE State;
    GUI_TOUCH_GetState(&State);
    if (State.Pressed == 0) {
      break;
    }
    GUI_Delay (100);
  } while (1);
/* _Calibrate lower right */
  GUI_SetBkColor(GUI_RED);  
  GUI_Clear();
  GUI_SetColor(GUI_WHITE);  GUI_FillCircle(ax[1], ay[1], 10);
  GUI_SetColor(GUI_RED);    GUI_FillCircle(ax[1], ay[1], 5);
  GUI_SetColor(GUI_WHITE);
  GUI_SetTextAlign(GUI_TA_RIGHT);
  GUI_DispStringAt("Press here", ax[1]-20, ay[1]);
  do {
    GUI_PID_STATE State;
    GUI_TOUCH_GetState(&State);
    if (State.Pressed) {
      ax_Phys[1] = GUI_TOUCH_GetxPhys();
      ay_Phys[1] = GUI_TOUCH_GetyPhys();
      break;
    }
    GUI_Delay (100);
  } while (1);
  GUI_TOUCH_Calibrate(GUI_COORD_X, ax[0], ax[1], ax_Phys[0], ax_Phys[1]);
  GUI_TOUCH_Calibrate(GUI_COORD_Y, ay[0], ay[1], ay_Phys[0], ay_Phys[1]);
  { /* calculate and display values for configuration file */
    int x0, x1;
    int y0, y1;
    GUI_Clear();
    _Calibrate(GUI_COORD_X, ax[0], ax[1], ax_Phys[0], ax_Phys[1], &x0, &x1);
    _Calibrate(GUI_COORD_Y, ay[0], ay[1], ay_Phys[0], ay_Phys[1], &y0, &y1);
    GUI_DispStringAt("x0: ", 0, 0); GUI_DispDec(x0, 4); GUI_DispNextLine();
    GUI_DispString  ("x1: ");       GUI_DispDec(x1, 4); GUI_DispNextLine();
    GUI_DispString  ("y0: ");       GUI_DispDec(y0, 4); GUI_DispNextLine();
    GUI_DispString  ("y1: ");       GUI_DispDec(y1, 4); GUI_DispNextLine();
    GUI_DispString  ("Please touch display to continue...");
    GUI_Delay(1000);
    do {
      GUI_PID_STATE State;
      GUI_TOUCH_GetState(&State);
      if (State.Pressed)
        break;
      GUI_Delay (10);
    } while (1);
  }
  CalibrationComplete = 1;
}
Esempio n. 29
0
void _ExecCalibration(void) {
  int x,y;
  uint16_t data[6];
  uint16_t get_data[6];
  int ax_Phys[2],ay_Phys[2];
/* calculate log. Positions */
  int ax[2] = { 15, LCD_XSIZE -1-15};
//  const int ay[2] = { 15, LCD_YSIZE-1-15};
  int ay[2] = { LCD_YSIZE-1-15, 15};
  GUI_TOUCH_SetDefaultCalibration();
/* _Calibrate upper left */
  GUI_SetBkColor(GUI_RED);  
  GUI_Clear();
  GUI_SetColor(GUI_WHITE);  GUI_FillCircle(ax[0], ay[0], 10);
  GUI_SetColor(GUI_RED);    GUI_FillCircle(ax[0], ay[0], 5);
  GUI_SetColor(GUI_WHITE);
  GUI_DispStringAt("Press here", ax[0]+20, ay[0]);
  do {

#if 0
    GUI_PID_STATE State;
    GUI_TOUCH_GetState(&State);
	 if (State.Pressed) {
#endif

#if 1
  x = TPReadX();
  y = TPReadY();
  if ((x>=3700)&&(y>=3400)&&(x<3800)&&(y<3600)) {

#endif
      ax_Phys[0] = GUI_TOUCH_GetxPhys();
      ay_Phys[0] = GUI_TOUCH_GetyPhys();
      break;
    }
    GUI_Delay (3000);
  } while (1);
/* Tell user to release */
  GUI_Clear();
  GUI_DispStringAt("OK", ax[0]+20, ay[0]);
  do {
    GUI_PID_STATE State;
    GUI_TOUCH_GetState(&State);
    if (State.Pressed == 0) {
      break;
    }
    GUI_Delay (100);
  } while (1);
/* _Calibrate lower right */
  GUI_SetBkColor(GUI_RED);  
  GUI_Clear();
  GUI_SetColor(GUI_WHITE);  GUI_FillCircle(ax[1], ay[1], 10);
  GUI_SetColor(GUI_RED);    GUI_FillCircle(ax[1], ay[1], 5);
  GUI_SetColor(GUI_WHITE);
  GUI_SetTextAlign(GUI_TA_RIGHT);
  GUI_DispStringAt("Press here", ax[1]-20, ay[1]);
  do {

#if 1
  x = TPReadX();
  y = TPReadY();
  if ((y>450)&&(y<620)&&(x>350)&&(x<450)) {
#endif

#if 0
	GUI_PID_STATE State;
  	GUI_TOUCH_GetState(&State);
	if (State.Pressed) {
#endif

      ax_Phys[1] = GUI_TOUCH_GetxPhys();
      ay_Phys[1] = GUI_TOUCH_GetyPhys();
      break;
    }
    GUI_Delay (3000);
  } while (1);
  GUI_TOUCH_Calibrate(GUI_COORD_X, ax[0], ax[1], ax_Phys[0], ax_Phys[1]);
  GUI_TOUCH_Calibrate(GUI_COORD_Y, ay[0], ay[1], ay_Phys[0], ay_Phys[1]);
  { /* calculate and display values for configuration file */
    int x0, x1;
    int y0, y1;
    GUI_Clear();
    _Calibrate(GUI_COORD_X, ax[0], ax[1], ax_Phys[0], ax_Phys[1], &x0, &x1);
    _Calibrate(GUI_COORD_Y, ay[0], ay[1], ay_Phys[0], ay_Phys[1], &y0, &y1);
    GUI_DispStringAt("x0: ", 0, 0); GUI_DispDec(x0, 4); GUI_DispNextLine();
    GUI_DispString  ("x1: ");       GUI_DispDec(x1, 4); GUI_DispNextLine();
    GUI_DispString  ("y0: ");       GUI_DispDec(y0, 4); GUI_DispNextLine();
    GUI_DispString  ("y1: ");       GUI_DispDec(y1, 4); GUI_DispNextLine();
    GUI_DispString  ("Please touch display to continue...");
    GUI_Delay(1000);

	data[0]=  CAL_READY;
	data[1]= ax_Phys[0];
	data[2]= ay_Phys[0];
	data[3]= ax_Phys[1];
	data[4]= ay_Phys[1];

	#if 1
	save_calibrate_to_flash(data);
	get_calibrate_data(get_data);

	GUI_DispStringAt("x0: ", 100, 0); GUI_DispDec(get_data[1], 4); GUI_DispNextLine();
    GUI_DispString  ("x1: ");       GUI_DispDec(get_data[2], 4); GUI_DispNextLine();
    GUI_DispString  ("y0: ");       GUI_DispDec(get_data[3], 4); GUI_DispNextLine();
    GUI_DispString  ("y1: ");       GUI_DispDec(get_data[4], 4); GUI_DispNextLine();
	GUI_DispString  ("state: ");       GUI_DispDec(get_data[0], 4); GUI_DispNextLine();
	#endif

    do {
      GUI_PID_STATE State;
      GUI_TOUCH_GetState(&State);
      if (State.Pressed)
      break;
      GUI_Delay (10);
    } while (1);
  }
}



int run_cal(void)
{
  if(get_calibrate_state()== CAL_READY)
  {
  	get_calibration();
  }else{
	#if 1
  	 _ExecCalibration();
	#endif	

	#if 0
	Calibration();
	#endif
  }
}

int get_calibration(void)
{
  uint16_t cal_data[5];
  int ax_Phys[2],ay_Phys[2];
  int ax[2] = { 15, LCD_XSIZE -1-15};
  int ay[2] = { LCD_YSIZE-1-15, 15};

  get_calibrate_data(cal_data);

  ax_Phys[0] = cal_data[1];
  ay_Phys[0] = cal_data[2];
  
  ax_Phys[1] = cal_data[3];
  ay_Phys[1] = cal_data[4];
  
  GUI_TOUCH_Calibrate(GUI_COORD_X, ax[0], ax[1], ax_Phys[0], ax_Phys[1]);
  GUI_TOUCH_Calibrate(GUI_COORD_Y, ay[0], ay[1], ay_Phys[0], ay_Phys[1]);
}


#if 0			

void myAD2XY( int *adx , int *ady ){
 float f_dat;
 int dat1;

 f_dat = (float)(*ady - admy)/(float)(*adx - admx);
 if(f_dat>0){
  if( *adx>admx && admk[2] >=f_dat) dat1 = 1;
  else if( *adx>admx && admk[2] < f_dat ) dat1 =2;//2
  else if( *adx<admx && admk[0] >=f_dat ) dat1 =0;
  else if( *adx<admx && admk[0] < f_dat ) dat1 =3;//0
  else{ dat1 =0; }//*adx =0;*ady =0; }
 }else{
  if( *adx>admx && admk[1] >=f_dat) dat1 = 0;
  else if( *adx>admx && admk[1] < f_dat ) dat1 =1;//1
  else if( *adx<admx && admk[3] >=f_dat ) dat1 =3;
  else if( *adx<admx && admk[3] < f_dat ) dat1 =2;//3
  else{ dat1 =0; }//*adx =0;*ady =0; }
 }
 *adx = (int)(Factors[dat1][0].a*(*adx)+Factors[dat1][0].b*(*ady)+Factors[dat1][0].c); 
 *ady = (int)(Factors[dat1][1].a*(*adx)+Factors[dat1][1].b*(*ady)+Factors[dat1][1].c);
}
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) {
    GUI_Init();
    GUI_DispString("Hello world!");
    while(1);
}