feasible second core sensor impl
This commit is contained in:
parent
7a918e2b65
commit
088e0225ca
1 changed files with 459 additions and 270 deletions
|
|
@ -12,15 +12,17 @@ use log::info;
|
|||
use mpu6050::Mpu6050;
|
||||
use nalgebra::Vector3;
|
||||
|
||||
use crate::CHANNEL;
|
||||
|
||||
pub struct SensorHardware {
|
||||
bus_tof: I2c<'static, I2C1, Async>,
|
||||
bus_gyro: I2c<'static, I2C0, Async>,
|
||||
tof2enable: Output<'static>,
|
||||
pub bus_tof: I2c<'static, I2C1, Async>,
|
||||
pub bus_gyro: I2c<'static, I2C0, Async>,
|
||||
pub tof2enable: Output<'static>,
|
||||
}
|
||||
|
||||
pub fn sensor_manager(mut hardware: SensorHardware) -> ! {
|
||||
let executor = Executor::new();
|
||||
let executor: &'static mut Executor = unsafe{transmute(&executor)};
|
||||
let mut executor = Executor::new();
|
||||
let executor: &'static mut Executor = unsafe{transmute(&mut executor)};
|
||||
executor.run(move |spawner| {
|
||||
spawner.spawn(init_sensors(hardware)).unwrap();
|
||||
});
|
||||
|
|
@ -35,7 +37,8 @@ enum PollState {
|
|||
Gyro,
|
||||
}
|
||||
|
||||
struct SensorData {
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct SensorData {
|
||||
/// distance, mm
|
||||
tof1: Option<u16>,
|
||||
/// distance, mm
|
||||
|
|
@ -95,8 +98,6 @@ async fn init_sensors(mut hardware: SensorHardware) {
|
|||
}
|
||||
POLL_STATE.store(PollState::None as u8, Ordering::SeqCst);
|
||||
|
||||
|
||||
|
||||
|
||||
CHANNEL.send(data.clone()).await;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue