Pigweed
 
Loading...
Searching...
No Matches
pw::analog::MicrovoltInput Class Referenceabstract

#include <microvolt_input.h>

Inheritance diagram for pw::analog::MicrovoltInput:
pw::analog::AnalogInput

Classes

struct  References
 

Public Member Functions

Result< int32_t > TryReadMicrovoltsFor (chrono::SystemClock::duration timeout)
 
Result< int32_t > TryReadMicrovoltsUntil (chrono::SystemClock::time_point deadline)
 
- Public Member Functions inherited from pw::analog::AnalogInput
Result< int32_t > TryReadFor (chrono::SystemClock::duration timeout)
 
virtual Result< int32_t > TryReadUntil (chrono::SystemClock::time_point deadline)=0
 
virtual Limits GetLimits () const =0
 

Detailed Description

The common interface for obtaining voltage samples in microvolts. This interface represents a single voltage input or channel. Users will need to supply their own ADC driver implementation in order to provide the reference voltages and to configure and enable the ADC peripheral where needed. Users are responsible for managing multi-threaded access to the ADC driver if the ADC services multiple channels.

Member Function Documentation

◆ TryReadMicrovoltsFor()

Result< int32_t > pw::analog::MicrovoltInput::TryReadMicrovoltsFor ( chrono::SystemClock::duration  timeout)
inline

Blocks until the specified timeout duration has elapsed or the voltage sample has been returned, whichever comes first.

This method is thread-safe.

Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns a voltage sample in microvolts (uV) on success.
* 
*     RESOURCE_EXHAUSTED: ADC peripheral in use.
* 
*     DEADLINE_EXCEEDED: Timed out waiting for a sample.
* 
*  Other statuses left up to the implementer.
* 
*  

◆ TryReadMicrovoltsUntil()

Result< int32_t > pw::analog::MicrovoltInput::TryReadMicrovoltsUntil ( chrono::SystemClock::time_point  deadline)
inline

Blocks until the deadline time has been reached or the voltage sample has been returned, whichever comes first.

This method is thread-safe.

Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns a voltage sample in microvolts (uV) on success.
* 
*     RESOURCE_EXHAUSTED: ADC peripheral in use.
* 
*     DEADLINE_EXCEEDED: Timed out waiting for a sample.
* 
*  Other statuses left up to the implementer.
* 
*  

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