23#ifndef ADS9324_REGISTERS_HPP
24#define ADS9324_REGISTERS_HPP
36using detail::operator
""_u16;
37using detail::operator
""_u8;
110inline constexpr uint8_t
kGain = 0x19;
115inline constexpr uint8_t
kTp = 0x2F;
123inline constexpr uint16_t
kSwRst = 0x0002;
218using PgaBw = Field<uint16_t, 0U, 2U>;
228inline constexpr uint16_t
kTpEn = 0x0001;
274 return static_cast<uint8_t
>(
kPgaConfig + (local >> 1U));
282 return static_cast<uint8_t
>(
kPhaseDelay + (local >> 1U));
290 return static_cast<uint8_t
>(
kOffset + local);
298 return static_cast<uint8_t
>(
kGain + local);
306 return static_cast<uint8_t
>(
kDwcTh + local);
314 return static_cast<uint8_t
>(
kDwcHys + (local >> 1U));
322 return static_cast<uint8_t
>(
kTp + local);
331 return ((
static_cast<uint32_t
>(local) & 1U) != 0U) ? 8U : 0U;
337constexpr bool IsCommon(uint8_t address)
noexcept {
365constexpr bool IsChannel(uint8_t address)
noexcept {
383 return (bank ==
Bank::Common) ? detail::IsCommon(address) : detail::IsChannel(address);
412 const bool command_register =
414 return !command_register;
429 return (address ==
kBankSel) ? 1_u16 : 0_u16;
431 const bool threshold = (address >=
kDwcTh) && (address <
kDwcTh + 8U);
432 const bool hysteresis = (address >
kDwcHys) && (address <
kDwcHys + 4U);
433 return (threshold || hysteresis) ? 0xFF00_u16 : 0_u16;
482namespace ads9324::detail {
486struct EnumLast<reg::Bank> {
Compile-time helpers of the ADS9324 driver: typed integer literals, exact hook matching,...
constexpr uint16_t kDigFiltSysref
DIG_FILT_SYSREF: written 1, then 0.
Definition ads9324_registers.hpp:205
constexpr ChannelLocation Locate(uint8_t channel) noexcept
The bank and local index of a channel (the AIN9 to AIN16 bank is reversed).
Definition ads9324_registers.hpp:247
constexpr uint8_t kXorBitsCtl
XOR_BITS_CTL: output randomizer.
Definition ads9324_registers.hpp:90
constexpr uint8_t GainAddress(uint8_t local) noexcept
The address of the GAN register of a local index.
Definition ads9324_registers.hpp:297
Field< uint16_t, 0U, 4U > DrdyAlrmSel
DRDY_ALRM_SEL[3:0].
Definition ads9324_registers.hpp:157
constexpr uint16_t kXorBitsRandomizer
Definition ads9324_registers.hpp:150
constexpr uint8_t kDwcHys
DWC_HYS, 4 registers, 8 bits per channel.
Definition ads9324_registers.hpp:113
constexpr bool IsDocumented(Bank bank, uint8_t address) noexcept
Whether a register is documented in a bank (section 8, Tables 8-1, 8-21, 8-72).
Definition ads9324_registers.hpp:382
constexpr uint16_t kRefselCtrlDis
REFSEL_CTRL_DIS: ignore the REFSEL pin.
Definition ads9324_registers.hpp:183
constexpr uint16_t kSeDiffAin1To8
SE_DIFF_MODE_AIN1_8: 1 = differential.
Definition ads9324_registers.hpp:192
Field< uint16_t, 8U, 8U > GenCfg1ReadAddress
REG_RD_ADD[7:0].
Definition ads9324_registers.hpp:122
constexpr uint16_t kExtRefEn
EXT_REF_EN: external reference.
Definition ads9324_registers.hpp:184
constexpr uint16_t kAlrmPol
ALRM_POL: 1 = active low.
Definition ads9324_registers.hpp:156
Field< uint16_t, 8U, 8U > DwcHighTh
HIGH_TH_AINn[7:0].
Definition ads9324_registers.hpp:223
constexpr uint8_t kDwcFlag
DWC_FLAG (R): latched high and low flags.
Definition ads9324_registers.hpp:117
constexpr uint8_t kDigDelayCfg2
DIG_DELAY_CFG2: D7 to D4 delay.
Definition ads9324_registers.hpp:94
constexpr uint16_t ResetValue(Bank bank, uint8_t address) noexcept
The value of a register after reset (section 8).
Definition ads9324_registers.hpp:424
constexpr bool IsReadOnly(Bank bank, uint8_t address) noexcept
Whether a register is read only (DEVICE_STATUS, DEVICE_ID and DWC_FLAG).
Definition ads9324_registers.hpp:393
constexpr uint8_t kOffset
OFS, 8 registers, 10 bits.
Definition ads9324_registers.hpp:109
Field< uint16_t, 8U, 4U > DwcGlitchFilt
DWC_GLITCH_FILT[3:0].
Definition ads9324_registers.hpp:222
constexpr uint8_t kTpCfg
TP_CFG: test pattern control.
Definition ads9324_registers.hpp:114
Field< uint16_t, 8U, 4U > MvgAvgLen
MVG_AVG_LEN[3:0].
Definition ads9324_registers.hpp:202
Field< uint16_t, 8U, 8U > AlarmMask
ALRM_MASK[7:0].
Definition ads9324_registers.hpp:154
Field< uint16_t, 0U, 2U > PgaBw
PGA_BW_SEL_AINn, 2 bits at 2 * local.
Definition ads9324_registers.hpp:218
Field< uint16_t, 0U, 14U > GainField
GAN_AINn[13:0], two's complement.
Definition ads9324_registers.hpp:220
constexpr uint16_t kTpUpdMode
TP_UPD_MODE: 1 = ramp steps at every CONVST.
Definition ads9324_registers.hpp:227
constexpr uint8_t kPgaConfig
PGA_CONFIG, 4 registers, two channels each.
Definition ads9324_registers.hpp:106
Field< uint16_t, 4U, 4U > BlkAvgOsr
BLK_AVG_OSR[3:0].
Definition ads9324_registers.hpp:203
Field< uint16_t, 0U, 2U > DriveStrengthField
DRIVE_STRENGTH[1:0].
Definition ads9324_registers.hpp:164
Field< uint16_t, 12U, 3U > FirFiltSel
FIR_FILT_SEL[2:0].
Definition ads9324_registers.hpp:201
Field< uint16_t, 3U, 3U > DelayD5
DIG_DELAY_D5, in CFG2.
Definition ads9324_registers.hpp:177
constexpr uint16_t kEnDiagFlag
EN_DIAG_FLAG: DIAG byte after the data.
Definition ads9324_registers.hpp:142
constexpr uint8_t kDrdyAlarmSel
DRDY_ALARM_SEL: pin function.
Definition ads9324_registers.hpp:91
Field< uint16_t, 6U, 3U > DelayD6
DIG_DELAY_D6, in CFG2.
Definition ads9324_registers.hpp:176
constexpr uint16_t kDwcStatRst
DWC_STAT_RST: written 1, then 0.
Definition ads9324_registers.hpp:221
constexpr uint16_t kAvgModeOvrEn
AVG_MODE_OVR_EN.
Definition ads9324_registers.hpp:206
constexpr uint16_t kSwRst
SW_RST.
Definition ads9324_registers.hpp:123
constexpr uint8_t kGenCfg2
GEN_CFG2: daisy chain (never written).
Definition ads9324_registers.hpp:88
Field< uint16_t, 0U, 3U > DelayD4
DIG_DELAY_D4, in CFG2.
Definition ads9324_registers.hpp:178
Field< uint16_t, 3U, 3U > DelayD1
DIG_DELAY_D1, in CFG1.
Definition ads9324_registers.hpp:173
Field< uint8_t, 0U, 3U > InputRangeField
INPUT_RANGE_AINn, in one byte of PGA_CONFIG.
Definition ads9324_registers.hpp:217
constexpr uint8_t kGenCfg5
GEN_CFG5: AVG_MODE gate.
Definition ads9324_registers.hpp:99
constexpr uint8_t kAnaCfg1
ANA_CFG1: reference source.
Definition ads9324_registers.hpp:95
constexpr uint16_t kAlrmDis
ALRM_DIS: 1 = alarm function disabled.
Definition ads9324_registers.hpp:162
constexpr uint16_t kGanCorrDis
GAN_CORR_DIS.
Definition ads9324_registers.hpp:230
constexpr uint16_t kDigDelayEn
DIG_DELAY_EN.
Definition ads9324_registers.hpp:163
constexpr uint8_t kPdnCtl
PDN_CTL: standby.
Definition ads9324_registers.hpp:87
Field< uint8_t, 4U, 3U > CmRange
CM_RANGE_AINn, in one byte of PGA_CONFIG.
Definition ads9324_registers.hpp:216
constexpr uint8_t kGain
GAN, 8 registers, 14 bits.
Definition ads9324_registers.hpp:110
constexpr uint16_t kIntTrigMode
INT_TRIG_MODE: internal oversampling clock.
Definition ads9324_registers.hpp:204
constexpr uint8_t kCorrection
GEN_CFG5 of a channel bank: correction bypass.
Definition ads9324_registers.hpp:116
Field< uint16_t, 6U, 3U > DelayD2
DIG_DELAY_D2, in CFG1.
Definition ads9324_registers.hpp:172
constexpr uint16_t kEnXorPatt
EN_XOR_PATT: randomizer.
Definition ads9324_registers.hpp:141
Field< uint16_t, 0U, 8U > DwcLowTh
LOW_TH_AINn[7:0].
Definition ads9324_registers.hpp:224
constexpr uint16_t kAdcDataSdoutEn
ADC_DATA_SDOUT_EN.
Definition ads9324_registers.hpp:145
constexpr uint32_t HalfShift(uint8_t local) noexcept
The bit position of the odd (high) or even (low) half of a two-channel register.
Definition ads9324_registers.hpp:330
constexpr uint16_t kRegRdEn
REG_RD_EN.
Definition ads9324_registers.hpp:124
constexpr uint16_t kTpEn
TP_EN.
Definition ads9324_registers.hpp:228
constexpr uint8_t kBankCount
Number of register banks.
Definition ads9324_registers.hpp:55
Field< uint16_t, 0U, 3U > DelayD0
DIG_DELAY_D0, in CFG1.
Definition ads9324_registers.hpp:174
Field< uint16_t, 0U, 2U > AdcCalMode
ADC_CAL_MODE[1:0].
Definition ads9324_registers.hpp:195
constexpr uint8_t kGenCfg4
GEN_CFG4: drive strength, delay enable.
Definition ads9324_registers.hpp:92
Field< uint16_t, 2U, 2U > AdcNumSel
ADC_NUM_SEL[1:0].
Definition ads9324_registers.hpp:187
constexpr uint16_t kAvgMode
AVG_MODE.
Definition ads9324_registers.hpp:207
Field< uint16_t, 9U, 3U > DelayD7
DIG_DELAY_D7, in CFG2.
Definition ads9324_registers.hpp:175
constexpr uint8_t kPhaseDelay
PHASE_DELAY, 4 registers, 8 bits per channel.
Definition ads9324_registers.hpp:108
Field< uint16_t, 0U, 10U > OffsetField
OFS_AINn[9:0], two's complement.
Definition ads9324_registers.hpp:219
Bank
A register bank. The value is the index of the bank in the driver's tables.
Definition ads9324_registers.hpp:47
constexpr uint16_t BankSelCode(Bank bank) noexcept
The BANK_SEL code of a bank (section 8.1.2).
Definition ads9324_registers.hpp:68
constexpr uint8_t DwcThAddress(uint8_t local) noexcept
The address of the DWC_TH register of a local index.
Definition ads9324_registers.hpp:305
constexpr uint8_t kDigFilter
DIG_FILTER: digital filters and SYSREF.
Definition ads9324_registers.hpp:98
constexpr uint16_t kEnOfsBinary
EN_OFS_BINARY: 1 = offset binary.
Definition ads9324_registers.hpp:140
constexpr uint16_t kAlrmType
ALRM_TYPE: 1 = pulse (window alert only).
Definition ads9324_registers.hpp:155
constexpr uint16_t kTpDisIdx
TP_DIS_IDX: 1 = no channel index insertion.
Definition ads9324_registers.hpp:226
constexpr uint16_t kDeviceIdValue
DEVICE_ID after reset, read only (8.1.18).
Definition ads9324_registers.hpp:211
Field< uint16_t, 4U, 4U > DaisyDevices
DAISY_CHN_NUM_DEV[3:0].
Definition ads9324_registers.hpp:134
Field< uint16_t, 8U, 4U > DaisyLocation
DAISY_CHN_LOC[3:0].
Definition ads9324_registers.hpp:133
constexpr uint8_t kDeviceId
DEVICE_ID (R): 0x0004.
Definition ads9324_registers.hpp:101
constexpr uint8_t PhaseDelayAddress(uint8_t local) noexcept
The address of the PHASE_DELAY register of a local index.
Definition ads9324_registers.hpp:281
constexpr uint32_t CountDocumented() noexcept
The number of documented registers over the three banks.
Definition ads9324_registers.hpp:440
constexpr uint16_t kResetDetectFlag
DIAG_CTRL.RESET_DETECT_FLAG (8.1.3).
Definition ads9324_registers.hpp:127
constexpr uint8_t PgaConfigAddress(uint8_t local) noexcept
The address of the register that holds the PGA_CONFIG of a local index.
Definition ads9324_registers.hpp:273
constexpr uint8_t ChannelAt(Bank bank, uint8_t local) noexcept
The channel at a bank-local index; the inverse of Locate().
Definition ads9324_registers.hpp:260
constexpr uint8_t DwcHysAddress(uint8_t local) noexcept
The address of the DWC_HYS register of a local index.
Definition ads9324_registers.hpp:313
constexpr uint16_t kAdcCalTrig
ADC_CAL_TRIG: written 1, then 0.
Definition ads9324_registers.hpp:194
constexpr uint8_t OffsetAddress(uint8_t local) noexcept
The address of the OFS register of a local index.
Definition ads9324_registers.hpp:289
Field< uint16_t, 9U, 3U > DelayD3
DIG_DELAY_D3, in CFG1.
Definition ads9324_registers.hpp:171
constexpr uint8_t kDeviceStatus
DEVICE_STATUS (R): CALIB_BUSY_FLAG.
Definition ads9324_registers.hpp:100
constexpr uint16_t kXtalkLowSpeed
CH_XTALK_LOW_SPEED.
Definition ads9324_registers.hpp:185
Field< uint16_t, 4U, 2U > DoutLaneSel
DOUT_LANE_SEL[1:0].
Definition ads9324_registers.hpp:143
Field< uint16_t, 4U, 3U > AdcChSel
ADC_CH_SEL[2:0].
Definition ads9324_registers.hpp:186
constexpr uint8_t kAnaCfg2
ANA_CFG2: channel mode, low-speed crosstalk.
Definition ads9324_registers.hpp:96
constexpr uint8_t kDiagCtrl
DIAG_CTRL: RESET_DETECT_FLAG.
Definition ads9324_registers.hpp:86
constexpr uint16_t kDevicePdn
PDN_CTL.DEVICE_PDN (8.1.4).
Definition ads9324_registers.hpp:128
constexpr uint8_t kDwcTh
DWC_TH, 8 registers: high byte, low byte.
Definition ads9324_registers.hpp:112
constexpr uint8_t kChannelCount
Number of channels.
Definition ads9324_registers.hpp:57
constexpr uint8_t kTp
TP_AIN, 8 registers, 16 bits.
Definition ads9324_registers.hpp:115
constexpr uint8_t kAdcCal
ADC_CAL: ADC calibration module.
Definition ads9324_registers.hpp:97
constexpr uint8_t TpAddress(uint8_t local) noexcept
The address of the TP_AIN register of a local index.
Definition ads9324_registers.hpp:321
constexpr uint8_t kBankSel
BANK_SEL: always accessible.
Definition ads9324_registers.hpp:85
constexpr uint8_t kDigDelayCfg1
DIG_DELAY_CFG1: SDOUT and D3 to D0 delay.
Definition ads9324_registers.hpp:93
Field< uint16_t, 2U, 2U > DoutLength
DOUT_LENGTH[1:0].
Definition ads9324_registers.hpp:144
constexpr uint16_t kSeDiffAin9To16
SE_DIFF_MODE_AIN9_16: 1 = differential.
Definition ads9324_registers.hpp:193
constexpr uint8_t kChannelsPerBank
Channels per channel bank.
Definition ads9324_registers.hpp:59
Field< uint8_t, 7U, 1U > CmeCorrEn
CME_CORR_EN_AINn, in one byte of PGA_CONFIG.
Definition ads9324_registers.hpp:215
Field< uint16_t, 4U, 3U > TpMode
TP_MODE[2:0].
Definition ads9324_registers.hpp:225
constexpr uint8_t kDwcCfg
DWC_CFG: enables, glitch filter, flag reset.
Definition ads9324_registers.hpp:111
constexpr uint16_t kCalibBusyFlag
DEVICE_STATUS.CALIB_BUSY_FLAG (8.1.17).
Definition ads9324_registers.hpp:210
Field< uint16_t, 12U, 3U > DelaySdout
DIG_DELAY_SDOUT, in CFG1.
Definition ads9324_registers.hpp:170
constexpr uint8_t kGenCfg3
GEN_CFG3: data format and lanes.
Definition ads9324_registers.hpp:89
constexpr uint8_t kGenCfg1
GEN_CFG1: read command, software reset.
Definition ads9324_registers.hpp:84
constexpr uint8_t kPgaBwSel
PGA_BW_SEL, 2 bits per channel.
Definition ads9324_registers.hpp:107
constexpr uint16_t kDaisyEnable
DAISY_CHN_EN.
Definition ads9324_registers.hpp:135
constexpr uint16_t kOfsCorrDis
OFS_CORR_DIS.
Definition ads9324_registers.hpp:229
constexpr bool IsShadowed(Bank bank, uint8_t address) noexcept
Whether the driver keeps a write-through shadow of a register: documented, writable and not one of th...
Definition ads9324_registers.hpp:408
constexpr uint8_t kAddressSpace
Addresses per bank table: the highest documented address is 0x3E.
Definition ads9324_registers.hpp:61
constexpr uint16_t kPhaseDelayEn
PHASE_DELAY_EN.
Definition ads9324_registers.hpp:200
@ Ain1To8
Channel registers AIN1 to AIN8, BANK_SEL code 010b.
@ Common
The common registers, BANK_SEL code 001b.
The ADS9324 register map.
Definition ads9324_registers.hpp:33
Where a channel's registers are: the bank and the bank-local index.
Definition ads9324_registers.hpp:235
uint8_t local
The bank-local index, 0 to 7.
Definition ads9324_registers.hpp:237
Bank bank
The channel bank.
Definition ads9324_registers.hpp:236