野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 5928|回复: 2

[ucos] 【求助】GPS裸机程序移植进ucos iii

[复制链接]
发表于 2017-5-5 11:17:00 | 显示全部楼层 |阅读模式
将GPS裸机程序移植进ucos iii回不到主窗口,也不显示信息
/**************************************************************************************
* 因为emWin显示只支持UTF-8编码格式的中文,如果希望直接显示在Keil直接输入的中文,      *
*            比如使用:GUI_DispStringHCenterAt("流水灯",110,120);                     *
* 该文件必须以UTF-8编码格式,不然中文无法正常显示。                                   *
*                                                                                     *
* 如果只是个别例程出现中文显示乱码(如果所有例程都无法显示中文可能是字库问题),      *
* 把对应的例程文件(比如LEDapp.c)用电脑的记事本软件打开,然后选择另存为,在弹出对      *
* 话框中“保存(S)"按钮的左边有个"编码(E)"选项,选择"UTF-8",然后同样保存为同名称的      *
* C语言文件(覆盖原来文件),再编译。                                                   *
*                                                                                     *
* 如果编译工程时出现下面类似错误也是该文件编码格式问题,必须把文件保存为UTF-8格式      *
* 再编译                                                                              *
* ..\..\User\app\LEDapp.c(275): error:  #8: missing closing quote                     *
*        GUI_DispStringHCenterAt("娴?姘?鐏?",110,120);                                *
* ..\..\User\app\LEDapp.c(276): error:  #165: too few arguments in function call      *
*        GUI_DispStringHCenterAt("瑙?鎽?鍋?宸?澶?鎵?闇
回复

使用道具 举报

 楼主| 发表于 2017-5-5 11:17:32 | 显示全部楼层
#include "includes.h"
#include  "app.h"
#include "stm32f10x.h"
#include "bsp_sdio_sdcard.h"
#include "bsp_usart1.h"       
#include "bsp_usart2.h"
#include "ff.h"
#include "nmea.h"
#include "gps_config.h"
#include "GUI.h"
// USER END

/*********************************************************************
*
*       Defines
*
**********************************************************************
*/
// USER START (Optionally insert additional defines)
// USER END

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

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

