10#ifndef SEMF_INPUT_SENSOR_ANALOGDMASENSOR_H_
11#define SEMF_INPUT_SENSOR_ANALOGDMASENSOR_H_
30template <
typename T,
size_t N_CHANNELS = 1>
49 void onDataAvailable();
58 size_t m_dataSize = 0;
60 SEMF_SLOT(m_onDataAvailableSlot,
AnalogDmaSensor, *
this, onDataAvailable);
63template <
typename T,
size_t N_CHANNELS>
65: m_analogInDma(analogInDma),
67 m_dataSize(bufferSize)
70 for (
size_t i = 0; i < N_CHANNELS; i++)
72 m_buffers[i].setBuffer(
buffer, bufferSize);
73 m_buffers[i].setPos(i);
74 m_buffers[i].setStride(N_CHANNELS);
77template <
typename T,
size_t N_CHANNELS>
80 m_analogInDma.start(
reinterpret_cast<uint8_t*
>(m_data), m_dataSize *
sizeof(T));
83template <
typename T,
size_t N_CHANNELS>
86 return m_buffers[index];
89template <
typename T,
size_t N_CHANNELS>
92 for (
size_t i = 0; i < N_CHANNELS; i++)
Provides data from an AnalogInDma to one to more Sensor objects.
virtual ~AnalogDmaSensor()=default
AnalogDmaSensor(AnalogInDma &analogInDma, T buffer[], size_t bufferSize)
Constructor.
LastInBuffer< T > & buffer(size_t index) override
Returns the buffer, where the measurement data is stored in.
AnalogDmaSensor(const AnalogDmaSensor &other)=delete
Interface for using ADC (Analog to Digital Conversion) hardware in DMA (Direct Memory Access) mode.
Base class for sensor hardware like analog sensor. By calling update(), a measurement cycle gets trig...
The LastInBuffer class implements a kind of circular buffer.
The LastInDmaBuffer class implements a kind of circular buffer.
void connect(SlotBase< Arguments... > &slot)
Connect a method to the signal.