Ana Sayfa STM32F429 Discovery STM32F429 Discovery ile GUI Builder Kullanımı

STM32F429 Discovery ile GUI Builder Kullanımı

57 min read
20
0
9,449

Merhaba arkadaşlar.
Bu yazıda size GUI BUİLDER ile arayüz tasarlamayı anlatacağım.
Öncelikle gui builder dan bahsedelim. Gui builder segger firmasının emwin kütüphaneleri için geliştirdiği bir arayüz tasarlama programıdır. Ayrıntılı bilgi için:
buradan ziyaret edebilirsiniz.

St firmasının stm32f429 boardu için verdigi stsw-stm32138 dosyasını indirin. Dosya içinde
stsw-stm32138\STM32F429I-Discovery_FW_V1.0.1\Libraries\STemWinLibrary522_4x9i\Software dosya yolu içerisinde gui builder mevcuttur. Basit bir arayüze sahiptir. Üst tarafta widget ler bulunur. Toolbox gibide düşüne bilirsiniz. Her ekran çıktısının altında window veya framewin olmalıdır. Projemizde bir giriş ekranı ,yönlendirme ekranı ve işlem penceresi olmak üzere üç çıktı oluşturacağız Ve gui üzerinden butonlarla led kontrolü yapacağız.şunuda ayrıca belirtmek gerekirse işlemcimizin dma(Direct Memory Access) donanım özelliği vardır. Bu özellik bize işlemciye sıfır iş yüküyle lcd ekranı rahatça sürmemizi saglar. işlemci başka bir işle meşgul iken dma sürekli lcd yi yenileyerek degişiklikleri anında yansıtır. Tabi dma yı gui kütüphaneleri sürüyor. Buda gui nin ayrı bir güzelliği.

İlk olarak bir window alıyoruz. Sol taraftaki property kısmından xpos=0, ypos=0, xsize=240, ysize=320 backgrount color =00000000 yapıyoruz. Bir progbar , 3 tane text ve bir image alıyoruz. Burada image tıkladıgımızda property kısmının en altında bmp files’e tıklıyoruz. Ve bmp uzantılı resmimizi seçiyoruz. Herhangibi bir formattaki resmide format factory gibi programlarla bmp ye çevire bilirsiniz. Bu widget ler üzeine sag tıklayarak renk ve font ayarlarını istediğiniz gibi yapabilirsiniz. Düzenlemeleri yapınca şu görüntüyü alması lazım:
roboturka

Save yapıyoruz. Burada dikkat etmek gereken bu ekranınız window widget’inize verdiğiniz isimle kayıtedilir. Kayıt yeri gui builderı açtığınız klasörün içindeki Guibuilder.ini dosyasında yazılı dosya yoludur. Kayıt yerini buradan degiştirebilirsiniz
Şimdi gui builder’ı kapatıyoruz. Program çok profesyonel olmadığı için birden fazla pencere aldıgımızda çalışmayı durduruyor. Kaydetmemişseniz sıkıntı yaşayabilirsiniz. Builderi Yeniden açıyoruz.
Window alıyoruz. Yine property ayarlarını yapıyoruz. Window un üzerine bir button ve text yerleştiriyoruz. Yine sağ tıklayıp arka plan rengini istediğiniz gibi değiştirebilirsiniz.
Çıktı şu şekilde olacaktır:
window
Bu nuda kaydedip kapatıyoruz. Yeniden builder açıp bu sefer led butoları için bir diyalog penceresi oluşturmamız gerekiyor. Bir framewin alıyoruz. Framewin in üzerine 2 checkbox ve bir buton yerleştiriyoruz. Ekran çıktısı:
led diyalog
Bu çalışmayıda kayıt ettikten sonra işin eğlenceli tarafı bitiyor. Şimdi Gui builderın bize verdiği c kodlarında düzenlemeler yapmalıyız. coocox ta oluşturdugunuz projeye bu 3 çıktıyı ekliyoruz. Ayrıca bu kodların çalışa bilmesi için gui kütüpanelerine ve widget kütüphanelerini eklemeniz gerekiyor.
icludes1includes2includes3
Yazının sonunda kaynak kodlara ulaşabilirsiniz. Burada en önemli şey kütüpanelerin çakışmamasıdır. örnegin gui içinde tanımlı olan lcd fonksiyonları vardır. Siz ayrıca başka bir lcd kütüpanesi eklerseniz sistem hatası verecektir. Bütün eklemeleri yaptıktan sonra oluşturduğumuz giriş ekranının kodları açıp şu şekilde modifiye etmemiz gerekiyor:

