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

📄 zigbee.def

📁 microchip公司提供的无线ziebee协议的演示程序
💻 DEF
字号:
#ifndef _ZIGBEE_DEF
#define _ZIGBEE_DEF

/*
 * Clock frequency value.
 * This value is used to calculate Tick Counter value
 */
#define CLOCK_FREQ                      (16000000)      // Hz

// For debug output.
#define BAUD_RATE                       (19200)

#if defined(WIN32)
#define TICKS_PER_SECOND                (CLOCKS_PER_SEC)
#define TICK_PRESCALE_VALUE             (2)
#else
#define TICKS_PER_SECOND                (50)
#define TICK_PRESCALE_VALUE             (2)
#endif

// Uncomment only one of the following as per hardware.
// You may instead define this parameter as a project wide build 
// option macro.
//#define USE_CC2420
#define USE_UZ2400

// ZMD is not supported yet.
//#define USE_ZMD44101

//#define ENABLE_DEBUG


// Uncomment one of the below to describe this node's functionality.
// RFD's are not capable of being a coordinator or router, so do not
// uncomment them.
//#define I_AM_COORDINATOR        
  #define I_AM_ROUTER
//#define I_AM_END_DEVICE

//check that a device type is chosen
#if !defined(I_AM_COORDINATOR) && !defined(I_AM_ROUTER) && !defined(I_AM_END_DEVICE)
	#error "device must be defined as a coordinator, router, or end device."
#endif

// If you are a router and you want to have a binding table, uncomment the 
// definition below.
#ifdef I_AM_ROUTER
	//#define I_SUPPORT_BINDINGS
#endif	

#if defined(I_AM_COORDINATOR) || defined(I_AM_ROUTER)
	#define I_AM_FFD
#else
//Select here if the end device is going to be a RFD or FFD
	#define I_AM_FFD
	//#define I_AM_RFD
#endif

//check that exactly one functional level is selected
#if !defined(I_AM_FFD) && !defined (I_AM_RFD)
	#error "device must be defined as either a RFD or FFD."
#endif
#if defined(I_AM_RFD) && defined(I_AM_FFD)
	#error "device is define both as a RFD and as a FFD in Zigbee.def."
#endif

//check for illegal RFD device types
#if defined(I_AM_COORDINATOR) && defined(I_AM_RFD)
    #error "A RFD can not be a coordinator."
#endif
#if defined(I_AM_ROUTER) && defined(I_AM_RFD)
    #error "A RFD can not be a ZigBee router."
#endif

// Determine if we support routing or not.  If we are a coordinator or a router,
// we support routing.  If we are an FFD end device (probably because we want to
// do peer-to-peer), we also need to support routing.  This reduces to 
// "if I_AM_FFD".  We create a new label for it in case we change the definition.
#if defined(I_AM_FFD)
	#define I_SUPPORT_ROUTING
#endif
	
// If we are not an end device, then we are capable of routing
#ifdef I_SUPPORT_ROUTING
//	#define USE_TREE_ROUTING_ONLY
	#ifndef USE_TREE_ROUTING_ONLY
		#define ROUTE_DISCOVERY_TABLE_SIZE		8
		#define ROUTING_TABLE_SIZE				16
		#define RESERVED_ROUTING_TABLE_ENTRIES	8
	#endif
#endif


// Uncomment one of the below to specifiy frequency band of operation.
// You may instead define this parameter as a project wide build 
// option macro.
    //#define MY_FREQ_BAND_IS_868_MHZ
    //#define MY_FREQ_BAND_IS_900_MHZ
#define MY_FREQ_BAND_IS_2400_MHZ

// Uncomment below if this node is a FFD and wants to be alternate PAN
// coordinator - note that only FFD can be alternate PAN coordinator
    //#define I_AM_ALT_PAN_COORD

// Uncomment one of the below to specify the power source
    #define I_AM_MAINS_POWERED
    //#define I_AM_RECHARGEABLE_BATTERY_POWERED
    //#define I_AM_DISPOSABLE_BATTERY_POWERED

// Uncomment one of the below to specify security capability.
// In current version security capability is not implemented.
    //#define I_AM_SECURITY_CAPABLE

// Uncomment one of the below to specify how receiver on/off is managed.
// Current version only implements non-beacon-enabled network,
// meaning, either you may have receiver always on, periodically or
// stimulated ON.
#define MY_RX_IS_ALWAYS_ON_OR_SYNCED_WITH_BEACON
//#define MY_RX_IS_PERIODICALLY_ON
//#define MY_RX_IS_ON_WHEN_STIMULATED


// All node must have unique extended address to begin with.
#define MAC_LONG_ADDR_BYTE0             (0x04)      // BYTE0:3 are user defined
#define MAC_LONG_ADDR_BYTE1             (0x00)
#define MAC_LONG_ADDR_BYTE2             (0x00)
#define MAC_LONG_ADDR_BYTE3             (0x00)
#define MAC_LONG_ADDR_BYTE4             (0x00)      // BYTE4:7 are OUI bytes.
#define MAC_LONG_ADDR_BYTE5             (0xa3)
#define MAC_LONG_ADDR_BYTE6             (0x04)
#define MAC_LONG_ADDR_BYTE7             (0x00)

