ADS7952 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
ads7952_registers.hpp File Reference

ADS795x command and reply words: the bit fields of every frame (datasheet SLAS605C, section 8.4 and 8.5, Tables 1 to 13). More...

#include <cstdint>
#include "ads7952_detail.hpp"

Go to the source code of this file.

Namespaces

namespace  ads7952
 The ADS7952 driver: everything it declares lives here; internals in detail.
 
namespace  ads7952::reg
 The ADS795x frame format.
 

Functions

constexpr uint8_t ads7952::reg::ReplyAddress (uint16_t reply) noexcept
 The 4-bit field DO15:12 of a reply: the channel the result belongs to (DI04 = 0 in the frame before), or the levels of GPIO3:0 (DI04 = 1).
 
constexpr uint16_t ads7952::reg::ReplyCode (uint16_t reply) noexcept
 The 12-bit conversion result of a reply, DO11:00.
 
constexpr uint16_t ads7952::reg::ManualWord (uint8_t channel, uint16_t control) noexcept
 A Manual mode word with DI11 = 1: select channel for the next frame and set DI06:00.
 
constexpr uint16_t ads7952::reg::AutoWord (uint16_t mode, bool restart, uint16_t control) noexcept
 An Auto-1 or Auto-2 mode word with DI11 = 1.
 
constexpr uint16_t ads7952::reg::Auto2ProgramWord (uint8_t last) noexcept
 The Auto-2 program word: last becomes the last channel of the Auto-2 sequence.
 
constexpr uint16_t ads7952::reg::AlarmGroupWord (uint8_t group) noexcept
 The first frame of an alarm group's programming sequence.
 
constexpr uint16_t ads7952::reg::AlarmThresholdWord (uint8_t channel_in_group, bool high, bool exit, uint16_t threshold) noexcept
 One alarm threshold frame of a group's programming sequence.
 

Variables

constexpr uint32_t ads7952::reg::kCommandShift = 12
 DI15:12 hold the command.
 
constexpr uint16_t ads7952::reg::kCommandMask = 0xF000U
 DI15:12.
 
constexpr uint16_t ads7952::reg::kContinue = 0x0000U
 0000: keep the mode, ignore DI11:00.
 
constexpr uint16_t ads7952::reg::kManual = 0x1000U
 0001: Manual mode (Table 1).
 
constexpr uint16_t ads7952::reg::kAuto1 = 0x2000U
 0010: Auto-1 mode (Table 2).
 
constexpr uint16_t ads7952::reg::kAuto2 = 0x3000U
 0011: Auto-2 mode (Table 5).
 
constexpr uint16_t ads7952::reg::kGpioProgram = 0x4000U
 0100: GPIO program register (Table 11).
 
constexpr uint16_t ads7952::reg::kAuto1Program = 0x8000U
 1000: Auto-1 mask in the next frame.
 
constexpr uint16_t ads7952::reg::kAuto2Program = 0x9000U
 1001: Auto-2 last channel (Table 6).
 
constexpr uint16_t ads7952::reg::kAlarmProgramGroup0 = 0xC000U
 11bb: alarm group bb (Table 13).
 
constexpr uint16_t ads7952::reg::kProgramEnable = 0x0800U
 DI11: take DI10:00 (Manual: DI06:00).
 
constexpr uint16_t ads7952::reg::kAutoReset = 0x0400U
 DI10, Auto modes: restart the sequence.
 
constexpr uint32_t ads7952::reg::kManualChannelShift = 7
 DI10:07, Manual: the next channel.
 
constexpr uint16_t ads7952::reg::kRangeTwoVref = 0x0040U
 DI06: 0 to 2 x VREF (Range 2).
 
constexpr uint16_t ads7952::reg::kPowerDown = 0x0020U
 DI05: power down at the next frame's end.
 
constexpr uint16_t ads7952::reg::kGpioReadout = 0x0010U
 DI04: next reply carries GPIO3:0 in DO15:12.
 
constexpr uint16_t ads7952::reg::kGpioDataMask = 0x000FU
 DI03:00: GPIO output levels.
 
constexpr uint16_t ads7952::reg::kControlMask = 0x007FU
 DI06:00: the bits a mode word programs.
 
constexpr uint32_t ads7952::reg::kAuto2LastShift = 6
 DI09:06: the last channel of the sequence.
 
constexpr uint16_t ads7952::reg::kGpioResetAll = 0x0200U
 DI09: reset every register next frame.
 
constexpr uint16_t ads7952::reg::kGpio3PowerDown = 0x0100U
 DI08: GPIO3 is the power-down input.
 
constexpr uint16_t ads7952::reg::kGpio2Range = 0x0080U
 DI07: GPIO2 is the range input.
 
constexpr uint32_t ads7952::reg::kGpioAlarmShift = 4
 DI06:04: GPIO0/GPIO1 alarm outputs.
 
constexpr uint16_t ads7952::reg::kGpioDirectionMask = 0x000FU
 DI03:00: 1 = output.
 
constexpr uint32_t ads7952::reg::kAlarmChannelShift = 14
 DI15:14: channel within the group.
 
constexpr uint16_t ads7952::reg::kAlarmHigh = 0x2000U
 DI13: 1 high threshold, 0 low.
 
constexpr uint16_t ads7952::reg::kAlarmExit = 0x1000U
 DI12: leave the sequence after this frame.
 
constexpr uint16_t ads7952::reg::kAlarmThresholdMask = 0x03FFU
 DI09:00: the upper 10 result bits.
 
constexpr uint16_t ads7952::reg::kAlarmHighReset = 0x03FFU
 High threshold after reset: all ones.
 
constexpr uint16_t ads7952::reg::kAlarmLowReset = 0x0000U
 Low threshold after reset: all zeros.
 
constexpr uint32_t ads7952::reg::kChannelsPerAlarmGroup = 4
 Table 12: four channels per group.
 
constexpr uint32_t ads7952::reg::kReplyAddressShift = 12
 DO15:12: channel address or GPIO3:0.
 
constexpr uint16_t ads7952::reg::kReplyCodeMask
 DO11:00: the 12-bit result, straight binary.
 

Detailed Description

ADS795x command and reply words: the bit fields of every frame (datasheet SLAS605C, section 8.4 and 8.5, Tables 1 to 13).

The chip has no addressable registers. Every frame is one 16-bit word on SDI, MSB first, with CS low for exactly 16 SCLK cycles; its top four bits (DI15:12) say what the word is: a mode control word (Manual, Auto-1, Auto-2 or "continue") or the first or only frame of a program register (GPIO, Auto-1 channel mask, Auto-2 last channel, alarm thresholds). At the same time the chip shifts out one 16-bit reply on SDO: a 4-bit channel address (or the GPIO levels) in DO15:12 and the 12-bit conversion result in DO11:00.

Everything here is constexpr masks and shifts; there are no bit-field unions, whose layout depends on the compiler.