C/C++ API Reference
Loading...
Searching...
No Matches
pw_analog

Oveview

Analog-to-digital converter libraries and utilities. Main docs: https://pigweed.dev/pw_analog.

Classes

class  pw::analog::AnalogInput
 
struct  pw::analog::AnalogInput::Limits
 
class  pw::analog::MicrovoltInput
 
struct  pw::analog::MicrovoltInput::References
 

Functions

Result< int32_t > pw::analog::AnalogInput::TryReadFor (chrono::SystemClock::duration timeout)
 
virtual Result< int32_t > pw::analog::AnalogInput::TryReadUntil (chrono::SystemClock::time_point deadline)=0
 
virtual Limits pw::analog::AnalogInput::GetLimits () const =0
 
Result< int32_t > pw::analog::MicrovoltInput::TryReadMicrovoltsFor (chrono::SystemClock::duration timeout)
 
Result< int32_t > pw::analog::MicrovoltInput::TryReadMicrovoltsUntil (chrono::SystemClock::time_point deadline)
 

Variables

int32_t pw::analog::AnalogInput::Limits::min
 The minimum of the sample range.
 
int32_t pw::analog::AnalogInput::Limits::max
 The maximum of the sample range.
 
int32_t pw::analog::MicrovoltInput::References::max_voltage_uv
 Microvolts at AnalogInput::Limits::max.
 
int32_t pw::analog::MicrovoltInput::References::min_voltage_uv
 Microvolts at AnalogInput::Limits::min.
 

Function Documentation

◆ GetLimits()

virtual Limits pw::analog::AnalogInput::GetLimits ( ) const
pure virtual
Returns
The range of the ADC sample. These values do not change at runtime.

◆ TryReadFor()

Result< int32_t > pw::analog::AnalogInput::TryReadFor ( chrono::SystemClock::duration  timeout)
inline

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

This method is thread safe.

Returns
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.
* 
*  

◆ 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.
* 
*  

◆ TryReadUntil()

virtual Result< int32_t > pw::analog::AnalogInput::TryReadUntil ( chrono::SystemClock::time_point  deadline)
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.

Returns
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.
* 
*