[php]#include "DIALOG.h"
#define ID_WINDOW_0 (GUI_ID_USER + 0x00)
#define ID_TEXT_0 (GUI_ID_USER + 0x01)
#define ID_PROGBAR_0 (GUI_ID_USER + 0x02)
#define ID_IMAGE_0 (GUI_ID_USER + 0x03)
#define ID_TEXT_1 (GUI_ID_USER + 0x04)
#define ID_TEXT_2 (GUI_ID_USER + 0x05)

#define ID_IMAGE_0_IMAGE_0 0x00

static U8 _acImage_0[12098] = {
0x42, 0x4D, 0x36, 0xBD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x0 ,
/* resmin bmp kodları */ 0x3B, 0x36, 0x33, 0x3B, 0x36, 0x33, 0x3B, 0x36, 0x33, 0x3B, 0x36, 0x33,};

// USER START (<a id="_GPLITA_0" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#"><a id="_GPLITA_0" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#">Optionally<img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a><img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a> insert additional static data)
// USER END

/*********************************************************************
*
* _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
{ WINDOW_CreateIndirect, "loding", ID_WINDOW_0, 0, 0, 240, 320, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "GUI BUILDER", ID_TEXT_0, 16, 5, 212, 19, 0, 0x64, 0 },
{ PROGBAR_CreateIndirect, "Progbar", ID_PROGBAR_0, 4, 290, 230, 20, 0, 0x0, 0 },
{ IMAGE_CreateIndirect, "Image", ID_IMAGE_0, 45, 94, 145, 111, 0, 0, 0 },
{ TEXT_CreateIndirect, "STM32F429", ID_TEXT_1, 46, 38, 138, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "sistem dosyalari yükleniyor…", ID_TEXT_2, 7, 267, 208, 20, 0, 0x0, 0 },
// USER START (<a id="_GPLITA_1" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#"><a id="_GPLITA_1" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#">Optionally<img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a><img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a> insert additional widgets)
// USER END
};

/*********************************************************************
*
* Static code
*
**********************************************************************
*/
/*********************************************************************
*
* _GetImageById
*/
static const void * _GetImageById(U32 Id, U32 * pSize) {
switch (Id) {
case ID_IMAGE_0_IMAGE_0:
*pSize = sizeof(_acImage_0);
return (const void *)_acImage_0;
}
return NULL;
}

// USER START (<a id="_GPLITA_2" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#"><a id="_GPLITA_2" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#">Optionally<img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a><img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a> insert additional static code)
// USER END

/*********************************************************************
*
* _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
const void * pData;
WM_HWIN hItem;
U32 FileSize;
// USER START (<a id="_GPLITA_3" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#"><a id="_GPLITA_3" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#">Optionally<img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a><img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a> insert additional variables)
// USER END

switch (pMsg->MsgId) {
case WM_INIT_DIALOG:
//
// Initialization of ‘loding’
//
hItem = pMsg->hWin;
WINDOW_SetBkColor(hItem, 0x00000000);
//
// Initialization of ‘YENI NESIL KARAYOLU ‘
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
TEXT_SetTextColor(hItem, 0x00008000);
TEXT_SetFont(hItem, GUI_FONT_20_1);
TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP);
//
// Initialization of ‘Image’
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_0);
pData = _GetImageById(ID_IMAGE_0_IMAGE_0, &FileSize);
IMAGE_SetBMP(hItem, pData, FileSize);
//
// Initialization of ‘TAKIP SISTEMI’
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
TEXT_SetTextColor(hItem, 0x00008000);
TEXT_SetFont(hItem, GUI_FONT_20_1);
//
// Initialization of ‘sistem dosyalari yükleniyor…’
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2);
TEXT_SetTextColor(hItem, 0x00008000);
// USER START (<a id="_GPLITA_4" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#"><a id="_GPLITA_4" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#">Optionally<img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a><img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a> insert additional code for further widget initialization)
// USER END
//*******************************************************************************//
/* aşagıdaki kodları normalde gui builder bize vermez. Bu kodlar progbar ı çalıştıra bilmemiz için gereklidir Ve bizim eklememiz gerekir.*/
int i;
PROGBAR_Handle ahProgBar[2];
ahProgBar[0] = PROGBAR_Create( 4, 290, 230, 20, WM_CF_SHOW);
PROGBAR_EnableMemdev(ahProgBar[0]);
PROGBAR_SetMinMax(ahProgBar[0], 0, 500);
PROGBAR_SetFont(ahProgBar[0], &GUI_Font8x16);
PROGBAR_SetBarColor(ahProgBar[0], 0, GUI_GREEN);
PROGBAR_SetBarColor(ahProgBar[0], 1, GUI_LIGHTGRAY);
GUI_Delay(500);

