/*********************************************************************
*
*       _MoveCursor
*/
static void _MoveCursor(){
  int x, y, tm, cnt = 0;
  int yStep=-1;
  int xPos,yPos;
  xPos = LCD_GetXSize() / 2 - bmSeggerLogoBlue.XSize/2;
  yPos = LCD_GetYSize() / 2 - bmSeggerLogoBlue.YSize/2+25;
  GUI_DispStringHCenterAt("Cursor shape can be changed\nand the cursor can be moved", 160,  75);
  GUI_CURSOR_Show(); 
  GUI_DrawBitmap(&bmSeggerLogoBlue, xPos, yPos );
  y = 150;
  for (x = 0; x < 320; x++) {
    if ((x % 54) == 0) {
      GUI_CURSOR_Select(_apCursor[cnt++]);
    }
    tm = GUI_GetTime();
    y += yStep;
    if(y<=80) yStep=1;
    if(y>=150) yStep=-1;
    GUI_CURSOR_SetPosition(x, y);
    while ((GUI_GetTime() - tm) < 10);
  }
  for (x = 320; x > 0; x--) {
    tm = GUI_GetTime();
    if ((x % 54) == 0) {
      GUI_CURSOR_Select(_apCursor[cnt++]);
    }
    y += yStep;
    if(y<=80) yStep=1;
    if(y>=150) yStep=-1;
    GUI_CURSOR_SetPosition(x, y);
    while ((GUI_GetTime() - tm) < 10);
  }
  GUI_CURSOR_Hide(); 
  GUI_Delay(500);
}
Пример #2
0
/*********************************************************************
*
*       GUIDEMO_Cursor
*/
void GUIDEMO_Cursor(void) {
  GUIDEMO_ShowIntro("Cursor", "emWin supports\nsoftware cursors");
  _DispCursor();
  GUIDEMO_Wait(4000);
  GUIDEMO_CursorShow();
  #if (GUI_SUPPORT_CURSOR && GUI_SUPPORT_TOUCH)
    if (GUIDEMO_GetConfFlag(GUIDEMO_CF_SUPPORT_TOUCH)) {
      GUI_CURSOR_SetPosition(0,0);
      GUI_CURSOR_Select(&GUI_CursorArrowM);
    }
  #endif
}
Пример #3
0
void GUIDEMO_Cursor(void) {
  int i = 0;
  GUIDEMO_ShowIntro("Cursor",
                    "\nuC/GUI supports"
                    "\nsoftware cursor");
  GUI_SetBkColor(GUI_BLUE);
  GUI_Clear();
  _DispCursor();
  GUIDEMO_Delay(2000);
  GUIDEMO_NotifyStartNext();
  GUI_CURSOR_Show(); 
  for ( i = 0;(i < countof(_aCursor) && !GUIDEMO_CheckCancel()); i++) {
      _MoveCursor(_aCursor[i]);
  }
  GUI_CURSOR_SetPosition(0,0);
  GUI_CURSOR_Select(&GUI_CursorArrowM);  
}
Пример #4
0
static void _MoveCursor(const GUI_CURSOR* Cursor){
  int x, y;
  int xMax, yMax;
  xMax = LCD_GetXSize()/2;
  yMax = LCD_GetYSize()/2;
  GUI_CURSOR_Select(Cursor);  
  for(x = y = 0; ((x != xMax)  && (y != yMax)  && !GUIDEMO_CheckCancel()); x += 4, y += 4) {
    if ( x == xMax) {
      x = xMax;
    }
    if ( y == yMax) {
      y = yMax;
    }
    GUI_CURSOR_SetPosition(x,y);
    GUIDEMO_Delay(75);
  }
}
Пример #5
0
void TH_GUI (void const *argument) {
	static volatile uint16_t i=0;
	static uint16_t Triggered_Sample=0;	
	osEvent evt;
	GUI_MEMDEV_Handle hMem0;
	GUI_SelectLayer(0);
	hMem0 = GUI_MEMDEV_Create(0,0,480,272);
	
	if(!GUI_CURSOR_GetState())
		GUI_CURSOR_Select(&GUI_CursorCrossM);
	
	GUI_CURSOR_Show();
  while (1) {
																															Anal_CH1_Set(/*Main loop start*/);
																															Anal_CH2_Set(/*Wait start*/);
		evt = osSignalWait(DMA_ConvCpltSig,(uint32_t)2);
		if( evt.status == osEventTimeout)
				Error_Handler();
																															Anal_CH2_Reset(/*Wait finish*/);
		//osSignalSet(tid_Touch,GUI_TouchStateReqSig);
		
																															Anal_CH3_Set(/*Copy start*/);
		for(i=0;i<ADC_BUFFER_LENGTH;i++)	// <- Temporary. Take the full advantage of DMA !
		values_BUF[i]=255-values[i];
																															Anal_CH3_Reset(/*Copy finish*/);
		
		HAL_ADC_Start_DMA(&g_AdcHandle, values, ADC_BUFFER_LENGTH);
		osSignalClear(tid_TH_GUI, DMA_ConvCpltSig);
																															Anal_CH4_Set(/*Wait start*/);		
		osSignalWait(GUI_TouchGetSig,(uint32_t)0);
		GUI_CURSOR_SetPosition(g_Touched.pState->x,g_Touched.pState->y);
																															Anal_CH4_Reset(/*Wait finish*/);
		
		Trigger_Point = g_Touched.MSG;
		Triggered_Sample = Trigger(Trigger_Point, values_BUF, ADC_BUFFER_LENGTH, 1348000UL);
		//if(Triggered_Sample >=20)Triggered_Sample -=20; // Offset to see the edge in the center <- bullshit ?
		
		GUI_MEMDEV_Select(hMem0);
		GUI_MEMDEV_Clear(hMem0);
		
		GUI_SetColor(GUI_DARKGRAY);
		GUI_FillRect(0,0,480,272);
		
		GUI_SetColor(GUI_BLACK);
		GUI_DrawRect(34,5,474,266);		
		
		GUI_SetColor(GUI_WHITE);
		GUI_FillRect(35,6,475,266);
		
		Draw_GraphGrid(440,260,40,40);
		
		GUI_SetColor(GUI_BLUE);
		/*Draw garph start*/HAL_GPIO_TogglePin(GPIOI,GPIO_PIN_1);
		GUI_DrawGraph((short*)&values_BUF[Triggered_Sample],440,35,6); // Useful: GUI_COUNTOF(values)
		/*Draw garph finish*/HAL_GPIO_TogglePin(GPIOI,GPIO_PIN_1);
		
		GUI_SetColor(GUI_ORANGE);
		GUI_DrawHLine(Trigger_Point,0,480);
		GUI_FillCircle(15,Trigger_Point,10);
		
		GUI_SetColor(GUI_YELLOW);
		GUI_DrawCircle(15,Trigger_Point,10);
		
		GUI_MEMDEV_CopyToLCD(hMem0);
																															Anal_CH1_Reset(/*Main loop finish*/);
    osThreadYield ();                                           // suspend thread
  }
}
void MainTask_2D_text_bmp(void) {
	int i;

	horPos = ICONS_HOR_POS;
	verPos = ICONS_VER_POS;
	iconTouched = 0xFF;

	SetemWinRunning(1);	
	GUI_SelectLayer(1); // select foregroung layer
	GUI_SetBkColor(GUI_TRANSPARENT);	// select background as transparent color
	GUI_Clear();	// fill with the background color

	// get the number of icons
	iconNumber = GUI_COUNTOF(iconDrawFunctions);
	// compute padding to fit to whole display
	iconPadding =  ((GUI_GetScreenSizeY() - (iconNumber * ICON_SIZE) - 2*ICONS_VER_POS) / iconNumber);


	// start time measurement
	timeMeasureStart();

	// draw a background bitmap to the bottom LCD layer
	GUI_SelectLayer(0); // select the background layer
	// !! TO BE MODIFIED !!
	 GUI_DrawBitmap(&bmbackground, 0, 0);
	GUI_SelectLayer(1); // set back the foregroung layer

	// now draw our icons one by one
	for (i = 0; i < iconNumber; i++)
	{
		iconDrawFunctions[i](horPos, verPos, ICON_SIZE);
		verPos += ICON_SIZE + iconPadding;
	}

	// add a title text
	GUI_SetTextMode(GUI_TM_TRANS);
	GUI_SetFont(&GUI_FontTimesNewRoman31);
  LCD_AA_SetAndMask(0xFFFFFFFF);
	GUI_DispStringInRect("STM32 Player", &rect, GUI_TA_CENTER);
	LCD_AA_SetAndMask(0x00FFFFFF);

	// end measurement
	time = timeMeasureEnd();
	GUI_SetFont(&GUI_Font8_1);
	sprintf (timeString, "time to render: %d,%dms", time/10, time%10);
	GUI_DispStringAt(timeString, 10, 320 - 10);
	
	// optionally we can use cursor
  GUI_CURSOR_Show(); 

	// the GUI is now rendered 
	// in never ending loop just check if an incon is touched

  while(!tamperPushed)
  {
		GUI_TOUCH_GetState(&TouchState);  // Get the touch position in pixel
		if (TouchState.Pressed)
		{
			if (iconTouched == 0xFF)	// no icon was touched previously
			{
				GUI_CURSOR_SetPosition(TouchState.x, TouchState.y);	// move the cursor to current touch position
				// check if the touch is in icons area
				if (TouchState.x > ICONS_HOR_POS && TouchState.x < ICONS_HOR_POS + ICON_SIZE)
				{
					if(TouchState.y > ICONS_VER_POS && TouchState.y < ICONS_VER_POS + iconNumber*(ICON_SIZE + iconPadding))
					{
						// get he number of touched icon
						iconTouched = (TouchState.y - ICONS_VER_POS) / (ICON_SIZE + iconPadding);
						ReDrawIcon(GUI_RED, iconTouched); // draw again with hihghlight color
					}
				}
			}
		}
		else
		{
			ReDrawIcon(GUI_WHITE, iconTouched);
			iconTouched = 0xFF;
		}  
  }
	SetemWinRunning(0);
  GUI_CURSOR_Hide(); 
}