HF-ADS7952 Driver 0.1.0-dev
HF-ADS7952 C++ Driver
Loading...
Searching...
No Matches
ads7952.hpp File Reference

Main driver class for the ADS7952 12-channel, 12-bit SAR ADC. More...

#include <cstdint>
#include <cstddef>
#include <algorithm>
#include "ads7952_config.hpp"
#include "ads7952_registers.hpp"
#include "ads7952_spi_interface.hpp"
#include "ads7952_types.hpp"
#include "ads7952.ipp"

Go to the source code of this file.

Classes

class  ads7952::ADS7952< SpiType >
 Main driver class for the ADS7952 ADC. More...
 

Namespaces

namespace  ads7952
 

Macros

#define ADS7952_HEADER_INCLUDED
 

Detailed Description

Main driver class for the ADS7952 12-channel, 12-bit SAR ADC.

Hardware-agnostic C++20 driver for the Texas Instruments ADS7952 multichannel SAR ADC using CRTP for zero-overhead SPI abstraction.

Key Features

  • 12 analog input channels, 12-bit resolution, up to 1 MSPS
  • Manual, Auto-1, and Auto-2 channel sequencing modes
  • Configurable input range (Vref or 2*Vref, clamped to VA)
  • GPIO programming (4 pins with alarm routing)
  • Per-channel alarm threshold programming (high/low)
  • Power-down control
  • Direct imperative SPI sequences (no state machine overhead)
  • Proper first-frame discard after power-up per datasheet spec

Basic Usage

class MySpi : public ads7952::SpiInterface<MySpi> {
public:
void transfer(const uint8_t* tx, uint8_t* rx, size_t len) { ... }
};
MySpi spi;
ads7952::ADS7952<MySpi> adc(spi, 2.5f, 5.0f);
adc.EnsureInitialized(); // Idempotent — safe to call repeatedly
auto result = adc.ReadChannel(3);
if (result.ok()) printf("CH3: %.3f V\n", result.voltage);
auto all = adc.ReadAllChannels();
for (uint8_t ch = 0; ch < 12; ch++)
if (all.hasChannel(ch)) printf("CH%u: %u\n", ch, all.count[ch]);
Main driver class for the ADS7952 ADC.
Definition ads7952.hpp:76
CRTP-based template interface for SPI bus operations.
void transfer(const uint8_t *tx, uint8_t *rx, std::size_t len)
Perform a full-duplex SPI data transfer.

Definition in file ads7952.hpp.

Macro Definition Documentation

◆ ADS7952_HEADER_INCLUDED

#define ADS7952_HEADER_INCLUDED

Definition at line 42 of file ads7952.hpp.