rasProject_01 / weSweetHome
R. 240
process control / RasPi software by weinert-automation
|
Functions for 1-wire sensors. More...
Functions | |
int | getTemp (oneWireDevice_t *const tempSensor) |
Get temperature. More... | |
void | initTempSensor (oneWireDevice_t *const tempSensor, char const *const name, char const *const valueFile) |
Initialise a 1-wire sensor structure. More... | |
Functions for 1-wire sensors.
Revision history
See file include/we1wire.h
int getTemp | ( | oneWireDevice_t *const | tempSensor | ) |
Get temperature.
This function tries a new measurement on the 1-wire temperature sensor provided. On success the new value is returned. On failure the last good value is returned, but at most 7 times after 7 good readings before. On total failure -99900 (-99.9 °C, 0 K, BAD_TEMP_READ) is returned.
Additionally on temperature changes, the integer reading (.value) and the floating point string (valueGrdC[]) will be set in the structure.
tempSensor | pointer to the sensor's structure |
void initTempSensor | ( | oneWireDevice_t *const | tempSensor, |
char const *const | name, | ||
char const *const | valueFile | ||
) |
Initialise a 1-wire sensor structure.
This function does basic initial settings for a 1-wire temperature sensor. tempSensor.name and tempSensor.valueFile are set by the respective parameters.
The temperature values are set to bad value; see BAD_TEMP_READ and BAD_TEMP_FLOAT
tempSensor | pointer to the sensor's structure (never NULL!) |
name | the sensor's short name or its directory name; NULL / empty: no change |
valueFile | the canonical absolute path to its value file; NULL / empty: no change |