rw007
中文 | English
Rust driver for RW007 SPI WiFi module.
Introduction
RW007 is a high-speed SPI/UART WiFi module based on Cortex-M4 WiFi SoC, developed by Shanghai Positive Electronic Technology Co., Ltd. This crate provides a no_std Rust driver for the RW007 module using the SPI interface.
Features
no_stdcompatible - works on bare metal embedded systems- Blocking API using
embedded-hal1.0 traits - Async API using
embedded-hal-async(withasyncfeature) - Embassy integration with
embassy-net-driver-channel - WiFi operations: scan, connect, disconnect, get RSSI
- Full SPI two-phase transfer protocol implementation
Hardware
The RW007 module requires the following connections:
| Pin | Description |
|---|---|
| SPI_CLK | SPI Clock |
| SPI_MOSI | SPI Master Out Slave In |
| SPI_MISO | SPI Master In Slave Out |
| CS | Chip Select (directly directly by driver) |
| RST | Reset (directly controlled by driver) |
| INT | Interrupt / Data Ready indicator |
| VCC | 3.3V Power |
| GND | Ground |
Note: CS pin directly controlled by the driver to support the two-phase SPI protocol.
Usage
Add to your Cargo.toml:
[]
= "0.1"
# For async support with Embassy
= { = "0.1", = ["async"] }
# For defmt logging
= { = "0.1", = ["defmt"] }
Blocking Example
use ;
// Create driver with SPI, CS, RST, INT pins
let mut wifi = new;
// Reset and initialize the module
wifi.reset?;
wifi.init?;
// Get firmware version
let version = wifi.get_version?;
println!;
// Scan for WiFi networks
let results = wifi.scan?;
for ap in results.as_slice
// Connect to WiFi
wifi.join?;
Async Example (with Embassy)
use ;
use ;
use StaticCell;
static STATE: = new;
static RESOURCES: = new;
async
async !
async !
Features
| Feature | Description |
|---|---|
defmt |
Enable defmt logging support |
async |
Enable async driver with Embassy support |
Supported Operations
| Operation | Blocking | Async |
|---|---|---|
| Reset | ✅ | ✅ |
| Init | ✅ | ✅ |
| Get Version | ✅ | ✅ |
| Get MAC | ✅ | ✅ |
| Scan | ✅ | ❌ |
| Connect | ✅ | ✅ |
| Disconnect | ✅ | ✅ |
| Get RSSI | ✅ | ✅ |
| TCP/UDP (via embassy-net) | - | ✅ |
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
References
- RT-Thread RW007 Package - Original C driver for RT-Thread
- RW007 Module Documentation