STM32F429 Discovery STM32F429 Discovery ile GUI Builder Kullanımı By Konuk Yazar Posted on 23 Şubat 2015 57 min read 20 0 9,476 Paylaş ! Facebook Paylaş ! Twitter Paylaş ! Google+ Paylaş ! Reddit Paylaş ! Pinterest Paylaş ! Linkedin Paylaş ! Tumblr 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: 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: 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ı: 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. 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: