Skip to content

Commit

Permalink
WIP-example
Browse files Browse the repository at this point in the history
  • Loading branch information
wprzytula committed Jun 18, 2024
1 parent 170eda2 commit 97bb61c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions examples/ieee802154.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//! An example showing use of IEEE 802.15.4 networking.
#![no_main]
#![no_std]
use libtock::ieee802154::{
Ieee802154, RxBufferAlternatingOperator, RxRingBuffer, RxSingleBufferOperator,
};
use libtock::runtime::{set_main, stack_size};

set_main! {main}
stack_size! {0x400}

fn main() {
Ieee802154::radio_on().unwrap();

rx_single_buffer();

rx_alternating_buffers();
}

fn rx_single_buffer() {
let mut operator = RxSingleBufferOperator::<2>::new();
let frame = operator.receive_frame().unwrap();
}

fn rx_alternating_buffers() {
let mut buf1 = RxRingBuffer::<2>::new();
let mut buf2 = RxRingBuffer::<2>::new();

let mut operator = RxBufferAlternatingOperator::new(&mut buf1, &mut buf2);
let frame = operator.receive_frame().unwrap();
}

0 comments on commit 97bb61c

Please sign in to comment.