Giter Club home page Giter Club logo

avr-i2c-slave's Introduction

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: https://github.com/devthrash/I2C-slave-lib

Files

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

Usage

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

I2C_init(I2C_ADDRESS);

Transmitting data to the master when requested

I2C_transmitByte(data);

Example

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

avr-i2c-slave's People

Contributors

thegouger avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.