/**************************************************************************************************
Filename: SimpleCollector.c
Revised: $Date: 2008-04-03 11:05:31 -0700 (Thu, 03 Apr 2008) $
Revision: $Revision: 16711 $
Description: Sample application utilizing the Simple API.
Copyright 2007 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED 揂S IS?WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
/******************************************************************************
* INCLUDES
*/
#include "ZComDef.h"
#include "OSAL.h"
#include "sapi.h"
#include "hal_key.h"
#include "hal_led.h"
#include "DebugTrace.h"
#include "SimpleApp.h"
#include "hal_uart.h"
#include "hal_lcd.h"
#include "stdio.h"
#include "string.h"
#include "hal_board_cfg.h" //@diy
/*********************************************************************
* CONSTANTS
*/
// Application States
#define APP_INIT 0
#define APP_START 1
// Application osal event identifiers
#define MY_START_EVT 0x0001
// Same definitions as in SimpleSensor.c
#define VOLTAGE_REPORT1 0x02
/*********************************************************************
* TYPEDEFS
*/
/*********************************************************************
* LOCAL VARIABLES
*/
static uint8 myAppState = APP_INIT;
static uint8 myStartRetryDelay = 10;
/*********************************************************************
* GLOBAL VARIABLES
*/
// Inputs and Outputs for Collector device
#define NUM_OUT_CMD_COLLECTOR 0
#define NUM_IN_CMD_COLLECTOR 1
// List of output and input commands for Collector device
const cId_t zb_InCmdList[NUM_IN_CMD_COLLECTOR] =
{
SENSOR_REPORT_CMD_ID
};
// Define SimpleDescriptor for Collector device
const SimpleDescriptionFormat_t zb_SimpleDesc =
{
MY_ENDPOINT_ID, // Endpoint
MY_PROFILE_ID, // Profile ID
DEV_ID_COLLECTOR, // Device ID
DEVICE_VERSION_COLLECTOR, // Device Version
0, // Reserved
NUM_IN_CMD_COLLECTOR, // Number of Input Commands
(cId_t *) zb_InCmdList, // Input Command List
NUM_OUT_CMD_COLLECTOR, // Number of Output Commands
(cId_t *) NULL // Output Command List
};
#define CLKSPD ( CLKCONCMD & 0x03 ) //系统时钟速率 虽然会与hal_mcu.h 中的文件打架,但还能用
/* 串行UART 配置 */
#define HIGH_STOP 0x02
#define LOW_STOP 0x00
#define HIGH_START 0x01
#define TRANSFER_MSB_FIRST 0x80
#define TRANSFER_MSB_LAST 0x00
#define FLOW_CONTROL_ENABLE 0x40
#define UART_ENABLE_RECEIVE 0x40
#define IO_PER_LOC_USART0_AT_PORT0_PIN2345() \
do { PERCFG = (PERCFG&~0x01)|0x00; } while (0)
/* 串行UART_E设置 */
#define BAUD_E(baud, clkDivPow) ( \
(baud==2400) ? 6 +clkDivPow : \
(baud==4800) ? 7 +clkDivPow : \
(baud==9600) ? 8 +clkDivPow : \
(baud==14400) ? 8 +clkDivPow : \
(baud==19200) ? 9 +clkDivPow : \
(baud==28800) ? 9 +clkDivPow : \
(baud==38400) ? 10 +clkDivPow : \
(baud==57600) ? 10 +clkDivPow : \
(baud==76800) ? 11 +clkDivPow : \
(baud==115200) ? 11 +clkDivPow : \
(baud==153600) ? 12 +clkDivPow : \
(baud==230400) ? 12 +clkDivPow : \
(baud==307200) ? 13 +clkDivPow : \
0 )
/* 串行UART_M设置 */
#define BAUD_M(baud) ( \
(baud==2400) ? 59 : \
(baud==4800) ? 59 : \
(baud==9600) ? 59 : \
(baud==14400) ? 216 : \
(baud==19200) ? 59 : \
(baud==28800) ? 216 : \
(baud==38400) ? 59 : \
(baud==57600) ? 216 : \
(baud==76800) ? 59 : \
(baud==115200) ? 216 : \
(baud==153600) ? 59 : \
(baud==230400) ? 216 : \
(baud==307200) ? 59 : \
0)
/* 串行UART设置 */
#define UART_SETUP(uart, baudRate, options) \
do { \
if ((options) & FLOW_CONTROL_ENABLE){ \
if((uart) == 0){ /* USART0 */\
if(PERCFG & 0x01){ /* Alt 2 */\
P1SEL |= 0x3C; \
} else { /* Alt 1 */\
P0SEL |= 0x3C; \
} \
} \
else { /* USART1 */\
if(PERCFG & 0x02){ /* Alt 2 */\
P1SEL |= 0xF0; \
} else { /* Alt 1 */\
P0SEL |= 0x3C; \
} \
} \
} \
else{ /* 流控不时能 */ \
if((uart) == 0){ /* USART0 */\
if(PERCFG & 0x01){ /* Alt 2 */\
P1SEL |= 0x30; \
} else { /* Alt 1 */\
P0SEL |= 0x0C; \
} \
} \
else { /* USART1 */\
if(PERCFG & 0x02){ /* Alt 2 */\
P1SEL |= 0xC0; \
} else { /* Alt 1 */\
P0SEL |= 0x30; \
} \
} \
} \
\
U##uart##GCR = BAUD_E((baudRate), CLKSPD); \
U##uart##BAUD = BAUD_M(baudRate); \
\
U##uart##CSR |= 0x80;
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【作品名称】:基于ZigBee的无线ECG心电采集诊断系统(硬件设计+软件源码+论文) 【适用人群】:适用于希望学习不同技术领域的小白或进阶学习者。可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。 【项目介绍】: 无线ECG心电采集和诊断系统是一种新兴的、有广阔发展前景的医疗器械。本文基于CC2530 ZigBee模块和Cortex M3处理器,设计并实现了远距离无线心电检测诊断系统。该系统采集人体心电信号,通过CC2530模块建立ZigBee网络,将采集节点采到的信号发送到协调器。协调器再将信号送至Cortex M3高性能处理器,对信号进行进一步处理,将心电图实时在LCD上显示,并进行初步诊断。本系统具有抗干扰能力强、可靠性好、功耗低、体积小等特点,可以广泛应用于医院和社区医疗站等。
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/msword](https://img-home.csdnimg.cn/images/20210720083327.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/DOC.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/DOC.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
共 10 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/4530fde4ec954012a1ac6bd3893fbfc9_weixin_44010641.jpg!1)
MarcoPage
- 粉丝: 3465
- 资源: 4316
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)