HardFOC driver
ADS7952 Driver¶
A C++20 driver for the Texas Instruments ADS7952 12-channel, 12-bit, 1 MSPS SAR ADC. It reads one channel or a whole sequence, programs per-channel alarms and the four GPIOs, and converts counts to volts, on any MCU with SPI.
The driver has no platform code. You give it a small class that moves bytes over SPI; it does the rest: the 16-bit command words, the two-frame result pipeline, the power-up discard, sequence and alarm programming and the conversion to volts.
- Inputs
- 12 single-ended channels through one multiplexer (MXO, wired to AINP)
- Interface
- SPI mode 0 up to 20 MHz, 16-bit frames, MSB first
- Input range
- 0 to VREF, or 0 to 2 × VREF while 2 × VREF ≤ +VA; external VREF 2.0 V to 3.0 V
- Supply
- +VA 2.7 V to 5.25 V (analog), +VBD 1.7 V to +VA (digital I/O)
- Extras
- Manual, Auto-1 and Auto-2 sequencing; high and low alarm per channel; 4 GPIOs (TSSOP)
- Package
- 38-pin TSSOP (DBT) or 32-pin VQFN (RHB, one GPIO); −40 °C to 125 °C
What you get¶
- One object per chip.
ADS7952<YourSpi>reads channels, switches modes and programs sequences, alarms and GPIOs. See API guide. - Results matched to their channel. Every reply carries the 4-bit address of the channel it belongs to; the driver keys on it instead of counting frames. See Modes and the frame pipeline.
- Volts in and out. Counts convert with the reference and range you run, and alarm thresholds take volts. See Configuration.
- Zero-overhead portability. The port is a CRTP class with one method: no virtual calls, no heap, no RTOS dependency. See Porting.
- Tested without hardware. Host unit tests run the driver against a model of the chip's SPI pipeline. See Testing and CI.
Where to go next¶
-
Wire the chip, write the port, read every channel in about 15 lines.
-
Pins, bus settings, timing, reference and supply ranges.
-
The three layers and what each one owns.
-
Configure, read, program alarms and GPIOs, handle errors, task by task.
-
Implement the SPI interface for your MCU.
-
Every class and member, generated from the headers.