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

📄 app.h

📁 基于MDK的LPC1100处理器开发应用例程
💻 H
字号:

#ifndef __APP_H__
#define __APP_H__

#include"LPC11xx.h"

#include "LPC11xx_ssp.h"
#include "LPC11xx_gpio.h"
#include "LPC11xx_adc.h"
//#include "LPC11xx_clkpwr.h"
#include "stdint.h"
#include "mrfi_spi.h"


/*smpl config*/
#define  NUM_CONNECTIONS  2
#define  SIZE_INFRAME_Q  2
#define  SIZE_OUTFRAME_Q  2

#define  END_DEVICE
//#define  RX_POLLS



/*smpl nwk config */
#define  MAX_HOPS 3
#define  MAX_HOPS_FROM_AP  1
#define  MAX_NWK_PAYLOAD   9
#define  MAX_APP_PAYLOAD   10

#define  DEFAULT_LINK_TOKEN   0x01020304

#define  DEFAULT_JOIN_TOKEN   0x05060708

//#define  FREQUENCY_AGILITY
//#define  APP_AUTO_ACK
//#define  EXTENDED_API
//#define  SMPL_SECURE
//#define  NVOBJECT_SUPPORT
#define  SW_TIMER

#ifndef BV
#define BV(n)      (1 << (n))
#endif


#define MRFI_CC2500


typedef uint8_t u8;
typedef uint16_t u16;
typedef int8_t s8;


extern uint8_t mrfiRadioState;
extern uint8_t  u8GDO0Flag;
extern uint8_t  u8GDO2Flag;

/* SPI critical section macros */
typedef uint16_t bspIState_t;
typedef uint16_t mrfiSpiIState_t;

#define MRFI_SPI_ENTER_CRITICAL_SECTION(x)  (x++) // {__asm volatile (" CPSID   I \n");}
#define MRFI_SPI_EXIT_CRITICAL_SECTION(x)  (x--) // {__asm volatile (" CPSIE   I \n");}

#define BSP_ENTER_CRITICAL_SECTION(s)  (s++)//     {__asm volatile (" CPSID   I \n");}
#define BSP_EXIT_CRITICAL_SECTION(s)  (s--)//    {__asm volatile (" CPSIE   I \n");}




/* read/write macros */
#define MRFI_SPI_WRITE_BYTE(x)      (LPC_SSP0->DR= x)          //st( IFG2 &= ~UCB0RXIFG;  UCB0TXBUF = x; )
#define MRFI_SPI_READ_BYTE()  LPC_SSP0->DR                //UCB0RXBUF
#define MRFI_SPI_WAIT_DONE()       while (LPC_SSP0->SR & (SSP_SR_BSY));         //while(!(IFG2 & UCB0RXIFG));

#define TI_CCxxx0_NUM_RXBYTES  0x7F        // Mask "# of bytes" field in _RXBYTES



/* define cc2500 related SPI pins */
#define CSPort   3
#define SCLKPort 2
#define CSPIPort 0
#define CGDOPort 2
#define CSPICSN  1<<5 //USE 1<<3 test
#define CSPISCLK 1<<11
#define CSPISO   1<<8
#define CSPISI   1<<9
#define CGDO0    1<<5//
#define CGDO2    1<<4

#define WRITE_BURST     0x40



/*key define*/
#define  KETPORT 2

#define  KEY2  1<<0
#define  KEY3  1<<1
#define  KEY4  1<<2
#define  KEY5  1<<3
#define MRFI_DELAY(x)  {volatile uint32_t i = x; while(i--);}

extern uint32_t ntohl(uint32_t netlong);
extern uint32_t htonl(uint32_t hostlong);
extern uint16_t ntohs(uint16_t netshort);
extern uint16_t htons(uint16_t hostshort);

//extern void  EINT3_IRQHandler(void);
extern void KeyInit(void);


extern uint8_t txBuffer[ ];
extern uint8_t rxBuffer[ ];


extern void SPI_GPIO_Configuration(void);
extern void MRFI_SyncPinRxIsr(void);
extern void Mrfi_RxModeOff(void);
extern void Mrfi_RxModeOn(void);

extern void NWK_DELAY(uint16_t milliseconds);
extern void RFSendPacket(uint8_t *txBuffer, uint8_t size);
extern void SendCurInfo(void);
extern char RFReceivePacket(uint8_t *rxBuffer, uint8_t *length);
extern void writeRFSettings(void);


#endif

⌨️ 快捷键说明

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