ELEC-C7222
Libraries for ELEC C7222 Course Work
Loading...
Searching...
No Matches
onchip_temperature_sensor.hpp
Go to the documentation of this file.
1
9#ifndef TEMPLATE_ONCHIP_TEMPERATURE_SENSOR_HPP
10#define TEMPLATE_ONCHIP_TEMPERATURE_SENSOR_HPP
11
12#include <memory>
13
14#include "non_copyable.hpp"
15namespace c7222 {
16
34 public:
39
44 bool Initialize();
45
50 float GetCelsius() const;
51
56 float GetFahrenheit() const;
57
61 bool IsInitialized() const {
62 return initialized_;
63 }
70
71 private:
79 static std::unique_ptr<OnChipTemperatureSensor> instance_;
80
84 bool initialized_{false};
85};
86
87} // namespace c7222
88
89#endif // TEMPLATE_ONCHIP_TEMPERATURE_SENSOR_HPP
Disable both copy and move operations.
Definition non_copyable.hpp:75
Reads the RP2040 on-chip temperature sensor via the ADC.
Definition onchip_temperature_sensor.hpp:33
bool IsInitialized() const
Check if the sensor has been initialized.
Definition onchip_temperature_sensor.hpp:61
bool Initialize()
Initialize the ADC and temperature sensor.
float GetFahrenheit() const
Read temperature in degrees Fahrenheit.
float GetCelsius() const
Read temperature in degrees Celsius.
static OnChipTemperatureSensor * GetInstance()
Get the singleton instance.
~OnChipTemperatureSensor()=default
Destructor.
C7222 course abstractions namespace.
Definition ble.hpp:20
Base classes to control copy/move semantics.