OneWireBus_ROMCode ds18b20_read_rom(DS18B20_Info *ds18b20_info)
Read 64-bit ROM code from device - only works when there is a single device on the bus.
void ds18b20_init_solo(DS18B20_Info *ds18b20_info, const OneWireBus *bus)
Initialise a device info instance as a solo device on the bus.
bool ds18b20_set_resolution(DS18B20_Info *ds18b20_info, DS18B20_RESOLUTION resolution)
Set temperature measurement resolution.
void ds18b20_init(DS18B20_Info *ds18b20_info, const OneWireBus *bus, OneWireBus_ROMCode rom_code)
Initialise a device info instance with the specified GPIO.
void ds18b20_free(DS18B20_Info **ds18b20_info)
Delete an existing device info instance.
DS18B20_RESOLUTION ds18b20_read_resolution(DS18B20_Info *ds18b20_info)
Update and return the current temperature measurement resolution from the device.
float ds18b20_wait_for_conversion(const DS18B20_Info *ds18b20_info)
Wait for the maximum conversion time according to the current resolution of the device....
DS18B20_ERROR ds18b20_read_temp(const DS18B20_Info *ds18b20_info, float *value)
Read last temperature measurement from device.
DS18B20_RESOLUTION
Symbols for the supported temperature resolution of the device.
@ DS18B20_RESOLUTION_10_BIT
10-bit resolution, LSB bits 1,0 undefined
@ DS18B20_RESOLUTION_12_BIT
12-bit resolution (default)
@ DS18B20_RESOLUTION_11_BIT
11-bit resolution, LSB bit 0 undefined
@ DS18B20_RESOLUTION_9_BIT
9-bit resolution, LSB bits 2,1,0 undefined
@ DS18B20_RESOLUTION_INVALID
Invalid resolution.
DS18B20_ERROR
Success and error codes.
@ DS18B20_ERROR_UNKNOWN
An unknown error occurred, or the value was not set.
@ DS18B20_ERROR_NULL
A parameter or value is NULL.
@ DS18B20_ERROR_DEVICE
A device error occurred.
@ DS18B20_ERROR_CRC
A CRC error occurred.
@ DS18B20_ERROR_OWB
A One Wire Bus error occurred.
DS18B20_ERROR ds18b20_check_for_parasite_power(const OneWireBus *bus, bool *present)
Check OneWire bus for presence of parasitic-powered devices.
void ds18b20_convert_all(const OneWireBus *bus)
Start temperature conversion on all connected devices.
void ds18b20_use_crc(DS18B20_Info *ds18b20_info, bool use_crc)
Enable or disable use of CRC checks on device communications.
DS18B20_ERROR ds18b20_convert_and_read_temp(const DS18B20_Info *ds18b20_info, float *value)
Convert, wait and read current temperature from device.
bool ds18b20_convert(const DS18B20_Info *ds18b20_info)
Start a temperature measurement conversion on a single device.
DS18B20_Info * ds18b20_malloc(void)
Construct a new device info instance. New instance should be initialised before calling other functio...
Interface definitions for the 1-Wire bus component.
Structure containing information related to a single DS18B20 device connected via a 1-Wire bus.
DS18B20_RESOLUTION resolution
Temperature measurement resolution per reading.
bool init
True if struct has been initialised, otherwise false.
const OneWireBus * bus
Pointer to 1-Wire bus information relevant to this device.
OneWireBus_ROMCode rom_code
The ROM code used to address this device on the bus.
bool use_crc
True if CRC checks are to be used when retrieving information from a device on the bus.
bool solo
True if device is intended to be the only one connected to the bus, otherwise false.
Structure containing 1-Wire bus information relevant to a single instance.
Represents a 1-Wire ROM Code. This is a sequence of eight bytes, where the first byte is the family n...