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

Public types of the ADS7952 driver: errors, Result<T>, variants, ranges, GPIO and alarm settings, the configuration and the result of a scan. More...

#include <array>
#include <cstddef>
#include <cstdint>
#include "ads7952_detail.hpp"
#include "ads7952_registers.hpp"
#include "ads7952_version.h"

Go to the source code of this file.

Classes

struct  ads7952::Result< T >
 The value of a call, or why there is none. More...
 
struct  ads7952::Result< void >
 The result of a call that returns no value. More...
 
struct  ads7952::GpioConfig
 The GPIO program register and the GPIO output levels. GpioConfig{} is the reset state: every pin an input with no function. More...
 
struct  ads7952::AlarmThreshold
 The two alarm thresholds of one channel, in 12-bit result codes. The chip keeps the upper 10 bits and compares them with the upper 10 bits of each result (Table 13), so the two lowest bits of a threshold are dropped. AlarmThreshold{} is the reset state: no alarm. More...
 
struct  ads7952::Bank
 The result of one Auto-1 or Auto-2 scan: one code per channel of the sequence. More...
 
struct  ads7952::ScaleMonitor
 A channel the board drives with a known voltage, so the driver can prove the scale every code is converted with: the range the chip is really in, and a reference that is present. More...
 
struct  ads7952::Config
 What the driver is told about the chip and the board. Config{} is an ADS7952 in TSSOP left in its reset state (Tables 1 to 13): Range 1, every GPIO an input, every channel in Auto-1, channel 11 the last of Auto-2, no alarm; with a 2.5 V reference and a 5 V analog supply. More...
 

Namespaces

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

Enumerations

enum class  ads7952::Error : uint8_t {
  ads7952::Error::Ok = 0 , ads7952::Error::NotInitialized = 1 , ads7952::Error::InvalidArgument = 2 , ads7952::Error::Bus = 3 ,
  ads7952::Error::Timeout = 4 , ads7952::Error::DeviceIdMismatch = 5 , ads7952::Error::Crc = 6 , ads7952::Error::Busy = 7 ,
  ads7952::Error::DeviceFault = 8 , ads7952::Error::Unsupported = 9 , ads7952::Error::NoDevice = 16 , ads7952::Error::ChannelMismatch = 17 ,
  ads7952::Error::SequenceMismatch = 18 , ads7952::Error::WriteMismatch = 19 , ads7952::Error::RangeMismatch = 20 , ads7952::Error::ScaleMismatch = 21 ,
  ads7952::Error::DeviceReset = 22
}
 Why a call failed. Every call of the driver returns one of these in its Result. More...
 
enum class  ads7952::LogLevel : uint8_t { ads7952::LogLevel::Error = 0 , ads7952::LogLevel::Warning , ads7952::LogLevel::Info , ads7952::LogLevel::Debug }
 Severity passed to the optional Log() hook. More...
 
enum class  ads7952::Variant : uint8_t { ads7952::Variant::Ads7950 = 0 , ads7952::Variant::Ads7951 = 1 , ads7952::Variant::Ads7952 = 2 , ads7952::Variant::Ads7953 = 3 }
 Which 12-bit member of the family is fitted. The chip cannot tell, so it is configured. More...
 
enum class  ads7952::Package : uint8_t { ads7952::Package::Tssop = 0 , ads7952::Package::Vqfn = 1 }
 The package: the VQFN parts bring out GPIO0 only (section 8.5.2). More...
 
enum class  ads7952::Range : uint8_t { ads7952::Range::Vref = 0 , ads7952::Range::TwoVref = 1 }
 Input range, DI06 of the mode control word (Tables 1, 2, 5; Table 8). More...
 
enum class  ads7952::Verify : uint8_t { ads7952::Verify::None = 0 , ads7952::Verify::ReadBack = 1 }
 Extra verification for one call, chosen per call (handbook KB-ARCH-041). More...
 
