登录站点

用户名

密码

李现路:MTK开发中怎么建立一个独立的模块

已有 838 次阅读  2009-11-28 11:29   标签李现路  模块  MTK  开发 

李现路:MTK开发中怎么建立一个独立的模块   Post By:2009-11-24 10:03:16

 
李现路:MTK开发中怎么建立一个独立的模块

 

具体步骤如下:

1../plutommi/mmi 目录先建一个HelloWorld文件夹

文件夹下的子文件夹:Inc,Res,Src

2.在Inc文件夹中放四个头文件,四个头文件分别以xxxDefs.h,xxxGprot.h

xxxProt.h,xxxTypes.h来命名

 

3.xxxDefs.h--本模块用到的资源 ID的定义

  xxxGprot.h--本模块的对外接口,供模块外部调用的函数原型在此申明

  xxxProt.h---模块内部接口,供模块内部调用的函数原型在此申明

  xxxTypes.h--本模块用到的一些常量、自定义数据类型、结构的定义

 

4.在HelloWorld.c中定义开关(方便我们随时调用):

#ifdef __MMI_HELLOWORLD_ENABLED__ , 

  #endif

 完整版本请见http://www.51qianru.cn/bbs/        

 我们建立的文件夹里,所有头文件和源文件的内容如下:

 

          头文件 HelloWorldGprot.h 的内容如下:

/*************************************************************************/

#ifndef __HELLOWORLD_GPROT_H__

#define __HELLOWORLD_GPROT_H__

#include "PixtelDataTypes.h"

#include "HelloWorldTypes.h"

extern void mmi_HelloWorld_entry(void);

#endif

/*************************************************************************/

 

头文件 HelloWorldProt.h 的内容的如下:

/*************************************************************************/

#ifndef __HELLOWORLD_GPROT_H__

#define __HELLOWORLD_GPROT_H__

#include "PixtelDataTypes.h"

#include "HelloWorldTypes.h"

extern void mmi_HelloWorld_entry(void);

#endif

/*************************************************************************/

HelloWorldTypes.h, HelloWorldDefs.h 两个头文件的内容为空即可,但是一定要建立文

件,否则后面编译会出错。

HelloWorld.c 的内容如下:

/*************************************************************************/

#include "stdC.h"

#include "MMI_Features.h"

#include "L4Dr.h"

#include "L4Dr1.h"

#include "AllAppGprot.h"

#include "FrameworkStruct.h"

#include "GlobalConstants.h"

#include "EventsGprot.h"

#include "mmiappfnptrs.h"

#include "HistoryGprot.h"

#include "HelloWorldProt.h"

#include "HelloWorldTypes.h"

#include "HelloWorldDefs.h"

#include "MainMenuDef.h"

#include "wgui_categories.h"

#include "Unicodexdcl.h"

void mmi_HelloWorld_exit(void);

void mmi_HelloWorld_entry(void)

{

#ifdef __MMI_HELLOWORLD_ENABLED__

/* 强制退出当前屏幕,之后进入到我们的模块了 */

/* 上电缺省是idle 屏幕,现进入MAIN_MENU_SCREENID 屏 */

/* 注意看第二个参数,这个是当我们模块被强制退出时执行的一些操作 */

EntryNewScreen(MAIN_MENU_SCREENID, mmi_HelloWorld_exit, NULL, NULL);

entry_full_screen(); /* 关掉屏幕顶部的状态条,我们要用整个屏幕 */

clear_screen(); /* 擦除当前背景 */

gui_move_text_cursor(50, 100); /* 移动文本输出光标 */

gui_set_text_color(UI_COLOR_RED); /* 设置字体颜色 */

gui_print_text(L"Hello, World"); /* 输出文本到显示缓冲, 注意是Unicode 编码 */

/* 刷新屏幕显示,MMI 用的是双缓冲绘图方式,而且需要显式刷新 */

gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);

/* 注册一个按键处理,右软键弹起时返回到之前被我们强制退出的模块 */

SetKeyHandler(GoBackHistory, KEY_RSK, KEY_EVENT_UP);

#endif

}

/* 模块出口

* 当我们的模块被其他模块强制退出时会执行这个函数,

* 这个函数的常见写法,包括:

* 1、模块已申请资源的释放(如果需要的话),这一步可选

* 2、手动把自己压栈到窗口(实际是整个屏)堆栈里面,

* 便于强制我们退出的模块执行完后重新把我们叫出来

* 不像Window 的窗口管理是自动压栈的,Pluto MMI 需要手动压栈

* 3、其他一些清理动作

*/

void mmi_HelloWorld_exit(void)

{

#ifdef __MMI_HELLOWORLD_ENABLED__

history currHistory;

S16 nHistory = 0;

currHistory.scrnID = MAIN_MENU_SCREENID;

currHistory.entryFuncPtr = mmi_HelloWorld_entry;

pfnUnicodeStrcpy( (S8*)currHistory.inputBuffer, (S8*)&nHistory);

AddHistory(currHistory);

#endif

}

 

5.MainMenu.c放的代码

 

#ifdef __MMI_HELLOWORLD_ENABLED__

mmi_HelloWorld_entry();

return;

#else

 

.......

 


#endif

 

6.修改相关的系统文件,使这个模块成为成为整个项目的一部分:

 修改./make/plutommi下的3个文件:

 plutommi.inc---所有mmi部分的头文件所在目录的相对路径列表

 plutommi.lis---所有mmi部分的源文件(相对路径)列表

 plutommi.pth---所有mmi部分的源文件所在目录的相对路径列表

 

 plutommi.inc里加(顶部):

 plutommi\mmi\HelloWorld\Inc

 

 plutommi.lis里加(顶部):

 plutommi\mmi\HelloWorld\Src\HelloWorld.c

 

 plutommi.pth里加(顶部):

 plutommi\mmi\HelloWorld\Src

 

7.把开关加入系统:

  \plutommi\Customer\CustResource\PLUTO_MMI\MMI_featuresPLUTO.h

  (mmi的配置文件)

 

  [Framework]: Languages 下加:

  #define __MMI_HELLOWORLD_ENABLED__

8.让模拟器找到头文件:

  在\plutommi\mmi\GlobalSimulatorPathDef 的顶部添加以下内容:

  /I ".\HelloWorld\Inc"

 

9.在cmd中,在源代码根目录下执行命令:make update

  编译完成后再在vc在运行run

 

  错误可在build\NEOTEL25_06B\log找相关信息

 


  完整版本请见http://www.51qianru.cn/bbs/

 

                                               曙海教育

                                            曙海嵌入式学院

                      (课程:DSP培训,FPGA培训,MTK培训,Android培训,iPhone培训)

                                           电话:021-51875830

                                           网址:http://www.51qianru.cn

                                              讲师:李现路

                             -版权所有-曙海教育,欢迎转摘,转摘请注明作者和出处课程有:

<a href=http://www.51qianru.com.cn>android培训班</a>
<a href=http://www.morning-sea.cn>brew手机培训</a>
<a href=http://www.51qianru.cn>dsp培训</a>
<a href=http://www.shuhai9.cn>嵌入式培训</a>
<a href=http://www.youhuapaiming.cn>嵌入式培训</a>

 

 

上一篇: FPGA系统设计高级班 下一篇: FPGA系统设计高级班

分享 举报