for (i=0; i<=500; i++) { // burada ise progbar degişkeni ni çeviriyoruz.
PROGBAR_SetValue(ahProgBar[0], i); //degişkeni yüzdekik olarak ilerlemesi için progbar a yolluyoruz

GUI_Delay(5);
}
//*************************************************************************//

break;
// USER START (Optionally insert additional message handling)
// USER END
default:
WM_DefaultProc(pMsg);
break;
}
}

/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* Createloding
*/
WM_HWIN Createloding(void);
WM_HWIN Createloding(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 ****************************/
[/php]

Şimdide 2. Oluşturdugumuz window kodlarını açıyoruz ve şu şekilde modifiye ediyoruz:

[php]
#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 (<a id="_GPLITA_5" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#">Optionally<img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a> insert additional defines)
// USER END

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

// USER START (<a id="_GPLITA_6" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#">Optionally<img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a> insert additional static data)
// USER END

/*********************************************************************
*
* _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, "giriş", ID_BUTTON_0, 72, 93, 80, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "led kontrol paneli", ID_TEXT_0, 33, 24, 158, 31, 0, 0x64, 0 },
// USER START (<a id="_GPLITA_7" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#">Optionally<img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a> insert additional widgets)
// USER END
};

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

// USER START (<a id="_GPLITA_8" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#">Optionally<img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a> insert additional static code)
// USER END

/*********************************************************************
*
* _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
WM_HWIN hItem;
int NCode;
int Id;
// USER START (<a id="_GPLITA_9" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#">Optionally<img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a> 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, "gui led kontrol");
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: //butona basıldı mı?
CreateFramewin(); //basıldı ise led diyalogu aç.
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) //bu fonksiyon ile pencereler arasında geçiş //yapabiliyoruz.
{
WM_SetCreateFlags(WM_CF_MEMDEV | WM_CF_CONST_OUTLINE);
GUI_Init();
Createloding(); //loding(framawin) diyalogunu ekrana basıyoruz.
GUI_Delay(1000);//ekran hareketleri tamamlana kadar bekliyoruz.
CreateWindow(); //küçük menü penceresini ekrana alıyoruz.

while(1) //gui olayını bitirmiyoruz. Çünki her an butona //basabiliriz.burada cpu boştadır. Dma ekranı yeniliyor.
{
GUI_Delay(100);
}
}
// USER START (Optionally insert additional public code)
// USER END

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

[/php]

Ve led diyalog yani framawin kodlarını modifiye ediyoruz.

[php]
#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_EDIT_0 (GUI_ID_USER + 0x12)

WM_HWIN ItemId;
unsigned int CState0,CState1;

// USER START (<a id="_GPLITA_10" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#">Optionally<img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a> insert additional defines)
WM_HWIN ItemId;
unsigned int CState0,CState1;
// USER END

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

// USER START (<a id="_GPLITA_11" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#">Optionally<img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a> 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 },
{ EDIT_CreateIndirect, "Edit", ID_EDIT_0, -147, 154, 80, 20, 0, 0x64, 0 },
// USER START (<a id="_GPLITA_12" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#">Optionally<img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a> insert additional widgets)
// USER END
};

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

// USER START (<a id="_GPLITA_13" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#">Optionally<img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a> insert additional static code)
// USER END

/*********************************************************************
*
* _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
WM_HWIN hItem;
int NCode;
int Id;
// USER START (<a id="_GPLITA_14" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;" title="Click to Continue > by WordProser" href="#">Optionally<img style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: super !important; width: 10px !important; background: transparent !important;" src="http://cdncache-a.akamaihd.net/items/it/img/arrow-10×10.png" alt="" /></a> 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: //checkbox işaretlendi mi?
ItemId=WM_GetDialogItem(pMsg->hWin,ID_CHECKBOX_0);
if(CHECKBOX_GetState(ItemId))//işaretlendi ise
{
GPIOG->ODR|=1<<13;//PG13 e //port ataması yap.
CState0=1; //giriş degeri 1.(led on)
}
else
{
GPIOG->ODR&=~(1<<13);//porta “0” gönder.
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: //checkbox1 işaretlimi.
ItemId=WM_GetDialogItem(pMsg->hWin,ID_CHECKBOX_1);
if(CHECKBOX_GetState(ItemId))
{
CState1=1; //PG14 e ‘1’ //dederibi ata
GPIOG->ODR|=1<<14;
}
else
{
CState1=0;
GPIOG->ODR&=~(1<<14);//PG14 e ‘0’ //degerini ata
}
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:// butona basıldı ise diyalogu kapat.

CreateWindow(); //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_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;
// 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 ****************************/

[/php]

Son olarak main.c dosyasında gerekli ayarları yapıyoruz.

[php]
#include "main.h"
#include "stm32_ub_stemwin.h"
#include "guidemo.h"
#include "dialog.h"
#include "stm32_ub_lcd_ili9341.h"
#include "stm32_ub_touch_stmpe811.h"
#include "stm32f4xx_dma2d.h"
#include "stm32f4xx_gpio.h"
#include "stm32_ub_led.h"
#include "stm32_ub_font.h"

void gpioInit(void)
{
RCC->AHB1ENR|=1<<6;
GPIOG->MODER|=1<<26|1<<28;
GPIOG->OTYPER|=0<<13|0<<14;
GPIOG->OSPEEDR|=3UL<<(26) | 3UL<<(28);
GPIOG->PUPDR|=2UL<<26 | 2UL<<28;
}
int main(void)
{

SystemInit();
UB_LCD_Init();
UB_STemWIN_init();
UB_Touch_Init();
__disable_irq();
UB_Led_Init();
__enable_irq();

SysTick_Config(SystemCoreClock / 1000); //çalışma frekansımızı ayarlıyoruz.

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_CRC, ENABLE);// registerleri okumak ve yazmak için gereli olan saat sintali aktif.
MainTask();
for(;;);
}
[/php]

