/CrossPlatformI2C

Simple cross-platform C++ support for I2C devices

Primary LanguageC++GNU General Public License v3.0GPL-3.0

This library supports communication with I2C and SPI devices on today's popular microcontroller and single-board-computer platforms:

  • Arduino
  • Teensy
  • Raspberry Pi
  • NVIDIA Jetson

The project is similar in spirit to Jeff Rowberg's I2Cdevlib, but unlike I2Cdevlib, CrossPlatformDataBus does not provide code for particular I2C devices. Instead, we provide a separate repository with support for each such sensor, which works together with CrossPlatformDataBus to help you use that sensor. Currently supported sensors include:

  • EM7180 SENtral Sensor Fusion Solution from Tlera Corp

  • LIS2MDL magnetometer from STMicroelectronics

  • LPS22HB barometer from STMicroelectronics

  • LSM6DSM intertial measurement unit from STMicroelectronics

  • MB1242 ultrasonic rangefinder from MaxBotix

  • MPU line of intertial measurement units from Invensense

  • MS5637 barometer from TE / Measurement Specialties

  • VL53L1X time-of-flight rangefinder from STMicroelectronics (partial support)

We've set up the library as a standard Arduino library, with src and examples folders. To keep things simple, we provide a single example sketch MPU_WhoAmI.ino, which reads from the “Who am I” register (0x75) of an Invensense MPU Internal Measurement Unit (device address 0x68). Success at reading from this register results in a reported value of 0x71. Arduino users who have such a sensor can just open the File/Examples/CrossPlatformDataBus menu item to try out the sketch.

RaspberryPi users should download and install WiringPi, then cd to CrossPlatformDataBus/extras/i2c/wiringpi/examples, and run make to build the example. You may have to run this examples as root; i.e., sudo ./MPU_WhoAmI.

Users of NVIDIA Jetson and other Linux-based boards can cd to CrossPlatformDataBus/extras/i2c/i2cdev/examples, and run make. You may have to run this examples as root; i.e., sudo ./MPU_WhoAmI.