Skyward boardcore
|
Common class for current sensors. More...
#include <CurrentSensor.h>
Public Member Functions | |
CurrentSensor (std::function< ADCData()> getVoltage, std::function< float(float)> voltageToCurrent) | |
bool | init () override |
Initialize the sensor. | |
bool | selfTest () override |
Check if the sensor is working. | |
![]() | |
Sensor () | |
Sensor (Sensor &&other) | |
virtual | ~Sensor () |
void | sample () override |
Sample the sensor. | |
virtual CurrentData | getLastSample () |
![]() | |
virtual | ~AbstractSensor () |
SensorErrors | getLastError () |
Get last error for debugging purposes. Avoid silent fails. | |
Static Public Attributes | |
static constexpr int | MOVING_AVERAGE_N = 20 |
Protected Member Functions | |
CurrentData | sampleImpl () override |
< Converts the voltage value to pressure | |
Additional Inherited Members | |
![]() | |
using | DataType |
![]() | |
DataType | lastSample |
miosix::FastMutex | mutex |
![]() | |
SensorErrors | lastError = SensorErrors::NO_ERRORS |
Common class for current sensors.
It needs a transfer function to convert the read voltage into current.
Definition at line 37 of file CurrentSensor.h.
|
inline |
Definition at line 42 of file CurrentSensor.h.
|
inlineoverridevirtual |
Initialize the sensor.
Implements Boardcore::AbstractSensor.
Definition at line 49 of file CurrentSensor.h.
|
inlineoverrideprotectedvirtual |
< Converts the voltage value to pressure
Implements Boardcore::Sensor< CurrentData >.
Definition at line 55 of file CurrentSensor.h.
|
inlineoverridevirtual |
Check if the sensor is working.
Implements Boardcore::AbstractSensor.
Definition at line 51 of file CurrentSensor.h.
|
staticconstexpr |
Definition at line 40 of file CurrentSensor.h.