Skip to content

How to pass mpu9250 handle to a function #37

@liebman

Description

@liebman

Maybe I'm missing something as my rust-foo is new. I'm trying to pass ownership to a function. The receiving function is declared as:

    pub fn new<E, DEV, MODE>(mpu: Mpu9250<DEV, MODE>) -> Result<IMU, Box<dyn Error>> 
    where 
        DEV: Device<Error = E>

Yet when I attempt to call the mpu.all() I get this:

error[E0599]: no method named `all` found for struct `Mpu9250<DEV, MODE>` in the current scope
  --> src/imu.rs:40:63
   |
40 |                     let data: ImuMeasurements<[f32; 3]> = mpu.all()?;
   |                                                               ^^^ method not found in `Mpu9250<DEV, MODE>`
   |
   = note: the method was found for
           - `Mpu9250<DEV, Imu>`
           - `Mpu9250<DEV, Marg>`

Any idea on what I'm doing wrong? (I've tried many variations on the signature)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions