utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder > Class Template Referenceabstract

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>`

Inheritance diagram for utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >:

## Public Types

using | type = spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >
| Export type as identity meta-function. More...
Public Types inherited from utl::spi_i< virtual_tag >
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...
Protected Member Functions inherited from utl::spi_i< virtual_tag >
| 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

Public Member Functions inherited from utl::spi_i< virtual_tag >
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

## Detailed Description

### template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>
class utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >

A virtual base class interface specialization. Using the private virtual interface we provide the interface from spi_i<virtual_tag>

Parameters

  impl_t | = virtual_tag
  CPOL | Clock polarity
  CPHA | Clock phase
  BitOrder | Data transfer bit order

Definition at line 190 of file spi_bb.h.

## Member Typedef Documentation

## type

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>

using utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::type = spi_bb_i<virtual_tag, CPOL, CPHA, BitOrder>

Export type as identity meta-function.

Definition at line 192 of file spi_bb.h.

## Constructor & Destructor Documentation

## ~spi_bb_i()

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>

utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::~spi_bb_i | ( |  | ) |

protecteddefault

A default destructor, allow destructor from derived only

## spi_bb_i()

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>

utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::spi_bb_i | ( | uint32_t | clk | ) |

inlineprotectednoexcept

A default constructor.

Definition at line 201 of file spi_bb.h.

## Member Function Documentation

## _clock() [1/2]

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>

uint32_t utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::_clock | ( |  | ) | const

inlinefinalprivatevirtual

Read the clock frequency of the bus.

Implements utl::spi_i< virtual_tag >.

Definition at line 239 of file spi_bb.h.

## _clock() [2/2]

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>

void utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::_clock | ( | uint32_t |  | ) |

inlinefinalprivatevirtual

Set the clock frequency of the bus.

Implements utl::spi_i< virtual_tag >.

Definition at line 240 of file spi_bb.h.

## _tx_data()

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>

byte_t utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::_tx_data | ( | byte_t |  | ) |

inlinefinalprivatevirtual

Transmit a byte on the bus and return the response

Implements utl::spi_i< virtual_tag >.

Definition at line 241 of file spi_bb.h.

## _tx_data_impl() [1/2]

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>
template<spi::cpha C>

meta::enable_if_t<(C==spi::cpha::LOW), byte_t > utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::_tx_data_impl | ( | byte_t | out | ) |

private

_tx_data implementation CPHA == LOW Out at preceding clock trailing edge, In at leading clock edge

Parameters

  out | The byte to send to SPI bus

Returns
  The byte read from the bus

Definition at line 266 of file spi_bb.h.

## _tx_data_impl() [2/2]

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>
template<spi::cpha C>

meta::enable_if_t<(C==spi::cpha::HIGH), byte_t > utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::_tx_data_impl | ( | byte_t | out | ) |

private

_tx_data implementation CPHA == HIGH Out at leading clock edge, In at trailing clock edge

Parameters

  out | The byte to send to SPI bus

Returns
  The byte read from the bus

Definition at line 290 of file spi_bb.h.

## clkHigh()

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>
template<spi::cpol C = CPOL>

static constexpr bool utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::clkHigh | ( |  | ) |

inlinestaticprivate

Definition at line 213 of file spi_bb.h.

## clkLow()

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>
template<spi::cpol C = CPOL>

static constexpr bool utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::clkLow | ( |  | ) |

inlinestaticprivate

Definition at line 216 of file spi_bb.h.

## delay()

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>

virtual void utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::delay | ( | uint32_t |  | ) |

privatepure virtual

Implementers's half period delay function

## MISO()

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>

virtual bool utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::MISO | ( |  | ) |

privatepure virtual

Implementers's MISO pin function.

## MOSI()

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>

virtual void utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::MOSI | ( | bool |  | ) |

privatepure virtual

Implementers's MOSI pin function.

## SCLK()

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>

virtual void utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::SCLK | ( | bool |  | ) |

privatepure virtual

Implementers's SCLK pin function.

## shift() [1/2]

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>
template<spi::bitOrder B = BitOrder>

constexpr meta::enable_if_t<(B == spi::bitOrder::LSB_First), void> utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::shift | ( | byte_t & | b | ) |

inlineprivate

Definition at line 210 of file spi_bb.h.

## shift() [2/2]

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>
template<spi::bitOrder B = BitOrder>

constexpr meta::enable_if_t<(B == spi::bitOrder::MSB_First), void> utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::shift | ( | byte_t & | b | ) |

inlineprivate

Definition at line 212 of file spi_bb.h.

## Member Data Documentation

## clkH_

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>

constexpr bool utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::clkH_ {clkHigh()}

staticprivate

Definition at line 219 of file spi_bb.h.

## clkL_

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>

constexpr bool utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::clkL_ {clkLow()}

staticprivate

Definition at line 220 of file spi_bb.h.

## nsec_

template<spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder>

uint32_t utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::nsec_

private

Data membershalf period of SPI bus

Definition at line 252 of file spi_bb.h.

The documentation for this class was generated from the following file:

- include/utl/com/spi_bb.h