Files
templates/c/ds18b20-ds2480/ds18b20_ds2480.h

33 lines
1.4 KiB
C

#ifndef DS18B20_DS2480_H
#define DS18B20_DS2480_H
#include "ds2480.h"
#ifdef __cplusplus
extern "C" {
#endif
/** Find next DS18B20, skipping other families; same cursor rules as bridge. */
ds2480_status ds18b20_ds2480_next(ds2480 *bus, ds2480_search *search);
/** Start conversion and hold strong pullup for 750 ms (all resolutions).
* rom=NULL broadcasts: use only on a bus containing exclusively DS18B20.
* Supports external and parasite power within the bridge's current budget.
*/
ds2480_status ds18b20_ds2480_convert(ds2480 *bus, const uint8_t rom[8]);
/** Read and validate all 9 scratchpad bytes. Output is unchanged on error.
* rom is mandatory, must have family 0x28 and valid CRC.
*/
ds2480_status ds18b20_ds2480_read(ds2480 *bus, const uint8_t rom[8], uint8_t scratchpad[9]);
/** Read last conversion in signed 1/16 Celsius units; masks undefined bits
* for 9/10/11-bit resolution. Call convert first: power-on 85 C is ambiguous.
* Output is unchanged on error. Does not start a conversion itself.
*/
ds2480_status ds18b20_ds2480_temperature(ds2480 *bus, const uint8_t rom[8], int16_t *raw);
/** Set TH/TL and resolution (9..12); verify by reading back.
* save!=0 copies to EEPROM with 12 ms strong pullup; avoid frequent writes.
*/
ds2480_status ds18b20_ds2480_configure(ds2480 *bus, const uint8_t rom[8],
int8_t th, int8_t tl, uint8_t resolution, uint8_t save);
#ifdef __cplusplus
}
#endif
#endif