|
ADS9324 Driver 0.1.0
API reference
|
Public types of the ADS9324 driver: errors, Result<T>, enumerations, configuration, the data frame and the pure helpers that decode it.
More...
#include <algorithm>#include <array>#include <cstddef>#include <cstdint>#include <span>#include "ads9324_detail.hpp"#include "ads9324_registers.hpp"#include "ads9324_version.h"Go to the source code of this file.
Classes | |
| struct | ads9324::Result< T > |
| The value of a call, or why there is none. More... | |
| struct | ads9324::Result< void > |
| The result of a call that returns no value. More... | |
| struct | ads9324::Window |
| The digital window comparator of one channel (section 7.3.12). More... | |
| struct | ads9324::Input |
| The configuration of one input channel. More... | |
| struct | ads9324::Interface |
| The data interface (GEN_CFG3, XOR_BITS_CTL, GEN_CFG4, DIG_DELAY_CFG1/2). More... | |
| struct | ads9324::ChannelSelect |
| Which channels the data frame carries (ANA_CFG2). More... | |
| struct | ads9324::Filter |
| The digital filter in the data path (DIG_FILTER, GEN_CFG5). More... | |
| struct | ads9324::Alarm |
| The DRDY/ALARM pin (DRDY_ALARM_SEL, GEN_CFG4). More... | |
| struct | ads9324::Sampling |
| CONVST timing and the ready wait (section 5.6). More... | |
| struct | ads9324::Correction |
| System offset and gain correction stages (GEN_CFG5 of the channel banks). More... | |
| struct | ads9324::Calibration |
Calibration at start-up and the mode RunAdcCalibration() uses. More... | |
| struct | ads9324::TestPattern |
| A test pattern of one channel group (TP_CFG, TP_AIN). More... | |
| struct | ads9324::DaisyChain |
Daisy chain settings: out of scope in this version, Validate() refuses enabled. More... | |
| struct | ads9324::Supply |
| Supplies in millivolts for the range checks; 0 means "not stated". More... | |
| struct | ads9324::Config |
Everything EnsureInitialized() and ApplyConfig() write to the chip. More... | |
| struct | ads9324::WindowFlags |
| The latched digital window comparator flags, one bit per channel (bit 0 is AIN1). More... | |
| class | ads9324::CheckedConfig |
| A configuration proven valid when the program is built. An invalid one does not compile. More... | |
| struct | ads9324::Frame |
| One decoded data frame. More... | |
Namespaces | |
| namespace | ads9324 |
The ADS9324 driver: everything it declares lives here; internals in detail. | |
Functions | |
| constexpr const char * | ads9324::ToString (Error error) noexcept |
| The name of an error, for logs. | |
| constexpr bool | ads9324::IsValid (InputType v) noexcept |
| Whether an input type holds a documented code. | |
| constexpr bool | ads9324::IsValid (InputRange v) noexcept |
| Whether an input range holds a documented code. | |
| constexpr bool | ads9324::IsValid (WordLength v) noexcept |
| Whether a word length holds a documented code (01b is reserved). | |
| constexpr bool | ads9324::IsValid (AlarmFunction v) noexcept |
| Whether an alarm function holds a documented code. | |
| constexpr bool | ads9324::IsValid (FirFilter v) noexcept |
| Whether a FIR filter holds a documented code (110b is reserved). | |
| constexpr bool | ads9324::IsValid (PatternKind v) noexcept |
| Whether a test pattern kind holds a documented code (only 0 and 2 are reachable). | |
| constexpr bool | ads9324::IsValid (CalibrationMode v) noexcept |
| Whether a calibration mode holds a documented code. | |
| constexpr std::array< Input, 16 > | ads9324::DefaultInputs () noexcept |
The default settings of the 16 inputs, spelled out because GCC skips nested member initialisers in inputs{}. | |
| constexpr Config | ads9324::ChipResetConfig () noexcept |
The chip's reset state as a Config: eight lanes on D7 to D0, everything else as Config{}. | |
| constexpr Error | ads9324::Validate (const Config &c) noexcept |
| Check a configuration against the documented ranges and combinations, with no I/O. | |
| constexpr int | ads9324::GetDriverVersionMajor () noexcept |
| constexpr int | ads9324::GetDriverVersionMinor () noexcept |
| constexpr int | ads9324::GetDriverVersionPatch () noexcept |
| constexpr const char * | ads9324::GetDriverVersion () noexcept |
| constexpr uint32_t | ads9324::AverageFactor (AverageLength length) noexcept |
| The averaging factor of a length code: 1, 2, 4, 6, 8, 10, 12, 16, 20, 32, 64, 128. | |
| constexpr uint32_t | ads9324::FirDecimation (FirFilter fir) noexcept |
| The decimation of a FIR filter (Table 7-9). | |
| constexpr uint32_t | ads9324::ResultsPerOutput (const Filter &filter) noexcept |
| Samples that make one result of the digital filter in the data path. | |
| constexpr uint32_t | ads9324::PulsesPerResult (const Filter &filter) noexcept |
| CONVST falling edges the chip needs for one result. | |
| constexpr uint32_t | ads9324::OutputRateHz (const Config &config) noexcept |
| Result rate of the data interface in hertz. | |
| constexpr uint32_t | ads9324::ConversionTimeUs (const Config &config) noexcept |
| Time from the start of a conversion to a ready result, rounded up to microseconds, at least 2. | |
| constexpr int16_t | ads9324::OffsetCorrectionFor (int32_t expected_code, int32_t measured_code) noexcept |
| The OFS value that removes a measured offset (equation 1, section 7.3.9). | |
| constexpr int16_t | ads9324::GainCorrectionFor (int32_t expected_code, int32_t measured_code) noexcept |
| The GAN value that removes a measured gain error (equations 2 to 4, section 7.3.9). | |
| constexpr int32_t | ads9324::RangeMillivolts (InputRange range) noexcept |
| Full-scale voltage of a range in millivolts. | |
| constexpr int32_t | ads9324::CodeToMicrovolts (int32_t code, InputRange range) noexcept |
Microvolts of a signed code: code x full scale / 32768, rounded half away from zero. | |
| constexpr int16_t | ads9324::ToSigned16 (uint16_t raw) noexcept |
| Reinterpret a 16-bit wire value as a signed code (two's complement). | |
| constexpr int16_t | ads9324::WireToCode (uint16_t raw, DataFormat format) noexcept |
| The signed code of a wire value. | |
| constexpr uint16_t | ads9324::DerandomizeMask (uint8_t prbs) noexcept |
| The XOR mask of the randomizer (equations 7 and 8, section 7.3.14.4). | |
| constexpr uint32_t | ads9324::FrameChannels (const ChannelSelect &select) noexcept |
| Number of channels in a frame. | |
| constexpr uint8_t | ads9324::FrameSlotChannel (const ChannelSelect &select, uint32_t slot) noexcept |
| Which channel a slot of the frame carries (Table 7-12). | |
| constexpr bool | ads9324::HasDiagByte (const Interface &interface) noexcept |
| Whether the frame ends with a DIAG byte: asked for, or implied by the randomizer (the datasheet shows the PRBS byte only together with the DIAG byte, assumption A14). | |
| constexpr std::size_t | ads9324::FrameBytes (const Interface &interface, const ChannelSelect &select) noexcept |
| Bytes of one data frame (section 7.3.14). | |
| constexpr bool | ads9324::IsStuckFrame (std::span< const uint8_t > bytes) noexcept |
| Whether a data frame could come from a stuck or floating line: every byte 0x00 or every byte 0xFF (hardware lessons, KB-CPP-116). | |
Variables | |
| constexpr uint8_t | ads9324::kAlarmSourceDrdy = 0x01 |
Sources of the OR output; bit n of Alarm::sources is the source with code n. | |
| constexpr uint8_t | ads9324::kAlarmSourceWindow = 0x02 |
| Source code 1, window alert. | |
| constexpr uint8_t | ads9324::kAlarmSourceCalDone = 0x40 |
| Source code 6, ADC calibration done. | |
| constexpr uint16_t | ads9324::kDeviceId = 0x0004 |
| DEVICE_ID value of every ADS9324. | |
| constexpr uint32_t | ads9324::kPowerUpMs = 30 |
| Power-up wait before the first access, tPU (section 5.7). | |
| constexpr uint32_t | ads9324::kResetMs = 30 |
| Wait after a reset before the first access (tPU, A3). | |
| constexpr uint32_t | ads9324::kResetPulseUs = 1000 |
| Shortest RESET low pulse the driver drives (a design choice, section 7.4.1). | |
| constexpr uint32_t | ads9324::kConvstMinHz = 100'000 |
| Lowest CONVST frequency, fCONVST (section 5.6). | |
| constexpr uint32_t | ads9324::kConvstMaxHz = 1'000'000 |
| Highest CONVST frequency, fCONVST. | |
| constexpr uint32_t | ads9324::kConvstHighMinNs = 50 |
| Shortest CONVST high time. | |
| constexpr uint32_t | ads9324::kConvstLowMinNs = 50 |
| Shortest CONVST low time. | |
| constexpr uint32_t | ads9324::kDrdyLowDelayNs = 350 |
| Delay from the CONVST falling edge to the DRDY falling edge. | |
| constexpr uint32_t | ads9324::kConversionNs = 1250 |
| Conversion time without oversampling, tCONV. | |
| constexpr uint32_t | ads9324::kSclkMaxHz = 60'000'000 |
| Highest SCLK frequency (section 5.6). | |
| constexpr uint32_t | ads9324::kSingleShotCalMs = 125 |
| The single-shot ADC calibration time, TWAIT (Table 7-7). | |
| constexpr uint32_t | ads9324::kCalMarginMs = 25 |
| Extra time the driver polls CALIB_BUSY after the single-shot wait. | |
| constexpr uint32_t | ads9324::kContinuousCalConvst = 100'000 |
| The free-running ADC calibration time in CONVST periods (Table 7-7). | |
| constexpr uint32_t | ads9324::kReadyTimeoutMaxUs = 200'000 |
Longest Sampling::ready_timeout_us. | |
| constexpr uint32_t | ads9324::kInternalVrefMv = 4096 |
| Internal reference voltage in millivolts (section 5.5). | |
| constexpr uint32_t | ads9324::kInputResistanceOhm = 1'000'000 |
| Input resistance of each AINnP and AINnM pin in ohms (section 7.3.3). | |
| constexpr std::size_t | ads9324::kMaxFrameBytes = 50 |
| Longest data frame in bytes: 16 channels of 24 bits, DIAG and PRBS. | |
| constexpr uint8_t | ads9324::kGlitchMax = 15 |
| Highest DWC glitch filter count (DWC_GLITCH_FILT, 4 bits). | |
| constexpr uint8_t | ads9324::kDelayMaxNs = 5 |
| Largest output delay in nanoseconds (3 bits, section 8.1.10). | |
| constexpr int32_t | ads9324::kOffsetMin = -512 |
| OFS range in quarter LSBs (10 bits, two's complement). | |
| constexpr int32_t | ads9324::kOffsetMax = 511 |
| OFS range in quarter LSBs. | |
| constexpr int32_t | ads9324::kGainMin = -8192 |
| GAN range (14 bits, two's complement). | |
| constexpr int32_t | ads9324::kGainMax = 8191 |
| GAN range. | |
| constexpr uint8_t | ads9324::kDiagWindowAlert = 0x40 |
| DIAG bit 6, DWC_ALERT_FLAG (Table 7-13). | |
| constexpr uint8_t | ads9324::kDiagResetDetect = 0x01 |
| DIAG bit 0, RESET_DETECT_FLAG. | |
Public types of the ADS9324 driver: errors, Result<T>, enumerations, configuration, the data frame and the pure helpers that decode it.
Everything here is plain data and constexpr code with no platform dependency, so tests and tools can include it without the driver template. Channels are counted from 0: channel 0 is AIN1 and channel 15 is AIN16. Voltages are integer microvolts; the driver has no floating point.