twi.h File Reference
#include <stdint.h>
Include dependency graph for twi.h:

Go to the source code of this file.

Macros

#define I2C_OK   0
 
#define I2C_SCL_HELD_LOW   1
 
#define I2C_SCL_HELD_LOW_AFTER_READ   2
 
#define I2C_SDA_HELD_LOW   3
 
#define I2C_SDA_HELD_LOW_AFTER_INIT   4
 

Functions

void twi_init (unsigned char sda, unsigned char scl)
 
void twi_stop (void)
 
void twi_setClock (unsigned int freq)
 
void twi_setClockStretchLimit (uint32_t limit)
 
uint8_t twi_writeTo (unsigned char address, unsigned char *buf, unsigned int len, unsigned char sendStop)
 
uint8_t twi_readFrom (unsigned char address, unsigned char *buf, unsigned int len, unsigned char sendStop)
 
uint8_t twi_status ()
 

Macro Definition Documentation

◆ I2C_OK

#define I2C_OK   0

◆ I2C_SCL_HELD_LOW

#define I2C_SCL_HELD_LOW   1

◆ I2C_SCL_HELD_LOW_AFTER_READ

#define I2C_SCL_HELD_LOW_AFTER_READ   2

◆ I2C_SDA_HELD_LOW

#define I2C_SDA_HELD_LOW   3

◆ I2C_SDA_HELD_LOW_AFTER_INIT

#define I2C_SDA_HELD_LOW_AFTER_INIT   4

Function Documentation

◆ twi_init()

void twi_init ( unsigned char  sda,
unsigned char  scl 
)

◆ twi_readFrom()

uint8_t twi_readFrom ( unsigned char  address,
unsigned char *  buf,
unsigned int  len,
unsigned char  sendStop 
)

◆ twi_setClock()

void twi_setClock ( unsigned int  freq)

◆ twi_setClockStretchLimit()

void twi_setClockStretchLimit ( uint32_t  limit)

◆ twi_status()

uint8_t twi_status ( )

◆ twi_stop()

void twi_stop ( void  )

◆ twi_writeTo()

uint8_t twi_writeTo ( unsigned char  address,
unsigned char *  buf,
unsigned int  len,
unsigned char  sendStop 
)