37 lines
778 B
Rust
37 lines
778 B
Rust
use crate::hardware::Hardware;
|
|
use anyhow::Result;
|
|
use log::info;
|
|
use rppal::gpio::Gpio;
|
|
use rppal::spi::SimpleHalSpiDevice;
|
|
|
|
const CLOCK_3MHZ: u32 = 3_000_000;
|
|
|
|
pub struct RaspiHardware {
|
|
gpio: Gpio,
|
|
}
|
|
|
|
impl RaspiHardware {
|
|
pub fn new() -> Result<Self> {
|
|
let device = rppal::system::DeviceInfo::new()?;
|
|
info!(
|
|
"Running on Raspberry Pi Emulated Hardware Model {} with {}",
|
|
device.model(),
|
|
device.soc()
|
|
);
|
|
|
|
Ok(Self {
|
|
gpio: Gpio::new()?,
|
|
// spi_bno085: Spi::new(
|
|
// Bus::Spi1,
|
|
// SlaveSelect::Ss0,
|
|
// CLOCK_3MHZ,
|
|
// Mode::Mode3,
|
|
// )?
|
|
})
|
|
}
|
|
}
|
|
|
|
impl Hardware for RaspiHardware {
|
|
|
|
}
|