Skip to main content

pamoja_ds18b20_parse_w1_slave

Function pamoja_ds18b20_parse_w1_slave 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_ds18b20_parse_w1_slave( text: *const c_char, out_reading: *mut PamojaDs18b20Reading, ) -> PamojaStatus
Expand description

Decodes the text the Linux kernel’s w1_therm driver serves for a DS18B20, the contents of its w1_slave file: the scratchpad in hex with the kernel’s CRC verdict, then the temperature.

§Arguments

  • text - the file’s contents, a null-terminated string.
  • out_reading - receives the reading.

§Returns

PamojaStatus::Ok with *out_reading filled in; PamojaStatus::Codec when the kernel or this decoder rejects the CRC, or the text is not in the driver’s format; or PamojaStatus::InvalidArgument for a null or non-UTF-8 argument.

§Safety

text must be a null-terminated string or null, and out_reading a writable pointer or null.