Skip to content

WannSea/bno085

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bno085

Inspired by bno080 library but rebuilt from scratch and different (although also not optimal) architecture. Allows for more control which helps due to our BNO085 being a bit unstable and we need to handle resets:

    let rpi_interface = rppal::i2c::I2c::new().unwrap();
    let interface = I2CInterface::new(rpi_interface);
    let mut driver = BnoDriver::new(interface);
    driver.setup();
    driver.soft_reset().unwrap();

    loop {
       match driver.receive_packet() {
        Ok(res) => match res {
            bno085::bno_packet::BnoPacket::ChannelExec(ce) => match ce {
                bno085::bno_packet::ChannelExecutableData::ResetComplete => {
                    // Enable reports after reset
                    driver.enable_report(bno_constants::SENSOR_REPORTID_ACCEL, 50, 49).unwrap();
                    driver.enable_report(bno_constants::SENSOR_REPORTID_GYRO_CALIBRATED, 50, 49).unwrap();
                },
                bno085::bno_packet::ChannelExecutableData::Unknown(_) => {},
            },
            bno085::bno_packet::BnoPacket::SensorReports(reports) => {
                println!("Reports: {:?}", reports.len());
            },
            _ => {}
        },
        Err(err) => println!("Error {:?}", err)
       }
        sleep(Duration::from_millis(50));
    }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages