upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
Go to the source code of this file.
Data Structures | |
struct | _ds18b20_context |
Functions | |
ds18b20_context | ds18b20_init (unsigned int uart) |
void | ds18b20_close (ds18b20_context dev) |
void | ds18b20_update (const ds18b20_context dev, int index) |
float | ds18b20_get_temperature (const ds18b20_context dev, unsigned int index) |
void | ds18b20_set_resolution (const ds18b20_context dev, unsigned int index, DS18B20_RESOLUTIONS_T res) |
void | ds18b20_copy_scratchpad (const ds18b20_context dev, unsigned int index) |
void | ds18b20_recall_eeprom (const ds18b20_context dev, unsigned int index) |
unsigned int | ds18b20_devices_found (const ds18b20_context dev) |
const uint8_t * | ds18b20_get_id (const ds18b20_context dev, unsigned int index) |
Typedefs | |
typedef struct _ds18b20_info_t | ds18b20_info_t |
typedef struct _ds18b20_context * | ds18b20_context |
ds18b20_context ds18b20_init | ( | unsigned int | uart | ) |
This function will initilaize and search the 1-wire bus and store information on each DS18B20 device detected on the bus. If no devices are found, NULL is returned. Once this function completes successfully, you can use ds18b20_devices_found() to determine how many devices were detected.
void ds18b20_close | ( | ds18b20_context | dev | ) |
Close the device and deallocate all resources.
void ds18b20_update | ( | const ds18b20_context | dev, |
int | index | ||
) |
Update our stored temperature for a device. This method must be called prior to ds18b20_get_temperature().
index | The device index to access (starts at 0). Specify -1 to query all detected devices. Default: -1 |
float ds18b20_get_temperature | ( | const ds18b20_context | dev, |
unsigned int | index | ||
) |
Get the current temperature. ds18b20_update() must have been called prior to calling this method.
index | The device index to access (starts at 0). |
void ds18b20_set_resolution | ( | const ds18b20_context | dev, |
unsigned int | index, | ||
DS18B20_RESOLUTIONS_T | res | ||
) |
Set the device resolution for a device. These devices support 9, 10, 11, and 12 bits of resolution, with the default from the factory at 12 bits.
index | The device index to access (starts at 0). |
res | One of the DS18B20_RESOLUTIONS_T values |
void ds18b20_copy_scratchpad | ( | const ds18b20_context | dev, |
unsigned int | index | ||
) |
Copy the device's scratchpad memory to the EEPROM. This includes the configuration byte (resolution).
index | The device index to access (starts at 0). |
void ds18b20_recall_eeprom | ( | const ds18b20_context | dev, |
unsigned int | index | ||
) |
Copy the device's EEPROM memory to the scratchpad. This method will return when the copy completes. This operation is performed by the device automatically on power up, so it is rarely needed.
index | The device index to access (starts at 0). |
unsigned int ds18b20_devices_found | ( | const ds18b20_context | dev | ) |
This method will return the number of DS18B20 devices that were found on the bus by ds18b20_init().
const uint8_t* ds18b20_get_id | ( | const ds18b20_context | dev, |
unsigned int | index | ||
) |
Return an 8 byte string representing the unique device ID (1-wire romcode) for a given device index. The pointer returned is statically allocated and will be overwritten on each call.
index | The device index to access (starts at 0). |
typedef struct _ds18b20_context * ds18b20_context |
Device context