Driver interface for the DS18 temperature sensors.
More...
Driver interface for the DS18 temperature sensors.
This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities. Currently the driver has the following limitations:
|
file | ds18_internal.h |
| Internal addresses, registers, constants for DS1822 and DS18B20 temperature sensors.
|
|
file | ds18_params.h |
| Default configuration for DS1822 and DS18B20 temperature sensors.
|
|
file | ds18.h |
| Driver for Maxim Integrated DS1822 and DS18B20 temperature sensors.
|
|
|
#define | DS18_OK (0) |
|
#define | DS18_ERROR (-1) |
|
◆ ds18_get_temperature()
int ds18_get_temperature |
( |
const ds18_t * |
dev, |
|
|
int16_t * |
temperature |
|
) |
| |
convenience function for triggering a conversion and reading the value
- Note
- This function will block for the conversion time. The current implementation of the driver uses 12-bit resolution, so this time is 750 ms.
- Parameters
-
[in] | dev | device descriptor |
[out] | temperature | buffer to write the temperature in centi-degrees |
- Returns
- 0 on success
-
-1 on error
◆ ds18_init()
Initialize a ds18 device.
- Parameters
-
[out] | dev | device descriptor |
[in] | params | ds18 initialization struct |
- Returns
- 0 on success
-
-1 on error
◆ ds18_read()
int ds18_read |
( |
const ds18_t * |
dev, |
|
|
int16_t * |
temperature |
|
) |
| |
Reads the scratchpad for the last conversion.
- Parameters
-
[in] | dev | device descriptor |
[out] | temperature | buffer to write the temperature in centi-degrees |
- Returns
- 0 on success
-
-1 on error
◆ ds18_trigger()
int ds18_trigger |
( |
const ds18_t * |
dev | ) |
|
Triggers a temperature conversion.
- Note
- This also triggers a conversion on all devices connected to the bus
- Parameters
-
- Returns
- 0 on success
-
-1 on error