semf
semf::HardwareSensor< T_RAW > Class Template Referenceabstract

Base class for sensor hardware like analog sensor. By calling update(), a measurement cycle gets triggered and the dataAvailable signal will be emitted after completion. The buffer() function provides the raw sensor data to the Sensor class. By using the LastInBuffer class the access is thread save. Multiple Sensor respectively SensorConverter objects can be connected to one HardwareSensor. More...

#include <hardwaresensor.h>

Collaboration diagram for semf::HardwareSensor< T_RAW >:
Collaboration graph

Public Member Functions

virtual ~HardwareSensor ()=default
 
virtual void update ()=0
 
virtual LastInBuffer< T_RAW > & buffer (size_t index)=0
 Returns the buffer, where the measurement data is stored in. More...
 

Public Attributes

Signal< size_t > dataAvailable
 

Detailed Description

template<typename T_RAW>
class semf::HardwareSensor< T_RAW >

Base class for sensor hardware like analog sensor. By calling update(), a measurement cycle gets triggered and the dataAvailable signal will be emitted after completion. The buffer() function provides the raw sensor data to the Sensor class. By using the LastInBuffer class the access is thread save. Multiple Sensor respectively SensorConverter objects can be connected to one HardwareSensor.

Template Parameters
T_RAWType of a raw sensor value, e.g. uint16_t for a 16-bit ADC value.
See also
AnalogSensor
AnalogDmaSensor
Sensor

Definition at line 30 of file hardwaresensor.h.

Constructor & Destructor Documentation

◆ ~HardwareSensor()

template<typename T_RAW >
virtual semf::HardwareSensor< T_RAW >::~HardwareSensor ( )
virtualdefault

Member Function Documentation

◆ buffer()

template<typename T_RAW >
virtual LastInBuffer< T_RAW > & semf::HardwareSensor< T_RAW >::buffer ( size_t  index)
pure virtual

Returns the buffer, where the measurement data is stored in.

Parameters
indexIndex of a specific sensor.
Returns
Buffer.

Implemented in semf::AnalogDmaSensor< T, N_CHANNELS >, and semf::AnalogSensor< T, N_CHANNELS >.

◆ update()

template<typename T_RAW >
virtual void semf::HardwareSensor< T_RAW >::update ( )
pure virtual

Starts a measurement cycle and will emit dataAvailable afterwards.

Implemented in semf::AnalogDmaSensor< T, N_CHANNELS >, and semf::AnalogSensor< T, N_CHANNELS >.

Member Data Documentation

◆ dataAvailable

template<typename T_RAW >
Signal<size_t> semf::HardwareSensor< T_RAW >::dataAvailable

Will be emitted after a measurement cycle finished.

Definition at line 45 of file hardwaresensor.h.