Skyward boardcore
Loading...
Searching...
No Matches
Boardcore::TrafagPressureSensor Class Reference

Sensor class for a Trafag pressure sensor. More...

#include <TrafagPressureSensor.h>

Inheritance diagram for Boardcore::TrafagPressureSensor:
Collaboration diagram for Boardcore::TrafagPressureSensor:

Public Member Functions

 TrafagPressureSensor (std::function< ADCData()> getVoltage, float shuntResistance, float maxPressure, float minCurrent=4, float maxCurrent=20)
 Construct a TrafagPressureSensor.
 
bool init () override
 Initialize the sensor.
 
bool selfTest () override
 Check if the sensor is working.
 
- Public Member Functions inherited from Boardcore::Sensor< PressureData >
 Sensor ()
 
 Sensor (Sensor &&other)
 
virtual ~Sensor ()
 
void sample () override
 Sample the sensor.
 
virtual PressureData getLastSample ()
 
- Public Member Functions inherited from Boardcore::AbstractSensor
virtual ~AbstractSensor ()
 
SensorErrors getLastError ()
 Get last error for debugging purposes. Avoid silent fails.
 

Protected Member Functions

PressureData sampleImpl () override
 Read a data sample from the sensor. In case of errors, the method should return the last available correct sample.
 

Additional Inherited Members

- Public Types inherited from Boardcore::Sensor< PressureData >
using DataType
 
- Protected Attributes inherited from Boardcore::Sensor< PressureData >
DataType lastSample
 
miosix::FastMutex mutex
 
- Protected Attributes inherited from Boardcore::AbstractSensor
SensorErrors lastError = SensorErrors::NO_ERRORS
 

Detailed Description

Sensor class for a Trafag pressure sensor.

Definition at line 36 of file TrafagPressureSensor.h.

Constructor & Destructor Documentation

◆ TrafagPressureSensor()

Boardcore::TrafagPressureSensor::TrafagPressureSensor ( std::function< ADCData()> getVoltage,
float shuntResistance,
float maxPressure,
float minCurrent = 4,
float maxCurrent = 20 )
inline

Construct a TrafagPressureSensor.

Parameters
getVoltagelambda to retrieve current voltage.
shuntResistanceshunt resistance value.
maxPressuremaximum pressure of this sensor.
minCurrentcurrent at the 0 pressure point.
maxCurrentcurrent at the maximum pressure point.

Definition at line 48 of file TrafagPressureSensor.h.

Member Function Documentation

◆ init()

bool Boardcore::TrafagPressureSensor::init ( )
inlineoverridevirtual

Initialize the sensor.

Returns
boolean value indicating whether the operation succeded or not

Implements Boardcore::AbstractSensor.

Definition at line 57 of file TrafagPressureSensor.h.

◆ sampleImpl()

PressureData Boardcore::TrafagPressureSensor::sampleImpl ( )
inlineoverrideprotectedvirtual

Read a data sample from the sensor. In case of errors, the method should return the last available correct sample.

Returns
sensor data sample

Implements Boardcore::Sensor< PressureData >.

Definition at line 62 of file TrafagPressureSensor.h.

◆ selfTest()

bool Boardcore::TrafagPressureSensor::selfTest ( )
inlineoverridevirtual

Check if the sensor is working.

Returns
boolean indicating whether the sensor is correctly working or not

Implements Boardcore::AbstractSensor.

Definition at line 59 of file TrafagPressureSensor.h.


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