twi.h File Reference
#include <stdint.h>
#include <stddef.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 (uint8_t sda, uint8_t scl)
 
void twi_stop ()
 
void twi_setClock (uint32_t freq)
 
void twi_setClockStretchLimit (uint32_t limit)
 
uint8_t twi_writeTo (uint8_t address, const uint8_t *buf, size_t len, bool sendStop)
 
uint8_t twi_readFrom (uint8_t address, uint8_t *buf, size_t len, bool 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 ( uint8_t  sda,
uint8_t  scl 
)

◆ twi_readFrom()

uint8_t twi_readFrom ( uint8_t  address,
uint8_t *  buf,
size_t  len,
bool  sendStop 
)

◆ twi_setClock()

void twi_setClock ( uint32_t  freq)

◆ twi_setClockStretchLimit()

void twi_setClockStretchLimit ( uint32_t  limit)

◆ twi_status()

uint8_t twi_status ( )

◆ twi_stop()

void twi_stop ( )

◆ twi_writeTo()

uint8_t twi_writeTo ( uint8_t  address,
const uint8_t *  buf,
size_t  len,
bool  sendStop 
)