Interp

Trait Interp 

Source
pub trait Interp: Sealed {
    // Required methods
    fn pop(&mut self) -> u32;
    fn peek(&self) -> u32;
    fn set_base(&mut self, v: u32);
    fn get_base(&self) -> u32;
    fn set_base_1and0(&mut self, v: u32);
}
Expand description

Trait representing the functionality of an interpolator.

use rp235x_hal::{
    self as hal,
    sio::{Lane, LaneCtrl, Sio},
};
let mut peripherals = hal::pac::Peripherals::take().unwrap();
let mut sio = Sio::new(peripherals.SIO);

// by having the configuration const, the validity is checked during compilation.
const config: u32 = LaneCtrl {
    mask_msb: 4, // Most significant bit of the mask is bit 4
    // By default the least significant bit is bit 0
    // this will keep only the 5 least significant bits.
    // this is equivalent to %32
    ..LaneCtrl::new()
}
.encode();
sio.interp0.get_lane0().set_ctrl(config);
sio.interp0.get_lane0().set_accum(0);
sio.interp0.get_lane0().set_base(1); // will increment the value by 1 on each call to pop

sio.interp0.get_lane0().peek(); // returns 1
sio.interp0.get_lane0().pop(); // returns 1
sio.interp0.get_lane0().pop(); // returns 2
sio.interp0.get_lane0().pop(); // returns 3

Required Methods§

Source

fn pop(&mut self) -> u32

Read the interpolator result (Result 2 in the datasheet), and simultaneously write lane results to both accumulators.

Source

fn peek(&self) -> u32

Read the interpolator result (Result 2 in the datasheet) without altering any internal state

Source

fn set_base(&mut self, v: u32)

Write to the interpolator Base register (Base2 in the datasheet)

Source

fn get_base(&self) -> u32

Read the interpolator Base register (Base2 in the datasheet)

Source

fn set_base_1and0(&mut self, v: u32)

Write the lower 16 bits to BASE0 and the upper bits to BASE1 simultaneously. Each half is sign-extended to 32 bits if that lane’s SIGNED flag is set

Implementors§