* Rework hal initialization * Turn sw interrupt control into a virtual peripheral * Return a tuple instead of a named struct * Fix docs * Remove SystemClockControl * Move software interrupts under interrupt * Re-document what's left in system * Update time docs * Update sw int docs * Introduce Config * Fix tests * Remove redundant inits * Doc * Clean up examples&tests * Update tests * Add changelog entry * Start migration guide * Restore some convenience-imports * Remove Config from prelude
36 lines
841 B
Rust
36 lines
841 B
Rust
//% CHIPS: esp32c6 esp32h2
|
|
|
|
#![no_std]
|
|
#![no_main]
|
|
|
|
use esp_backtrace as _;
|
|
use esp_hal::prelude::*;
|
|
use esp_ieee802154::{Config, Ieee802154};
|
|
use esp_println::println;
|
|
|
|
#[entry]
|
|
fn main() -> ! {
|
|
let (mut peripherals, _clocks) = esp_hal::init(esp_hal::Config::default());
|
|
let mut ieee802154 = Ieee802154::new(peripherals.IEEE802154, &mut peripherals.RADIO_CLK);
|
|
|
|
ieee802154.set_config(Config {
|
|
channel: 15,
|
|
promiscuous: false,
|
|
rx_when_idle: true,
|
|
auto_ack_rx: true,
|
|
auto_ack_tx: true,
|
|
pan_id: Some(0x4242),
|
|
short_addr: Some(0x2323),
|
|
..Default::default()
|
|
});
|
|
|
|
println!("Start receiving:");
|
|
ieee802154.start_receive();
|
|
|
|
loop {
|
|
if let Some(frame) = ieee802154.get_received() {
|
|
println!("Received {:?}\n", &frame);
|
|
}
|
|
}
|
|
}
|