A library for the Invensense MPU9150
MPU9150.cpp@1:1b0ada1695a7, 2014-06-04 (annotated)
- Committer:
- ethanharstad
- Date:
- Wed Jun 04 05:56:54 2014 +0000
- Revision:
- 1:1b0ada1695a7
- Parent:
- 0:d6616b97605d
- Child:
- 2:581fad93a809
Bare minimum accel/gyro function definitions
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ethanharstad | 0:d6616b97605d | 1 | #include "MPU9150.h" |
ethanharstad | 0:d6616b97605d | 2 | #include "mbed.h" |
ethanharstad | 0:d6616b97605d | 3 | |
ethanharstad | 1:1b0ada1695a7 | 4 | MPU9150::MPU9150() : i2c_(I2C_SDA, I2C_SCL) { |
ethanharstad | 1:1b0ada1695a7 | 5 | address_ = MPU9150_ADDRESS_DEFAULT; |
ethanharstad | 0:d6616b97605d | 6 | } |
ethanharstad | 0:d6616b97605d | 7 | |
ethanharstad | 1:1b0ada1695a7 | 8 | MPU9150::MPU9150(const bool AD0) : i2c_(I2C_SDA, I2C_SCL) { |
ethanharstad | 1:1b0ada1695a7 | 9 | if(AD0) { |
ethanharstad | 1:1b0ada1695a7 | 10 | address_ = MPU9150_ADDRESS_AD0_HIGH; |
ethanharstad | 1:1b0ada1695a7 | 11 | } else { |
ethanharstad | 1:1b0ada1695a7 | 12 | address_ = MPU9150_ADDRESS_AD0_LOW; |
ethanharstad | 1:1b0ada1695a7 | 13 | } |
ethanharstad | 0:d6616b97605d | 14 | } |
ethanharstad | 0:d6616b97605d | 15 | |
ethanharstad | 1:1b0ada1695a7 | 16 | MPU9150::MPU9150(const PinName sda, const PinName scl, const bool AD0) : i2c_(sda, scl) { |
ethanharstad | 1:1b0ada1695a7 | 17 | if(AD0) { |
ethanharstad | 1:1b0ada1695a7 | 18 | address_ = MPU9150_ADDRESS_AD0_HIGH; |
ethanharstad | 1:1b0ada1695a7 | 19 | } else { |
ethanharstad | 1:1b0ada1695a7 | 20 | address_ = MPU9150_ADDRESS_AD0_LOW; |
ethanharstad | 1:1b0ada1695a7 | 21 | } |
ethanharstad | 0:d6616b97605d | 22 | } |