极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 11964|回复: 2

抛砖贴:rNF24L01库文件内函数功能及用法的简单翻译

[复制链接]
发表于 2013-8-26 20:20:50 | 显示全部楼层 |阅读模式
最近在找rNF24L01的库文件使用方法,只在arduion.cc上找到了份英文资料,随便翻译了一下,很多词汇没有时间细研究,有很多错误的地方,我把英文原文保留下来,希望网友们一起把不对的地方完善下。

Methods:
void init(void)
Initialize the module, set the pin modes for the configurable pins and initialize the SPI module.
模式初始化:设置可配置的管脚和初始化SPI模块

例子:
Mirf.csnPin = 9;
Mirf.cePin = 7;
Mirf.init();

void setRADDR(byte *addr)
Set the receiving address. Addresses are 5 bytes long.
设置接收数据地址,长度为5字节
例子:
Mirf.setRADDR((byte *)"addr1");

void setTADDR(byte *addr)
Set the sending address.
设置发送地址
例子:
Mirf.setTADDR((byte *)"addr1");

void config(void)
Set channel and payload width. Power up in RX mode and flush RX fifo.
设置通道和payload宽度,上电后进入RX模式并清空 RX先进先出队列。
例子:
Mirf.payload = 32;
Mirf.channel = 2;
Mirf.config();

bool dataReady(void)
Is there data ready to be received?.
判断是否做好接收准备
例子:
if(Mirf.dataReady()){
//Get the data to play with.
}

void getData(byte *data)
Get the received data. 'data' should be an array of bytes Mirf.payload long.
得到接收的数据,“data”的长度是由队列 Mirf.payload 定义。
例子:
byte data[Mirf.payload]
Mirf.getData(data);

void send(byte *data)
Send data. 'data' should be Mirf.payload bytes long.
发送数据,“data”长度由 Mirf.payload确定
bool isSending(void)
Return true if still trying to send. If the chip is still in transmit mode then this method will return the chip to receive mode.
如果正在尝试发送则返回“true”,如果芯片还在传送模式则该函数将使芯片进入接收模式;
例子:
Mirf.send(data);

while(Mirf.isSending()){
//Wait.
}

//Chip is now in receive mode.芯片此时处于接收模式
附言:更多可用的寄存器状态信息及出错信息,请参阅Mirf.cpp
NB: Lots more information is available from the status registers regarding acknolagement or failure status. See Mirf.cpp:218.

bool rxFifoEmpty(void)
Is the RX Fifo Empty.
判断RX (先进先出)队列是否为空

bool txFifoEmpty(void)
Is the TX Fifo Empty.
判断TX 队列是否为空。

byte getStatus(void)
Return the status register.
返回寄存器状态

void powerUpRx(void)
Power up chip and set to receive mode. Also clear sending interrupts.
设置芯片上电后自动进入接收模式,并且清空发送中断。
void powerUpTx(void)
Power up tx mode.
设置为上电进入TX模式。
回复

使用道具 举报

 楼主| 发表于 2013-8-26 20:21:39 | 显示全部楼层
希望引起大家的讨论,把这份说明完善起来。
回复 支持 反对

使用道具 举报

发表于 2015-3-19 16:17:47 | 显示全部楼层
居然900多个人查看没有一个人回复 的~!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-17 18:50 , Processed in 0.042727 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表