Skip to content
I2C slave library for Atmel AVRs
C Makefile
Branch: master
Clone or download
Latest commit ae740b0 Nov 6, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
I2CSlave.c Initial Commit Mar 22, 2015
I2CSlave.h Initial Commit Mar 22, 2015
LICENSE Create LICENSE Nov 6, 2017 Create Mar 23, 2015
main.c Initial Commit Mar 22, 2015
makefile Initial Commit Mar 22, 2015

AVR I2C Slave Library

This library provides interrupt-based I2C slave functionality for Atmel 8-bit microcontrollers equipped with a TWI peripheral.

It is somewhat based on an existing library found here:


  • I2CSlave.c -- Implements init/stop, and interrupt-based receive and request logic
  • I2CSlave.h -- Function prototypes and a convience method for transmitting data


Provide callbacks for receiving and handling requests in your application code. eg:

void I2C_received(uint8_t data);
void I2C_requested();

I2C_setCallbacks(I2C_received, I2C_requested);

The library calls the received callback for each byte the master transmits to the slave. The library calls the requested callback for each byte the master attempts to read from the slave.

Init the I2C slave with the slave address


Transmitting data to the master when requested



The example in main.c implements a sample application in which the slave can receive a byte, and then will echo the byte when requested.

To compile: make

You can’t perform that action at this time.