cargo: replace the 'motion' features with an i2c on/off flag, add a flag to switch between the mpu6050 and the next iteration board with the LSM6DS chip

This commit is contained in:
2026-03-11 14:37:16 +01:00
parent e09649592b
commit 3f87e22585
3 changed files with 4 additions and 10 deletions

View File

@@ -114,7 +114,7 @@ async fn main(spawner: Spawner) {
let mut io = esp_hal::gpio::Io::new(peripherals.IO_MUX);
io.set_interrupt_handler(gpio_interrupt_handler);
#[cfg(feature="motion")]
#[cfg(feature="i2c")]
{
use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice;
use esp_hal::{i2c::master::{Config, I2c}, Async};
@@ -127,12 +127,10 @@ async fn main(spawner: Spawner) {
let scl = peripherals.GPIO3;
let i2c = I2c::new(peripherals.I2C1, Config::default()).unwrap().with_scl(scl).with_sda(sda).into_async();
let i2c_bus = I2C_BUS.init(Mutex::new(i2c));
#[cfg(feature="mpu")]
#[cfg(feature="mpu6050")]
spawner.must_spawn(renderbug_bike::tasks::mpu::mpu_task(motion_bus.dyn_sender(), I2cDevice::new(i2c_bus), imu_interrupt));
#[cfg(feature="gps")]
spawner.must_spawn(renderbug_bike::tasks::gps::gps_task(motion_bus.dyn_sender(), I2cDevice::new(i2c_bus)));
// TODO: Everything i2c should be turned on by default, I guess. we don't need features for individual sensors, but we can keep the option to disable the whole bus for testing purposes
spawner.must_spawn(renderbug_bike::tasks::usb_power::usb_task(I2cDevice::new(i2c_bus), pd_interrupt));
}

View File

@@ -1,6 +1,5 @@
#[cfg(feature="mpu")]
#[cfg(feature="mpu6050")]
pub mod mpu;
#[cfg(feature="gps")]
pub mod gps;
#[cfg(feature="radio")]
pub mod wifi;

View File

@@ -187,9 +187,6 @@ impl<S: Debug + Surface<Uniforms = Uniforms, CoordinateSpace = SegmentSpace, Pix
}
}
#[cfg(not(feature="real-output"))]
pub type UiSurfacePool = NullBufferPool<Uniforms, SegmentSpace, Rgba<u8>>;
#[cfg(feature="real-output")]
pub type UiSurfacePool = BufferedSurfacePool<Uniforms, SegmentSpace, Rgba<u8>>;
#[embassy_executor::task]