ADS9324 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Classes | Namespaces | Concepts | Enumerations
ads9324_spi_interface.hpp File Reference

The port of the ADS9324 driver: the CRTP base, its pin enums, the SpiPort concept and the 24-bit register framing. More...

#include <array>
#include <concepts>
#include <cstddef>
#include <cstdint>
#include <span>
#include "ads9324_detail.hpp"
#include "ads9324_registers.hpp"
#include "ads9324_types.hpp"

Go to the source code of this file.

Classes

class  ads9324::SpiInterface< Derived >
 CRTP base of the platform port. More...
 

Namespaces

namespace  ads9324
 The ADS9324 driver: everything it declares lives here; internals in detail.
 

Concepts

concept  ads9324::SpiPort
 Satisfied by a class that derives from SpiInterface<Port> and implements the required hooks with exactly the types above, noexcept and returning bool.
 

Enumerations

enum class  ads9324::CtrlPin : uint8_t { ads9324::Reset = 0 , ads9324::Convst = 1 , ads9324::DrdyAlarm = 2 }
 Control pins the port may drive or read through the optional hooks. More...
 
enum class  ads9324::GpioSignal : uint8_t { ads9324::INACTIVE = 0 , ads9324::ACTIVE = 1 }
 Logical level of a control pin; the port maps it to the physical polarity. More...
 

Variables

Bus requirements

What the ADS9324 needs from the SPI bus (datasheet sections 5.6, 5.7 and 7.5). A port and a board configuration check their settings against these with static_assert (KB-CPP-123).

constexpr uint8_t ads9324::kSpiMode = 0
 
constexpr bool ads9324::kMsbFirst = true
 Each byte is clocked most significant bit first.
 
constexpr uint32_t ads9324::kMaxClockHz = kSclkMaxHz
 Highest SCLK frequency, f_SCLK (section 5.6), for frames that read nothing back.
 
constexpr uint32_t ads9324::kMaxSdoutClockHz = 29'000'000
 
constexpr uint32_t ads9324::kMinCsHighNs = 16
 Shortest time CS stays high between two frames, thi_CS (section 5.6).
 
constexpr uint32_t ads9324::kCsSetupNs = 16
 CS low to the first SCLK edge, tsu_CSCK.
 
constexpr uint32_t ads9324::kCsHoldNs = 16
 Last SCLK edge to CS high, tht_CSCK.
 
constexpr bool ads9324::kFrameIsAtomic = true
 
constexpr bool ads9324::kContinuousWord = false
 
constexpr uint32_t ads9324::kFrameBits = 24
 Bits in a register frame: 8 address bits and 16 data bits.
 

Detailed Description

The port of the ADS9324 driver: the CRTP base, its pin enums, the SpiPort concept and the 24-bit register framing.

The driver never calls an SDK. It calls hooks on a class you derive from ads9324::SpiInterface<Self>:

The port moves raw bytes: it never retries, never interprets a frame and never configures the chip. What the chip needs from the bus is below as constexpr values (kSpiMode to kFrameBits, datasheet sections 5.6, 5.7 and 7.5); a port checks its settings against them with static_assert. The optional hooks (GpioSet, GpioGet, CaptureLanes, Log) are described in ads9324.hpp.