资源简介
nrf_51822_mpu6050_DMP移植好的,验证可用,使用官方库,更改量小
代码片段和文件信息
/* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is property of Nordic Semiconductor ASA.
* Terms and conditions of usage are described in detail in NORDIC
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free non-transferable use of the information. NO
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from
* the file.
*
*/
#include
#include
#include “twi_master.h“
#include “mpu6050.h“
/*lint ++flb “Enter library region“ */
#define ADDRESS_WHO_AM_I (0x75U) // !< WHO_AM_I register identifies the device. Expected value is 0x68.
#define ADDRESS_SIGNAL_PATH_RESET (0x68U) // !<
static uint8_t m_device_address=0xD0;
bool mpu6050_write(uint8_t device_address uint8_t register_address uint8_t len uint8_t *data)
{
uint8_t w2_data[len+1];
for(int i=0;i {
if(i==0)
w2_data[0] =register_address;
else
w2_data[i] = *(data+i-1);
}
return twi_master_transfer((device_address<<1)|TWI_WRITE_BIT w2_data len+1 TWI_ISSUE_STOP);
}
bool mpu6050_read(uint8_t device_address uint8_t register_address uint8_t number_of_bytes uint8_t *destination)
{
bool transfer_succeeded;
transfer_succeeded = twi_master_transfer((device_address<<1)|TWI_WRITE_BIT ®ister_address 1 TWI_DONT_ISSUE_STOP);
transfer_succeeded &= twi_master_transfer((device_address<<1)|TWI_READ_BIT destination number_of_bytes TWI_ISSUE_STOP);
return transfer_succeeded;
}
/*lint --flb “Leave library region“ */
// !< Device address in bits [7:1]
bool mpu6050_init(uint8_t device_address)
{
bool transfer_succeeded = true;
m_device_address = (uint8_t)(device_address << 1);
// Do a reset on signal paths
uint8_t reset_value = 0x04U | 0x02U | 0x01U; // Resets gyro accelerometer and temperature sensor signal paths.
transfer_succeeded &= mpu6050_write(0xd0ADDRESS_SIGNAL_PATH_RESET1&reset_value);
// Read and verify product ID
transfer_succeeded &= mpu6050_verify_product_id();
return transfer_succeeded;
}
bool mpu6050_verify_product_id(void)
{
uint8_t who_am_i;
if ( mpu6050_read(0x68ADDRESS_WHO_AM_I1 &who_am_i))
{
if (who_am_i != 0x68u)
{
return false;
}
else
{
return true;
}
}
else
{
return false;
}
}
bool mpu6050_register_write(uint8_t register_address uint8_t value)
{
uint8_t w2_data[2];
w2_data[0] = register_address;
w2_data[1] = value;
return twi_master_transfer(m_device_address w2_data 2 TWI_ISSUE_STOP);
}
bool mpu6050_register_read(uint8_t register_address uint8_t * destination uint8_t number_of_bytes)
{
bool transfer_succeeded;
transfer_succeeded = twi_master_transfer(m_device_address ®ister_address
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-03-16 18:30 DMP\
目录 0 2018-03-16 18:31 DMP\已移植好的\
目录 0 2018-03-16 18:30 DMP\已移植好的\DMP\
文件 19342 2012-12-14 11:16 DMP\已移植好的\DMP\dmpKey.h
文件 6765 2012-12-14 11:16 DMP\已移植好的\DMP\dmpmap.h
文件 89661 2018-03-16 17:45 DMP\已移植好的\DMP\inv_mpu.c
文件 4900 2018-03-16 12:52 DMP\已移植好的\DMP\inv_mpu.h
文件 58371 2018-03-16 12:54 DMP\已移植好的\DMP\inv_mpu_dmp_motion_driver.c
文件 3538 2012-12-14 11:16 DMP\已移植好的\DMP\inv_mpu_dmp_motion_driver.h
文件 3186 2018-03-16 17:36 DMP\已移植好的\mpu6050.c
文件 2373 2018-03-15 21:55 DMP\已移植好的\mpu6050.h
目录 0 2018-03-16 18:16 DMP\正点原子的(移植前)\
文件 19342 2012-12-14 11:16 DMP\正点原子的(移植前)\dmpKey.h
文件 6765 2012-12-14 11:16 DMP\正点原子的(移植前)\dmpmap.h
文件 89576 2017-07-30 14:09 DMP\正点原子的(移植前)\inv_mpu.c
文件 4891 2017-07-30 13:18 DMP\正点原子的(移植前)\inv_mpu.h
文件 58387 2014-05-09 12:20 DMP\正点原子的(移植前)\inv_mpu_dmp_motion_driver.c
文件 3538 2012-12-14 11:16 DMP\正点原子的(移植前)\inv_mpu_dmp_motion_driver.h
相关资源
- 最小NRF51822系统原理图+PCB版图+元器件
- nrf51822 SDk12.3 DFU空中升级中添加看门狗
- Nordic的nRF-Toolbox的源代码
- 2.4G nrf51822 nrf24le1
- Master Control Panel
- keil4开发nrf51822必要的pack包
- nrf51822使用LIS3DH计步算法库
- 基于nRF51822调试的LIS3DH传感器代码,使
- 2018年Nordic Technica Tour
- 清风带你学蓝牙 NRF51822 底层驱动详
- nRF51822手环代码
- nRF51822开发文档-中文
- NRF51822 中文资料
- nrf51822中文参考手册
- nRF51822 adc pwm
- 基于nrf51822的TSM12触控例程
- nrf51822青风系列
- nrf51822创建多个自定义服务和特征值
- BLE手机做从机nrf51822做主机通信实验
- nrf51822蓝牙原理图PCB文件
- NRF51822_SDK9.0 DFU移植笔记
- NRF51822SDK+S110协议栈
- NRF51822_青风电子教程
- 《青风带你学蓝牙》nrf51822电子书pd
- nrf51822蓝牙连接APP安卓源码
- nRF51822开发工具包 SDK包 协议栈 全
- NRF51822 SDK
- nrf51822 spi
- nRF51822低功耗睡眠函数应用
- nrf51822 ADC
评论
共有 条评论