⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apus_apnode.h

📁 TI 公司的Z-STACK 应用层开发程序
💻 H
字号:
#ifndef APUS_H
#define APUS_H

/*********************************************************************
    Filename:       APUS.h
    Revised:        $Date: 2006-07-03 16:50:57 -0700 (Mon, 03 Jul 2006) $
    Revision:       $Revision: 11263 $

    Description:

       This file contains the Generic Application definitions.

    Notes:

    Copyright (c) 2006 by Texas Instruments, Inc.
    All Rights Reserved.  Permission to use, reproduce, copy, prepare
    derivative works, modify, distribute, perform, display or sell this
    software and/or its documentation for any purpose is prohibited
    without the express written consent of Texas Instruments, Inc.
*********************************************************************/

#ifdef __cplusplus
extern "C"
{
#endif

/*********************************************************************
 * INCLUDES
 */
#include "ZComDef.h"

/*********************************************************************
 * CONSTANTS
 */

// These constants are only for example and should be changed to the
// device's needs
#define APUS_ENDPOINT           10
#define APUS_ENDPOINT_OUT           11

#define APUS_PROFID             0x0F04
#define APUS_PROFID_OUT             0x0F05
#define APUS_DEVICEID           0x0001
#define APUS_DEVICE_VERSION     0
#define APUS_FLAGS              0

#define APUS_MAX_CLUSTERS       1
#define APUS_CLUSTERID          1          //sensor temperature
#define APUS_MAX_CLUSTERS_ROUTER       1
#define APUS_CLUSTERID_ROUT      1          //router send out MSG

// Send Message Timeout
#define APUS_SEND_MSG_TIMEOUT   2000     // Every 2 seconds

// Application Events (OSAL) - These are bit weighted definitions.
#define APUS_SEND_MSG_EVT       0x0001
#define APUS_DISP_VAL_EVT       0x0002
//#define APUS_DISP_HELLO_EVT       0x0003
#define ACCELERATION_DISP_VAL_EVT     0x0004
#define APUS_SEND_SELECTEDDATA_EVT       0x0001


/*********************************************************************
 * MACROS
 */
// Where _settings_ are the following:
// Reference voltage:
#define ADC_REF_1_25_V      0x00     // Internal 1.25V reference
#define ADC_REF_P0_7        0x40     // External reference on AIN7 pin
#define ADC_REF_AVDD        0x80     // AVDD_SOC pin
#define ADC_REF_P0_6_P0_7   0xC0     // External reference on AIN6-AIN7 differential input

// Resolution (decimation rate):
#define ADC_8_BIT           0x00     //  64 decimation rate
#define ADC_10_BIT          0x10     // 128 decimation rate
#define ADC_12_BIT          0x20     // 256 decimation rate
#define ADC_14_BIT          0x30     // 512 decimation rate

// Input channel:
#define ADC_AIN0            0x00     // single ended P0_0
#define ADC_AIN1            0x01     // single ended P0_1
#define ADC_AIN2            0x02     // single ended P0_2
#define ADC_AIN3            0x03     // single ended P0_3
#define ADC_AIN4            0x04     // single ended P0_4
#define ADC_AIN5            0x05     // single ended P0_5
#define ADC_AIN6            0x06     // single ended P0_6
#define ADC_AIN7            0x07     // single ended P0_7
#define ADC_GND             0x0C     // Ground
#define ADC_TEMP_SENS       0x0E     // on-chip temperature sensor
#define ADC_VDD_3           0x0F     // (vdd/3)

#define  CHVER              XREG( 0xDF60 )  //  Chip Version
// Chip revisions
#define REV_A               0x00
#define REV_B               0x01
#define REV_C               0x02
#define REV_D               0x03
#define REV_E               0x04

#define GRADIENT_T          1496
#define OFFSET_T            3036
#define ADC14_TO_CELSIUS(ADC_VALUE)    \
  ( (int32)ADC_VALUE * (int32)GRADIENT_T / 10000 - OFFSET_T)

#define GRADIENT_A          16
#define OFFSET_A            40
#define ADC14_TO_G(ADC_VALUE)    \
 ( (int32)ADC_VALUE * (int32)GRADIENT_A / 10000 - OFFSET_A)

//#define BUILD_UINT16(loByte, hiByte) \
      //    ((uint16)((loByte) + ((hiByte)  << 8)))
/*********************************************************************
 * FUNCTIONS
 */

/*
 * Task Initialization for the Generic Application
 */
extern void ApusApp_Init( byte task_id );

/*
 * Task Event Processor for the Generic Application
 */
extern UINT16 ApusApp_ProcessEvent( byte task_id, UINT16 events );

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

#ifdef __cplusplus
}
#endif

#endif /* APUS_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -