1 Star 0 Fork 1

qingsonggege/nrf24L01_plus

forked from 何亚红/nrf24L01_plus 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
nrf24.h 4.14 KB
一键复制 编辑 原始数据 按行查看 历史
/*
* ----------------------------------------------------------------------------
* “THE COFFEEWARE LICENSE” (Revision 1):
* <ihsan@kehribar.me> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a coffee in return.
* -----------------------------------------------------------------------------
* This library is based on this library:
* https://github.com/aaronds/arduino-nrf24l01
* Which is based on this library:
* http://www.tinkerer.eu/AVRLib/nRF24L01
* -----------------------------------------------------------------------------
*/
#ifndef NRF24
#define NRF24
#include "nRF24L01.h"
#include <stdint.h>
#define LOW 0
#define HIGH 1
#define nrf24_ADDR_LEN 5
#define nrf24_CONFIG ((1<<EN_CRC)|(0<<CRCO))
#define NRF24_TRANSMISSON_OK 0
#define NRF24_MESSAGE_LOST 1
/* adjustment functions */
void nrf24_init();
void nrf24_rx_address(uint8_t* adr);
void nrf24_tx_address(uint8_t* adr);
void nrf24_config(uint8_t channel, uint8_t pay_length);
/* state check functions */
uint8_t nrf24_dataReady();
uint8_t nrf24_isSending();
uint8_t nrf24_getStatus();
uint8_t nrf24_rxFifoEmpty();
/* core TX / RX functions */
void nrf24_send(uint8_t* value);
void nrf24_getData(uint8_t* data);
/* use in dynamic length mode */
uint8_t nrf24_payloadLength();
/* post transmission analysis */
uint8_t nrf24_lastMessageStatus();
uint8_t nrf24_retransmissionCount();
/* Returns the payload length */
uint8_t nrf24_payload_length();
/* power management */
void nrf24_powerUpRx();
void nrf24_powerUpTx();
void nrf24_powerDown();
/* low level interface ... */
uint8_t spi_transfer(uint8_t tx);
void nrf24_transmitSync(uint8_t* dataout,uint8_t len);
void nrf24_transferSync(uint8_t* dataout,uint8_t* datain,uint8_t len);
void nrf24_configRegister(uint8_t reg, uint8_t value);
void nrf24_readRegister(uint8_t reg, uint8_t* value, uint8_t len);
void nrf24_writeRegister(uint8_t reg, uint8_t* value, uint8_t len);
/* -------------------------------------------------------------------------- */
/* You should implement the platform spesific functions in your code */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* In this function you should do the following things:
* - Set MISO pin input
* - Set MOSI pin output
* - Set SCK pin output
* - Set CSN pin output
* - Set CE pin output */
/* -------------------------------------------------------------------------- */
extern void nrf24_setupPins();
/* -------------------------------------------------------------------------- */
/* nrf24 CE pin control function
* - state:1 => Pin HIGH
* - state:0 => Pin LOW */
/* -------------------------------------------------------------------------- */
extern void nrf24_ce_digitalWrite(uint8_t state);
/* -------------------------------------------------------------------------- */
/* nrf24 CE pin control function
* - state:1 => Pin HIGH
* - state:0 => Pin LOW */
/* -------------------------------------------------------------------------- */
extern void nrf24_csn_digitalWrite(uint8_t state);
/* -------------------------------------------------------------------------- */
/* nrf24 SCK pin control function
* - state:1 => Pin HIGH
* - state:0 => Pin LOW */
/* -------------------------------------------------------------------------- */
extern void nrf24_sck_digitalWrite(uint8_t state);
/* -------------------------------------------------------------------------- */
/* nrf24 MOSI pin control function
* - state:1 => Pin HIGH
* - state:0 => Pin LOW */
/* -------------------------------------------------------------------------- */
extern void nrf24_mosi_digitalWrite(uint8_t state);
/* -------------------------------------------------------------------------- */
/* nrf24 MISO pin read function
/* - returns: Non-zero if the pin is high */
/* -------------------------------------------------------------------------- */
extern uint8_t nrf24_miso_digitalRead();
#endif
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/qingsonggege/nrf24L01_plus.git
git@gitee.com:qingsonggege/nrf24L01_plus.git
qingsonggege
nrf24L01_plus
nrf24L01_plus
master

搜索帮助