[][src]Type Definition mynewt::hw::sensor::sensor_read_func_t

type sensor_read_func_t = Option<unsafe extern "C" fn(arg1: *mut sensor, arg2: sensor_type_t, arg3: sensor_data_func_t, arg4: *mut c_void, arg5: u32) -> c_int>;

Read a single value from a sensor, given a specific sensor type (e.g. SENSOR_TYPE_PROXIMITY).

  • sensor: The sensor to read from
  • type: The type(s) of sensor values to read. Mask containing that type, provide all, to get all values.
  • data_func: The function to call with each value read. If NULL, it calls all sensor listeners associated with this function.
  • arg: The argument to pass to the read callback.
  • timeout: Timeout. If block until result, specify OS_TIMEOUT_NEVER, 0 returns immediately (no wait.)

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