utl::i2c_bb_i< virtual_tag > Class Template Referenceabstract

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

`#include <i2c_bb.h>`

Inheritance diagram for utl::i2c_bb_i< virtual_tag >:

## Public Types

enum | SDAMode { SDAMode::INPUT =0, SDAMode::OUTPUT }
| SDA pin direction enumerator. More...
using | type = i2c_bb_i< virtual_tag >
| Export type as identity meta-function. More...
using | Sequence = typename i2c_i< virtual_tag >::Sequence
Public Types inherited from utl::i2c_i< virtual_tag >
enum | Sequence { Sequence::BYTE =0, Sequence::ACK, Sequence::BYTEnACK }
| I2C transmit/receive sequence. More...
using | type = i2c_i< virtual_tag >
| Export type as identity meta-function. More...

## Protected Member Functions

Object lifetime
| i2c_bb_i (uint32_t clk) noexcept
| Constructor. More...
virtual | ~i2c_bb_i () noexcept=default
| Virtual destructor. More...
Protected Member Functions inherited from utl::i2c_i< virtual_tag >
| i2c_i ()=default
| Allow constructor from derived only. More...
| i2c_i (const type &)=delete
| No copies. More...
type & | operator= (const type &)=delete

## Private Member Functions

Implementation requirements
virtual bool | SDA (SDAMode mode, bool st)=0
virtual void | SCL (bool st)=0
| Implementers's scl pin function. More...
virtual void | delay (uint32_t usec)=0

## Implementation of base requirements

uint32_t | usec_
| half period of I2C bus More...
uint32_t | _clock () const final
void | _clock (uint32_t c) final
| set clock frequency of the bus [Hz] More...
void | _start () final
| Send a START bit to the bus. More...
void | _stop () final
| Send a START bit to the bus. More...
byte_t | _rx_data (bool ack, Sequence seq) final
| Receive a byte from the i2c bus. More...
bool | _tx_data (byte_t byte, Sequence seq) final
| Transmit a byte to the i2c bus. More...

## Additional Inherited Members

Public Member Functions inherited from utl::i2c_i< virtual_tag >
uint32_t | clock () const
void | clock (uint32_t c)
| set clock frequency of the bus [Hz] More...
void | start ()
void | stop ()
byte_t | rx_data (bool ack, Sequence seq=Sequence::BYTEnACK)
| Receive a byte from the i2c bus. More...
bool | tx_data (byte_t byte, Sequence seq=Sequence::BYTEnACK)
| Transmit a byte to the i2c bus. More...
virtual | ~i2c_i ()=default

## Detailed Description

### template<>
class utl::i2c_bb_i< virtual_tag >

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

Parameters

  impl_t | = virtual_tag

Definition at line 234 of file i2c_bb.h.

## Member Typedef Documentation

## Sequence

using utl::i2c_bb_i< virtual_tag >::Sequence = typename i2c_i<virtual_tag>::Sequence

Definition at line 237 of file i2c_bb.h.

## type

using utl::i2c_bb_i< virtual_tag >::type = i2c_bb_i<virtual_tag>

Export type as identity meta-function.

Definition at line 236 of file i2c_bb.h.

## Member Enumeration Documentation

## SDAMode

enum utl::i2c_bb_i< virtual_tag >::SDAMode

strong

SDA pin direction enumerator.

Enumerator
INPUT |
OUTPUT |

Definition at line 239 of file i2c_bb.h.

## Constructor & Destructor Documentation

## i2c_bb_i()

utl::i2c_bb_i< virtual_tag >::i2c_bb_i | ( | uint32_t | clk | ) |

inlineprotectednoexcept

Constructor.

Definition at line 250 of file i2c_bb.h.

## ~i2c_bb_i()

virtual utl::i2c_bb_i< virtual_tag >::~i2c_bb_i | ( |  | ) |

protectedvirtualdefaultnoexcept

Virtual destructor.

## Member Function Documentation

## _clock() [1/2]

uint32_t utl::i2c_bb_i< virtual_tag >::_clock | ( |  | ) | const

inlinefinalprivatevirtual

Returns
  clock frequency of the bus [Hz]

Implements utl::i2c_i< virtual_tag >.

Definition at line 276 of file i2c_bb.h.

## _clock() [2/2]

void utl::i2c_bb_i< virtual_tag >::_clock | ( | uint32_t |  | ) |

inlinefinalprivatevirtual

set clock frequency of the bus [Hz]

Implements utl::i2c_i< virtual_tag >.

Definition at line 277 of file i2c_bb.h.

## _rx_data()

byte_t utl::i2c_bb_i< virtual_tag >::_rx_data | ( | bool | ack,
|  | Sequence | seq
| ) |  |

finalprivatevirtual

Receive a byte from the i2c bus.

Parameters

  ack

  Optional ack bit.
  - 1 ACK the reception
  - 0 Don't ACK the reception.

  seq

  The operation sequence to execute
  - Sequence::BYTE Receive only the byte, do not send ack clock
  - Sequence::ACK Send only the ack bit
  - Sequence::BYTEnACK Receive the byte and send the ack bit

Returns
  The byte received.

Implements utl::i2c_i< virtual_tag >.

Definition at line 330 of file i2c_bb.h.

## _start()

void utl::i2c_bb_i< virtual_tag >::_start | ( | void |  | ) |

finalprivatevirtual

Send a START bit to the bus.

Returns
  none

Implements utl::i2c_i< virtual_tag >.

Definition at line 293 of file i2c_bb.h.

## _stop()

void utl::i2c_bb_i< virtual_tag >::_stop | ( | void |  | ) |

finalprivatevirtual

Send a START bit to the bus.

Returns
  none

Implements utl::i2c_i< virtual_tag >.

Definition at line 308 of file i2c_bb.h.

## _tx_data()

bool utl::i2c_bb_i< virtual_tag >::_tx_data | ( | byte_t | byte,
|  | Sequence | seq
| ) |  |

finalprivatevirtual

Transmit a byte to the i2c bus.

Parameters

  byte | The byte to send.

  seq

  The operation sequence to execute
  - Sequence::BYTE Transmit only the byte, do not read ack bit
  - Sequence::ACK Read only the ack bit
  - Sequence::BYTEnACK Transmit the byte and read the ack bit

Returns
  Slave's ACK bit
  - false Slave didn't ACK
  - true Slave did ACK

Implements utl::i2c_i< virtual_tag >.

Definition at line 369 of file i2c_bb.h.

## delay()

virtual void utl::i2c_bb_i< virtual_tag >::delay | ( | uint32_t | usec | ) |

privatepure virtual

Implementers's usec delay function

## SCL()

virtual void utl::i2c_bb_i< virtual_tag >::SCL | ( | bool | st | ) |

privatepure virtual

Implementers's scl pin function.

## SDA()

virtual bool utl::i2c_bb_i< virtual_tag >::SDA | ( | SDAMode | mode,
|  | bool | st
| ) |  |

privatepure virtual

Implementers's sda pin function

Parameters

  st | In SDA_OUTPUT mode, selects the pin output state

Returns
  In SDA_INPUT mode return the pin input state

## Member Data Documentation

## usec_

uint32_t utl::i2c_bb_i< virtual_tag >::usec_

private

half period of I2C bus

Definition at line 284 of file i2c_bb.h.

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

- include/utl/com/i2c_bb.h