Herkese Merhaba kit üzerinde ki Lcd ekranı nasıl kullanabilirim diye araştırma yaparken Ferhat arkadaşımız STemWin hazırladığı yazıya rastladım.http://arectron.com/arm/stm32f429i-discoveryde-keil-ile-stemwin-kurulumu.html (http://arectron.com/arm/stm32f429i-discoveryde-keil-ile-stemwin-kurulumu.html) paylaşımı için kendisine teşekkür ederim.
Sitede verilen proje dosyalarını buradan https://yadi.sk/d/Tf3JiBVPhrrMj (https://yadi.sk/d/Tf3JiBVPhrrMj)indirebilirsiniz.Ben hazır proje dosyalarını kullandım.Sadece "main.c" ve Gui builderin otomatik olarak oluşturduğu " WindowDLG"dosyasında değişiklik yaptım.
Yandex üzerinden proje dosyaları indikten sonra GUIBuilder klasöründeki
1- GUIBuilder.ini yapılandırma dosyasını silip ve gui builder programını açıyoruz.
2- Program arayüzünden window penceresine tıklıyoruz. (https://s30.postimg.cc/u9aplesgd/GUI.gif) (https://postimg.cc/image/u9aplesgd/)
3-Gui builderin oluşturduğu "WindowDLG.c" dosyasını aşağıdaki gibi modifiye ediyoruz./*********************************************************************
* *
* SEGGER Microcontroller GmbH & Co. KG *
* Solutions for real time microcontroller applications *
* *
**********************************************************************
* *
* C-file generated by: *
* *
* GUI_Builder for emWin version 5.22 *
* Compiled Jul 4 2013, 15:16:01 *
* (c) 2013 Segger Microcontroller GmbH & Co. KG *
* *
**********************************************************************
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
*/
// USER START (Optionally insert additional includes)
// USER END
#include "stm32f4xx.h" // Device header
#include "DIALOG.h"
#include "main.h"
#include "transceiver_internal.h"
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
#define ID_WINDOW_0 (GUI_ID_USER + 0x00)
#define ID_PROGBAR_0 (GUI_ID_USER + 0x01)
#define ID_BUTTON_0 (GUI_ID_USER + 0x05)
#define ID_BUTTON_1 (GUI_ID_USER + 0x06)
// USER START (Optionally insert additional defines)
// USER END
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
// USER START (Optionally insert additional static data)
unsigned short a =1,b =1;
// USER END
/*********************************************************************
*
* _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
{ WINDOW_CreateIndirect, "Window", ID_WINDOW_0, -2, -2, 240, 320, 0, 0x0, 0 },
{ PROGBAR_CreateIndirect, "Progbar", ID_PROGBAR_0, 10, 35, 217, 45, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "AZALT", ID_BUTTON_0, 137, 182, 80, 66, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "ARTIR", ID_BUTTON_1, 26, 183, 80, 66, 0, 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 'Window'
//
hItem = pMsg->hWin;
WINDOW_SetBkColor(hItem, 0x00FFFF00);
//
// Initialization of 'Progbar'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_PROGBAR_0);
PROGBAR_SetFont(hItem, GUI_FONT_8X9);
//
// Initialization of 'AZALT'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
BUTTON_SetFont(hItem, GUI_FONT_13B_ASCII);
//
// Initialization of 'ARTIR'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
BUTTON_SetFont(hItem, GUI_FONT_13B_ASCII);
// 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 'AZALT'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
if(a>1 && b>1 )
{
a = a-200;
b = b-200;
}
// USER END
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_BUTTON_1: // Notifications sent by 'ARTIR'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
if(a<10000 && b<10000 )
{
a= a+200;
b= b+200;
}
// USER END
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;
}
}
unsigned char sayac = 0;
void TIM7_IRQHandler()
{
switch (sayac)
{
case STATE_IS_0:
{
TIM7->SR = 0;
TIM_SetAutoreload(TIM7,a);
GPIOG->ODR |= (1<<13);
GPIOG->ODR |= (1<<14);
sayac = STATE_IS_1;
}
break;
case STATE_IS_1:
{
TIM7->SR = 0;
TIM_SetAutoreload(TIM7,b);
GPIOG->ODR &= ~(1<<13);
GPIOG->ODR &= ~(1<<14);
sayac = STATE_IS_0;
}
break;
default:
break;
}
}
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;
}
// USER START (Optionally insert additional public code)
PROGBAR_Handle hProg;
WM_HWIN hWin1;
// USER START (Optionally insert additional public code)
void MainTask(void);
void MainTask(void)
{
WM_SetCreateFlags(WM_CF_MEMDEV | WM_CF_CONST_OUTLINE);
GUI_Init();
CreateWindow();
GUI_CURSOR_Show();
PROGBAR_SetDefaultSkin(PROGBAR_SKIN_FLEX);
hWin1 = CreateWindow();
hProg = WM_GetDialogItem(hWin1, ID_PROGBAR_0);
PROGBAR_SetValue(hProg, 0);
PROGBAR_SetMinMax(hProg, 0, 10000);
while(1)
{
GUI_Delay(10);
PROGBAR_SetValue(hProg, a);
}
}
/*************************** End of file ****************************/
4- main.c dosyasınıda bu şekilde değiştiriyoruz. /**
******************************************************************************
* @file Template/main.c
* @author MCD Application Team
* @version V1.0.0
* @date 20-September-2013
* @brief Main program body
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f4xx.h" // Device header
/** @addtogroup Template
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
uint8_t GUI_Initialized = 1;
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/**
* @brief Display Init (LCD)
* @param None
* @retval None
*/
/**
* @brief Main program
* @param None
* @retval None
*/
void gpio_init()
{
RCC->APB1ENR|=0x00000020;
RCC->AHB1ENR |= 0x0000007F;
GPIOG->MODER = 0x14000000;
GPIOG->OSPEEDR= 0xFFFFFFFF;
TIM7->CR1=0x0080;
TIM7->PSC =4200-1;
//TIM7->ARR =1000;
TIM7->DIER=0x0001;
NVIC->ISER[1] = 0X00800000;
TIM7->CR1|=0x0001;
}
int main(void)
{
gpio_init();
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
/* Initilize the BSP layer */
LowLevel_Init();
MainTask();
while (1)
{
}
}
/**
* @brief BSP_Background.
* @param None
* @retval None
*/
void BSP_Background (void)
{
static uint32_t POINTER_ticks = 0;
if ( POINTER_ticks++ >= 50 )
{
POINTER_ticks = 0;
/* Executed only for emWin demos, not for LTDC plain demos */
if(GUI_Initialized == 1)
{
/* Capture input event and updade cursor */
BSP_Pointer_Update();
}
}
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */
while (1)
{
}
}
#endif
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Timer7 ve Gpio registerlerini init ediyoruz.
5-Yandex inen hazır proje dosyasını main.c ve WindowDLG.c yukarda ki değiştiriyoruz.
6- User klasörüne "transceiver_internal" header dosyasını ekliyoruz.
#ifndef __TRANSCEIVER_INTERNAL_H
#define __TRANSCEIVER_INTERNAL_H
enum{
STATE_IS_0,
STATE_IS_1,
};
#endif
7- Proje dosyası 1.8.0 kütüphanesi ile hazırlanmış.Proje dosyasını açınca Keil direk güncelleme yapıyor.Güncellemeden çıkıp
Options for Target Device den STM32F429ZI seçiyoruz. Target kısmında kristal hızını 8.0 MHz yapıyoruz.
Debug Flash Dowloand sekmesinden resimdeki ayarı yaptıktan sonra derleme işlemine geçiyoruz.
(https://s30.postimg.cc/4k4o5azrh/Option_for_Target.gif) (https://postimg.cc/image/4k4o5azrh/)
Uygulama videosu:
https://www.youtube.com/watch?v=fMnAbh8wvAM (https://www.youtube.com/watch?v=fMnAbh8wvAM)
Proje dosyası link:
https://yadi.sk/d/Nr2RUAL3349qbc (https://yadi.sk/d/Nr2RUAL3349qbc)
Hocam ellerinize saglik