use crate::lowlevel::quickstate::get_general_quickstate;
pub fn radio_receive(output: &mut Vec<u64>)
{
let inbox_count = get_general_quickstate().read_i32(672);
output.clear();
output.reserve(inbox_count as usize);
if inbox_count == 0 {
return;
}
unsafe
{
let start = output.as_mut_ptr();
let count = radio_rx(start, (output.capacity() as i32) * 8);
assert_eq!(inbox_count, count);
output.set_len(count as usize);
}
}
pub fn radio_receive_filter(filter: u64, mask: u64)
{
unsafe
{
radio_rx_filter(filter, mask);
}
}
pub fn radio_transmit(message: u64, range: f32)
{
unsafe
{
radio_tx(message, range);
}
}
pub fn radio_pack(bytes: [u8;8]) -> u64
{
return u64::from_be_bytes(bytes);
}
pub fn radio_unpack(value: u64) -> [u8;8]
{
return u64::to_be_bytes(value);
}
protologic_define_extern!(pub(crate) fn radio_tx(message: u64, range: f32));
protologic_define_extern!(pub(crate) fn radio_rx(addr: *mut u64, bytes: i32) -> i32);
protologic_define_extern!(pub(crate) fn radio_rx_filter(filter: u64, mask: u64));