let pmw3610_config = Pmw3610Config {
res_cpi: 800,
// force_awake: true,
smart_mode: true,
swap_xy: true,
// invert_x: true,
// invert_y: true,
..Default::default()
};
let pmw3610_sck = Output::new(p.P0_05, Level::High, OutputDrive::Standard);
let pmw3610_sdio = Flex::new(p.P0_04);
let pmw3610_cs = Output::new(p.P0_09, Level::High, OutputDrive::Standard);
let pmw3610_motion = Some(Input::new(p.P0_02, Pull::Up));
// or if you want to omit the motion pin:
// let pmw3610_motion = Option::<Input<'static>>::None;
let pmw3610_spi = BitBangSpiBus::new(pmw3610_sck, pmw3610_sdio);
let mut pmw3610_device = Pmw3610Device::new(
pmw3610_spi,
pmw3610_cs,
pmw3610_motion,
pmw3610_config,
);
// If you want to customize the report rate (Hz):
// let mut pmw3610_device = Pmw3610Device::with_report_hz(
// pmw3610_spi,
// pmw3610_cs,
// pmw3610_motion,
// pmw3610_config,
// 125,
// );
run_devices! (
(matrix, pmw3610_device) => EVENT_CHANNEL,
),