uTL
micro Template library
|
Abstract base class for i2c bus. More...
#include <i2c.h>
Public Types | |
enum | Sequence { Sequence::BYTE =0, Sequence::ACK, Sequence::BYTEnACK } |
I2C transmit/receive sequence. More... | |
using | type = i2c_i< impl_t > |
Public Member Functions | |
Get/Set functions | |
uint32_t | clock () const |
void | clock (uint32_t f) |
set clock frequency of the bus More... | |
User functions | |
void | start () |
Send start functionality. More... | |
void | stop () |
Send stop functionality. More... | |
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... | |
Protected Member Functions | |
Object lifetime | |
i2c_i ()=default | |
Allow constructor from derived only. More... | |
~i2c_i ()=default | |
Allow destructor from derived only. More... | |
i2c_i (const type &)=delete | |
No copies. More... | |
type & | operator= (const type &)=delete |
Private Member Functions | |
_CRTP_IMPL (impl_t) | |
Implementation requirements | |
| |
uint32_t | _clock () const |
clock frequency of the bus [Hz] More... | |
void | _clock (uint32_t c) |
set clock frequency of the bus [Hz] More... | |
void | _start () |
Send start functionality. More... | |
void | _stop () |
Send stop functionality. More... | |
byte_t | _rx_data (bool ack, Sequence seq) |
bool | _tx_data (byte_t byte, Sequence seq) |
Abstract base class for i2c bus.
this class force a common interface for I2C communication protocol implementations using CRTP
impl_t | The CRTP type (the derived/implementation class typename). |
using utl::i2c_i< impl_t >::type = i2c_i<impl_t> |
|
strong |
|
protecteddefault |
Allow constructor from derived only.
|
protecteddefault |
Allow destructor from derived only.
|
protecteddelete |
No copies.
|
inlineprivate |
|
inlineprivate |
|
private |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inline |
|
protecteddelete |
|
inline |
Receive a byte from the i2c bus.
ack | Optional ack bit.
|
seq | The operation sequence to execute
|
|
inline |
|
inline |
|
inline |
Transmit a byte to the i2c bus.
byte | The byte to send. |
seq | The operation sequence to execute
|