nrfcxx
0.1.0
C++-17 Framework for Nordic nRF5 Devices
|
ADC instance to measure board Vdd. More...
#include <nrfcxx/sensor/adc.hpp>
Public Types | |
using | vdd_callback_bi = std::function< void(unsigned int vdd_mV)> |
Type for a function invoked from the ADC IRQ to provide the calculated VDD. More... | |
Public Types inherited from nrfcxx::periph::ADCClient | |
using | flags_type = unsigned int |
Type for client-specific flags. | |
using | queued_callback_type = std::function< void(int rc)> |
Signature for application notification of completed queue operation. More... | |
using | peripheral = ADC::peripheral |
using | mutex_type = peripheral::mutex_type |
Mutex required to inhibit ADC interrupts. | |
Public Member Functions | |
vdd (vdd_callback_bi callback=nullptr) | |
Construct an instance that measures board Vdd. More... | |
int | convert_adc16_mV (unsigned int vdd_adc16) const |
Convert a measured voltage to VDD voltage. More... | |
unsigned int | vdd_mV () const |
Return the result of the most recent measurement. More... | |
Public Member Functions inherited from nrfcxx::periph::ADCClient | |
virtual | ~ADCClient () |
Release the peripheral when the client is destructed. | |
int | claim () |
Attempt to claim exclusive use of the ADC peripheral. More... | |
int | release () |
Release the ADC peripheral. More... | |
int | calibrate (const notifier_type ¬ify={}) |
Calibrate the ADC. More... | |
virtual int | sample_setup () |
Overridable function to set up for an ADC measurement. More... | |
virtual void | sample_teardown () |
Reverse the effects of sample_setup_(). More... | |
int | sample (const notifier_type ¬ify={}) |
Trigger a client-specific collection. More... | |
int | queue (const notifier_type ¬ify, const queued_callback_type &qnotify={}, bool calibrate=false) |
Queue an operation to be initiated as soon as the ADC becomes available. More... | |
int | queue (bool calibrate=false) |
Overload when no notifications are required. More... | |
Additional Inherited Members | |
Protected Types inherited from nrfcxx::periph::ADCClient | |
enum | flags_e : flags_type { FL_QUEUED_SAMPLE = 0x0001, FL_QUEUED_CALIBRATE = 0x0002, FL_QUEUED_Msk = FL_QUEUED_SAMPLE | FL_QUEUED_CALIBRATE, FL_SUBCLASS_BASE = 0x0010 } |
Defined values for flags. More... | |
Protected Member Functions inherited from nrfcxx::periph::ADCClient | |
int | sample_bi_ (const notifier_type ¬ify) |
Implements sample() given that the mutex is already held. | |
void | complete_queue_bi_ () |
virtual int | nrf51_next_bi_ (size_t ci) |
Function used to reconfigure ADC for next sample within the collection. More... | |
Static Protected Member Functions inherited from nrfcxx::periph::ADCClient | |
static void | process_queue_bi_ () |
Protected Attributes inherited from nrfcxx::periph::ADCClient | |
flags_type | flags_ = 0 |
Flags for use by the core infrastructure and client specifications. More... | |
ADC instance to measure board Vdd.
using nrfcxx::sensor::adc::vdd::vdd_callback_bi = std::function<void(unsigned int vdd_mV)> |
Type for a function invoked from the ADC IRQ to provide the calculated VDD.
vdd_mV | the calculated Vdd expressed in millivolts. |
|
inline |
Construct an instance that measures board Vdd.
callback | optional callback to provide the result to the application. This is invoked after the result has been stored in the instance. If no callback is provided there is no notification that the result has completed. |
int nrfcxx::sensor::adc::vdd::convert_adc16_mV | ( | unsigned int | vdd_adc16 | ) | const |
Convert a measured voltage to VDD voltage.
vdd_adc16 | the measured voltage in 16-bit ADC counts. |
|
inline |
Return the result of the most recent measurement.
The value is zeroed on successful invocation of trigger(), and is set to the measured Vdd value only when conversion completes.