Ejemplo n.º 1
0
/*******************************************************************
*
*       _cbDemoCallback2
*/
static void _cbDemoCallback2(WM_MESSAGE* pMsg) {
  int x, y;
  switch (pMsg->MsgId) {
  case WM_PAINT:
    GUI_SetBkColor(GUI_MAGENTA);
    GUI_Clear();
    GUI_SetColor(GUI_YELLOW);
    GUI_SetFont(&GUI_FontComic18B_1);
    x = WM_GetWindowSizeX(pMsg->hWin);
    y = WM_GetWindowSizeY(pMsg->hWin);
    GUI_DispStringHCenterAt("Window 2\nanother Callback", x / 2, (y / 4) - 18);
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 2
0
    /*****************************************************************************
    * Function - DrawArrow
    * DESCRIPTION:
    *****************************************************************************/
    void ScrollBar::DrawArrow(int xpos, int ypos, int heigh, int width, bool upwards)
    {
      GUI_SetColor(mpSliderFrame->GetFillingColour());

      // Up arrow frame
      U8 j = xpos;
      for (U8 i = 0; i < heigh; i++)
      {
        if (i % 2 == 0)
        {
          j++;
        }
        GUI_DrawHLine((upwards ? ypos - i : ypos + i), j, width - j );
      }

    }
Ejemplo n.º 3
0
/*******************************************************************
*
*       _cbChild
*/
static void _cbChild(WM_MESSAGE* pMsg) {
  int x, y;
  switch (pMsg->MsgId) {
  case WM_PAINT:
    GUI_SetBkColor(_ChildColor);
    GUI_Clear();
    GUI_SetColor(GUI_RED);
    GUI_SetFont(&GUI_Font24_ASCII);
    x = WM_GetWindowSizeX(pMsg->hWin);
    y = WM_GetWindowSizeY(pMsg->hWin);
    GUI_DispStringHCenterAt("Child window", x / 2, (y / 2) - 12);
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 4
0
/*********************************************************************
*
*       _cbBkWindow
*/
static void _cbBkWindow(WM_MESSAGE * pMsg) {



  switch (pMsg->MsgId) {
  case WM_PAINT:
    GUI_SetBkColor(GUI_WHITE);
    GUI_Clear();
    GUI_SetColor(GUI_BLACK);
    GUI_SetFont(&GUI_Font24_ASCII);


  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 5
0
//#include "..\\User\\AppTask.h"
void 	TskGuiProc(void *p_arg)//30
{

	volatile	INT8U err;
		TLOG("TskGuiProc start Prio=%02d\n",OSTCBCur->OSTCBPrio);
		GUI_Initialize();				// 初始化LCM
 		GUI_SetColor(1, 0);//设置前景色和背景色的
		DispLog();						// 显示LOG
		RunMenuDemo();					// 显示菜单
		for(;;)
	{	   

		OSTimeDly(OS_TICKS_PER_SEC);//
		
	}
};
Ejemplo n.º 6
0
//////////////////////////////////////////////////////////////////////////////
// Product: DPP example with emWin/uC/GUI, WITH Window Manager
// Last updated for version 6.2.0
// Last updated on  2018-03-16
//
//                    Q u a n t u m     L e a P s
//                    ---------------------------
//                    innovating embedded systems
//
// Copyright (C) Quantum Leaps, LLC. All rights reserved.
//
// This program is open source software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Alternatively, this program may be distributed and modified under the
// terms of Quantum Leaps commercial licenses, which expressly supersede
// the GNU General Public License and are specifically designed for
// licensees interested in retaining the proprietary status of their code.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// Contact information:
// https://www.state-machine.com
// mailto:[email protected]
//////////////////////////////////////////////////////////////////////////////
#include "qpcpp.h"
#include "dpp.h"
#include "bsp.h"

extern "C" {
    #include "GUI.h"
    #include "WM.h"                                   // emWin Windows Manager
    #include "DIALOG.h"
    #include "SIM.h"
}

Q_DEFINE_THIS_FILE

// Active object class -------------------------------------------------------
class Table : public QActive {
private:
    uint8_t m_fork[N_PHILO];
    uint8_t m_isHungry[N_PHILO];

public:
    Table();

private:
    static QState initial(Table *me, QEvt const *e);
    static QState ready  (Table *me, QEvt const *e);
    static QState serving(Table *me, QEvt const *e);
    static QState paused (Table *me, QEvt const *e);
};

#define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1)) % N_PHILO))
#define LEFT(n_)  ((uint8_t)(((n_) + 1) % N_PHILO))
enum m_forkState { FREE, USED };

// Local objects -------------------------------------------------------------
static Table l_table;                                    // local Table object

#ifdef Q_SPY
    enum QSUserRecords {
        PHILO_STAT = QS_USER,
        TABLE_STAT
    };
    static uint8_t const l_onDialogGUI = 0U;
#endif

// Public-scope objects ------------------------------------------------------
QActive * const AO_Table = &l_table;                    // "opaque" AO pointer


// GUI definition ============================================================
static WM_HWIN l_hDlg;
static WM_CALLBACK *l_cb_WM_HBKWIN;

static const GUI_WIDGET_CREATE_INFO l_dialog[] = {
    { &FRAMEWIN_CreateIndirect, "Dining Philosopher Problem",
        0,  30,  30, 260, 180, FRAMEWIN_CF_MOVEABLE },
    { &TEXT_CreateIndirect, "Philosopher 0",
        GUI_ID_TEXT9,  50,  10, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "Philosopher 1",
        GUI_ID_TEXT9,  50,  30, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "Philosopher 2",
        GUI_ID_TEXT9,  50,  50, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "Philosopher 3",
        GUI_ID_TEXT9,  50,  70, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "Philosopher 4",
        GUI_ID_TEXT9,  50,  90, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "Table",
        GUI_ID_TEXT9,  50, 110, 0, 0, TEXT_CF_LEFT },

    { &TEXT_CreateIndirect, "thinking",
        GUI_ID_TEXT0, 130,  10, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "thinking",
        GUI_ID_TEXT1, 130,  30, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "thinking",
        GUI_ID_TEXT2, 130,  50, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "thinking",
        GUI_ID_TEXT3, 130,  70, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "thinking",
        GUI_ID_TEXT4, 130,  90, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "serving",
        GUI_ID_TEXT5, 130, 110, 0, 0, TEXT_CF_LEFT },

    { &BUTTON_CreateIndirect,"PAUSE",
        GUI_ID_BUTTON0,    160, 130, 80, 30 }
};

   //..........................................................................*/
static void onMainWndGUI(WM_MESSAGE* pMsg) {
    switch (pMsg->MsgId) {
        case WM_PAINT: {
            GUI_SetBkColor(GUI_GRAY);
            GUI_Clear();
            GUI_SetColor(GUI_BLACK);
            GUI_SetFont(&GUI_Font24_ASCII);
            GUI_DispStringHCenterAt("Dining Philosophers - Demo", 160, 5);
            break;
        }
        default: {
            WM_DefaultProc(pMsg);
            break;
        }
    }
}
Ejemplo n.º 7
0
/*********************************************************************
*
*       _cbBkWindow
*/
static void _cbBkWindow(WM_MESSAGE * pMsg) {
  int xPos, yPos;
  xPos = LCD_GetXSize() / 2 - bmSeggerLogoBlue.XSize/2;
  yPos = LCD_GetYSize() / 2 - bmSeggerLogoBlue.YSize/2 ;
  switch (pMsg->MsgId) {
  case WM_PAINT:
    GUI_SetBkColor(GUI_BLUE);
    GUI_Clear();
    GUI_SetColor(GUI_WHITE);
    GUI_SetFont(&GUI_Font24_ASCII);
    GUI_DispStringHCenterAt("DIALOG_SliderColor - Sample", 160, 5);
    GUI_DrawBitmap(&bmSeggerLogoBlue, xPos, yPos );
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 8
0
static void _DrawBkCircle(int DrawLogo) {
  static GUI_MEMDEV_Handle hMemStretch;
  GUI_MEMDEV_Handle        hMemCircle, hMemGradient, hMemOld;
  int   xSize, ySize, i, CircleWidth;
  U32 * pData;

  if (hMemStretch == 0) {
    xSize        = LCD_GetXSize();
    ySize        = LCD_GetYSize();
    CircleWidth  = (CIRCLE_RADIUS << 1) + 1;
    hMemCircle   = GUI_MEMDEV_CreateFixed(0, 0, CircleWidth, CircleWidth,   GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUI_COLOR_CONV_8888);
    hMemStretch  = GUI_MEMDEV_CreateEx   (0, 0, xSize,       ySize,         GUI_MEMDEV_NOTRANS);
    hMemGradient = GUI_MEMDEV_CreateFixed(0, 0, 1,           CIRCLE_RADIUS, GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUI_COLOR_CONV_8888);
    //
    // Initialize background
    //
    hMemOld = GUI_MEMDEV_Select(hMemCircle);
    GUI_SetBkColor(BK_COLOR_1);
    GUI_Clear();
    //
    // Create Gradient
    //
    GUI_MEMDEV_Select(hMemGradient);
    GUI_DrawGradientV(0, 0, 0, CIRCLE_RADIUS, BK_COLOR_0, BK_COLOR_1);
    //
    // Get color and draw circles
    //
    pData = (U32 *)GUI_MEMDEV_GetDataPtr(hMemGradient);
    GUI_MEMDEV_Select(hMemCircle);
    for (i = 0; i < CIRCLE_RADIUS; i++, pData++) {
      GUI_SetColor(*pData);
      GUI_DrawCircle(CIRCLE_RADIUS, CIRCLE_RADIUS, i);
    }
    //
    // Stretch and display
    //
    GUI_MEMDEV_Select(hMemStretch);
    GUI_MEMDEV_DrawPerspectiveX(hMemCircle, 0, 0, ySize, ySize, xSize, 0);
    GUI_MEMDEV_Delete(hMemCircle);
    GUI_MEMDEV_Delete(hMemGradient);
    GUI_MEMDEV_Select(hMemOld);
  }
  GUI_MEMDEV_Write(hMemStretch);
  if (DrawLogo) {
    GUI_DrawBitmap(&bmSeggerLogo70x35, 5, 5);
  }
}
Ejemplo n.º 9
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);
}
Ejemplo n.º 10
0
static void Paint(TERMINAL_Obj* pObj/*, GUI_RECT*pRect*/) {
  char*s = (char*) WM_HMEM2Ptr(pObj->hpText);
  GUI_RECT rClient;
  GUI_DEBUG_LOG("TERMINAL: Paint(..)\n");
  GUI_GetClientRect(&rClient);
/* Draw background */
  GUI_SetBkColor (GUI_WHITE/*pObj->aBkColor[0]*/);
  GUI_SetColor   (GUI_BLACK /*pObj->aTextColor[0]*/);
  GUI_Clear();
/* Draw the text */  
  {
    GUI_RECT rText = rClient;
    rText.x0 +=3;
//    GUI_SetFont    (pObj->pFont);
    GUI_DispStringInRect(s, &rText, GUI_TA_LEFT);
  }
}
Ejemplo n.º 11
0
void ShowKeyPadString(char* STR)
	{
	GUI_SetFont(Upper_Font); 
	GUI_SetColor(GW_BLACKV);
	GUI_SetBkColor(GW_WHITE);        
	/*Clear 27 chars*/
	GUI_SetTextAlign(GUI_TA_LEFT);
	GUI_GotoXY(73,97);
	//GUI_DispChars(' ',41);//For Clear String
	GUI_DispChars(' ',50);//For Clear String
	/*Clear channel mark area.*/        
	GUI_SetBkColor(GW_WHITE);
	GUI_SetTextAlign(GUI_TA_CENTER);        
	GUI_GotoXY(161,97);
	GUI_DispChar(' ');//For Clear String
	GUI_DispStringAt(STR,162,97);
	}
Ejemplo n.º 12
0
/*********************************************************************
*
*       _cbBk
*/
static void _cbBk(WM_MESSAGE * pMsg) {
  int xSize, ySize;

  switch (pMsg->MsgId) {
  case WM_PAINT:
    xSize = LCD_GetXSize();
    ySize = LCD_GetYSize();
    GUI_DrawGradientV(0, 0, xSize, ySize, GUI_BLUE, GUI_BLACK);
    GUI_SetColor(GUI_WHITE);
    GUI_SetFont(&GUI_Font24_ASCII);
    GUI_SetTextMode(GUI_TM_TRANS);
    GUI_DispStringHCenterAt("WIDGET_Spinbox - Sample", 160, 5);
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 13
0
static  void  App_Task1(void *p_arg)
{
	(void)p_arg;
	 LED_GPIO_Conf();
	GUI_Init();
	GUI_SetBkColor(GUI_RED);
	GUI_SetColor(GUI_BLUE);
	GUI_Clear();
	while(1)
	{
     	LED0(On);
		OSTimeDly(500);
		LED0(Off);
		OSTimeDly(500);
		MainTask();
	}	
}
Ejemplo n.º 14
0
void Hello_MSG(void) {

	GUI_SetColor(GUI_BLUE);
	GUI_SetFont(&GUI_Font16_1);
	GUI_DispStringHCenterAt("Oscyloskop cyfrowy v1.1" , 240, 150);
	GUI_DispStringHCenterAt("Adrian Kurylak" , 240, 175);
	GUI_DispStringHCenterAt("Politechnika Wroclawska" , 240, 200);
	GUI_SetFont(&GUI_Font32_1);
	GUI_DispStringHCenterAt("Inicjalizacja" , 240, 120);
	osDelay(250);
	GUI_DispStringHCenterAt("Inicjalizacja." , 240, 120);
	osDelay(500);
	GUI_DispStringHCenterAt("Inicjalizacja.." , 240, 120);
	osDelay(500);
	GUI_DispStringHCenterAt("Inicjalizacja..." , 240, 120);
	osDelay(750);
}
Ejemplo n.º 15
0
static void _UserDraw(WM_HWIN hWin, int Stage) {
  if (Stage == GRAPH_DRAW_LAST)
  {
    char acText[] = "Flow Rate L/s";
    GUI_RECT Rect;
    GUI_RECT RectInvalid;
    int      FontSizeY;

    GUI_SetFont(&GUI_Font13_ASCII);
    FontSizeY = GUI_GetFontSizeY();
    WM_GetInsideRect(&Rect);
    WM_GetInvalidRect(hWin, &RectInvalid);
    Rect.x1 = Rect.x0 + FontSizeY;
    GUI_SetColor(GUI_RED);
    GUI_DispStringInRectEx(acText, &Rect, GUI_TA_HCENTER, strlen(acText), GUI_ROTATE_CCW);
  }
}
Ejemplo n.º 16
0
int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_DMA_Init();
  MX_CRC_Init();
  MX_USART1_UART_Init();
//  MX_RTC_Init();  /**< 重新用cube生成工程时 注释掉此函数 再下载 */

  /* USER CODE BEGIN 2 */
    rtc_init();     /**< 使用改造后的初始化函数实现备份掉电时的数据 */
    
    GUI_Init();
    GUI_UC_SetEncodeUTF8();
    GUI_SetFont(&GUI_Font24B_1);
    GUI_SetBkColor(GUI_BLACK);
    GUI_SetColor(GUI_GREEN);

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
    RTC_display_current_time(20, 170);
    RTC_display_current_date(120, 170);  
  }
  /* USER CODE END 3 */

}
Ejemplo n.º 17
0
/*******************************************************************
*
*       _cbBkWindow
*/
static void _cbBkWindow(WM_MESSAGE* pMsg) {
  switch (pMsg->MsgId) {
  case MSG_CHANGE_TEXT:
    strcpy(_acInfoText, pMsg->Data.p);
  case WM_PAINT:
    GUI_SetBkColor(GUI_BLACK);
    GUI_Clear();
    GUI_SetColor(GUI_WHITE);
    GUI_SetFont(&GUI_Font24_ASCII);
    GUI_DispStringHCenterAt("WindowManager - Sample", 160, 5);
    GUI_SetFont(&GUI_Font8x16);
    GUI_DispStringAt(_acInfoText, 5, 40);
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 18
0
/*******************************************************************************
*  Function Name  :   testgui 
*  Description    : GUI测试函数,初化后,显示数据
*  Input          : None
*  Output         : None
*  Return         : None
*******************************************************************************/
void test_gui(void)
{
  int i;  
	RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE);
    GUI_Init();
    GUI_Initialized = 1;
    GUI_DispChars('/', 53);     
    for( i= 0; i < 240; i += 8)   
    {        
        GUI_DispCharAt('/', 312, i);
        GUI_DispCharAt('/', 1,   i);
    } 
    GUI_DispChars('/', 52); 
    GUI_SetFont(&GUI_Font24B_ASCII);
    GUI_SetColor(GUI_RED); 
    GUI_DispStringAt("This is a test program!",10,110);
}
Ejemplo n.º 19
0
/*********************************************************************
*
*       _cbBkWindow
*/
static void _cbBkWindow(WM_MESSAGE * pMsg) {
  int i;
  switch (pMsg->MsgId) {
  case WM_PAINT:
    GUI_SetBkColor(GUI_BLUE);
    GUI_Clear();
    GUI_SetColor(GUI_WHITE);
    GUI_SetFont(&GUI_Font24_ASCII);
    GUI_DispStringHCenterAt("Counting Sample", 160, 5);
    GUI_SetFont(&GUI_Font8x16);
    for (i = 0; i < GUI_COUNTOF(_asExplain); i++) {
      GUI_DispStringAt(_asExplain[i], 5, 40 + i * 16);
    }
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 20
0
static void _cbWindow1(WM_MESSAGE* pMsg) {
  int x, y,d;
  
  switch (pMsg->MsgId) {
  case WM_PAINT:
//    GUI_SetBkColor(_WindowColor1);
      
//    GUI_SetColor(GUI_WHITE);
//    GUI_SetFont(&GUI_Font24_ASCII);
	  if(curbuttonid != -1)
	  {
			GUI_SetColor(GUI_WHITE); 
			GUI_SetBkColor(GUI_BLUE);
			GUI_SetFont(&GUI_FontHZ12);		
			GUI_Clear(); 
			x = WM_GetWindowSizeX(pMsg->hWin);
			y = WM_GetWindowSizeY(pMsg->hWin);
			GUI_DispStringHCenterAt(pButton[curbuttonid].desc, x / 2, (y / 2) + 30);
		}
    break;
  case WM_NOTIFY_PARENT:
	  //#define WM_NOTIFICATION_CLICKED             1
      //#define WM_NOTIFICATION_RELEASED            2
	   if(pMsg->Data.v == WM_NOTIFICATION_RELEASED)
	   {
			x = WM_GetWindowSizeX(pMsg->hWin);
			y = WM_GetWindowSizeY(pMsg->hWin);
			d = GetButtonID(pMsg->hWinSrc);
			GUI_Clear();
			GUI_DispStringHCenterAt(pButton[d].desc, x / 2, (y / 2) + 30);
			curbuttonid = d;
			if(pButton[d].ExeProg)
			{
				//OSTaskCreate (pButton[d].ExeProg,pMsg->hWin, &TaskStk[TASK_STK_SIZE-1],20);
				printf("new 1 task\n");
				pButton[d].ExeProg(pMsg->hWin,0,0);
				
				 // CREATE_TASK(&aTCB[0],pButton[d].title,pButton[d].ExeProg,80,Stack_0);
			}
	   }
	  break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 21
0
void Display_wait(u8 datain)
{
	GUI_SetBkColor(GUI_BLACK);
	GUI_Clear();
	DisplayBattery();
	GUI_SetColor(GUI_CYAN);
	
	if(datain==0)
	{
  	GUI_DispStringAt("正在验证白酒",12,20);
  	GUI_DispStringAt("防伪信息 Wait...",0,40);	
	}
	else
	{
  	GUI_DispStringAt("正在生成在线",12,20);
		GUI_DispStringAt("识别信息 Wait...",0,40);
	}
}
/*********************************************************************
*
*       _cbMyWidget
*/
static void _cbMyWidget(WM_MESSAGE * pMsg) {
    GUI_RECT WinRect;
    char     acText[20] = { 0 };

    switch (pMsg->MsgId) {
    case WM_PAINT:
        MYWIDGET_Callback(pMsg);
        MYWIDGET_GetUserData(pMsg->hWin, acText, sizeof(acText));
        GUI_SetColor(GUI_WHITE);
        GUI_SetTextMode(GUI_TM_TRANS);
        WM_GetWindowRectEx(pMsg->hWin, &WinRect);
        GUI_MoveRect(&WinRect, -WinRect.x0, -WinRect.y0);
        GUI_DispStringInRect(acText, &WinRect, GUI_TA_HCENTER | GUI_TA_VCENTER);
        break;
    default:
        MYWIDGET_Callback(pMsg);
    }
}
Ejemplo n.º 23
0
static void _Draw(void * p) {
  int i;
  PARAM * pParam = (PARAM *)p;
  GUI_SetBkColor(GUI_BLACK);
  GUI_SetColor(GUI_DARKGRAY);
  GUI_ClearRect(19, (LCD_YSIZE - 20) - _YSize, (LCD_XSIZE - 2), (LCD_YSIZE - 21));
  for (i = 0; i < (_YSize / 2); i += 20) {
    GUI_DrawHLine((LCD_YSIZE - 20) - (_YSize / 2) + i, 19, (LCD_XSIZE - 2));
    if (i) {
      GUI_DrawHLine((LCD_YSIZE - 20) - (_YSize / 2) - i, 19, (LCD_XSIZE - 2));
    }
  }
  for (i = 40; i < (LCD_XSIZE - 20); i += 40) {
    GUI_DrawVLine(18 + i, (LCD_YSIZE - 20) - _YSize, (LCD_YSIZE - 21));
  }
  GUIDEMO_SetColor(COLOR_GRAPH0);
  GUI_DrawGraph(pParam->aY, (LCD_XSIZE - 20), 19, (LCD_YSIZE - 20) - _YSize);
}
Ejemplo n.º 24
0
static void  _cbClock(WM_MESSAGE *pMsg)
{
	int NCode, Id;
	//PARAM pParam;
	switch (pMsg->MsgId)
	{
	case WM_PAINT:
		GUI_SetBkColor(GUI_WHITE); 
		GUI_Clear();
		GUI_SetColor(GUI_BLACK);
		_ShowButton(pMsg->hWin);
		GUI_DrawBitmap(&bmwatch, 37, 0);

		//GUI_AA_FillPolygon(pParam.aPoint1, GUI_COUNTOF(_aNeedle[0]), MAG * LCD_GetXSize() / 2, MAG * (LCD_GetYSize() / 2));
	//	GUI_AA_FillPolygon(pParam.aPoint2, GUI_COUNTOF(_aNeedle[1]), MAG * LCD_GetXSize() / 2, MAG * (LCD_GetYSize() / 2));
		//GUI_AA_FillPolygon(pParam.aPoint3, GUI_COUNTOF(_aNeedle[2]), MAG * LCD_GetXSize() / 2, MAG * (LCD_GetYSize() / 2));

		GUI_FillCircle(160, 120, 3);
	
		break;
	case WM_NOTIFY_PARENT:
		Id = WM_GetId(pMsg->hWinSrc);    /* Id of widget */
		NCode = pMsg->Data.v;            /* Notification code */
		switch (NCode)
		{
		case WM_NOTIFICATION_CLICKED:
			switch (Id)
			{
			case BUTTON_ID_EXIT:
				GUI_SetAppIndex(APP_MainMenu);
				GUI_SetAppDirection(MEMDEV_ANIMATION_LEFT);
				_MoveShiftWindow(&pMsg->hWin, MEMDEV_ANIMATION_RIGHT, 1, 1);
				GUI_SetCancel(APP_Clock);
				GUI_ClearHalt();
				break;
			default:
				break;
			}
		}
		break;
	default:
		WM_DefaultProc(pMsg);
	}
}
Ejemplo n.º 25
0
/*********************************************************************
*
*       _cbCallback
*/
static void _cbCallback(WM_MESSAGE * pMsg) {
  WM_HWIN hDlg;
  WM_HWIN hWinSrc;
  int Id;
  int NCode;

  hWinSrc = pMsg->hWinSrc;
  hDlg = pMsg->hWin;
  switch (pMsg->MsgId) {
  case WM_PAINT:
    GUI_SetColor(GUI_BLACK);
    GUI_DrawBitmap(&bmLogoBitmap, 30, 80);
    GUI_SetFont(&GUI_Font24B_ASCII);
    GUI_SetFont(&GUI_Font16B_ASCII);
    GUI_DispStringHCenterAt("www.segger.com", 30 + bmLogoBitmap.XSize / 2, 80 + bmLogoBitmap.YSize);
    GUI_DispStringHCenterAt("Virtual screen sample", 160, 20);
    break;
  case WM_INIT_DIALOG:
    FRAMEWIN_SetFont(hDlg, &GUI_Font24B_ASCII);
    FRAMEWIN_SetTextAlign(hDlg, GUI_TA_HCENTER);
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(hWinSrc);      /* Id of widget */
    NCode = pMsg->Data.v;           /* Notification code */
    switch (NCode) {
    case WM_NOTIFICATION_RELEASED:
      switch (Id) {
      case ID_BUTTON_SETUP:
        ExecSetup();
        break;
      case ID_BUTTON_CALIBRATION:
        ExecCalibration();
        break;
      case ID_BUTTON_ABOUT:
        ExecAbout();
        break;
      }
      break;
    }
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
/*******************************************************************
*
*       _DemoOrData
*/
static void _DemoOrData(void) {
  int i;
  PARAM Param;
  GUI_RECT Rect = {19, (LCD_YSIZE - 20) - YSIZE, (LCD_XSIZE - 2), (LCD_YSIZE - 21)};
  GUI_HMEM hMem = GUI_ALLOC_AllocZero(405 * sizeof(I16));
  GUI_SetColor(GUI_WHITE);
  GUI_SetBkColor(GUI_RED);
  GUI_ClearRect(0, 55, LCD_XSIZE, 75);
  GUI_SetFont(&GUI_FontComic18B_1);
  GUI_DispStringAt("Several waves...", 20 ,55);
  Param.aY = GUI_ALLOC_h2p(hMem);
  _GetSineData(Param.aY, 405);
  GUI_MEMDEV_Draw(&Rect, _Draw, &Param, 0, 0);
  for (i = 0; (i < 90); i++) {
    _DrawOrData(GUI_GREEN, ++Param.aY);
    GUI_Delay(10);
  }
  GUI_ALLOC_Free(hMem);
}
Ejemplo n.º 27
0
void OUI_DrawGraph(){	
	GUI_MEMDEV_Select(OUI_MemoryDeviceGrid.DeviceHandle);
	GUI_SetBkColor(OUI_GRAPH_BACKGROUND);
	GUI_Clear();
	
	GUI_SetColor(OUI_GRAPH_LINES);
	for(int i = 0; i <= 180; i += 20){
		GUI_DrawLine(0, i, 270, i);
	}
	for(int i = 0; i <= 270; i += 30){
		GUI_DrawLine(i, 0, i, 180);
	}
	
	OUI_Components[2]->DrawGraph(OUI_Components[1], 0, 0);
	OUI_Components[1]->DrawGraph(OUI_Components[1], 0, 0);
	
	GUI_MEMDEV_CopyToLCDAt(OUI_MemoryDeviceGrid.DeviceHandle,OUI_MemoryDeviceGrid.X,OUI_MemoryDeviceGrid.Y);
	GUI_MEMDEV_Clear(OUI_MemoryDeviceGrid.DeviceHandle);
}
Ejemplo n.º 28
0
/*******************************************************************
*
*       _cbWindow2
*/
static void _cbWindow2(WM_MESSAGE* pMsg) {
  int x, y;
  switch (pMsg->MsgId) {
  case WM_PAINT:
    GUI_SetBkColor(_WindowColor2);
    GUI_Clear();
    GUI_SetColor(GUI_WHITE);
    GUI_SetFont(&GUI_Font24_ASCII);
    x = WM_GetWindowSizeX(pMsg->hWin);
    y = WM_GetWindowSizeY(pMsg->hWin);
    GUI_DispStringHCenterAt("Window 2", x / 2, (y / 4) - 12);
    break;
  case WM_SIZE:
    WM_InvalidateWindow(_hChild);
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 29
0
/*********************************************************************
*
*       _DrawAlphaCircles
*/
static void _DrawAlphaCircles(int mx, int my, int r, int a, int FactorAA) {
  int Index;
  int x;
  int y;
  I32 SinHQ;
  I32 CosHQ;
  U32 a1000;
  U32 i;
  const GUI_COLOR aColor[] = {
    0xC00FFF38,
    0xC000FF8E,
    0xC000FCEA,
    0xC000B4FF,
    0xC0004EFF,
    0xC01304FF,
    0xC06E00FF,
    0xC0D200FF,
    0xC0FF00D2,
    0xC0FF006E,
    0xC0FF0413,
    0xC0FF4E00,
    0xC0FFB400,
    0xC0EAFC00,
    0xC08EFF00,
    0xC038FF0F
  };

  mx    *= FactorAA;
  my    *= FactorAA;
  r     *= FactorAA;
  a1000  = a * -1000;
  GUI_AA_EnableHiRes();
  GUI_AA_SetFactor(FactorAA);
  for (i = 0, Index = 0; i < 360000; i += 22500, Index++) {
    SinHQ = GUI__SinHQ(i + a1000);
    CosHQ = GUI__CosHQ(i + a1000);
    x     = SHIFT_RIGHT_16(r * CosHQ);
    y     = SHIFT_RIGHT_16(r * SinHQ);
    GUI_SetColor(aColor[Index % (int)GUI_COUNTOF(aColor)]);
    GUI_AA_FillCircle(mx + x, my + y, r);
  }
  GUI_AA_DisableHiRes();
}
Ejemplo n.º 30
0
    /*****************************************************************************
    * Function
    * DESCRIPTION:
    * Redraws or clears the colon.
    *****************************************************************************/
    bool DataPointTime::RedrawColon()
    {
      if (mVisible)
      {
        int x = 0;
        int minutes = mTime.GetTime(MINUTES);

        char sz_time[10];
        if (mFormat == DATETIME_FORMAT_MDY_AMPM)// timeformat using am/pm
        {
          bool isAm;
          int hoursOffset;
          GetAs12HourClock(&isAm, &hoursOffset);
          sprintf(sz_time, ":%02d %s", minutes, isAm ? "am" : "pm");
        }
        else
        {
          sprintf(sz_time, ":%02d", minutes);
        }

        SelectWindow();
        GUI_SetColor(mColour);
        GUI_SetBkColor(mBackgroundColour);
        GUI_SetFont(GetFont());

        x = GetWidth() - GUI_GetStringDistX(sz_time);

        if (mShowColon)
        {
          GUI_DispStringAt(":", x, 2);
          mLastColonPosition = x;
        }
        else if (mLastColonPosition == x)
        {
          GUI_ClearRect(x, 0, x + 1, GetHeight() - 1);
        }

        Validate();
      }
      
      return true;
    }