// SPDX-License-Identifier: Apache-2.0 // Copyright (c) 2012-2024 Scott Penrose and WII5 Buoy contributors // // This file is part of WII5 Buoy firmware. // See LICENSE for full terms. /** * @file WII5Weather_18B20.h * @brief Dallas DS18B20 temperature sensor driver (OneWire). */ #ifndef WII5Weather_18B20_h #define WII5Weather_18B20_h #include #include #include class WII5Weather_18B20 : public WII5Power { public: WII5Weather_18B20() {} virtual WII5_CONTROLLERS controllerId() {return WII5CONTROLLER_DRIVER;} virtual WII5_DRIVERS driverId() {return WII5DRIVER_WEATHER_18B20;} void begin(); void loop(); bool temperatureRead(); elapsedMillis age; int32_t value; protected: byte data[12]; byte addr[8]; float currentTemperature; elapsedMillis stepWait; }; extern OneWire ds; extern WII5Weather_18B20 wii5Weather_18B20; #endif