Miosix  2.01
miosix::SoftwareI2C< SDA, SCL, stretchTimeout > Class Template Reference

#include <software_i2c.h>

Static Public Member Functions

static void init ()
 
static void sendStart ()
 
static void sendStop ()
 
static bool send (unsigned char data)
 
static unsigned char recvWithAck ()
 
static unsigned char recvWithNack ()
 

Detailed Description

template<typename SDA, typename SCL, unsigned stretchTimeout = 50>
class miosix::SoftwareI2C< SDA, SCL, stretchTimeout >

Software I2C class.

Parameters
SDASDA gpio pin. Pass a Gpio<P,N> class
SCLSCL gpio pin. Pass a Gpio<P,N> class
timeoutfor clock stretching, in milliseconds

Member Function Documentation

template<typename SDA , typename SCL , unsigned stretchTimeout>
void miosix::SoftwareI2C< SDA, SCL, stretchTimeout >::init ( )
static

Initializes the SPI software peripheral

template<typename SDA , typename SCL , unsigned stretchTimeout>
unsigned char miosix::SoftwareI2C< SDA, SCL, stretchTimeout >::recvWithAck ( )
static

Receive a byte from a device. Always acknowledges back.

Returns
the received byte
template<typename SDA , typename SCL , unsigned stretchTimeout>
unsigned char miosix::SoftwareI2C< SDA, SCL, stretchTimeout >::recvWithNack ( )
static

Receive a byte from a device. Never acknowledges back.

Returns
the received byte
template<typename SDA , typename SCL , unsigned stretchTimeout>
bool miosix::SoftwareI2C< SDA, SCL, stretchTimeout >::send ( unsigned char  data)
static

Send a byte to a device.

Parameters
databyte to send
Returns
true if the device acknowledged the byte
template<typename SDA , typename SCL , unsigned stretchTimeout>
void miosix::SoftwareI2C< SDA, SCL, stretchTimeout >::sendStart ( )
static

Send a start condition

template<typename SDA , typename SCL , unsigned stretchTimeout>
void miosix::SoftwareI2C< SDA, SCL, stretchTimeout >::sendStop ( )
static

Send a stop condition


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