theCore C++ embedded framework
ecl::sensor::fc28< PowerPin > Class Template Reference

FC-28 Soil Humidity/Moisture Sensor class. More...

#include </home/travis/build/forGGe/theCore/dev/sensor/fc28/export/dev/sensor/fc28.hpp>

Static Public Member Functions

static void power_on ()
 Power-on the sensor. More...
 
static void power_off ()
 Power-off the sensor. More...
 
template<typename St , typename Rt >
static err get_moisture (St sample, Rt resolution, fc28_defs::moisture_type &moisture)
 Gets moisture value based on previously converted ADC sample. More...
 

Detailed Description

template<typename PowerPin = ecl::empty_gpio>
class ecl::sensor::fc28< PowerPin >

FC-28 Soil Humidity/Moisture Sensor class.

Template Parameters
PowerPinPower GPIO connected to the power input of FC-28.

According to what can be found in Web, power pin must be capable to supply around as 20-30 ma at 5V. In practice, 3V is enough too. If sensor is connected directly to the power output pin on the board and there is no way to control it (usually it is always "on") then ecl::empty_gpio can be used in a place of PowerPin.

ADC control
ADC must be controlled outside of this sensor. This is required to avoid any race conditions when multiple sensors access the same ADC. To convert ADC sample to the moisture value, use get_moisture() routine.

Member Function Documentation

◆ power_on()

template<typename PowerPin >
void ecl::sensor::fc28< PowerPin >::power_on ( )
static

Power-on the sensor.

◆ power_off()

template<typename PowerPin >
void ecl::sensor::fc28< PowerPin >::power_off ( )
static

Power-off the sensor.

◆ get_moisture()

template<typename PowerPin >
template<typename St , typename Rt >
err ecl::sensor::fc28< PowerPin >::get_moisture ( St  sample,
Rt  resolution,
fc28_defs::moisture_type moisture 
)
static

Gets moisture value based on previously converted ADC sample.

Template Parameters
StSample type.
RtResolution type.
Parameters
[in]sampleADC sample.
[in]resolutionADC resolution, in bits.
[out]moistureResulting moisture. Valid value can be read only if operation is successfull.
Returns
Status of operation. err::ok indicates successfull operation.

The documentation for this class was generated from the following file: