#include "drv_mpu9250.h" #include "nrf_delay.h" #include "twi_master.h" #include "drv_iic_01.h" #include "drv_mpu9250.h" #include "drv_iic_01.h" bool MPU9250_Write_Byte(uint8_t Device_Address,uint8_t REG_Address,uint8_t REG_data) { return IIC_01_WriteBytes(Device_Address,REG_Address,®_data,1); } bool MPU9250_Read_nBytes(uint8_t Device_Address,uint8_t REG_Address,uint8_t *readDataBuf,uint8_t readDataLen) { return IIC_01_ReadBytes(Device_Address,REG_Address,readDataBuf,readDataLen); } bool MPU9250_register_write_len(uint8_t Device_Address,uint8_t register_address, uint8_t len,uint8_t *buf) { return IIC_01_WriteBytes(Device_Address,register_address,buf,len); } bool MPU9250_register_read_len(uint8_t Device_Address,uint8_t register_address, uint8_t number_of_bytes,uint8_t * destination ) { return IIC_01_ReadBytes(Device_Address,register_address,destination,number_of_bytes); } //************************************** //写入一个字节数据 ////************************************** //bool MPU9250_Write_Byte(uint8_t Device_Address,uint8_t REG_Address,uint8_t REG_data) //{ // uint8_t buf[2]; // SEGGER_RTT_printf(0,"MPU9250_Write_Byte\n"); // buf[0] = REG_Address; // buf[1] = REG_data; // return twi_master_transfer(Device_Address, buf, 2, TWI_ISSUE_STOP); //} //************************************** //读取N个字节数据 //************************************** //bool MPU9250_Read_nBytes(uint8_t Device_Address,uint8_t REG_Address,uint8_t *readDataBuf,uint8_t readDataLen)/* //{ // bool ret; // ret = twi_master_transfer(Device_Address, ®_Address, 1, TWI_DONT_ISSUE_STOP); // ret &= twi_master_transfer(Device_Address|TWI_READ_BIT, readDataBuf, readDataLen, TWI_ISSUE_STOP); // return ret; //} //bool MPU9250_register_write_len(uint8_t Device_Address,uint8_t register_address, uint8_t len,uint8_t *buf) //{ // uint8_t w2_data[50],i; // w2_data[0] = register_address; // for(i=0;i