STM32F429 & EmWin Çalışmalarım

Başlatan Mucit23, 01 Ekim 2014, 23:02:32

KESKİN_877

#15
hocam ben emwin ile birçok uygulama yaptım. coocox ile hiç sıkıntı çıkmıyor.
buda basit bir led on of uygulaması.
#include "DIALOG.h"

/*********************************************************************
*
*       Defines
*
**********************************************************************
*/
#define ID_WINDOW_0         (GUI_ID_USER + 0x00)
#define ID_BUTTON_0         (GUI_ID_USER + 0x02)
#define ID_TEXT_0         (GUI_ID_USER + 0x0B)
#define ID_IMAGE_0         (GUI_ID_USER + 0x01)
#define ID_IMAGE_0_IMAGE_0       0x00
// USER START (Optionally insert additional defines)
// USER END

/*********************************************************************
*
*       Static data
*
**********************************************************************
*/


/*********************************************************************
*
*       _aDialogCreate
*/
extern WM_HWIN CreateFramewin(void);
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 240, 320, 0, 0x0, 0 },

  { BUTTON_CreateIndirect, "enter", ID_BUTTON_0, 72, 93, 80, 20, 0, 0x0, 0 },
  { TEXT_CreateIndirect, "abdullah keskin", ID_TEXT_0, 33, 24, 158, 31, 0, 0x64, 0 },
  // USER START (Optionally insert additional widgets)
  // USER END
};

/*********************************************************************
*
*       Static code
*
**********************************************************************
*/

// USER START (Optionally insert additional static code)
// USER END

/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int     NCode;
  int     Id;
  // USER START (Optionally insert additional variables)
  // USER END

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'Window'
    //
    hItem = pMsg->hWin;
    WINDOW_SetBkColor(hItem, 0x00000080);
    //
    // Initialization of 'abdullah keskin'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
    TEXT_SetFont(hItem, GUI_FONT_16_1);
    TEXT_SetText(hItem, "abdullah keskin");
    TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
    TEXT_SetTextColor(hItem, 0x00FFFF80);
    // USER START (Optionally insert additional code for further widget initialization)
    // USER END
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_BUTTON_0: // Notifications sent by 'enter'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        CreateFramewin();
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;
  // USER START (Optionally insert additional message handling)
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       CreateWindow
*/
WM_HWIN CreateWindow(void);
WM_HWIN CreateWindow(void) {
  WM_HWIN hWin;

  hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
  return hWin;
}
/********************************************************************/
void MainTask(void)
{
	WM_SetCreateFlags(WM_CF_MEMDEV | WM_CF_CONST_OUTLINE);
  GUI_Init();
	Creategiris();
	GUI_Delay(1000);
	CreateWindow();
	while(1)
	{
		GUI_Delay(100);
	}
}
// USER START (Optionally insert additional public code)
// USER END

/*************************** End of file ****************************/



buda frawin kodları:
#include "DIALOG.h"
#include "stm32f4xx.h"
#include "stm32_ub_led.h"
/*********************************************************************
*
*       Defines
*
**********************************************************************
*/
#define ID_FRAMEWIN_0         (GUI_ID_USER + 0x0C)
#define ID_CHECKBOX_0         (GUI_ID_USER + 0x0E)
#define ID_CHECKBOX_1         (GUI_ID_USER + 0x0F)
#define ID_BUTTON_0         (GUI_ID_USER + 0x10)
#define ID_SCROLLBAR_0         (GUI_ID_USER + 0x11)
#define ID_EDIT_0         (GUI_ID_USER + 0x12)
#define ID_SCROLLBAR_1         (GUI_ID_USER + 0x13)

WM_HWIN ItemId;
unsigned int CState0,CState1;

// USER START (Optionally insert additional defines)
WM_HWIN ItemId;
unsigned int CState0,CState1;
// USER END

/*********************************************************************
*
*       Static data
*
**********************************************************************
*/

// USER START (Optionally insert additional static data)
// USER END

/*********************************************************************
*
*       _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  { FRAMEWIN_CreateIndirect, "Framewin", ID_FRAMEWIN_0, 47, 68, 120, 139, 0, 0x64, 0 },
  { CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_0, 11, 32, 80, 20, 0, 0x0, 0 },
  { CHECKBOX_CreateIndirect, "Checkbox", ID_CHECKBOX_1, 11, 58, 80, 20, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "close", ID_BUTTON_0, 13, 89, 51, 20, 0, 0x0, 0 },
  { SCROLLBAR_CreateIndirect, "Scrollbar", ID_SCROLLBAR_0, 157, 15, 10, 103, 8, 0x0, 0 },
  { EDIT_CreateIndirect, "Edit", ID_EDIT_0, -147, 154, 80, 20, 0, 0x64, 0 },
  { SCROLLBAR_CreateIndirect, "Scrollbar", ID_SCROLLBAR_1, 86, 3, 15, 113, 8, 0x0, 0 },
  // USER START (Optionally insert additional widgets)
  // USER END
};

/*********************************************************************
*
*       Static code
*
**********************************************************************
*/

// USER START (Optionally insert additional static code)
// USER END

