LibDriver DS18B20
Loading...
Searching...
No Matches
ds18b20 base driver function

ds18b20 base driver modules More...

Collaboration diagram for ds18b20 base driver function:

Data Structures

struct  ds18b20_handle_s
 ds18b20 handle structure definition More...
struct  ds18b20_info_s
 ds18b20 info structure definition More...

Typedefs

typedef struct ds18b20_handle_s ds18b20_handle_t
 ds18b20 handle structure definition
typedef struct ds18b20_info_s ds18b20_info_t
 ds18b20 info structure definition

Enumerations

enum  ds18b20_mode_t { DS18B20_MODE_SKIP_ROM = 0x00 , DS18B20_MODE_MATCH_ROM = 0x01 }
 ds18b20 mode enumeration definition More...
enum  ds18b20_power_mode_t { DS18B20_POWER_MODE_PARASITE = 0x00 , DS18B20_POWER_MODE_EXTERNALLY = 0x01 }
 ds18b20 power mode enumeration definition More...
enum  ds18b20_resolution_t { DS18B20_RESOLUTION_9BIT = 0x00 , DS18B20_RESOLUTION_10BIT = 0x01 , DS18B20_RESOLUTION_11BIT = 0x02 , DS18B20_RESOLUTION_12BIT = 0x03 }
 ds18b20 resolution enumeration definition More...

Functions

uint8_t ds18b20_info (ds18b20_info_t *info)
 get chip's information
uint8_t ds18b20_init (ds18b20_handle_t *handle)
 initialize the chip
uint8_t ds18b20_deinit (ds18b20_handle_t *handle)
 close the chip
uint8_t ds18b20_read (ds18b20_handle_t *handle, int16_t *raw, float *temp)
 read data from the chip
uint8_t ds18b20_set_mode (ds18b20_handle_t *handle, ds18b20_mode_t mode)
 set the chip mode
uint8_t ds18b20_get_mode (ds18b20_handle_t *handle, ds18b20_mode_t *mode)
 get the chip mode
uint8_t ds18b20_set_rom (ds18b20_handle_t *handle, uint8_t rom[8])
 set the handle rom
uint8_t ds18b20_get_rom (ds18b20_handle_t *handle, uint8_t rom[8])
 get the chip rom
uint8_t ds18b20_scratchpad_set_resolution (ds18b20_handle_t *handle, ds18b20_resolution_t resolution)
 set the resolution in the scratchpad
uint8_t ds18b20_scratchpad_get_resolution (ds18b20_handle_t *handle, ds18b20_resolution_t *resolution)
 get the resolution in the scratchpad
uint8_t ds18b20_copy_scratchpad_to_eeprom (ds18b20_handle_t *handle)
 copy the scratchpad content to the eeprom
uint8_t ds18b20_copy_eeprom_to_scratchpad (ds18b20_handle_t *handle)
 copy the eeprom content to the scratchpad

Detailed Description

ds18b20 base driver modules

Typedef Documentation

◆ ds18b20_handle_t

ds18b20 handle structure definition

◆ ds18b20_info_t

ds18b20 info structure definition

Enumeration Type Documentation

◆ ds18b20_mode_t

ds18b20 mode enumeration definition

Enumerator
DS18B20_MODE_SKIP_ROM 

skip rom mode

DS18B20_MODE_MATCH_ROM 

match rom mode

Definition at line 79 of file driver_ds18b20.h.

◆ ds18b20_power_mode_t

ds18b20 power mode enumeration definition

Enumerator
DS18B20_POWER_MODE_PARASITE 

parasite power mode

DS18B20_POWER_MODE_EXTERNALLY 

externally power mode

Definition at line 88 of file driver_ds18b20.h.

◆ ds18b20_resolution_t

ds18b20 resolution enumeration definition

Enumerator
DS18B20_RESOLUTION_9BIT 

9 bit resolution

DS18B20_RESOLUTION_10BIT 

10 bit resolution

DS18B20_RESOLUTION_11BIT 

11 bit resolution

DS18B20_RESOLUTION_12BIT 

12 bit resolution

Definition at line 97 of file driver_ds18b20.h.

Function Documentation

