资源简介
用iic和spi对9250和9150分别进行了开发和测试
代码片段和文件信息
/** based on InvenSense MPU-9250 register map document rev. 1.4 9/9/2013 (RM-MPU-9250A-00)
* 13/04/2014 by Conor Forde
* Updates should be available at https://github.com/Snowda/MPU9250
*
* Changelog:
* ... - ongoing development release
* NOTE: THIS IS ONLY A PARIAL RELEASE.
* THIS DEVICE CLASS IS CURRENTLY UNDERGOING ACTIVE DEVELOPMENT AND IS MISSING MOST FEATURES.
* PLEASE KEEP THIS IN MIND IF YOU DECIDE TO USE THIS PARTICULAR CODE FOR ANYTHING.
*/
#include “MPU9250.h“
/** Default constructor uses default I2C address.
* @see MPU9250_DEFAULT_ADDRESS
*/
MPU9250::MPU9250() {
_address = MPU9250_DEFAULT_ADDRESS;
}
/** Specific address constructor.
* @param address I2C address
* @see MPU9250_DEFAULT_ADDRESS
* @see MPU9250_ADDRESS_AD0_LOW
* @see MPU9250_ADDRESS_AD0_HIGH
*/
MPU9250::MPU9250(uint8_t address) {
_address = address;
}
void MPU9250::writeRegister(uint8_t register_addr uint8_t value) {
}
uint8_t MPU9250::readRegister(uint8_t register_addr) {
}
uint16_t MPU9250::readRegisters(uint8_t msb_register uint8_t lsb_register) {
uint8_t msb = readRegister(msb_register);
uint8_t lsb = readRegister(lsb_register);
return (((int16_t)msb) << 8) | lsb;
}
uint8_t MPU9250::readMaskedRegister(uint8_t register_addr uint8_t mask) {
uint8_t data = readRegister(register_addr);
return (data & mask);
}
/** Power on and prepare for general usage.
* This will activate the device and take it out of sleep mode (which must be done
* after start-up). This function also sets both the accelerometer and the gyroscope
* to their most sensitive settings namely +/- 2g and +/- 250 degrees/sec and sets
* the clock source to use the X Gyro for reference which is slightly better than
* the default internal clock source.
*/
void MPU9250::initialize(void) {
setClockSource(MPU9250_CLOCK_PLL_XGYRO);
setFullScaleGyroRange(MPU9250_GYRO_FS_250);
setFullScaleAccelRange(MPU9250_ACCEL_FS_2);
setSleepEnabled(false); // thanks to Jack Elston for pointing this one out!
}
// AUX_VDDIO register (InvenSense demo code calls this RA_*G_OFFS_TC)
/** Get the auxiliary I2C supply voltage level.
* When set to 1 the auxiliary I2C bus high logic level is VDD. When cleared to
* 0 the auxiliary I2C bus high logic level is VLOGIC. This does not apply to
* the MPU-6000 which does not have a VLOGIC pin.
* @return I2C supply voltage level (0=VLOGIC 1=VDD)
*/
uint8_t MPU9250::getAuxVDDIOLevel(void) {
I2Cdev::readBit(_address MPU9250_RA_YG_OFFS_TC MPU9250_TC_PWR_MODE_BIT buffer);
return buffer[0];
}
/** Set the auxiliary I2C supply voltage level.
* When set to 1 the auxiliary I2C bus high logic level is VDD. When cleared to
* 0 the auxiliary I2C bus high logic level is VLOGIC. This does not apply to
* the MPU-6000 which does not have a VLOGIC pin.
* @param level I2C supply voltage level (0=VLOGIC 1=VDD)
*/
void MPU9250::setAuxVDDIOLevel(uint8_t level) {
I2Cdev::writeBit(_addres
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 126 2014-04-15 23:52 MPU9250-master\.gitignore
....... 3517 2014-04-15 23:52 MPU9250-master\Examples\MPU9250_raw\MPU9250_raw.ino
....... 6413 2014-04-15 23:52 MPU9250-master\helper_3dmath.h
....... 18025 2014-04-15 23:52 MPU9250-master\LICENSE
文件 42815 2016-01-07 15:38 MPU9250-master\MPU9150.h
....... 38907 2014-04-15 23:52 MPU9250-master\MPU9150_6Axis_MotionApps20.h
....... 46548 2014-04-15 23:52 MPU9250-master\MPU9150_9Axis_MotionApps41.h
....... 131133 2014-04-15 23:52 MPU9250-master\MPU9250.cpp
....... 13019 2014-04-15 23:52 MPU9250-master\MPU9250.h
....... 426 2014-04-15 23:52 MPU9250-master\README.md
目录 0 2015-04-02 11:19 MPU9250-master\Examples\MPU9250_raw
目录 0 2014-04-15 23:52 MPU9250-master\Examples
目录 0 2015-04-02 11:19 MPU9250-master
----------- --------- ---------- ----- ----
300929 13
- 上一篇:中文最全停用词
- 下一篇:2020国家电网改革攻坚重点工作安排.pdf
评论
共有 条评论