/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int     NCode;
  int     Id;
  // USER START (Optionally insert additional variables)
  // USER END

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'Framewin'
    //
    hItem = pMsg->hWin;
    FRAMEWIN_SetText(hItem, "led Diyalog");
    FRAMEWIN_AddCloseButton(hItem, FRAMEWIN_BUTTON_RIGHT, 0);
    FRAMEWIN_AddMaxButton(hItem, FRAMEWIN_BUTTON_RIGHT, 0);
    FRAMEWIN_AddMinButton(hItem, FRAMEWIN_BUTTON_RIGHT, 2);
    //
    // Initialization of 'Checkbox'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_0);
    CHECKBOX_SetText(hItem, "led1");
    //
    // Initialization of 'Checkbox'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_1);
    CHECKBOX_SetText(hItem, "led2");
    //
    // Initialization of 'Edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
    EDIT_SetText(hItem, "123");
    // USER START (Optionally insert additional code for further widget initialization)
    // USER END
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_CHECKBOX_0: // Notifications sent by 'Checkbox'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
    	  ItemId=WM_GetDialogItem(pMsg->hWin,ID_CHECKBOX_0);
    	  				if(CHECKBOX_GetState(ItemId))
    	  				{
    	  						GPIOG->ODR|=1<<13;
    	  						CState0=1;
    	  				}
    	  				else
    	  				{
    	  					GPIOG->ODR&=~(1<<13);
    	  					CState0=0;
    	  				}
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_CHECKBOX_1: // Notifications sent by 'Checkbox'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
    	  ItemId=WM_GetDialogItem(pMsg->hWin,ID_CHECKBOX_1);
    	  				if(CHECKBOX_GetState(ItemId))
    	  				{
    	  						CState1=1;
    	  						GPIOG->ODR|=1<<14;
    	  				}
    	  				else
    	  				{
    	  					CState1=0;
    	  					GPIOG->ODR&=~(1<<14);
    	  				}
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_0: // Notifications sent by 'close'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:

    	  //CreateGPS();
    	  //GUI_EndDialog(pMsg->hWin,0);
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_SCROLLBAR_0: // Notifications sent by 'Scrollbar'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_0: // Notifications sent by 'Edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_SCROLLBAR_1: // Notifications sent by 'Scrollbar'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;
  // USER START (Optionally insert additional message handling)
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       CreateFramewin
*/

WM_HWIN CreateFramewin(void);
WM_HWIN CreateFramewin(void) {
  WM_HWIN hWin;

  hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);

  return hWin;
}

// USER START (Optionally insert additional public code)
// USER END

/*************************** End of file ****************************/


yamak

Hocam bayram tatilinde olduğum için internete giremedim.
Proje dosyasını gönderdiğinizde inceleyeyim.Belki gözünüzden kaçırdığınız bir yer vardır.

Mucit23

Hocam selamlar.  GUI konusunda sormak istediğim birşey var.

DMA2D sayesinde LCD de iki adet Layer var. Bu layer'leri ayrı ayrı kullanabiliyorduk değilmi. Daha önce GUI olmadan iki katmanıda ayrı ayrı kontrol edebiliyordum. Yani iki katmanda yaptığım değişiklikler ekrana yansıyordu. Fakat GUI'de Layer0'ı bir türlü ekranda görüntüleyemedim.

Örneğin Layer0'ı seçiyorum, ardından BackGround Color'u kırmızı yapıyorum. Sonra GUI_Clear ile ekranı temizliyorum normalde ekran kırmızı olması gerekiyor ama olmuyor. Fakat Layer1 de böyle bir durum yok.

GUI olmadan az önce birkaç test yaptım.

   LCD_SetLayer(LCD_FOREGROUND_LAYER);
   LCD_Clear(LCD_COLOR_RED);
        LCD_SetLayer(LCD_BACKGROUND_LAYER);
   LCD_Clear(LCD_COLOR_BLUE);

Yukarıdaki komutlarla ekran mavi oluyor. Yani BackGround layer ekrana basılıyor. Sıralamayı değiştirirsem eğer yani aşağıdaki gibi
        LCD_SetLayer(LCD_BACKGROUND_LAYER);
   LCD_Clear(LCD_COLOR_BLUE);
   LCD_SetLayer(LCD_FOREGROUND_LAYER);
   LCD_Clear(LCD_COLOR_RED);

Ekran kırmızı olarak kalıyor. Buradan anlıyorumki bu sefer FOREGROUND üstte. Birde Transparanlığı deneyeyim dedim. Ufak bir ekleme ile aşağıdaki kodları denedim

        LCD_SetLayer(LCD_BACKGROUND_LAYER);
   LCD_Clear(LCD_COLOR_BLUE);
   LCD_SetLayer(LCD_FOREGROUND_LAYER);
   LCD_Clear(LCD_COLOR_RED);
   LCD_SetTransparency(127);

Ekran mor oldu. Yani FOREGROUND'un transparanlığını %50 yaptık. FOREGROUND kırmızı, BACKGROUND ise mavi olduğundan iki renk harmanlanmış oldu.
Bu işlemi tam ters yapıyorum. Yani BACKGROUND seçili iken transparanlığı ayarlıyorum

   LCD_SetLayer(LCD_FOREGROUND_LAYER);
   LCD_Clear(LCD_COLOR_RED);
        LCD_SetLayer(LCD_BACKGROUND_LAYER);
   LCD_Clear(LCD_COLOR_BLUE);
   LCD_SetTransparency(127);

Ekranın yine mor olması gerekir. Bu sefer BACKGROUND'un transparanlığını %50 yaptım. Ama olmuyor. Ekran tümüyle mavi olarak kaldı.

Sonuç olarak buradan anlıyorumki Transparanlık meselesi Sadece FOREGROUND için geçerli. BACKGROUND'da böyle bir seçenek yok. Burada hatam yok değilmi?

Herneyse burada GUI olmadan hem FOREGROUND, hemde BACKGROUND ekrana basılabiliyor. Bundan eminim ama GUI'de Layer 0'ı bir türlü ekranda görüntüleyemedim.

Sorun bundan kaynaklanabilirmi?