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

📄 api.h

📁 Zigbee模块的详细电路原理图和C代码.rar
💻 H
字号:
/*******************************************************************************

       UBEC (Uniband Electronic Corp.)

       Project: U-NET01, Ubiquitous network platform

       File:  api.h

       Version: 0.1.1

       Usage: all function definition

       Platform: U-NET01 DK with IAR 8051 C compiler

       Reference:

               Silicon Laboratories: C8051F124

               UBEC: UZ2400

       Note : LED 4~7 Only for U-zig interface

               Copyright (C) 2007 Uniband Electronic Corporation, All rights reserved

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

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

	UNET Main Function
					
**************************************************************/

void INIT_UNET();

UINT8 ESTABLISH_UNET(UINT16 PanId, UINT8 Channel);

UINT8 JOIN_UNET(UINT16 PanId, UINT8 Channel);

UINT8 CHECK_UNET_DATA();

UINT8 RECV_FROM_UNET(UINT8 *Buff);

UINT8 SEND_TO_UNET(UINT16 DstAddr, UINT8 *DataPtr, UINT8 Length);


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

	Rf Function
					
**************************************************************/

void UzInit();

void UzEnablePA();

void UzSetTxPower(INT8 dB);

void UzSetChannel(UINT8 NewChannel);

void UzSetCca(UINT8 CCAMode, UINT8 CSThreshold, UINT8 EDThreshold);

UINT8 UzReadRSSI();

void UzSetMacAddress(UINT8 *MacAddress);

void UzSetPanId(UINT16 PanId);

void UzSetNwkAddr(UINT16 NwkAddr);

void UzSoftReset();

void UzRxPromiscouosMode();

void UzRxErrorMode();

void UzRxNormalMode();

void UzRxOnlyBeacon();

void UzRxOnlyData();

void UzRxOnlyCommand();

void UzRxAllFrame();

void UzRxFlush();

void UzRegWakeUp();

void UzPowWakeUp();

void UzEnabExtWakeUp();

void UzSleep();

void UzTimedSleep(UINT8 MS);

void UzSetBatteryMonitor(UINT8 Threshold);

UINT8 UzCheckBattery();

UINT8 UzTx(UINT8 * DataPtr, UINT8 Length);

UINT8 UzRx(UINT8 * RecvBuff);

void UzForceTxMode();

void UzEnabBatteryLifeEx();

void UzDisBatteryLifeEx();

void UzSetUnslotMode();

void UzSetCoordinator();

void UzEnabTurboMode();

void UzDisTurboMode();

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

	SPI Functions

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

void InitSPI();

void spi_sw(UINT8 Address, UINT8 Value);

UINT8 spi_sr(UINT8 Address);

void spi_lw(UINT16 Address, UINT8 Value);

UINT8 spi_lr(UINT16 Address);

void spi_fill_fifo(UINT16 Address, UINT8 *DataPtr, UINT8 Length);

//void spi_dump_fifo(UINT16 Address, UINT8 *DataPtr, UINT8 Length);

void spi_rd_rx_fifo(UINT8 *DataPtr, UINT8 *RxLength);


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

	Interrupt Functions

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

void DisInt(void);

void EnabInt(void);

void EnabMcuInt();

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

	Uart Functions

**************************************************************/
#ifdef CONSOLE

void InitUART();

void putstring(char *s);

UINT8 getstring(char *s);

#endif
/**************************************************************

	Timer Functions

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

//void WaitUS (UINT16 count);

void WaitMS (UINT16 count);

/**************************************************************
	LED Function (for U-Zig power module)
					
**************************************************************/

//void LED_SHOW();

#ifdef UZIG

void LED4_OPEN();

void LED4_CLOSE();

void LED5_OPEN();

void LED5_CLOSE();

void LED6_OPEN();

void LED6_CLOSE();

void LED7_OPEN();

void LED7_CLOSE();

#else

void LED1_OPEN();

void LED1_CLOSE();

void LED2_OPEN();

void LED2_CLOSE();

#endif

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

	MSG Function
					
********************************************************************************/

void  *MM_Alloc(UINT8 size);

void MM_Free(void *allocaddr);

void MM_Init(MSG_QUEUE *queueaddr);

#define MSG_Alloc(size) MM_Alloc(size)

#define MSG_AllocType(type) MM_Alloc(sizeof(type))

#define MSG_Free(allocaddr) MM_Free(allocaddr)

#define MSG_Init(queueaddr) MM_Init(queueaddr)

INT8 MSG_Add(void * Msg, UINT8 msgType, MSG_QUEUE * QueuePtr, UINT8 Length);

INT8 MSG_Fetch(MSG_QUEUE *QueuePtr);

#define MSG_Copy(dest, src, len) memcpy((void *)dest, (const void *) src, (size_t) len);

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

	Debug Function
					
********************************************************************************/

#ifdef DEBUG_MODE

#define DBG_tag() printf("TraceTag: %s()::[%d]\r\n",__func__, __LINE__)

#define DBG_val(val_name_or_msg, val) printf("%s()::[%d]: "#val_name_or_msg" = %02x\r\n",__func__, __LINE__, val)

#define DBG_msg(message) printf("%s()::[%d]: "#message"\r\n", __func__,__LINE__)

#else

#define DBG_tag()

#define DBG_val(val_name, val)

#define DBG_msg(message)

#endif

⌨️ 快捷键说明

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