Coder Social home page Coder Social logo

mahdiasdzd / i2cdevlib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jrowberg/i2cdevlib

1.0 0.0 0.0 2.08 MB

I2C device library collection for AVR/Arduino or other C++-based MCUs

Home Page: http://www.i2cdevlib.com

Shell 0.07% C++ 61.16% C 37.02% Processing 0.62% Makefile 0.90% CMake 0.22%

i2cdevlib's Introduction

I2C Device Library

The I2C Device Library (i2cdevlib) is a collection of mostly uniform and well-documented classes to provide simple and intuitive interfaces to I2C devices. Each device is built to make use of the generic "I2Cdev" class, which abstracts the I2C bit- and byte-level communication away from each specific device class, making it easy to keep the device class clean while providing a simple way to modify just one class to port the I2C communication code onto different platforms (Arduino, PIC, MSP430, Jennic, simple bit-banging, etc.). Device classes are designed to provide complete coverage of all functionality described by each device's documentation, plus any generic convenience functions that are helpful.

There are examples in many of the classes that demonstrate basic usage patterns. The I2Cdev class is built to be used statically, reducing the memory requirement if you have multiple I2C devices in your project. Only one instance of the I2Cdev class is required. Recent additions as of late 2021 have also made it possible to pass in non-default Wire objects (in the Arduino environment) to allow using multiple I2C transceivers at the same time, specifically because of the number of people who wanted to use up to four MPU-6050 IMUs without I2C mux ICs involved.

Documentation for each class is created using Doxygen-style comments placed in each class definition file, based on the information available in each device's datasheet. This documentation is available in HTML format on the i2cdevlib.com website, which also holds helpful information for most of the classes present here on the repository.

Installation

Due to my...ahem...unfortunate ignorance way back when I first created this project, the entire codebase (all platforms, cores, and device libraries) are all inside of this one giant repository. That means there's no easy IDE integration the way most libraries work in the Arduino world and elsewhere. Instead, do the following:

  1. Clone or download a .zip archive of the repo
  2. Move or copy the relevant core and device drivers into your project tree or library subfolder
    (For Arduino, this means the /Arduino/I2Cdev and /Arduino/MPU6050 folders, for example)
  3. Rescan libraries or restart your IDE if necessary

For both usage and development, I've found that it's best to clone using the git client of your choice, and then create symlinks as needed from the master repository sources into your development location(s). This is usually more intuitive for people who use Linux, but it can be done in Windows as well using the mklink /D command. See this page for a set of Windows-specific instructions with screenshots.

Usage

Exact usage varies from device to device, but most (especially the more popular ones) include example projects demonstrating the basics. Refer to those examples for the best material currently available.

Contributing

Want a library for a device that isn't up on the repository? You can either request it in the discussion area for this repo on Github, or fork the code and write it yourself.

Realistically, Option B is more reliable. Try to mimic the structure and code conventions of the existing codebase as much as possible. If you go this route, please use the following approach:

  1. Fork the repository to your own user
  2. Create a new branch specific to your new code
  3. Write, test, and commit your new code
  4. Submit a pull request from your branch back to the original source

I and a few others will review the pull request and comment as needed, and then hopefully merge it.


Note: additional details about this project can be found at https://www.i2cdevlib.com

Another note: this project has a fledgling successor that aims to address all of its shortcomings, which can be found at https://github.com/perilib

i2cdevlib's People

Contributors

alphatech56 avatar anvol avatar aspineux avatar brand17 avatar daichou avatar eadf avatar frankboesing avatar ginolig avatar hamish2014 avatar honnet avatar i164j9 avatar ivankravets avatar j3rn avatar jensh avatar jrowberg avatar kript0n avatar loopj avatar mateus-amarante avatar me21 avatar mr-nice avatar natecostello avatar paulstoffregen avatar paynterf avatar rgsteele avatar robertrfenichel avatar ryanneve avatar schamp avatar shmakins avatar thorsten-gehrig avatar zhomeslice avatar

Stargazers

 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.