初级会员

- 积分
- 68
- 金钱
- 68
- 注册时间
- 2014-7-11
- 在线时间
- 0 小时
|
发表于 2014-7-26 17:15:40
|
显示全部楼层
回复【4楼】xiaomengyichen:
---------------------------------
大师!我下载你的程序到我的mini板上,花屏,不好使,是程序问题么 谢谢
我移植了一下,按照您的设置步骤,就是现实一个按钮,结果就不行,只要调用GUI_TOUCH_Exec就黑屏,连按钮对话框显示都不行了,我在GUI_TOUCH_Exec中读取转换后的坐标,可以在串口中打印出来,困扰好多天了,求解,不胜感激
下边时我的主函数部分
tatic const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
{ FRAMEWIN_CreateIndirect, "TCR", 0, 0, 0, 311,225,FRAMEWIN_CF_MOVEABLE,0},
{ BUTTON_CreateIndirect, "OK", GUI_ID_OK, 100,78, 80, 37, 0,0},
{ TEXT_CreateIndirect, "zcx", GUI_ID_TEXT0, 61, 138,149,27, 0,0}
};
/*****************************************************************
** FunctionName:void  aintDialog(WM_MESSAGE * pMsg)
** Function: to initialize the Dialog items
**
** call this function in _cbCallback --> WM_PAINT
*****************************************************************/
void  aintDialog(WM_MESSAGE * pMsg)
{
WM_HWIN hWin = pMsg->hWin;
}
/*****************************************************************
** FunctionName:void InitDialog(WM_MESSAGE * pMsg)
** Function: to initialize the Dialog items
**
** call this function in _cbCallback --> WM_INIT_DIALOG
*****************************************************************/
void InitDialog(WM_MESSAGE * pMsg)
{
WM_HWIN hWin = pMsg->hWin;
//
//FRAMEWIN
//
FRAMEWIN_SetTextColor(hWin,0x0000ff);
FRAMEWIN_AddCloseButton(hWin, FRAMEWIN_BUTTON_RIGHT, 0);
FRAMEWIN_AddMaxButton(hWin, FRAMEWIN_BUTTON_RIGHT, 1);
FRAMEWIN_AddMinButton(hWin, FRAMEWIN_BUTTON_RIGHT, 2);
//
//GUI_ID_BUTTON0
//
BUTTON_SetTextColor(WM_GetDialogItem(hWin,GUI_ID_OK),BUTTON_CI_UNPRESSED,0x0000ff);
//
//GUI_ID_TEXT0
//
TEXT_SetTextColor(WM_GetDialogItem(hWin,GUI_ID_TEXT0),0x0000ff);
TEXT_SetTextAlign(WM_GetDialogItem(hWin,GUI_ID_TEXT0),GUI_TA_VCENTER|GUI_TA_CENTER);
}
/*********************************************************************
*
* Dialog callback routine
*/
static void _cbCallback(WM_MESSAGE * pMsg)
{
int NCode, Id;
WM_HWIN hWin = pMsg->hWin;
switch (pMsg->MsgId)
{
case WM_PAINT:
  aintDialog(pMsg);
break;
case WM_INIT_DIALOG:
InitDialog(pMsg);
break;
case WM_KEY:
switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key)
{
case GUI_KEY_ESCAPE:
GUI_EndDialog(hWin, 1);
break;
case GUI_KEY_ENTER:
GUI_EndDialog(hWin, 0);
break;
}
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch (Id)
{
case GUI_ID_OK:
if(NCode==WM_NOTIFICATION_RELEASED)
GUI_EndDialog(hWin, 0);
break;
case GUI_ID_CANCEL:
if(NCode==WM_NOTIFICATION_RELEASED)
GUI_EndDialog(hWin, 0);
break;
}
break;
default:
WM_DefaultProc(pMsg);
}
}
int main(void)
{
u16 cnt=0;
WM_HWIN hWin_son_A, hWin_son_B;
//GUI_MEMDEV_Handle hMem=GUI_MEMDEV_Create(0,0,319,239);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_AFIO,ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);
USART1_GPIO_Config();
USART1_Config();
NVIC_Config();
GPIO_SetBits(GPIOA,GPIO_Pin_2);//设置LED的PA2为1
Time2_Init();//定时器2初始化
ADS7843_Init();//触摸初始化
Wait_Delay(4000000);
GUI_Init(); //LCD及GUI初始化
GUI_CURSOR_Show();
WM_SetDesktopColor(GUI_WHITE); /* Automacally update desktop window */
GUI_DispStringAt("Made By CMD!",10,10);
//WM_SetCreateFlags(WM_CF_MEMDEV); /* Use memory devices on all windows to avoid flicker */
GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbCallback, 0, 0, 0);
/* while(1)
{
Wait_Delay(4000000);
GUI_TOUCH_Exec();
}
*/
}
定时器部分
void TIM2_IRQHandler(void) //TIM2中断服务函数
{
int i;
if(TIM_GetFlagStatus(TIM2,TIM_FLAG_Update)!=RESET)
{
TIM_ClearFlag(TIM2,TIM_FLAG_Update); //清标志
TIM_ClearITPendingBit(TIM2,TIM_IT_Update);//清除更新中断标志
GPIO_ResetBits(GPIOA,GPIO_Pin_3);//将LED3灯点亮
for(i=0;i<=800000;i++); //延时一会,不然看不到灯亮
GPIO_SetBits(GPIOA,GPIO_Pin_3);
//GUI_TOUCH_Exec();
}
} |
|