LibDriver DS18B20
Loading...
Searching...
No Matches
driver_ds18b20.h File Reference

driver ds18b20 header file More...

#include <stdint.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for driver_ds18b20.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

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

Macros

#define DS18B20_MAX_SEARCH_SIZE   64
 ds18b20 max search size definition
#define DRIVER_DS18B20_LINK_INIT(HANDLE, STRUCTURE)
 initialize ds18b20_handle_t structure
#define DRIVER_DS18B20_LINK_BUS_INIT(HANDLE, FUC)
 link bus_init function
#define DRIVER_DS18B20_LINK_BUS_DEINIT(HANDLE, FUC)
 link bus_deinit function
#define DRIVER_DS18B20_LINK_BUS_READ(HANDLE, FUC)
 link bus_read function
#define DRIVER_DS18B20_LINK_BUS_WRITE(HANDLE, FUC)
 link bus_write function
#define DRIVER_DS18B20_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_DS18B20_LINK_DELAY_US(HANDLE, FUC)
 link delay_us function
#define DRIVER_DS18B20_LINK_ENABLE_IRQ(HANDLE, FUC)
 link enable_irq function
#define DRIVER_DS18B20_LINK_DISABLE_IRQ(HANDLE, FUC)
 link disable_irq function
#define DRIVER_DS18B20_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

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
uint8_t ds18b20_scratchpad_set_alarm_threshold (ds18b20_handle_t *handle, int8_t threshold_high, int8_t threshold_low)
 set the alarm threshold in the scratchpad
uint8_t ds18b20_scrachpad_get_alarm_threshold (ds18b20_handle_t *handle, int8_t *threshold_high, int8_t *threshold_low)
 get the alarm threshold in the scratchpad
uint8_t ds18b20_alarm_convert_to_register (ds18b20_handle_t *handle, float temp, int8_t *reg)
 convert the alarm temperature to the register data
uint8_t ds18b20_alarm_convert_to_data (ds18b20_handle_t *handle, int8_t reg, float *temp)
 convert the register data to the alarm temperature
uint8_t ds18b20_search_rom (ds18b20_handle_t *handle, uint8_t(*rom)[8], uint8_t *num)
 search the ds18b20 rom
uint8_t ds18b20_search_alarm (ds18b20_handle_t *handle, uint8_t(*rom)[8], uint8_t *num)
 search the ds18b20 alarm rom
uint8_t ds18b20_get_power_mode (ds18b20_handle_t *handle, ds18b20_power_mode_t *power_mode)
 get the power mode

Detailed Description

driver ds18b20 header file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
2.0.0
Author
Shifeng Li
Date
2021-04-06

history

Date Version Author Description
2021/04/06 2.0 Shifeng Li format the code
2020/12/20 1.0 Shifeng Li first upload

Definition in file driver_ds18b20.h.