All Projects → g4lvanix → I2c Slave Lib

g4lvanix / I2c Slave Lib

I2C slave library for AVR 8 bit mircocontrollers

Labels

Projects that are alternatives of or similar to I2c Slave Lib

Cderpm
RPM spec file, patches, and scripts to package up the Common Desktop Environment
Stars: ✭ 31 (-13.89%)
Mutual labels:  makefile
Zh Google Styleguide
Google 开源项目风格指南 (中文版)
Stars: ✭ 8,315 (+22997.22%)
Mutual labels:  makefile
Docker Bitcoin Regtest
A way to experiment with Bitcoin.
Stars: ✭ 35 (-2.78%)
Mutual labels:  makefile
Cv Boilerplate
Programmatic generation of high-quality CVs
Stars: ✭ 967 (+2586.11%)
Mutual labels:  makefile
Device Sony Lilac
Stars: ✭ 34 (-5.56%)
Mutual labels:  makefile
Android device motorola titan
Stars: ✭ 34 (-5.56%)
Mutual labels:  makefile
3ds portlibs
Portlibs for 3DS
Stars: ✭ 32 (-11.11%)
Mutual labels:  makefile
Llvm Cheatsheet
LLVM, clang, ninja, dyld and others.
Stars: ✭ 36 (+0%)
Mutual labels:  makefile
Pantheios
The C/C++ Diagnostic Logging Sweetspot
Stars: ✭ 34 (-5.56%)
Mutual labels:  makefile
Android device xiaomi polaris
Stars: ✭ 35 (-2.78%)
Mutual labels:  makefile
Android device samsung serranoltexx
Stars: ✭ 33 (-8.33%)
Mutual labels:  makefile
Arduino Datalogging
Methods of Datalogging Sensor Data from an Arduino.
Stars: ✭ 33 (-8.33%)
Mutual labels:  makefile
Rust Ffi Stringtools
A collection of examples how to use Rust libraries from other languages.
Stars: ✭ 34 (-5.56%)
Mutual labels:  makefile
Contract
My plain-language freelance contract (in Markdown).
Stars: ✭ 32 (-11.11%)
Mutual labels:  makefile
Monero Gui Guide
Guide for the Monero GUI wallet
Stars: ✭ 36 (+0%)
Mutual labels:  makefile
Docker Images
🚢 Basic images for different usages
Stars: ✭ 32 (-11.11%)
Mutual labels:  makefile
Mal
mal - Make a Lisp
Stars: ✭ 8,287 (+22919.44%)
Mutual labels:  makefile
Avian Pack
Avian all-inclusive. Everything needed to build Avian with (or without) Android classpath.
Stars: ✭ 36 (+0%)
Mutual labels:  makefile
Coreos Nvidia
Yet another NVIDIA driver container for Container Linux (aka CoreOS)
Stars: ✭ 36 (+0%)
Mutual labels:  makefile
Espeak Korean
Korean data for eSpeak
Stars: ✭ 34 (-5.56%)
Mutual labels:  makefile

I2C Slave library

Table of contents

  1. What is this library?
  2. Contents of this library
  3. Supported devices
  4. Functions in this library

1. What is this library?

This library is an I2C slave library which uses the TWI peripheral inside the AVR microcontroller to establish connections using the I2C protocol


2. Contents of this library

The library contains the following files:

  • main.c
  • I2C_slave.c
  • I2C_slave.h
main.c

This is a piece of example code which prints out the first index of the buffer to show that the slave device acts as an EEPROM.

I2C_slave.c

This file contains all the function declarations to setup and work with the TWI hardware peripheral inside the AVR. It takes care of the interrupt handling and receiving the bytes.

Make sure you add this source file to your Makefile!

I2C_slave.h

This file contains the function prototypes

This file has to be included in your source file


3. Supported devices

Though I have only tested this library on an ATmega328P it should be running on all major ATmega AVRs like:

  • ATmega644
  • ATmega32
  • ATmega16
  • ATmega328/P
  • ATmega168/P
  • ATmega88/P
  • ATmega44/P
  • ATmega8

If your device is not supported you can probably adapt this library easily to your needs by having a look at the your device's datasheet and changing the register names appropriately

The ATtiny range of microcontrolles is not supported as they only provide a USI peripheral which is completely different from the TWI peripheral used on the other controllers


4. Functions in this library

  • void I2C_init(uint8_t address)
  • void I2C_stop(void)
void I2C_init(uint8_t address)

This function needs to be called only once to set up the TWI to respond to the address passed into the function

Note that you have to include the avr/interrupt.h and you have to globally enable interrupts with sei() for this library to work

void I2C_stop(void)

This function disables the TWI peripheral completely and therefore isolates the device from the bus

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].