14#ifndef ADS9324_TYPES_HPP
15#define ADS9324_TYPES_HPP
25#include "ads9324_version.h"
45enum class [[nodiscard]]
Error : uint8_t {
74 return "NotInitialized";
76 return "InvalidArgument";
82 return "DeviceIdMismatch";
92 return "UnexpectedReset";
94 return "VerifyFailed";
98 return "DataMismatch";
119 [[nodiscard]]
constexpr bool ok() const noexcept {
120 return error == Error::Ok;
123 constexpr explicit operator bool() const noexcept {
132 return {v, Error::Ok};
150 [[nodiscard]]
constexpr bool ok() const noexcept {
151 return error == Error::Ok;
154 constexpr explicit operator bool() const noexcept {
355struct EnumLast<
Lanes> {
465 const auto code =
static_cast<uint32_t
>(detail::ToUnderlying(v));
466 return (code >= 1U) && (code <= 7U) && (code != 6U);
483 const auto code =
static_cast<uint32_t
>(detail::ToUnderlying(v));
484 return (code >= 1U) && (code <= 3U);
597 std::array<Input, 16> inputs{};
598 for (
Input& in : inputs) {
694 c.interface.data_on_sdout =
false;
714constexpr bool InRange(int32_t v, int32_t lo, int32_t hi)
noexcept {
715 return (v >= lo) && (v <= hi);
719constexpr Error Check(
bool condition)
noexcept {
724constexpr uint8_t GroupCount(
ChannelCount count)
noexcept {
748 for (
const uint8_t d : i.
delay_ns) {
754constexpr Error ValidateWindow(
const Window& w)
noexcept {
758constexpr Error ValidateInput(
const Input& in)
noexcept {
765constexpr bool IsDifferential(
const Input& in)
noexcept {
771constexpr bool BankClassUniform(
const std::array<Input, 16>& inputs, uint32_t first)
noexcept {
772 const bool first_class = IsDifferential(inputs[first]);
773 for (uint32_t i = first; i < (first + 8U); ++i) {
774 if (IsDifferential(inputs[i]) != first_class) {
781constexpr Error ValidateInputs(
const std::array<Input, 16>& inputs)
noexcept {
782 for (
const Input& in : inputs) {
783 const Error e = ValidateInput(in);
792 return Check(BankClassUniform(inputs, 0U) && BankClassUniform(inputs, 8U));
795constexpr Error ValidateFilter(
const Filter& f)
noexcept {
799 ok = ok && (!average || (f.
length != AverageLength::None));
804constexpr Error ValidateAlarm(
const Alarm& a)
noexcept {
807 ok = ok && (or_masked || (a.
sources == 0U));
813constexpr Error ValidateSampling(
const Sampling& s)
noexcept {
814 bool ok = IsEnumerator(s.
ready);
820constexpr Error ValidateSupply(
const Supply& s)
noexcept {
821 const auto in = [](uint32_t v, uint32_t lo, uint32_t hi) {
822 return (v == 0U) || ((v >= lo) && (v <= hi));
824 return Check(in(s.avdd_5v_mv, 4750U, 5250U) && in(s.avdd_1v8_mv, 1700U, 1900U) &&
825 in(s.iovdd_mv, 1700U, 3600U));
828constexpr Error ValidateExtras(
const Config& c)
noexcept {
845constexpr bool WindowWithOffsetBinary(
const Config& c)
noexcept {
849 return std::ranges::any_of(c.
inputs, [](
const Input& in) { return in.window.enabled; });
862 if (c.daisy.enabled) {
865 const std::array<Error, 8> steps{detail::ValidateInterface(c.interface),
866 detail::ValidateInputs(c.inputs),
867 detail::ValidateFilter(c.filter),
868 detail::ValidateAlarm(c.alarm),
869 detail::ValidateSampling(c.sampling),
870 detail::ValidateSupply(c.supply),
871 detail::ValidateExtras(c),
872 detail::Check(!detail::WindowWithOffsetBinary(c))};
873 for (
const Error e : steps) {
890void ConfigIsInvalid() noexcept;
906 detail::ConfigIsInvalid();
910 [[nodiscard]]
constexpr const Config&
Get() const& noexcept {
914 void Get() const&& = delete;
923 return ADS9324_VERSION_MAJOR;
927 return ADS9324_VERSION_MINOR;
931 return ADS9324_VERSION_PATCH;
935 return ADS9324_VERSION_STRING;
945 constexpr std::array<uint8_t, 12> kFactor{1, 2, 4, 6, 8, 10, 12, 16, 20, 32, 64, 128};
946 const auto code =
static_cast<uint32_t
>(detail::ToUnderlying(length));
947 return (code < kFactor.size()) ?
static_cast<uint32_t
>(kFactor[code]) : 1U;
977 switch (filter.kind) {
1033 ns +=
static_cast<uint64_t
>(n - 1U) * (1'000'000'000ULL / config.sampling.convst_hz);
1035 const uint64_t us = (ns + 999ULL) / 1000ULL;
1036 return static_cast<uint32_t
>((us < 2ULL) ? 2ULL : us);
1048 const int32_t v = 4 * (expected_code - measured_code);
1050 return static_cast<int16_t
>(clamped);
1062 if (measured_code == 0) {
1065 const int64_t num =
static_cast<int64_t
>(expected_code - measured_code) * 65536;
1066 const int64_t den = measured_code;
1067 const int64_t half = ((den < 0) ? -den : den) / 2;
1068 const bool same_sign = (num >= 0) == (den > 0);
1069 const int64_t v = same_sign ? ((((num < 0) ? -num : num) + half) / ((den < 0) ? -den : den))
1070 : -((((num < 0) ? -num : num) + half) / ((den < 0) ? -den : den));
1072 return static_cast<int16_t
>(clamped);
1075static_assert((
AverageFactor(AverageLength::X128) == 128U) &&
1112 const int64_t full_scale_uv =
static_cast<int64_t
>(
RangeMillivolts(range)) * 1000;
1113 const int64_t scaled =
static_cast<int64_t
>(code) * full_scale_uv;
1114 const int64_t half = 16384;
1115 const int64_t rounded = (scaled >= 0) ? ((scaled + half) / 32768) : ((scaled - half) / 32768);
1116 return static_cast<int32_t
>(rounded);
1125 return static_cast<int16_t
>(raw);
1136 return ToSigned16(
static_cast<uint16_t
>(
static_cast<uint32_t
>(raw) ^ 0x8000U));
1147 const auto value =
static_cast<uint32_t
>(prbs);
1148 const uint32_t low = ((value & 1U) != 0U) ? 255U : 0U;
1149 return static_cast<uint16_t
>((value << 8U) + low);
1158 switch (select.count) {
1180 const auto group =
static_cast<uint32_t
>(select.group);
1181 uint32_t channel = slot;
1182 switch (select.count) {
1185 channel = slot + 4U;
1186 }
else if (slot >= 4U) {
1187 channel = slot + 8U;
1193 channel = (slot < 2U) ? (slot + (2U * group)) : (slot + 12U - (2U * group));
1196 channel = (slot == 0U) ? group : (15U - group);
1202 return static_cast<uint8_t
>(channel);
1213 return interface.append_diag || interface.randomize;
1227 bytes += interface.randomize ? 1U : 0U;
1228 return static_cast<std::size_t
>(bytes);
1233 std::array<uint16_t, 16> raw{};
1234 std::array<int16_t, 16> codes{};
1235 std::array<uint8_t, 16> low_byte{};
1236 std::array<int32_t, 16> microvolts{};
1237 uint16_t present_mask{0};
1238 uint16_t clipped_mask{0};
1241 bool window_alert{
false};
1242 bool reset_detected{
false};
1257 if (bytes.size() < 4U) {
1260 const uint8_t first = bytes[0];
1261 if ((first != 0x00U) && (first != 0xFFU)) {
1264 return std::ranges::all_of(bytes, [first](uint8_t b) {
return b == first; });
Compile-time helpers of the ADS9324 driver: typed integer literals, exact hook matching,...
ADS9324 register map: banks, addresses, bit fields, reset values and the channel layout (datasheet se...
A configuration proven valid when the program is built. An invalid one does not compile.
Definition ads9324_types.hpp:900
constexpr uint32_t kSclkMaxHz
Highest SCLK frequency (section 5.6).
Definition ads9324_types.hpp:667
FirFilter fir
For FilterKind::Fir.
Definition ads9324_types.hpp:530
Supply supply
Supply voltages for the range check.
Definition ads9324_types.hpp:626
constexpr std::size_t FrameBytes(const Interface &interface, const ChannelSelect &select) noexcept
Bytes of one data frame (section 7.3.14).
Definition ads9324_types.hpp:1223
Correction correction
Offset and gain stages.
Definition ads9324_types.hpp:621
constexpr int16_t OffsetCorrectionFor(int32_t expected_code, int32_t measured_code) noexcept
The OFS value that removes a measured offset (equation 1, section 7.3.9).
Definition ads9324_types.hpp:1047
constexpr uint8_t kGlitchMax
Highest DWC glitch filter count (DWC_GLITCH_FILT, 4 bits).
Definition ads9324_types.hpp:699
CalibrationMode
Which errors ADC_CAL removes (ADC_CAL_MODE).
Definition ads9324_types.hpp:324
constexpr uint32_t kConversionNs
Conversion time without oversampling, tCONV.
Definition ads9324_types.hpp:665
DriveStrength drive
Output drive strength.
Definition ads9324_types.hpp:516
constexpr int16_t 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).
Definition ads9324_types.hpp:1061
bool cm_correction
Common mode error correction (CME_CORR_EN).
Definition ads9324_types.hpp:500
bool reject_stuck_frames
ReadFrame() refuses an all-0x00 or all-0xFF frame.
Definition ads9324_types.hpp:549
LogLevel
Severity passed to the optional Log() hook.
Definition ads9324_types.hpp:172
Verify
Whether a setter reads back what it wrote (costs one two-frame read per register).
Definition ads9324_types.hpp:181
constexpr uint32_t OutputRateHz(const Config &config) noexcept
Result rate of the data interface in hertz.
Definition ads9324_types.hpp:1013
Error
Why a call failed. Every call of the driver returns one of these in its Result.
Definition ads9324_types.hpp:45
constexpr bool HasDiagByte(const Interface &interface) noexcept
Whether the frame ends with a DIAG byte: asked for, or implied by the randomizer (the datasheet shows...
Definition ads9324_types.hpp:1212
InputRange
Input range of a channel (INPUT_RANGE_AINn, Table 7-1).
Definition ads9324_types.hpp:200
constexpr uint32_t kSingleShotCalMs
The single-shot ADC calibration time, TWAIT (Table 7-7).
Definition ads9324_types.hpp:669
constexpr const char * GetDriverVersion() noexcept
Definition ads9324_types.hpp:934
ReferenceSource reference
Reference selection.
Definition ads9324_types.hpp:614
CalibrationMode mode
Which errors.
Definition ads9324_types.hpp:562
constexpr uint32_t FirDecimation(FirFilter fir) noexcept
The decimation of a FIR filter (Table 7-9).
Definition ads9324_types.hpp:955
std::array< Input, 16 > inputs
AIN1 to AIN16.
Definition ads9324_types.hpp:615
constexpr int GetDriverVersionMinor() noexcept
Definition ads9324_types.hpp:926
constexpr std::size_t kMaxFrameBytes
Longest data frame in bytes: 16 channels of 24 bits, DIAG and PRBS.
Definition ads9324_types.hpp:684
constexpr int32_t kOffsetMax
OFS range in quarter LSBs.
Definition ads9324_types.hpp:705
constexpr int32_t kGainMin
GAN range (14 bits, two's complement).
Definition ads9324_types.hpp:707
bool enabled
DWC_EN: the digital window comparator watches this channel.
Definition ads9324_types.hpp:489
ChannelCount count
How many channels.
Definition ads9324_types.hpp:522
Filter filter
Digital filter.
Definition ads9324_types.hpp:616
uint32_t convst_hz
CONVST frequency, 100 kHz to 1 MHz.
Definition ads9324_types.hpp:546
constexpr const char * ToString(Error error) noexcept
The name of an error, for logs.
Definition ads9324_types.hpp:69
constexpr uint32_t kInputResistanceOhm
Input resistance of each AINnP and AINnM pin in ohms (section 7.3.3).
Definition ads9324_types.hpp:681
PatternKind
Kind of a test pattern (TP_MODE, Table 7-14).
Definition ads9324_types.hpp:311
DataFormat format
Coding.
Definition ads9324_types.hpp:513
friend constexpr bool operator==(const WindowFlags &lhs, const WindowFlags &rhs) noexcept=default
Equal when both masks are.
constexpr uint8_t FrameSlotChannel(const ChannelSelect &select, uint32_t slot) noexcept
Which channel a slot of the frame carries (Table 7-12).
Definition ads9324_types.hpp:1179
std::array< uint16_t, 8 > value
Pattern per channel; the first is the ramp step.
Definition ads9324_types.hpp:572
Alarm alarm
DRDY/ALARM pin.
Definition ads9324_types.hpp:619
WordLength length
16 or 24 bits per channel.
Definition ads9324_types.hpp:512
uint8_t group
Which group of that size (ADC_CH_SEL).
Definition ads9324_types.hpp:523
uint32_t ready_timeout_us
Longest pin wait, 1 to kReadyTimeoutMaxUs.
Definition ads9324_types.hpp:548
ReadySource
How WaitDataReady() learns that a result is ready.
Definition ads9324_types.hpp:318
constexpr uint32_t kConvstHighMinNs
Shortest CONVST high time.
Definition ads9324_types.hpp:659
uint16_t low
Channel n went below its low threshold.
Definition ads9324_types.hpp:634
bool append_diag
Append the DIAG byte (EN_DIAG_FLAG).
Definition ads9324_types.hpp:514
constexpr std::array< Input, 16 > DefaultInputs() noexcept
The default settings of the 16 inputs, spelled out because GCC skips nested member initialisers in in...
Definition ads9324_types.hpp:596
constexpr bool ok() const noexcept
Definition ads9324_types.hpp:150
constexpr bool IsValid(InputType v) noexcept
Whether an input type holds a documented code.
Definition ads9324_types.hpp:405
uint8_t sources
For OrMasked: the sources in the OR.
Definition ads9324_types.hpp:540
DriveStrength
Drive strength of the digital outputs (DRIVE_STRENGTH, Table 7-15).
Definition ads9324_types.hpp:236
bool enabled
TP_EN.
Definition ads9324_types.hpp:568
constexpr uint32_t kResetPulseUs
Shortest RESET low pulse the driver drives (a design choice, section 7.4.1).
Definition ads9324_types.hpp:653
constexpr Error Validate(const Config &c) noexcept
Check a configuration against the documented ranges and combinations, with no I/O.
Definition ads9324_types.hpp:861
AlarmFunction
What the DRDY/ALARM pin shows (DRDY_ALRM_SEL, Table 7-10).
Definition ads9324_types.hpp:261
uint8_t hysteresis
Hysteresis on both thresholds, in top-byte counts.
Definition ads9324_types.hpp:492
PatternKind kind
Constant or ramp.
Definition ads9324_types.hpp:569
constexpr int16_t WireToCode(uint16_t raw, DataFormat format) noexcept
The signed code of a wire value.
Definition ads9324_types.hpp:1134
DaisyChain daisy
Out of scope.
Definition ads9324_types.hpp:625
uint32_t avdd_5v_mv
AVDD_5V, 4750 to 5250.
Definition ads9324_types.hpp:585
constexpr uint32_t AverageFactor(AverageLength length) noexcept
The averaging factor of a length code: 1, 2, 4, 6, 8, 10, 12, 16, 20, 32, 64, 128.
Definition ads9324_types.hpp:944
Calibration calibration
ADC calibration.
Definition ads9324_types.hpp:622
constexpr uint32_t ConversionTimeUs(const Config &config) noexcept
Time from the start of a conversion to a ready result, rounded up to microseconds,...
Definition ads9324_types.hpp:1028
void Get() const &&=delete
Not on a temporary: the reference would dangle (KB-CPP20-044).
Bandwidth
Analog low-pass filter of a channel (PGA_BW_SEL_AINn, Table 7-2).
Definition ads9324_types.hpp:209
constexpr uint32_t kConvstMaxHz
Highest CONVST frequency, fCONVST.
Definition ads9324_types.hpp:657
int8_t low_code
Low threshold on the top byte of the code.
Definition ads9324_types.hpp:491
bool active_low
ALRM_POL, applies to every function.
Definition ads9324_types.hpp:537
CalibrationTrigger trigger
CONVST behaviour.
Definition ads9324_types.hpp:563
bool offset_enabled
OFS stage in the data path.
Definition ads9324_types.hpp:555
bool internal_clock
Block average: internal oversampling clock.
Definition ads9324_types.hpp:531
CalibrationTrigger
How the CONVST clock behaves during ADC calibration (section 7.3.10).
Definition ads9324_types.hpp:332
bool gain_enabled
GAN stage in the data path.
Definition ads9324_types.hpp:556
constexpr uint8_t kDiagResetDetect
DIAG bit 0, RESET_DETECT_FLAG.
Definition ads9324_types.hpp:1248
constexpr int32_t RangeMillivolts(InputRange range) noexcept
Full-scale voltage of a range in millivolts.
Definition ads9324_types.hpp:1086
std::array< uint8_t, 9 > delay_ns
Output delay 0 to 5 ns: SDOUT, then D0 to D7.
Definition ads9324_types.hpp:517
bool pulse
ALRM_TYPE: pulse instead of level (window).
Definition ads9324_types.hpp:538
constexpr uint32_t kConvstLowMinNs
Shortest CONVST low time.
Definition ads9324_types.hpp:661
std::array< TestPattern, 2 > test_pattern
Group 0 is AIN1 to AIN8, group 1 AIN9 to AIN16.
Definition ads9324_types.hpp:623
int16_t gain
GAN: -8192 to 8191, result x (1 + gain / 65536).
Definition ads9324_types.hpp:502
Window window
The window comparator of this channel.
Definition ads9324_types.hpp:504
bool run_at_start
Run ADC_CAL in EnsureInitialized().
Definition ads9324_types.hpp:561
ChannelCount
How many channels the data frame carries (ADC_NUM_SEL, Table 7-12).
Definition ads9324_types.hpp:253
constexpr uint32_t ResultsPerOutput(const Filter &filter) noexcept
Samples that make one result of the digital filter in the data path.
Definition ads9324_types.hpp:976
constexpr uint32_t kDrdyLowDelayNs
Delay from the CONVST falling edge to the DRDY falling edge.
Definition ads9324_types.hpp:663
constexpr int32_t kOffsetMin
OFS range in quarter LSBs (10 bits, two's complement).
Definition ads9324_types.hpp:703
DataFormat
Coding of the conversion result (EN_OFS_BINARY).
Definition ads9324_types.hpp:229
int16_t offset_quarter_lsb
OFS: -512 to 511 quarter LSBs, added first.
Definition ads9324_types.hpp:501
static constexpr Result Success() noexcept
Definition ads9324_types.hpp:158
uint32_t avdd_1v8_mv
AVDD_1V8, 1700 to 1900.
Definition ads9324_types.hpp:586
constexpr const Config & Get() const &noexcept
Definition ads9324_types.hpp:910
InputType type
Differential, single ended, open-wire safe.
Definition ads9324_types.hpp:497
constexpr uint32_t kCalMarginMs
Extra time the driver polls CALIB_BUSY after the single-shot wait.
Definition ads9324_types.hpp:671
constexpr uint8_t kAlarmSourceWindow
Source code 1, window alert.
Definition ads9324_types.hpp:272
constexpr bool 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 (ha...
Definition ads9324_types.hpp:1256
AlarmFunction function
What the pin shows.
Definition ads9324_types.hpp:536
ResetKind
How Reset() resets the chip.
Definition ads9324_types.hpp:187
ChannelSelect channels
Channels in the frame.
Definition ads9324_types.hpp:617
static constexpr Result Failure(Error e) noexcept
A failed result.
Definition ads9324_types.hpp:166
static constexpr Result Success(T v) noexcept
A successful result.
Definition ads9324_types.hpp:131
AverageLength length
For the two average kinds.
Definition ads9324_types.hpp:529
constexpr uint32_t kConvstMinHz
Lowest CONVST frequency, fCONVST (section 5.6).
Definition ads9324_types.hpp:655
WordLength
Bits per conversion result on the data interface (DOUT_LENGTH).
Definition ads9324_types.hpp:223
bool disabled
ALRM_DIS: the alarm function is off.
Definition ads9324_types.hpp:539
constexpr int32_t CodeToMicrovolts(int32_t code, InputRange range) noexcept
Microvolts of a signed code: code x full scale / 32768, rounded half away from zero.
Definition ads9324_types.hpp:1111
uint16_t high
Channel n went above its high threshold.
Definition ads9324_types.hpp:633
Sampling sampling
CONVST and ready wait.
Definition ads9324_types.hpp:620
constexpr uint8_t kDelayMaxNs
Largest output delay in nanoseconds (3 bits, section 8.1.10).
Definition ads9324_types.hpp:701
Bandwidth bandwidth
Analog low-pass filter.
Definition ads9324_types.hpp:499
std::array< uint8_t, 2 > window_glitch
DWC glitch filter per group, 0 to 15.
Definition ads9324_types.hpp:624
constexpr uint32_t kPowerUpMs
Power-up wait before the first access, tPU (section 5.7).
Definition ads9324_types.hpp:648
uint8_t devices
Devices in the chain (unused).
Definition ads9324_types.hpp:580
AverageLength
Length of a block or moving average (BLK_AVG_OSR, MVG_AVG_LEN).
Definition ads9324_types.hpp:276
constexpr Config ChipResetConfig() noexcept
The chip's reset state as a Config: eight lanes on D7 to D0, everything else as Config{}.
Definition ads9324_types.hpp:691
bool step_every_convst
Ramp: step at every CONVST (TP_UPD_MODE).
Definition ads9324_types.hpp:571
bool randomize
XOR the data with PRBS, append the PRBS byte.
Definition ads9324_types.hpp:515
bool or_mask_acknowledged
The caller accepts that the mask sense is unverified.
Definition ads9324_types.hpp:541
uint8_t phase_delay
Sample delay in CONVST periods, 0 to 255.
Definition ads9324_types.hpp:503
constexpr uint16_t DerandomizeMask(uint8_t prbs) noexcept
The XOR mask of the randomizer (equations 7 and 8, section 7.3.14.4).
Definition ads9324_types.hpp:1146
FilterKind
Which one digital filter is in the data path (section 7.3.11).
Definition ads9324_types.hpp:303
constexpr uint32_t kResetMs
Wait after a reset before the first access (tPU, A3).
Definition ads9324_types.hpp:650
bool data_on_sdout
One lane on SDOUT (true) or D7 (false).
Definition ads9324_types.hpp:511
ReferenceSource
Where the ADC reference comes from (Table 7-3).
Definition ads9324_types.hpp:244
constexpr uint8_t kDiagWindowAlert
DIAG bit 6, DWC_ALERT_FLAG (Table 7-13).
Definition ads9324_types.hpp:1246
Interface interface
Data interface.
Definition ads9324_types.hpp:613
uint32_t iovdd_mv
Definition ads9324_types.hpp:587
bool low_speed_crosstalk
CH_XTALK_LOW_SPEED, for under 100 kSPS per channel.
Definition ads9324_types.hpp:618
constexpr int GetDriverVersionMajor() noexcept
Definition ads9324_types.hpp:922
constexpr int GetDriverVersionPatch() noexcept
Definition ads9324_types.hpp:930
constexpr uint8_t kAlarmSourceCalDone
Source code 6, ADC calibration done.
Definition ads9324_types.hpp:273
Lanes lanes
Lane count; Config{} uses one lane.
Definition ads9324_types.hpp:510
constexpr uint32_t PulsesPerResult(const Filter &filter) noexcept
CONVST falling edges the chip needs for one result.
Definition ads9324_types.hpp:997
constexpr uint16_t kDeviceId
DEVICE_ID value of every ADS9324.
Definition ads9324_types.hpp:646
Lanes
Number of data lanes (DOUT_LANE_SEL, Table 7-11).
Definition ads9324_types.hpp:215
InputType
Input type of a channel (CM_RANGE_AINn, Table 7-1).
Definition ads9324_types.hpp:193
constexpr int16_t ToSigned16(uint16_t raw) noexcept
Reinterpret a 16-bit wire value as a signed code (two's complement).
Definition ads9324_types.hpp:1124
uint8_t location
Position in the chain (unused).
Definition ads9324_types.hpp:579
InputRange range
Full-scale range.
Definition ads9324_types.hpp:498
constexpr uint32_t FrameChannels(const ChannelSelect &select) noexcept
Number of channels in a frame.
Definition ads9324_types.hpp:1157
ReadySource ready
How a result is known to be ready.
Definition ads9324_types.hpp:547
constexpr uint32_t kReadyTimeoutMaxUs
Longest Sampling::ready_timeout_us.
Definition ads9324_types.hpp:676
constexpr bool ok() const noexcept
Definition ads9324_types.hpp:119
constexpr uint8_t kAlarmSourceDrdy
Sources of the OR output; bit n of Alarm::sources is the source with code n.
Definition ads9324_types.hpp:271
FirFilter
The FIR low-pass filters (FIR_FILT_SEL, Table 7-9). FIR6 is reserved and absent.
Definition ads9324_types.hpp:293
bool hardware_reset
Use the RESET pin at start-up (needs GpioSet()).
Definition ads9324_types.hpp:627
bool index_insertion
Add the channel index in the top nibble (TP_DIS_IDX = 0).
Definition ads9324_types.hpp:570
constexpr int32_t kGainMax
GAN range.
Definition ads9324_types.hpp:709
bool enabled
Refused with Unsupported.
Definition ads9324_types.hpp:578
FilterKind kind
Which filter.
Definition ads9324_types.hpp:528
static constexpr Result Failure(Error e) noexcept
A failed result.
Definition ads9324_types.hpp:139
int8_t high_code
High threshold on the top byte of the code (two's complement).
Definition ads9324_types.hpp:490
constexpr uint32_t kInternalVrefMv
Internal reference voltage in millivolts (section 5.5).
Definition ads9324_types.hpp:678
constexpr uint32_t kContinuousCalConvst
The free-running ADC calibration time in CONVST periods (Table 7-7).
Definition ads9324_types.hpp:674
consteval CheckedConfig(const Config &config)
Definition ads9324_types.hpp:904
@ Warning
Something unexpected that the driver recovered from.
@ Debug
Detail for bring-up.
@ ReadBack
Read every register the call touched and compare with the shadow.
@ UnexpectedReset
RESET_DETECT_FLAG is set: the chip reset since the start.
@ InvalidArgument
An argument or a Config field is out of range; nothing was sent.
@ DeviceIdMismatch
DEVICE_ID or BANK_SEL did not read as a ADS9324 after a reset.
@ Crc
Never returned: the chip has no CRC.
@ Bus
A port hook returned false.
@ VerifyFailed
A read-back differs from what was written.
@ DeviceFault
Reserved for a chip fault flag; the ADS9324 reports none.
@ NotInitialized
EnsureInitialized() has not succeeded, or the driver was reset.
@ Unsupported
The port hook or chip feature this call needs is absent.
@ Timeout
A flag did not change in the allowed time.
@ Busy
Never returned: the chip has no busy reply.
@ Refused
The call is not allowed in the current state; nothing was sent.
@ Constant
A fixed 16-bit value per channel.
@ Time
Wait the conversion time (no pin needed).
@ Pin
Poll the DRDY/ALARM pin through GpioGet().
@ Normal
1 x. Reset value.
@ WindowAlert
Digital window comparator alert.
@ Drdy
ADC data ready. Reset value.
@ CalDone
ADC calibration done.
@ Low
25.5 kHz for every range.
@ Wide
280 kHz to 350 kHz, by range.
@ Continuous
A free-running CONVST: 100,000 periods.
@ SingleShot
INT_TRIG_MODE = 1: one CONVST pulse, 125 ms.
@ All16
16 channels. Reset value.
@ Four
4 channels; group 0 to 3.
@ Two
2 channels; group 0 to 7.
@ Eight
8 channels; group 0 or 1.
@ OffsetBinary
Straight offset binary.
@ TwosComplement
Binary two's complement. Reset value.
@ Hardware
A pulse on the RESET pin through GpioSet().
@ Software
SW_RST in GEN_CFG1.
@ Bits16
16 bits. Reset value.
@ Bits24
24 bits: the result and an extra byte.
@ Fir
A FIR filter, Filter::fir.
@ MovingAverage
Moving average over Filter::length conversions.
@ BlockAverage
Block average over Filter::length conversions.
@ Internal
Internal 4.096 V reference, REFSEL ignored.
@ Pin
The REFSEL pin chooses. Reset value.
@ One
D7, or SDOUT with Interface::data_on_sdout.
@ Eight
D7 to D0. Reset value.
@ Differential
Differential, common mode up to +-12.5 V.
@ SingleEnded
AINnM tied to ground.
@ SingleEndedOpenWireSafe
Single ended with the least code change on an open wire.
The ADS9324 driver: everything it declares lives here; internals in detail.
Definition ads9324.hpp:32
The DRDY/ALARM pin (DRDY_ALARM_SEL, GEN_CFG4).
Definition ads9324_types.hpp:535
Calibration at start-up and the mode RunAdcCalibration() uses.
Definition ads9324_types.hpp:560
Which channels the data frame carries (ANA_CFG2).
Definition ads9324_types.hpp:521
Everything EnsureInitialized() and ApplyConfig() write to the chip.
Definition ads9324_types.hpp:612
System offset and gain correction stages (GEN_CFG5 of the channel banks).
Definition ads9324_types.hpp:554
Daisy chain settings: out of scope in this version, Validate() refuses enabled.
Definition ads9324_types.hpp:577
The digital filter in the data path (DIG_FILTER, GEN_CFG5).
Definition ads9324_types.hpp:527
One decoded data frame.
Definition ads9324_types.hpp:1232
The data interface (GEN_CFG3, XOR_BITS_CTL, GEN_CFG4, DIG_DELAY_CFG1/2).
Definition ads9324_types.hpp:509
The value of a call, or why there is none.
Definition ads9324_types.hpp:114
CONVST timing and the ready wait (section 5.6).
Definition ads9324_types.hpp:545
Supplies in millivolts for the range checks; 0 means "not stated".
Definition ads9324_types.hpp:584
A test pattern of one channel group (TP_CFG, TP_AIN).
Definition ads9324_types.hpp:567
The latched digital window comparator flags, one bit per channel (bit 0 is AIN1).
Definition ads9324_types.hpp:632
The digital window comparator of one channel (section 7.3.12).
Definition ads9324_types.hpp:488