Kaynak kodlara buradan ulaşabilirsiniz:

Uygulamanın çalışma videosu:

 

Buna Benzer Yazılar Göster !
Daha Fazlasını Yükle - Konuk Yazar
Daha Fazla Göster -  STM32F429 Discovery

20 Yorumlar

  1. emrah

    7 Mart 2015 at 15:06

    Merhabalar,

    Bu GUI uygulamasında GUI builderdan aldığımız kodlarda yapılacak modifikasyonlar nelerdir? Çünkü bendeki kod ile sizin modifiye ettiğiniz kod arasındaki farkı bulamadım? Teşekkür ederim

    Reply

    • Abdullah Keskin

      7 Mart 2015 at 15:27

      merhabalar.
      ilk kod blogunun 100. satırına bakarsanız orada progbarla ilgi fonksiyon eklemişiz. 2. kod bolgunda 86. satıra bakarsamız WM_NOTIFICATION_CLICKED: gösteriminin altında create_Framewin fonksiyonu var. butona basılında framewini açmak için. 3. kod blogununda 113. ve 140. satırlarında led ler için atama yapmışız. kolay gelsin. iyi çalışmalar…

      Reply

      • emrah

        7 Mart 2015 at 15:53

        Teşekkür ederim 🙂

        Reply

  2. fab

    25 Mart 2015 at 02:19

    Where is the toolchain path?

    Reply

    • Yücel Yılmaz

      Yücel Yılmaz

      28 Mart 2015 at 12:39

      Hello fab, what do you mean of toolchain path? Do you want project files ? You can find here https://yadi.sk/d/Z1VCBrdzerRQB and if you want something different,you can write again,don’t hesitate.

      Reply

  3. İsmail

    8 Nisan 2015 at 12:14

    Hocam elinize sağlık,çok güzel bir çalışma olmuş.Programın hex dosyasını borda yükledim ve çalıştırdım.Yalnız indirdiğim programı coocox da derleyemedim ,sürekli eksik dosya var diyor.Bu konuda yardımınızı rica ediyorum.Başarılar.

    Reply

  4. fab

    16 Nisan 2015 at 03:19

    hello there!
    How do you change the framwin background with GUI Builder? I know how to change the window’s background but it’s does’nt work with the framewin’s background

    Reply

    • Selim MERİÇ

      28 Mayıs 2015 at 22:44

      maybe there are another solution but put a image to bottom of layers (I think it must be Layers 0 )..

      Reply

  5. Mert EROL

    17 Haziran 2015 at 14:02

    Sizden bir isteğim olacaktı. Kütüphane yükleme konusunda hep sıkıntı yaşıyorum. Bununla alakalı bir proje yapabilir misiniz? Hangi Kütüphane ne için, nasıl yüklenir gibi gibi…İlginiz için çok teşekkür ederim. İyi günler.

    Reply

    • Bilal Kaya

      17 Haziran 2015 at 14:20

      Merhabalar,
      İlk önce ilginiz için teşekkürler.Siteyi takip eden arkadaşlarımızın çoğundan istekler alıyoruz.Bu isteklerin hepsini belki ilk etapta gerçekleştiremiyoruz.Bunun için üzgünüz.Ama isteğinizi dikkate almaya çalışcağız.Yine projelerle ilgili sorularınızı yorum olarak sorabilirsiniz.
      İyi çalışmalar diliyoruz.

      Reply

  6. Volkan Ünal

    22 Temmuz 2015 at 14:23

    Merhabalar , uygulama dosyasını indirerek derledim , çalışıyor herhangi bir sıkıntı yok.Ancak coocoxta projeyi oluştururken emwin dosylarını göremiyorum , bunları siz oluşturduğunuz klasörden mi ekliyorsunuz.Ayrıca sizin bu kullandığınız dosyayı template olarak kullanabiliyorum değil mi, her tasarımdan sonra da sadece oraya ekleyerek sıkıntısız kullanabilir mi? bir de hesap makinası yapmaya çalışıyorum.Tam beceremedim.

    Reply

  7. Volkan Ünal

    22 Temmuz 2015 at 15:46

    Uygulamayı kendi dosyamı ekledikten sonra maintaskta hata veriyor.Onu kontrol eden fonksiyonu düzeltmeme rağmen çalışmadı , siyah ekran geliyor tft de sadece

    Reply

  8. Abdullah Keskin

    23 Temmuz 2015 at 07:41

    merhabalar. öncelikle emwin dosyaları ub_lib\emWin_demo yolunda tanımlıdır.sıkıntısız kullanabilirsiniz. her yeni tasarımınızda sadece emwin doslarını create olarak düzenlemeniz yeterli. MainTask için ise dosyalarınızı ekledikten sonra MainTask fonksiyonunun birtane oldugundan emin olun ve eski emwin dosyaları ile alakalı fonksiyonların MainTask içinde yer almamasına dikkat edin.

    Reply

  9. Volkan Ünal

    23 Temmuz 2015 at 09:28

    Hallettim teşekkürler

    Reply

  10. wildan

    16 Kasım 2015 at 18:14

    can I change English?

    Reply

  11. Mustafa

    3 Nisan 2016 at 08:37

    Hocam Selam,

    GUI Builder kullanarak menüleri hazırladım. Ana ekranda malum bazı veriler görünecek. Ana ekrana çizim yapamıyorum veya form üzerine yazı yazamıyorum. Bunun için ne yapmam gerekiyor. EmWin dökümanını da okudum ama yinede sorunu çözemedim. Bu adımı geçersem haraketli bir akış yapmam gerekiyor.

    İyi çalışmalar.
    Mustafa.

    Reply

  12. HİLMİ OMÜ

    23 Ağustos 2018 at 09:08

    coocox ide yikuramıyorum siteye giriş yapılamıyo ne yapmam gerekiyor acaba

    Reply

  13. Burak

    14 Kasım 2019 at 16:27

    Hocam, öncelikle elinize sağlık. Bir ricam olacaktı. İnternette GUI oluşturmayla ilgili sayısız video var. Ama bu oluşturulan GUI’nin entegre edileceği proje dosyasını oluşturan 1 tane video yok. Bütün videolarda GUI’yi oluşturup daha önce oluşturulmuş proje dosyasına atılıyor. Bu GUI dosyalarını rahatlıkla atacağımız proje dosyasını nasıl oluşturacağımız konusunda yardımcı olur musunuz ? Valla bol bol dua ederim. Kafayı yiyeceğim artık şu lanet olası ekrana 1 tane yazı yazamadım. Kütüphane ekliyorum derlemiyor hata veriyor. GUI tasarlıyorum hangi proje dosyasına nasıl atacağım bilmiyorum.

    Reply

İsmail için bir cevap yazın Cevabı iptal et

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Bak Bakalım ?

Lazer İşleme Makinesi Yapımı

Merhaba arkadaşlar,bu projemizde sizlerle birlikte lazer işleme makinesi yapımını göreceği…