![]() |
semf
|
Offers an simple way for implementing a SensorConverter
class for simple conversion functions by handing over an lambda function in the constructor.
More...
#include <simplesensorconverter.h>
Public Types | |
typedef T_CONVERTED(* | function) (T_RAW) |
Public Member Functions | |
SimpleSensorConverter (HardwareSensor< T_RAW > &hardwareSensor, size_t index, function convertFunction) | |
Constructor. More... | |
SimpleSensorConverter (const SimpleSensorConverter &other)=delete | |
virtual | ~SimpleSensorConverter ()=default |
![]() | |
SensorConverter (HardwareSensor< T_RAW > &hardwareSensor, size_t index) | |
Constructor. More... | |
virtual | ~SensorConverter ()=default |
![]() | |
virtual | ~Sensor ()=default |
virtual T_CONVERTED | currentValue () const =0 |
Returns the last measured converted value. More... | |
virtual T_CONVERTED | averageValue () const =0 |
Returns the converted value of the average measured raw values. More... | |
virtual void | update ()=0 |
Triggers the sensor hardware to start a measurement cycle. More... | |
Additional Inherited Members | |
![]() | |
Signal | dataAvailable |
virtual T_CONVERTED | convert (T_RAW value) const =0 |
Converts a raw sensor measurement value from HardwareSensor into the required format. More... | |
Offers an simple way for implementing a SensorConverter
class for simple conversion functions by handing over an lambda function in the constructor.
Example: SimpleSensorConverter<uint16_t, double> simpleSensorConverter(analogSensor, 0, [](uint16_t value){return value*1.5;});
T_RAW | Type of a raw sensor value, e.g. uint16_t for a 16-bit ADC value. |
T_CONVERTED | Type of an application/usable sensor value which has an unit, e.g. float for temperature [°C]. |
SensorValueConverter
Sensor
HardwareSensor
Definition at line 31 of file simplesensorconverter.h.
typedef T_CONVERTED(* semf::SimpleSensorConverter< T_RAW, T_CONVERTED >::function) (T_RAW) |
Typedef for lambda function pointer.
Definition at line 35 of file simplesensorconverter.h.
semf::SimpleSensorConverter< T_RAW, T_CONVERTED >::SimpleSensorConverter | ( | HardwareSensor< T_RAW > & | hardwareSensor, |
size_t | index, | ||
function | convertFunction | ||
) |
Constructor.
hardwareSensor | Sensor hardware object. |
index | Index of specific sensor. |
convertFunction | Lambda for converting T_RAW to T_CONVERTED via convert() function. |
Definition at line 54 of file simplesensorconverter.h.
|
explicitdelete |
|
virtualdefault |