◆ ds18b20_copy_eeprom_to_scratchpad()

uint8_t ds18b20_copy_eeprom_to_scratchpad ( ds18b20_handle_t * handle)

copy the eeprom content to the scratchpad

Parameters
[in]*handlepointer to a ds18b20 handle structure
Returns
status code
  • 0 success
  • 1 copy eeprom to scratchpad failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1164 of file driver_ds18b20.c.

◆ ds18b20_copy_scratchpad_to_eeprom()

uint8_t ds18b20_copy_scratchpad_to_eeprom ( ds18b20_handle_t * handle)

copy the scratchpad content to the eeprom

Parameters
[in]*handlepointer to a ds18b20 handle structure
Returns
status code
  • 0 success
  • 1 copy scratchpad to eeprom failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1078 of file driver_ds18b20.c.

◆ ds18b20_deinit()

uint8_t ds18b20_deinit ( ds18b20_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to a ds18b20 handle structure
Returns
status code
  • 0 success
  • 1 bus deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1392 of file driver_ds18b20.c.

◆ ds18b20_get_mode()

uint8_t ds18b20_get_mode ( ds18b20_handle_t * handle,
ds18b20_mode_t * mode )

get the chip mode

Parameters
[in]*handlepointer to a ds18b20 handle structure
[out]*modepointer to a chip mode buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 368 of file driver_ds18b20.c.

◆ ds18b20_get_rom()

uint8_t ds18b20_get_rom ( ds18b20_handle_t * handle,
uint8_t rom[8] )

get the chip rom

Parameters
[in]*handlepointer to a ds18b20 handle structure
[out]*rompointer to a rom buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 420 of file driver_ds18b20.c.

◆ ds18b20_info()

uint8_t ds18b20_info ( ds18b20_info_t * info)

get chip's information

Parameters
[out]*infopointer to a ds18b20 info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 2084 of file driver_ds18b20.c.

◆ ds18b20_init()

uint8_t ds18b20_init ( ds18b20_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to a ds18b20 handle structure
Returns
status code
  • 0 success
  • 1 bus initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
  • 4 reset failed
Note
none

Definition at line 1305 of file driver_ds18b20.c.

◆ ds18b20_read()

uint8_t ds18b20_read ( ds18b20_handle_t * handle,
int16_t * raw,
float * temp )

read data from the chip

Parameters
[in]*handlepointer to a ds18b20 handle structure
[out]*rawpointer to a raw adc buffer
[out]*temppointer to a converted temperature buffer
Returns
status code
  • 0 success
  • 1 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1426 of file driver_ds18b20.c.

◆ ds18b20_scratchpad_get_resolution()

uint8_t ds18b20_scratchpad_get_resolution ( ds18b20_handle_t * handle,
ds18b20_resolution_t * resolution )

get the resolution in the scratchpad

Parameters
[in]*handlepointer to a ds18b20 handle structure
[out]*resolutionpointer to a chip resolution buffer
Returns
status code
  • 0 success
  • 1 scratchpad get resolution failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 653 of file driver_ds18b20.c.

◆ ds18b20_scratchpad_set_resolution()

uint8_t ds18b20_scratchpad_set_resolution ( ds18b20_handle_t * handle,
ds18b20_resolution_t resolution )

set the resolution in the scratchpad

Parameters
[in]*handlepointer to a ds18b20 handle structure
[in]resolutionchip resolution
Returns
status code
  • 0 success
  • 1 scratchpad set resolution failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 469 of file driver_ds18b20.c.

◆ ds18b20_set_mode()

uint8_t ds18b20_set_mode ( ds18b20_handle_t * handle,
ds18b20_mode_t mode )

set the chip mode

Parameters
[in]*handlepointer to a ds18b20 handle structure
[in]modechip mode
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 342 of file driver_ds18b20.c.

◆ ds18b20_set_rom()

uint8_t ds18b20_set_rom ( ds18b20_handle_t * handle,
uint8_t rom[8] )

set the handle rom

Parameters
[in]*handlepointer to a ds18b20 handle structure
[in]*rompointer to a rom buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 394 of file driver_ds18b20.c.