Z-Stack Home Developer's Guide—4.Using the sample applications as base for new applications 中文翻译
本章節是官方提供的文檔說明 如何將樣例程序改為我們自己需要開發的程序,下面是中文翻譯
4.使用樣例程序為基礎開發一個新的應用程序
HA樣例程序旨在用作用戶開的應用程序的基礎,修改他們需要遵循如下步驟:
1.拷貝你選擇的樣例程序到新的文件夾并且根據你的需要進行重命名
拷貝
Projects\zstack\HomeAutomation\SampleLight*.*
到
Projects\zstack\HomeAutomation\YourApp*.*
2.源文件重命名以匹配你的應用程序
以下的文件名需要更改 Projects\zstack\HomeAutomation\YourApp\Source, 重命名的規則如下:
- OSAL_SampleLight.c -> OSAL_YourApp.c
- zcl_samplelight.c -> zcl_yourapp.c
- zcl_samplelight.h -> zcl_yourapp.h
- zcl_samplelight_data.c -> zcl_yourapp_data.c
3.在Projects\zstack\HomeAutomation\YourApp\CC2538文件夾中, 重命名以下文件(插一句CC2530也一樣):
- SampleLight.ewd -> YourApp.ewd
- SampleLight.ewp -> YYourApp.ewp
- SampleLight.eww -> YourApp.eww
如果這個文件下面有其他子文件/文件夾,請將他們刪掉。
4.使用文本編輯器,將YourApp.ewp和YourApp.eww中的SimpleLight(其他同理)替換為YourApp.
5.使用IAR開發工具打開你的應用程序YourApp.eww,它將是以下樣子。
使用CC2538應用程序將無法打開,會彈出警告,因為筆者iar安裝的是基于8051架構的的應該使用CC2530,CC2538是基于ARM架構的用 基于8051架構的 IAR開發工具 無法打開。
下面是CC2530應用程序的結構:
6.更改3個c源文件中包含的zcl_SampleLight.h->zcl_YourApp.h
一般我們會將程序文件中的SampleLight全部替換為YourApp
我們進行編譯,如果有遇到下面錯誤,Error[e46]: Undefined external “?V11” referred in AF ,原因是iar的高版本和z-stack不兼容。
解決方案:
1.右鍵項目文件的options
2.下載TI官方提供的[替換文件chipcon_cstartup.s51,將Z-Stack Home 1.2.0\Projects\zstack\ZMain\TI2530DB下的這個文件進行替換
再次進行編譯:
7.現在您已經準備好更改應用程序代碼來滿足您的需求,比如 修改 按鍵有效,修改設備類型,修改之處的cluster,等等。查看更多的信息,請閱讀整個文檔的最后有列出來。
英語原文
4. Using the sample applications as base for new applications
The HA Sample Applications are intended to be used as foundations for the user’s applications. Modifying them
will usually consist of the following steps:
1. Copy the Sample Application of your choice to a new folder, and name it according to your new application:
Copy
Project\zstack\HomeAutomation\SampleLight*.*
To
Project\zstack\HomeAutomation\YourApp*.*
2. Rename the files to match your application’s name:
Under Projects\zstack\HomeAutomation\YourApp\Source, rename the files as follows:
o OSAL_SampleLight.c ? OSAL_YourApp.c
o zcl_samplelight.c ? zcl_yourapp.c
Etc.
3. In Projects\zstack\HomeAutomation\YourApp\CC2538, rename the following files:
o SampleLight.ewd?YourApp.ewd
o SampleLight.ewp?YourApp.ewp
o SampleLight.eww?YourApp.eww
Z-Stack Home Developer’s Guide SWRA441 Version 1.0
14 Copyright ? 2013 Texas Instruments, Inc. All rights reserved.
Delete all the other files and subfolders from this folder, if there are any.
4. Using a text editor, replace all occurrences of “SampleLight” (case insensitive) to “YourApp”, in YourApp.ewp
and YourApp.eww.
5. You can now open YourApp.eww with IAR. Notice that the application files that are included in the project are
the files from your application:
Figure 1 - Application files within YourApp
6. You will have to edit the application files, to replace any occurrence of “zcl_samplelight.h” with
“zcl_yourapp.h”.
7. Now you are ready to manipulate the application code to suite your needs, e.g. modify key-press activities,
change the device type, modify the supported clusters, etc. For further information, please refer to the applicable
documents, listed at the end of this user guide.
總結
以上是生活随笔為你收集整理的Z-Stack Home Developer's Guide—4.Using the sample applications as base for new applications 中文翻译的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Netsparker超轻量级Web安全漏
- 下一篇: QT TextEdit设置背景、明文加密