enum class  ads7952::AlarmOutput : uint8_t {
  ads7952::AlarmOutput::None = 0 , ads7952::AlarmOutput::Gpio0HighOrLow = 1 , ads7952::AlarmOutput::Gpio0High = 2 , ads7952::AlarmOutput::Gpio1Low = 4 ,
  ads7952::AlarmOutput::Gpio1LowGpio0High = 6
}
 What GPIO0 and GPIO1 do besides general-purpose I/O: DI06:04 of the GPIO program register (Table 11). Alarm outputs are active high. More...
 

Functions

constexpr const char * ads7952::ToString (Error error) noexcept
 The name of an error, for logs.
 
constexpr uint8_t ads7952::ChannelCount (Variant variant) noexcept
 Number of analog inputs of a variant.
 
constexpr uint16_t ads7952::AllChannels (Variant variant) noexcept
 The mask of every channel of a variant: also the reset value of its Auto-1 program register (section 8.4.1).
 
constexpr Error ads7952::ValidateMonitor (const Config &config) noexcept
 Check the scale monitor of a configuration.
 
constexpr Error ads7952::CheckScaleCode (const Config &config, uint16_t code) noexcept
 Judge one code of the scale monitor's channel. No I/O.
 
constexpr Error ads7952::ValidateGpio (const Config &config) noexcept
 Check the GPIO settings of a configuration against its package.
 
constexpr Error ads7952::ValidateAlarms (const Config &config) noexcept
 Check the alarm thresholds of a configuration against its variant.
 
constexpr bool ads7952::ValidSupplies (const Config &config) noexcept
 Check the reference and the analog supply (section 7.3), and Range 2 against them (2 x VREF <= +VA, section 7.6).
 
constexpr bool ads7952::ValidPark (const Config &config) noexcept
 Check Config::park_channel against the variant.
 
constexpr Error ads7952::Validate (const Config &config) noexcept
 Check a configuration without touching the chip.
 
constexpr Config ads7952::ResetConfig (Variant variant) noexcept
 The Config of a variant left in its reset state: Config{} with that variant's Auto-1 mask and Auto-2 last channel.
 
constexpr uint32_t ads7952::CodeToMicrovolts (uint16_t code, Range range, uint16_t vref_mv) noexcept
 Convert a result code to the input voltage it stands for (Table 8: one LSB is full scale / 4096, code 4095 is full scale less one LSB).
 
constexpr const char * ads7952::GetDriverVersion () noexcept
 
constexpr uint32_t ads7952::GetDriverVersionMajor () noexcept
 
constexpr uint32_t ads7952::GetDriverVersionMinor () noexcept
 
constexpr uint32_t ads7952::GetDriverVersionPatch () noexcept
 

Variables

constexpr std::size_t ads7952::kMaxChannels = 16
 Channels of the largest part (ADS7953); arrays indexed by channel have this size.
 
constexpr uint16_t ads7952::kMaxCode = 4095
 Largest result code: 12 bits, straight binary (Table 8).
 
constexpr uint32_t ads7952::kCodesPerFullScale = 4096
 Codes per full scale: one LSB is full scale / 4096 (Table 8).
 
constexpr uint32_t ads7952::kPowerUpUs = 1
 
constexpr std::size_t ads7952::kMaxTraceFrames = 32
 Longest TraceFrames() request, in frames.
 
constexpr std::size_t ads7952::kFrameBytes = 2
 Bytes per transfer: every frame is 16 bits with CS low throughout (section 8.1).
 
constexpr uint8_t ads7952::kNoMonitor = 0xFF
 ScaleMonitor::channel when no channel carries a known voltage: no scale check.
 
constexpr uint8_t ads7952::kNoPark = 0xFF
 Config::park_channel when the chip stays on channel 0 after a read of it: no parking.
 

Detailed Description

Public types of the ADS7952 driver: errors, Result<T>, variants, ranges, GPIO and alarm settings, the configuration and the result of a scan.

Everything here is plain data with no platform dependency, so handlers, tests and tools can include it without the driver template. Section, table and figure numbers refer to the ADS79xx datasheet, TI SLAS605C (revised July 2018).