Skip to content
Prev Previous commit
Merge branch 'master' into stanley/DHT22-sensor
  • Loading branch information
Stanlist authored Jul 10, 2022
commit fb3d53fcc598b6ff06dd9e94312694a7d4fc965c
10 changes: 10 additions & 0 deletions libs/sensors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,13 @@ target_link_libraries(DHT22
Sensor
mbed-os
)

add_library(PollingSensors STATIC)
target_sources(PollingSensors PRIVATE src/PollingSensors.cpp)
target_include_directories(PollingSensors PUBLIC include)
target_link_libraries(PollingSensors
PRIVATE
Sensor
mbed-os
Logger
)
42 changes: 35 additions & 7 deletions libs/sensors/include/PollingSensors.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,41 @@
#include "Sensor.h"
#include "mbed.h"

namespace Sensor {
class PollingSensors final : Sensor {
public:
PollingSensors(PinName clk, PinName miso, PinName cs = NC);
float read() override;
float alternateRead() override;
bool getStatus() const override;
[[nodiscard]] bool reset() override;
[[nodiscard]] bool update() override;
// Add functions specific to sensor modules
PollingSensors(PinName moisture_in, PinName co2_in);

float read() override {}

float alternateRead() override {}

bool getStatus() const override {}

[[nodiscard]] bool reset() override {}

[[nodiscard]] bool update() override {}

/* Functions specific to sensor modules*/

/* This function returns Moisture sensor value
* 0-300 - dry
* 300-700 - humid
* 700-900 - wet
* Returns -1 for fault
* */
float moisture_monitoring();

/* This function returns CO2 sensor value in ppm\
* Returns -1 for fault and 0 for preheating
* */
float C02_monitoring();

private:
/*Pins configuration for moisture sensing*/
AnalogIn m_moisture_in_adc;

/*Pins configuration for CO2 sensing*/
AnalogIn m_CO2_in_adc;
};
} // namespace Sensor
You are viewing a condensed version of this merge commit. You can view the full changes here.