| // Copyright 2022 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef FUCHSIA_SDK_EXAMPLES_CC_I2C_TEMPERATURE_H_ |
| #define FUCHSIA_SDK_EXAMPLES_CC_I2C_TEMPERATURE_H_ |
| |
| #include <lib/driver2/driver2_cpp.h> |
| |
| #include "i2c_channel.h" |
| |
| namespace i2c_temperature { |
| |
| // Sample driver for a virtual temperature sensor device connected to an I2C bus controller. |
| class I2cTemperatureDriver : public driver::DriverBase { |
| public: |
| I2cTemperatureDriver(driver::DriverStartArgs start_args, fdf::UnownedDispatcher driver_dispatcher) |
| : driver::DriverBase("i2c-temperature", std::move(start_args), std::move(driver_dispatcher)) { |
| } |
| |
| virtual ~I2cTemperatureDriver() = default; |
| |
| zx::result<> Start() override; |
| |
| private: |
| zx::result<> SetupI2cChannel(); |
| |
| std::shared_ptr<I2cChannel> i2c_channel_; |
| }; |
| |
| } // namespace i2c_temperature |
| |
| #endif // FUCHSIA_SDK_EXAMPLES_CC_I2C_TEMPERATURE_H_ |