/CrossPlatformDataBus

Cross-platform C++ support for I2C and SPI devices

Primary LanguageC++MIT LicenseMIT

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:

  • USFS and USFSMAX motion co-processors from from Pesky Products

  • 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

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.