riot_sys

Type Alias saul_read_t

Source
pub type saul_read_t = Option<unsafe extern "C" fn(dev: *const c_void, res: *mut phydat_t) -> c_int>;
Expand description

@brief Read a value (a set of values) from a device

Simple sensors, as e.g. a temperature sensor, will return exactly one value together with the values scale and unit. Some sensors might return a tuple or triple of data (e.g. a 3-axis accelerometer).

Actuators can chose to either just return -ENOTSUP or to return their current set value (e.g. useful for reading back the current state of a switch)

@param[in] dev device descriptor of the target device @param[out] res data read from the device

@return number of values written into to result data structure [1-3] @return -ENOTSUP if the device does not support this operation @return -ECANCELED on other errors

Aliased Type§

enum saul_read_t {
    None,
    Some(unsafe extern "C" fn(_: *const c_void, _: *mut phydat_t) -> i32),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(_: *const c_void, _: *mut phydat_t) -> i32)

Some value of type T.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 4 bytes

Size for each variant:

  • None: 0 bytes
  • Some: 4 bytes