uTL
micro Template library
|
A virtual base class interface specialization. Using the private virtual interface we provide the interface from spi_i<virtual_tag> More...
#include <spi_bb.h>
Public Types | |
using | type = spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder > |
Export type as identity meta-function. More... | |
![]() | |
using | type = spi_i< virtual_tag > |
Export type as identity meta-function. More... | |
Protected Member Functions | |
Object lifetime | |
~spi_bb_i ()=default | |
spi_bb_i (uint32_t clk) noexcept | |
A default constructor. More... | |
![]() | |
spi_i ()=default | |
Allow constructor from derived only. More... | |
spi_i (const type &)=delete | |
No copies. More... | |
type & | operator= (const type &)=delete |
Private Member Functions | |
Implementation requirements | |
} | |
virtual void | MOSI (bool)=0 |
Implementers's MOSI pin function. More... | |
virtual bool | MISO ()=0 |
Implementers's MISO pin function. More... | |
virtual void | SCLK (bool)=0 |
Implementers's SCLK pin function. More... | |
virtual void | delay (uint32_t)=0 |
Implementation of base requirements | |
uint32_t | _clock () const final |
Read the clock frequency of the bus. More... | |
void | _clock (uint32_t c) final |
Set the clock frequency of the bus. More... | |
byte_t | _tx_data (byte_t out) final |
template<spi::cpha C = CPHA> | |
meta::enable_if_t<(C==spi::cpha::LOW), byte_t > | _tx_data_impl (byte_t out) |
_tx_data implementation CPHA == LOW Out at preceding clock trailing edge, In at leading clock edge More... | |
template<spi::cpha C = CPHA> | |
meta::enable_if_t<(C==spi::cpha::HIGH), byte_t > | _tx_data_impl (byte_t out) |
_tx_data implementation CPHA == HIGH Out at leading clock edge, In at trailing clock edge More... | |
Private Attributes | |
uint32_t | nsec_ |
SPI implementation specific functions | |
static constexpr bool | clkH_ {clkHigh()} |
static constexpr bool | clkL_ {clkLow()} |
template<spi::bitOrder B = BitOrder> | |
constexpr meta::enable_if_t<(B==spi::bitOrder::LSB_First), void > | shift (byte_t &b) |
template<spi::bitOrder B = BitOrder> | |
constexpr meta::enable_if_t<(B==spi::bitOrder::MSB_First), void > | shift (byte_t &b) |
template<spi::cpol C = CPOL> | |
static constexpr bool | clkHigh () |
template<spi::cpol C = CPOL> | |
static constexpr bool | clkLow () |
Additional Inherited Members | |
![]() | |
uint32_t | clock () const |
void | clock (uint32_t c) |
set clock frequency of the bus More... | |
byte_t | tx_data (byte_t out) |
size_t | tx_data (const byte_t *out, byte_t *in, size_t n) |
Transmit a number of bytes to the spi bus and read the response. More... | |
byte_t | rx_data () |
size_t | rx_data (byte_t *in, size_t n) |
Receive a number of bytes from the spi bus while transmitting 0xFFs. More... | |
virtual | ~spi_i ()=default |
A virtual base class interface specialization. Using the private virtual interface we provide the interface from spi_i<virtual_tag>
impl_t | = virtual_tag |
CPOL | Clock polarity |
CPHA | Clock phase |
BitOrder | Data transfer bit order |
using utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::type = spi_bb_i<virtual_tag, CPOL, CPHA, BitOrder> |
|
protecteddefault |
A default destructor, allow destructor from derived only
|
inlineprotectednoexcept |
|
inlinefinalprivatevirtual |
Read the clock frequency of the bus.
Implements utl::spi_i< virtual_tag >.
|
inlinefinalprivatevirtual |
Set the clock frequency of the bus.
Implements utl::spi_i< virtual_tag >.
|
inlinefinalprivatevirtual |
Transmit a byte on the bus and return the response
Implements utl::spi_i< virtual_tag >.
|
private |
|
private |
|
inlinestaticprivate |
|
inlinestaticprivate |
|
privatepure virtual |
Implementers's half period delay function
|
privatepure virtual |
Implementers's MISO pin function.
|
privatepure virtual |
Implementers's MOSI pin function.
|
privatepure virtual |
Implementers's SCLK pin function.
|
inlineprivate |
|
inlineprivate |
|
staticprivate |
|
staticprivate |
|
private |