Skip to main content

Crate cc1101_embassy

Crate cc1101_embassy 

Source
Expand description

§cc1101-embassy

An async Embassy driver for the CC1101 sub-1 GHz RF transceiver, targeting [embedded-hal] 1.0 and [embedded-hal-async] 1.0.

§Features

  • Async-first design using embedded-hal-async’s Wait trait for GDO pin interrupts
  • Human-readable RadioConfig builder — no raw register values required
  • Hardware CRC, variable or fixed packet length, RSSI/LQI status appending
  • Optional defmt logging behind the defmt feature flag
  • no_std, no heap allocation, works on stable Rust

§Quick start

let config = RadioConfig::new()
    .frequency_hz(433_920_000)
    .baud_rate(38_400)
    .modulation(Modulation::Gfsk)
    .tx_power(TxPower::Dbm0);

let mut radio = Cc1101::new(spi, gdo0, gdo2).await?;
radio.configure(&config).await?;

// Transmit
radio.transmit(b"hello").await?;

// Receive
let mut buf = [0u8; 64];
let packet = radio.receive(&mut buf).await?;
defmt::info!("rssi: {} lqi: {}", packet.rssi_dbm, packet.lqi);

§Wiring (CC1101 SPI)

CC1101 pinRP2040 (example)Notes
VCC3.3 V1.8–3.6 V
GNDGND
CSnGP5Active low chip select (managed by SpiDevice)
SCLKGP2SPI clock
MOSI (SI)GP3SPI MOSI
MISO (SO)GP4SPI MISO (also GDO1)
GDO0GP6Interrupt pin — packet RX/TX done
GDO2GP7Optional — sync word detect / RX threshold

Re-exports§

pub use config::Modulation;
pub use config::PacketLength;
pub use config::RadioConfig;
pub use config::SyncMode;
pub use config::TxPower;
pub use error::Error;

Modules§

config
High-level radio configuration for the CC1101.
error
Error types for the CC1101 driver.

Structs§

Cc1101
Async CC1101 driver.
ReceivedPacket
A received packet, returned by Cc1101::receive.