Skip to main content

rx_buf

Function rx_buf 

Source
pub fn rx_buf(i2s: ove_i2s_t) -> Option<*const u8>
Expand description

Pointer to the most recently completed RX half-buffer, or None if the handle is invalid / no buffer has been filled yet.

Call from within the RX callback. The pointed-to memory is [half_buf_size] bytes long and remains valid until the next stop or destroy on the same handle. To read the samples:

if let Some(p) = ove::i2s::rx_buf(i2s) {
    let n = ove::i2s::half_buf_size(i2s);
    let samples = unsafe { core::slice::from_raw_parts(p, n) };
    /* ... */
}