// Uncomment following to use MAC RF test code.
//#define MAC_USE_RF_TEST_CODE

// Uncomment following if this node is not a coordinator
// and wants coordinator to assign a short address to it.
#if defined(I_AM_END_DEVICE) || defined(I_AM_ROUTER)
    #define MAC_USE_SHORT_ADDR
#endif

// RF RSSI energy threshold after which a channel is said to be
// occupied.
#define MAC_CHANNEL_ENERGY_THRESHOLD    (0x20)

// Number of times a frame should be retried before declaring error
#define MAC_MAX_FRAME_RETRIES           (4)

// Amount of time we should wait for ACK from remote node.
#define MAC_ACK_WAIT_DURATION           (TICK_SECOND/2)

// Amount of time we should wait for response from remote node.
#define MAC_RESPONSE_WAIT_TIME          (TICK_SECOND)

// Amount of time we should wait for RF energy measurement.
#define MAC_ED_SCAN_PERIOD              (TICK_SECOND/4)

// Amount of time we should do active scan.
#define MAC_ACTIVE_SCAN_PERIOD          (TICK_SECOND/2)

// Amount of time a staged frame should be kept in buffer and within
// which intended receipt must request that frame.
#define MAC_MAX_DATA_REQ_PERIOD         (TICK_SECOND*10)

// Staging transmit buffer size - used by coordinator devices only.
#define MAX_HEAP_SIZE       2048

// Maximum number of neighbors this end device can have
// This should always equal 1 for an end device.
#define MAX_NEIGHBORS       (25)

// Maximum number of binding entries this coordinator is to support.
// This number if limited by amount of program memory available.
#if defined(I_AM_COORDINATOR) || defined(I_SUPPORT_BINDINGS)
	#define MAX_BINDINGS        0
#endif

//Enabling this command will force the exponential backoff of 
//the CSMA-CA algorithm.  This consumes the TMR3 resource of the
//PIC.  Leaving this command uncommented will cause the code
//to not comply to the IEEE spec but will free the TMR3 resource.
//The packet will be sent when the channel quiets down.
#define IEEE_COMPLY

// This defines the number of RX packets that you can buffer
// at one time.  Each will require 4 RAM bytes.  Also note that
// the expanding this value can also cause you to use up your heap
// faster.  Reduce this number to limit the amount of heap that the 
// RX Buffer can consume at the cost of being able to buffer more packets
#define RX_BUFFER_SIZE 4

// Uncomment this line to support the optional service discovery
// responses of Complex_Desc_req, User_Desc_req, Discovery_Register_req,
// End_Device_annc, User_Desc_set
#define INCLUDE_OPTIONAL_SERVICE_DISCOVERY_REQUESTS

// Uncomment this line to support the optional node management
// services of Mgmt_NWK_Disc_req, Mgmt_Lqi_req, Mgmt_Rtg_req, 
// Mgmt_Bind_req
// NOTE: These are not implemented in this version.
//#define INCLUDE_OPTIONAL_NODE_MANAGEMENT_SERVICES

// Uncomment the individual responses that your application may
// receive and will have call-backs for.
#define PROCESS_NWK_ADDR_RSP
//#define PROCESS_IEEE_ADDR_RSP
//#define PROCESS_NODE_DESC_RSP
//#define PROCESS_POWER_DESC_RSP
//#define PROCESS_SIMPLE_DESC_RSP
//#define PROCESS_ACTIVE_EP_RSP
//#define PROCESS_MATCH_DESC_RSP
//#define PROCESS_COMPLEX_DESC_RSP
//#define PROCESS_USER_DESC_RSP
//#define PROCESS_DISCOVERY_REGISTER_RSP
//#define PROCESS_USER_DESC_CONF
//#define PROCESS_END_DEVICE_BIND_RSP
//#define PROCESS_BIND_RSP
//#define PROCESS_UNBIND_RSP
//#define PROCESS_MGMT_NWK_DISC_RSP
//#define PROCESS_MGMT_LQI_RSP
//#define PROCESS_MGMT_RTG_RSP
//#define PROCESS_MGMT_BIND_RSP
//#define PROCESS_MGMT_LEAVE_RSP
//#define PROCESS_MGMT_DIRECT_JOIN_RSP

// Uncomment this line to support End Device Binding.  Only 
// coordinators can support this feature, though end devices can
// still generate the request.
//#define SUPPORT_END_DEVICE_BINDING

// Define the maximum input clusters a node can have.
// TODO This needs to be calculated based on the calculations in 
// the simple descriptor set-up as well as user input.
#define MY_MAX_INPUT_CLUSTERS	1
#define MY_MAX_OUTPUT_CLUSTERS	1

// Define how many endpoints your application will have
#define NUM_USER_ENDPOINTS	1

// Define your endpoint names and numbers.  Note that each must be between
// 1 and 240 inclusive.
#define EP_LIGHT_AND_SWITCH	0x08
#if (EP_LIGHT_AND_SWITCH < 1) || (EP_LIGHT_AND_SWITCH > 240)
	#error Endpoint value out of range (1-240)
#endif
	

// Include the header file for the profile being implemented.
#include "zHCLighting.h"


#endif

⌨️ 快捷键说明

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