/*********************************************************************
*
*       _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreateUSER[] = {
  { FRAMEWIN_CreateIndirect, "UserApp", 0, 0, 0, 240, 320, 0, 0x64, 0 },
  // USER START (Optionally insert additional widgets)
  // USER END
};

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

// USER START (Optionally insert additional static code)

// USER END

/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialogUSER(WM_MESSAGE * pMsg)
{
                WM_HWIN hItem;

                switch (pMsg->MsgId)
                {
                        case WM_DELETE:
                                OS_INFO("USERapp delete\n");
                                Flag_ICON102 = 0;
                                UserApp_Flag = 0;
                                tpad_flag=0;
                        break;
                       
                       
                        case WM_INIT_DIALOG:
                               
                                hItem = pMsg->hWin;
                                FRAMEWIN_SetTextColor(hItem,GUI_DARKGRAY);
                                FRAMEWIN_SetFont(hItem, GUI_FONT_16B_ASCII);
                                FRAMEWIN_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER);
                                FRAMEWIN_AddCloseButton(hItem,FRAMEWIN_BUTTON_RIGHT,0);
                                FRAMEWIN_SetTitleHeight(hItem, 20);
                       
                       
                        break;
                       
                       

                        case WM_PAINT:       
                               
  
                                // 给屏幕刷上背景颜色 //
                                GUI_SetBkColor(GUI_BLACK);
                       
                                // 设置字体格式 //
                                GUI_SetFont(&GUI_Font8x16);
                               
                                // 设置前景颜色(字体颜色)//
                                GUI_SetColor(GUI_RED);
                       
                                GUI_DispStringAt (" Wildfire STM32-ISO",40,30);
                       
                                GUI_DispStringAt (" WF-NEO-6M GPS module",30,50);
                                               
                        break;

                               
                        default:
                                WM_DefaultProc(pMsg);
                        break;
                }
}







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



/*********************************************************************
*
*       CreateUSB TEST
*/
void FUN_ICON102Clicked(void)
{
        WM_HWIN hWin;
        nmeaINFO info;          //GPS解码后得到的信息
        nmeaPARSER parser;      //解码时使用的数据结构  
        uint8_t new_parse=0;    //是否有新的解码数据标志
        nmeaTIME beiJingTime;    //北京时间
        char str_buff[100];
        uint8_t timecount=0;
        OS_INFO("USERapp create\n");
        hWin=GUI_CreateDialogBox(_aDialogCreateUSER, GUI_COUNTOF(_aDialogCreateUSER), _cbDialogUSER, WM_HBKWIN, 0, 0);
        timecount=0;
       
        // 初始化定时器 //
//        SysTick_Init();
               
        //CRC和emWin没有关系,只是他们为了库的保护而做的,这样STemWin的库只能用在ST的芯片上面,别的芯片是无法使用的。 //
//  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE);
                  

       
       
        while(Flag_ICON102)
        {
                                        // 初始化GPS模块使用的接口 //
                       
                //        GUI_Delay (20);
                if(GPS_Config()==0)
                {
                        while(1)
                        {                       
                                if(tpad_flag)WM_DeleteWindow(hWin);
                                GUI_Delay(10);
                        }
                }                       

                if(timecount>100)
                {
                                // 初始化GPS模块使用的接口 //
                               
                                if(GPS_HalfTransferEnd)     /* 接收到GPS_RBUFF_SIZE一半的数据 */
                                {
                                        /* 进行nmea格式解码 */
                                        nmea_parse(&parser, (const char*)&gps_rbuff[0], HALF_GPS_RBUFF_SIZE, &info);
                                       
                                        GPS_HalfTransferEnd = 0;   //清空标志位
                                        new_parse = 1;             //设置解码消息标志
                                }
                                else if(GPS_TransferEnd)    /* 接收到另一半数据 */
                                {

                                        nmea_parse(&parser, (const char*)&gps_rbuff[HALF_GPS_RBUFF_SIZE], HALF_GPS_RBUFF_SIZE, &info);
                                 
                                        GPS_TransferEnd = 0;
                                        new_parse =1;
                                }
                               
                                if(new_parse )                //有新的解码消息   
                                {   
                                        // 对解码后的时间进行转换,转换成北京时间 //
                                        GMTconvert(&info.utc,&beiJingTime,8,1);
                                                                               
                                        // 液晶输出 //
                                       
                                        // 设置前景颜色(字体颜色)//
                                        GUI_SetColor(GUI_BLUE);
                                       
                                        GUI_DispStringAt (" GPS Info:",0,80);

                                        // 设置前景颜色(字体颜色)//
                                        GUI_SetColor(GUI_WHITE);
                                       
                                        // 显示时间日期 //
                                        sprintf(str_buff," Date:%d/%d/%d Time:%d:%d:%d", beiJingTime.year+1900, beiJingTime.mon+1,beiJingTime.day,beiJingTime.hour,beiJingTime.min,beiJingTime.sec);
                                        GUI_DispStringAt (str_buff,0,100);
                               
                                        // 纬度 经度//
                                        sprintf(str_buff," latitude :%f \r\n longitude :%f", info.lat,info.lon);
                                        GUI_DispStringAt (str_buff,0,120);
                                       
                                        // 正在使用的卫星 可见的卫星//
                                        sprintf(str_buff," Satellite in use :%d \r\n Satellite in view :%d", info.satinfo.inuse,info.satinfo.inview);
                                        GUI_DispStringAt (str_buff,0,160);
                                       
                                        // 海拔高度 //
                                        sprintf(str_buff," Altitude:%f m", info.elv);
                                        GUI_DispStringAt (str_buff,0,200);
                                       
                                        // 速度 //
                                        sprintf(str_buff," speed:%f km/h", info.speed);
                                        GUI_DispStringAt (str_buff,0,220);
                                       
                                        // 航向 //
                                        sprintf(str_buff," Track angle:%f deg", info.direction);
                                        GUI_DispStringAt (str_buff,0,240);
                                       
                                                                 
                                        new_parse = 0;
                                }                       
                }
                timecount++;
               
                if(tpad_flag)WM_DeleteWindow(hWin);
    GUI_Delay(10);                                
        }
}

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

/*************************** End of file ****************************/
回复 支持 反对

使用道具 举报

发表于 2017-5-5 13:42:44 | 显示全部楼层
有些文件修改后要存储回utf8格式
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-5-9 03:41 , Processed in 0.030873 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表