Skip to content

Polling 802.15.4 API #355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions nrf-hal-common/src/ieee802154.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,29 @@ impl<'c> Radio<'c> {
}
}

pub fn recv_async_start(&mut self, packet: &mut Packet) -> () {
unsafe {
self.start_recv(packet);
}
}

pub fn recv_async_poll(&mut self) -> bool {
self.radio.events_end.read().events_end().bit_is_set()
//self.radio.events_end.reset();
}

pub fn recv_async_sync(&mut self) -> Result<u16, u16> {
self.wait_for_event(Event::End);
dma_end_fence();

let crc = self.radio.rxcrc.read().rxcrc().bits() as u16;
if self.radio.crcstatus.read().crcstatus().bit_is_set() {
Ok(crc)
} else {
Err(crc)
}
}

/// Listens for a packet for no longer than the specified amount of microseconds
/// and copies its contents into the given `packet` buffer
///
Expand Down