nRF24L01+ Commands
The nRF24L01+ is a wideband 2.4Ghz transceiver IC. It is controlled by commands sent over SPI.
This crate provides:
- Bitfield definitions for nRF24L01+ registers
- A friendly API for generating SPI byte sequences for nRF24L01+ commands
This crate is based on the nRF24L01+ specification document.
Examples
Command to write CONFIG register
use ;
const CONFIG: Config = new
.with_mask_rx_dr
.with_mask_tx_ds
.with_mask_max_rt
.with_en_crc
.with_crco
.with_pwr_up
.with_prim_rx;
const WRITE_COMMAND: WRegister = WRegister;
// Generate SPI byte sequence
const SPI_BYTES: = WRITE_COMMAND.bytes;
assert_eq!;
Command to read FIFO_STATUS register
use ;
// Generate SPI byte sequence
const SPI_BYTES: = bytes;
assert_eq!;
Command to write TX payload
use commands;
const PAYLOAD: = ;
// Generate SPI byte sequence
const SPI_BYTES: = WTxPayload.bytes;
assert_eq!;
Inspect register fields
use ;
const RF_SETUP: RfSetup = from_bits;
// Inspect fields
assert!;
assert!;
assert!;
assert_eq!;
assert_eq!;