#include <analog_input.h>
Classes | |
struct | Limits |
Public Member Functions | |
Result< int32_t > | TryReadFor (chrono::SystemClock::duration timeout) |
virtual Result< int32_t > | TryReadUntil (chrono::SystemClock::time_point deadline)=0 |
virtual Limits | GetLimits () const =0 |
Base interface for getting analog-to-digital (ADC) samples from one ADC channel in a thread-safe manner.
The ADC backend interface is up to the user to define and implement for now. This gives flexibility for the ADC driver implementation.
AnalogInput
controls a specific input / channel where the ADC peripheral may be shared across multiple channels that may be controlled by multiple threads. The implementer of this pure virtual interface is responsible for ensuring thread safety and access at the driver level.
|
pure virtual |
|
inline |
Blocks until the specified timeout duration has elapsed or the ADC sample has been returned, whichever comes first.
This method is thread safe.
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: Returns a sample. * * RESOURCE_EXHAUSTED: ADC peripheral in use. * * DEADLINE_EXCEEDED: Timed out waiting for a sample. * * Other statuses left up to the implementer. * *
|
pure virtual |
Blocks until the deadline time has been reached or the ADC sample has been returned, whichever comes first.
This method is thread safe.
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: Returns a sample on success. * * RESOURCE_EXHAUSTED: ADC peripheral in use. * * DEADLINE_EXCEEDED: Timed out waiting for a sample. * * Other statuses left up to the implementer. * *