HF-ADS7952 Driver 0.1.0-dev
HF-ADS7952 C++ Driver
Loading...
Searching...
No Matches
ads7952_spi_interface.hpp
Go to the documentation of this file.
1
7#pragma once
8#include <cstddef>
9#include <cstdint>
10
11namespace ads7952 {
12
44template <typename Derived> class SpiInterface {
45public:
59 void transfer(const uint8_t *tx, uint8_t *rx, std::size_t len) {
60 return static_cast<Derived *>(this)->transfer(tx, rx, len);
61 }
62
63 // Prevent copying
64 SpiInterface(const SpiInterface &) = delete;
66
67protected:
71 SpiInterface() = default;
72
73 // Allow moving
76
81 ~SpiInterface() = default;
82};
83
84} // namespace ads7952
CRTP-based template interface for SPI bus operations.
SpiInterface & operator=(SpiInterface &&)=default
SpiInterface(const SpiInterface &)=delete
~SpiInterface()=default
Protected destructor.
SpiInterface(SpiInterface &&)=default
void transfer(const uint8_t *tx, uint8_t *rx, std::size_t len)
Perform a full-duplex SPI data transfer.
SpiInterface & operator=(const SpiInterface &)=delete
SpiInterface()=default
Protected constructor to prevent direct instantiation.