![]() |
LibDriver DS18B20
|
driver ds18b20 source file More...
#include "driver_ds18b20.h"Go to the source code of this file.
Macros | |
| #define | CHIP_NAME "Maxim Integrated DS18B20" |
| chip information definition | |
| #define | MANUFACTURER_NAME "Maxim Integrated" |
| #define | SUPPLY_VOLTAGE_MIN 3.0f |
| #define | SUPPLY_VOLTAGE_MAX 5.5f |
| #define | MAX_CURRENT 4.0f |
| #define | TEMPERATURE_MIN -55.0f |
| #define | TEMPERATURE_MAX 125.0f |
| #define | DRIVER_VERSION 2000 |
| #define | DS18B20_CMD_SEARCH_ROM 0xF0 |
| chip command definition | |
| #define | DS18B20_CMD_READ_ROM 0x33 |
| #define | DS18B20_CMD_MATCH_ROM 0x55 |
| #define | DS18B20_CMD_SKIP_ROM 0xCC |
| #define | DS18B20_CMD_ALARM_SEARCH 0xEC |
| #define | DS18B20_CMD_CONVERT_T 0x44 |
| #define | DS18B20_CMD_WRITE_SCRATCHPAD 0x4E |
| #define | DS18B20_CMD_READ_SCRATCHPAD 0xBE |
| #define | DS18B20_CMD_COPY_SCRATCHPAD 0x48 |
| #define | DS18B20_CMD_RECALL_EE 0xB8 |
| #define | DS18B20_CMD_READ_POWER_SUPPLY 0xB4 |
Functions | |
| 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_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_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_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_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_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 | |
| uint8_t | ds18b20_info (ds18b20_info_t *info) |
| get chip's information | |
Variables | |
| const uint8_t | gc_ds18b20_crc_table [256] |
| crc table | |
driver ds18b20 source 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.
| 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.c.
| #define CHIP_NAME "Maxim Integrated DS18B20" |
| #define DRIVER_VERSION 2000 |
driver version
Definition at line 50 of file driver_ds18b20.c.
| #define DS18B20_CMD_ALARM_SEARCH 0xEC |
alarm search command
Definition at line 59 of file driver_ds18b20.c.
| #define DS18B20_CMD_CONVERT_T 0x44 |
convert command
Definition at line 60 of file driver_ds18b20.c.
| #define DS18B20_CMD_COPY_SCRATCHPAD 0x48 |
copy scratchpad command
Definition at line 63 of file driver_ds18b20.c.
| #define DS18B20_CMD_MATCH_ROM 0x55 |
match rom command
Definition at line 57 of file driver_ds18b20.c.
| #define DS18B20_CMD_READ_POWER_SUPPLY 0xB4 |
read power supply command
Definition at line 65 of file driver_ds18b20.c.
| #define DS18B20_CMD_READ_ROM 0x33 |
read rom command
Definition at line 56 of file driver_ds18b20.c.
| #define DS18B20_CMD_READ_SCRATCHPAD 0xBE |
read scratchpad command
Definition at line 62 of file driver_ds18b20.c.
| #define DS18B20_CMD_RECALL_EE 0xB8 |
recall ee command
Definition at line 64 of file driver_ds18b20.c.
| #define DS18B20_CMD_SEARCH_ROM 0xF0 |
| #define DS18B20_CMD_SKIP_ROM 0xCC |
skip rom command
Definition at line 58 of file driver_ds18b20.c.
| #define DS18B20_CMD_WRITE_SCRATCHPAD 0x4E |
write scratchpad command
Definition at line 61 of file driver_ds18b20.c.
| #define MANUFACTURER_NAME "Maxim Integrated" |
manufacturer name
Definition at line 44 of file driver_ds18b20.c.
| #define MAX_CURRENT 4.0f |
chip max current
Definition at line 47 of file driver_ds18b20.c.
| #define SUPPLY_VOLTAGE_MAX 5.5f |
chip max supply voltage
Definition at line 46 of file driver_ds18b20.c.
| #define SUPPLY_VOLTAGE_MIN 3.0f |
chip min supply voltage
Definition at line 45 of file driver_ds18b20.c.
| #define TEMPERATURE_MAX 125.0f |
chip max operating temperature
Definition at line 49 of file driver_ds18b20.c.
| #define TEMPERATURE_MIN -55.0f |
chip min operating temperature
Definition at line 48 of file driver_ds18b20.c.
| const uint8_t gc_ds18b20_crc_table[256] |
crc table
Definition at line 70 of file driver_ds18b20.c.