Crates.io | nrf24l01-commands |
lib.rs | nrf24l01-commands |
version | 1.1.2 |
source | src |
created_at | 2024-10-18 02:15:26.129444 |
updated_at | 2024-11-12 11:52:22.971096 |
description | Register bitfields and commands for the nRF24L01. |
homepage | https://github.com/god-is-a-crab/nrf24l01-commands |
repository | https://github.com/god-is-a-crab/nrf24l01-commands |
max_upload_size | |
id | 1413792 |
size | 72,257 |
This crate provides:
use nrf24l01_commands::{registers, commands};
const CONFIG: registers::Config = registers::Config::new()
.with_mask_rx_dr(true)
.with_mask_tx_ds(false)
.with_mask_max_rt(false)
.with_en_crc(false)
.with_crco(true)
.with_pwr_up(true)
.with_prim_rx(false);
const WRITE_COMMAND: commands::WRegister<registers::Config> = commands::WRegister(CONFIG);
// Generate SPI byte sequence
const SPI_BYTES: [u8; 2] = WRITE_COMMAND.bytes();
assert_eq!(SPI_BYTES, [0b0010_0000, 0b0100_0110]);
use nrf24l01_commands::{registers, commands};
// Generate SPI byte sequence
const SPI_BYTES: [u8; 2] = commands::RRegister::<registers::FifoStatus>::bytes();
assert_eq!(SPI_BYTES, [0 | 0x17, 0]);
use nrf24l01_commands::commands;
const PAYLOAD: [u8; 9] = [1, 2, 3, 4, 5, 6, 7, 8, 9];
// Generate SPI byte sequence
const SPI_BYTES: [u8; 10] = commands::WTxPayload(PAYLOAD).bytes();
assert_eq!(SPI_BYTES, [0b1010_0000, 1, 2, 3, 4, 5, 6, 7, 8, 9]);