49 |
49 |
50 static const char * TAG = "ds18b20"; |
50 static const char * TAG = "ds18b20"; |
51 static const int T_CONV = 750; // maximum conversion time at 12-bit resolution in milliseconds |
51 static const int T_CONV = 750; // maximum conversion time at 12-bit resolution in milliseconds |
52 |
52 |
53 // Function commands |
53 // Function commands |
54 #define DS18B20_FUNCTION_TEMP_CONVERT 0x44 |
54 #define DS18B20_FUNCTION_TEMP_CONVERT 0x44 ///< Start temperature conversion |
55 #define DS18B20_FUNCTION_SCRATCHPAD_WRITE 0x4E |
55 #define DS18B20_FUNCTION_SCRATCHPAD_WRITE 0x4E ///< Write scratchpad |
56 #define DS18B20_FUNCTION_SCRATCHPAD_READ 0xBE |
56 #define DS18B20_FUNCTION_SCRATCHPAD_READ 0xBE ///< Read scratchpad |
57 #define DS18B20_FUNCTION_SCRATCHPAD_COPY 0x48 |
57 #define DS18B20_FUNCTION_SCRATCHPAD_COPY 0x48 ///< Copy scratchpad |
58 #define DS18B20_FUNCTION_EEPROM_RECALL 0xB8 |
58 #define DS18B20_FUNCTION_EEPROM_RECALL 0xB8 ///< EEPROM recall |
59 #define DS18B20_FUNCTION_POWER_SUPPLY_READ 0xB4 |
59 #define DS18B20_FUNCTION_POWER_SUPPLY_READ 0xB4 ///< Read powersupply mode |
60 |
60 |
61 /// @cond ignore |
61 /// @cond ignore |
62 typedef struct |
62 typedef struct |
63 { |
63 { |
64 uint8_t temperature[2]; // [0] is LSB, [1] is MSB |
64 uint8_t temperature[2]; // [0] is LSB, [1] is MSB |