Merge pull request #10558 from iNavFlight/MrD_Correct-comments-on-OSD-symbols
[inav.git] / src / main / drivers / temperature / ds18b20.h
blobaaecf160d030ed55a5c3ced2111fbb8c0c5f7e7b
2 #pragma once
4 #include <stdint.h>
5 #include <stdbool.h>
6 #include "drivers/1-wire.h"
8 #if defined(USE_1WIRE) && defined(USE_TEMPERATURE_DS18B20)
10 #define USE_TEMPERATURE_SENSOR
11 #define DS18B20_DRIVER_AVAILABLE
13 #define DS18B20_CONFIG_9BIT 0x1F
14 #define DS18B20_CONFIG_10BIT 0x3F
15 #define DS18B20_CONFIG_11BIT 0x5F
16 #define DS18B20_CONFIG_12BIT 0x7F
18 // milliseconds
19 #define DS18B20_9BIT_CONVERSION_TIME 94
20 #define DS18B20_10BIT_CONVERSION_TIME 188
21 #define DS18B20_11BIT_CONVERSION_TIME 375
22 #define DS18B20_12BIT_CONVERSION_TIME 750
25 bool ds18b20Enumerate(owDev_t *owDev, uint64_t *rom_table, uint8_t *rom_table_len);
26 bool ds18b20Configure(owDev_t *owDev, uint64_t rom, uint8_t config);
27 bool ds18b20ParasiticPoweredPresent(owDev_t *owDev, bool *result);
28 bool ds18b20ReadPowerSupply(owDev_t *owDev, uint64_t rom, bool *parasiticPowered);
29 bool ds18b20StartConversionCommand(owDev_t *owDev);
30 bool ds18b20StartConversion(owDev_t *owDev);
31 bool ds18b20WaitForConversion(owDev_t *owDev);
32 bool ds18b20ReadScratchpadCommand(owDev_t *owDev);
33 bool ds18b20ReadTemperatureFromScratchPadBuf(const uint8_t *buf, int16_t *temperature);
34 bool ds18b20ReadTemperature(owDev_t *owDev, uint64_t rom, int16_t *temperature);
36 #endif /* defined(USE_1WIRE) && defined(USE_TEMPERATURE_DS18B20) */