完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
// nRF24L01.h
#ifndef _NRF_24L01_ #define _NRF_24L01_ #define TX_ADR_WIDTH 5 // 5 bytes TX address width #define RX_ADR_WIDTH 5 // 5 bytes RX address width #define TX_PLOAD_WIDTH 20 // 20 bytes TX payload #define RX_PLOAD_WIDTH 20 // 20 bytes TX payload typedef unsigned char BYTE; typedef unsigned char uchar; //****************************************************************// // SPI(nRF24L01) commands #define READ_REG 0x00 // Define read command to register #define WRITE_REG 0x20 // Define write command to register #define RD_RX_PLOAD 0x61 // Define RX payload register address #define WR_TX_PLOAD 0xA0 // Define TX payload register address #define FLUSH_TX 0xE1 // Define flush TX register command #define FLUSH_RX 0xE2 // Define flush RX register command #define REUSE_TX_PL 0xE3 // Define reuse TX payload register command #define NOP 0xFF // Define No Operation, might be used to read status register //***************************************************// // SPI(nRF24L01) registers(addresses) #define CONFIG 0x00 // 'Config' register address #define EN_AA 0x01 // 'Enable Auto Acknowledgment' register address #define EN_RXADDR 0x02 // 'Enabled RX addresses' register address #define SETUP_AW 0x03 // 'Setup address width' register address #define SETUP_RETR 0x04 // 'Setup Auto. Retrans' register address #define RF_CH 0x05 // 'RF channel' register address #define RF_SETUP 0x06 // 'RF setup' register address #define STATUS 0x07 // 'Status' register address #define OBSERVE_TX 0x08 // 'Observe TX' register address #define CD 0x09 // 'Carrier Detect' register address #define RX_ADDR_P0 0x0A // 'RX address pipe0' register address #define RX_ADDR_P1 0x0B // 'RX address pipe1' register address #define RX_ADDR_P2 0x0C // 'RX address pipe2' register address #define RX_ADDR_P3 0x0D // 'RX address pipe3' register address #define RX_ADDR_P4 0x0E // 'RX address pipe4' register address #define RX_ADDR_P5 0x0F // 'RX address pipe5' register address #define TX_ADDR 0x10 // 'TX address' register address #define RX_PW_P0 0x11 // 'RX payload width, pipe0' register address #define RX_PW_P1 0x12 // 'RX payload width, pipe1' register address #define RX_PW_P2 0x13 // 'RX payload width, pipe2' register address #define RX_PW_P3 0x14 // 'RX payload width, pipe3' register address #define RX_PW_P4 0x15 // 'RX payload width, pipe4' register address #define RX_PW_P5 0x16 // 'RX payload width, pipe5' register address #define FIFO_STATUS 0x17 // 'FIFO Status Register' register address //***************************************************************// // FUNCTION's PROTOTYPES // /****************************************************************/ // void SPI_Init(BYTE Mode); // Init HW or SW SPI BYTE SPI_RW(BYTE byte); // Single SPI read/write BYTE SPI_Read(BYTE reg); // Read one byte from nRF24L01 BYTE SPI_RW_Reg(BYTE reg, BYTE byte); // Write one byte to register 'reg' BYTE SPI_Write_Buf(BYTE reg, BYTE *pBuf, BYTE bytes); // Writes multiply bytes to one register BYTE SPI_Read_Buf(BYTE reg, BYTE *pBuf, BYTE bytes); // Read multiply bytes from one register //*****************************************************************/ void inerDelay_us(unsigned char n); void init_io(void) ; void SetRX_Mode(void); unsigned char nRF24L01_RxPacket(unsigned char* rx_buf); void nRF24L01_TxPacket(unsigned char * tx_buf); extern uchar const TX_ADDRESS[TX_ADR_WIDTH];//TX address extern uchar const RX_ADDRESS[RX_ADR_WIDTH];//;RX address #endif //_NRF_24L01_ 一直说error c141:syntax error near 'unsigned'怎么办呀,求大神帮助 |
|
相关推荐
8个回答
|
|
自己先顶上去
|
|
|
|
求大神帮忙
|
|
|
|
是不是typedef处重了吧,去掉一个
|
|
|
|
unsigned int
|
|
|
|
在他附近有什么地方是错的吧
|
|
|
|
|
|
|
|
|
|
|
|
解决了嘛???能说下怎么改的吗?我也遇到这个问题啦 谢谢
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
304 浏览 0 评论
使用Keil建立完整的工程,并使用外部中断0触发数码管显示903
842 浏览 0 评论
嵌入式学习-飞凌嵌入式ElfBoard ELF 1板卡-使用AHT20进行环境监测之AHT20传感器介绍
1131 浏览 0 评论
876 浏览 0 评论
914 浏览 1 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
11838 浏览 31 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-2 02:55 , Processed in 0.640652 second(s), Total 57, Slave 49 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号