[][src]Function mynewt::hw::sensor::read

pub fn read(
    sensor: *mut sensor,
    type_: sensor_type_t,
    data_func: sensor_data_func_t,
    arg: Ptr,
    timeout: u32
) -> MynewtResult<()>

Read the data for sensor type "type," from the given sensor and return the result into the "value" parameter.

  • sensor: The sensor to read data from
  • type: The type of sensor data to read from the sensor
  • data_func: The callback to call for data returned from that sensor
  • arg: The argument to pass to this callback.
  • timeout: Timeout before aborting sensor read

Return: 0 on success, non-zero on failure.