HF-AS5047U Driver  0.1.0-dev
HF-AS5047U C++ Driver
Loading...
Searching...
No Matches
as5047u_spi_interface.hpp
Go to the documentation of this file.
1
6#pragma once
7#include <cstddef>
8#include <cstdint>
9
10namespace as5047u {
11
36template <typename Derived> class SpiInterface {
37public:
51 void transfer(const uint8_t *tx, uint8_t *rx, std::size_t len) {
52 return static_cast<Derived *>(this)->transfer(tx, rx, len);
53 }
54
55 // Prevent copying
56 SpiInterface(const SpiInterface &) = delete;
58
59protected:
63 SpiInterface() = default;
64
65 // Allow moving
68
73 ~SpiInterface() = default;
74};
75
76} // namespace as5047u
CRTP-based template interface for SPI bus operations.
Definition as5047u_spi_interface.hpp:36
~SpiInterface()=default
Protected destructor.
SpiInterface()=default
Protected constructor to prevent direct instantiation.
SpiInterface(const SpiInterface &)=delete
SpiInterface(SpiInterface &&)=default
SpiInterface & operator=(SpiInterface &&)=default
SpiInterface & operator=(const SpiInterface &)=delete
void transfer(const uint8_t *tx, uint8_t *rx, std::size_t len)
Perform a full-duplex SPI data transfer.
Definition as5047u_spi_interface.hpp:51
Definition as5047u.ipp:17