40template <
class T,
class ExpectedDataType>
42 : std::is_base_of<ExpectedDataType,
43 typename std::remove_reference<
44 decltype(std::declval<T>().getLastSample())>::type>
89template <
typename Data>
123 miosix::Lock<miosix::FastMutex> l(
mutex);
133 miosix::Lock<miosix::FastMutex> l(
mutex);
147template <
typename Data, u
int32_t FifoSize>
150 using Super = Sensor<Data>;
175 const std::array<Data, FifoSize>
getLastFifo(uint16_t& lastFifoSize)
177 miosix::Lock<miosix::FastMutex> l(Super::mutex);
Base abstract class for sensor drivers.
virtual void sample()=0
Sample the sensor.
virtual bool selfTest()=0
Check if the sensor is working.
SensorErrors getLastError()
Get last error for debugging purposes. Avoid silent fails.
virtual ~AbstractSensor()
virtual bool init()=0
Initialize the sensor.
Interface for sensor that implement a FIFO.
const std::array< Data, FifoSize > getLastFifo(uint16_t &lastFifoSize)
std::array< Data, FifoSize > lastFifo
uint64_t interruptTimestampDelta
uint64_t lastInterruptTimestamp
SensorFIFO(SensorFIFO &&other)
virtual void IRQupdateTimestamp(uint64_t ts)
Called by the interrupt handling routine: provides the timestamp of the last interrupt (if FIFO is di...
Base sensor class with has to be extended by any sensor driver.
virtual DataType sampleImpl()=0
Read a data sample from the sensor. In case of errors, the method should return the last available co...
void sample() override
Sample the sensor.
virtual Data getLastSample()
This file includes all the types the logdecoder script will decode.
SensorErrors
Generic error codes that a sensor can generate.
Check that a given type has a method called getData() and that the return type of this method is a su...