From caadba420518d041e14570bf6669443fd805c47b Mon Sep 17 00:00:00 2001 From: EmanueleDajko Date: Fri, 24 Nov 2023 15:36:47 +0100 Subject: [PATCH 1/2] Add Temp def. class for temperature sensor --- smart_bridge/src/components/api/Temp.h | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 smart_bridge/src/components/api/Temp.h diff --git a/smart_bridge/src/components/api/Temp.h b/smart_bridge/src/components/api/Temp.h new file mode 100644 index 0000000..7b7f869 --- /dev/null +++ b/smart_bridge/src/components/api/Temp.h @@ -0,0 +1,29 @@ +#ifndef __TEMP__ +#define __TEMP__ + +/** + * @class Temp + * @brief This class represents a temperature sensor. + * + * It provides functionalities to get the temperature. + */ +class Temp +{ + +public: + /** + * @brief Construct a new Temp object + * + * @param pin The pin number where the temperature sensor is connected. + */ + Temp(int pin); + +private: + /** + * @brief The pin number where the temperature sensor is connected. + * + */ + int tempPin; +}; + +#endif // __TEMP__ From 6aaf361f99ae9e018bd6f1593d458b242ab7a1c1 Mon Sep 17 00:00:00 2001 From: EmanueleDajko Date: Fri, 24 Nov 2023 15:37:01 +0100 Subject: [PATCH 2/2] Add Temp class implementation --- smart_bridge/src/components/impl/Temp.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 smart_bridge/src/components/impl/Temp.cpp diff --git a/smart_bridge/src/components/impl/Temp.cpp b/smart_bridge/src/components/impl/Temp.cpp new file mode 100644 index 0000000..4b0e17f --- /dev/null +++ b/smart_bridge/src/components/impl/Temp.cpp @@ -0,0 +1,9 @@ +#include "../api/Temp.h" +#include "config/config.h" +#include "Arduino.h" + +Temp::Temp(int pin) +{ + this->tempPin = TMP_PIN; + pinMode(tempPin, INPUT); +} \ No newline at end of file