首页 星云 工具 资源 星选 资讯 热门工具
:

PDF转图片 完全免费 小红书视频下载 无水印 抖音视频下载 无水印 数字星空

STM32F4 HAL库 MPU6050 软件I2C DMP库读取,可获得稳定偏航角yaw

硬件开发 51.98KB 24 需要积分: 1
立即下载

资源介绍:

STM32F4 HAL库 MPU6050 软件I2C DMP库读取,可获得稳定偏航角yaw
/** * @addtogroup DRIVERS Sensor Driver Layer * @brief Hardware drivers to communicate with sensors via I2C. * * @{ * @file inv_mpu.c * @brief An I2C-based driver for Invensense gyroscopes. * @details This driver currently works for the following devices: * MPU6050 * MPU6500 * MPU9150 (or MPU6050 w/ AK8975 on the auxiliary bus) * MPU9250 (or MPU6500 w/ AK8963 on the auxiliary bus) */ #include "main.h" /* The following functions must be defined for this platform: * i2c_write(unsigned char slave_addr, unsigned char reg_addr, * unsigned char length, unsigned char const *data) * i2c_read(unsigned char slave_addr, unsigned char reg_addr, * unsigned char length, unsigned char *data) * delay_ms(unsigned long num_ms) * get_ms(unsigned long *count) * reg_int_cb(void (*cb)(void), unsigned char port, unsigned char pin) * labs(long x) * fabsf(float x) * min(int a, int b) */ #define MPU6050 #define MOTION_DRIVER_TARGET_MSP430 #if defined MOTION_DRIVER_TARGET_MSP430 /*#include "msp430.h" #include "msp430_i2c.h" #include "msp430_clock.h" #include "msp430_interrupt.h" */ #define i2c_write i2cWrite #define i2c_read i2cRead #define delay_ms delay_ms #define get_ms myget_ms //static int reg_int_cb(struct int_param_s *int_param) //{ // /*return msp430_reg_int_cb(int_param->cb, int_param->pin, int_param->lp_exit, // int_param->active_low);*/ // return 0; //} //#define log_i(...) do {} while (0) //#define log_e(...) do {} while (0) #define log_e printf #define log_i printf /* labs is already defined by TI's toolchain. */ /* fabs is for doubles. fabsf is for floats. */ #define fabs fabsf #define min(a,b) ((acb, int_param->pin, int_param->lp_exit, int_param->active_low); } #define log_i MPL_LOGI #define log_e MPL_LOGE /* labs is already defined by TI's toolchain. */ /* fabs is for doubles. fabsf is for floats. */ #define fabs fabsf #define min(a,b) ((apin, int_param->cb, int_param->arg); return 0; } #define log_i MPL_LOGI #define log_e MPL_LOGE /* UC3 is a 32-bit processor, so abs and labs are equivalent. */ #define labs abs #define fabs(x) (((x)>0)?(x):-(x)) #else //#error Gyro driver is missing the system layer implementations. #endif #if !defined MPU6050 && !defined MPU9150 && !defined MPU6500 && !defined MPU9250 //#error Which gyro are you using? Define MPUxxxx in your compiler options. #endif /* Time for some messy macro work. =] * #define MPU9150 * is equivalent to.. * #define MPU6050 * #define AK8975_SECONDARY * * #define MPU9250 * is equivalent to.. * #define MPU6500 * #define AK8963_SECONDARY */ #if defined MPU9150 #ifndef MPU6050 #define MPU6050 #endif /* #ifndef MPU6050 */ #if defined AK8963_SECONDARY #error "MPU9150 and AK8963_SECONDARY cannot both be defined." #elif !defined AK8975_SECONDARY /* #if defined AK8963_SECONDARY */ #define AK8975_SECONDARY #endif /* #if defined AK8963_SECONDARY */ #elif defined MPU9250 /* #if defined MPU9150 */ #ifndef MPU6500 #define MPU6500 #endif /* #ifndef MPU6500 */ #if defined AK8975_SECONDARY #error "MPU9250 and AK8975_SECONDARY cannot both be defined." #elif !defined AK8963_SECONDARY /* #if defined AK8975_SECONDARY */ #define AK8963_SECONDARY #endif /* #if defined AK8975_SECONDARY */ #endif /* #if defined MPU9150 */ #if defined AK8975_SECONDARY || defined AK8963_SECONDARY #define AK89xx_SECONDARY #else /* #warning "No compass = less profit for Invensense. Lame." */ #endif static int set_int_enable(unsigned char enable); /* Hardware registers needed by driver. */ struct gyro_reg_s { unsigned char who_am_i; unsigned char rate_div; unsigned char lpf; unsigned char prod_id; unsigned char user_ctrl; unsigned char fifo_en; unsigned char gyro_cfg; unsigned char accel_cfg; //unsigned char accel_cfg2; //unsigned char lp_accel_odr; unsigned char motion_thr; unsigned char motion_dur; unsigned char fifo_count_h; unsigned char fifo_r_w; unsigned char raw_gyro; unsigned char raw_accel; unsigned char temp; unsigned char int_enable; unsigned char dmp_int_status; unsigned char int_status; //unsigned char accel_intel; unsigned char pwr_mgmt_1; unsigned char pwr_mgmt_2; unsigned char int_pin_cfg; unsigned char mem_r_w; unsigned char accel_offs; unsigned char i2c_mst; unsigned char bank_sel; unsigned char mem_start_addr; unsigned char prgm_start_h; #if defined AK89xx_SECONDARY unsigned char s0_addr; unsigned char s0_reg; unsigned char s0_ctrl; unsigned char s1_addr; unsigned char s1_reg; unsigned char s1_ctrl; unsigned char s4_ctrl; unsigned char s0_do; unsigned char s1_do; unsigned char i2c_delay_ctrl; unsigned char raw_compass; /* The I2C_MST_VDDIO bit is in this register. */ unsigned char yg_offs_tc; #endif }; /* Information specific to a particular device. */ struct hw_s { unsigned char addr; unsigned short max_fifo; unsigned char num_reg; unsigned short temp_sens; short temp_offset; unsigned short bank_size; #if defined AK89xx_SECONDARY unsigned short compass_fsr; #endif }; /* When entering motion interrupt mode, the driver keeps track of the * previous state so that it can be restored at a later time. * TODO: This is tacky. Fix it. */ struct motion_int_cache_s { unsigned short gyro_fsr; unsigned char accel_fsr; unsigned short lpf; unsigned short sample_rate; unsigned char sensors_on; unsigned char fifo_sensors; unsigned char dmp_on; }; /* Cached chip configuration data. * TODO: A lot of these can be handled with a bitmask. */ struct chip_cfg_s { /* Matches gyro_cfg >> 3 & 0x03 */ unsigned char gyro_fsr; /* Matches accel_cfg >> 3 & 0x03 */ unsigned char accel_fsr; /* Enabled sensors. Uses same masks as fifo_en, NOT pwr_mgmt_2. */ unsigned char sensors; /* Matches config register. */ unsigned char lpf; unsigned char clk_src; /* Sample rate, NOT rate divider. */ unsigned short sample_rate; /* Matches fifo_en register. */ unsigned char fifo_enable; /* Matches int enable register. */ unsigned char int_enable; /* 1 if devices on auxiliary I2C bus appear on the primary. */ unsigned char bypass_mode; /* 1 if half-sensitivity. * NOTE: This doesn't belong here, but everything else in hw_s is const, * and this allows us to save some precious RAM. */ unsigned char accel_half; /* 1 if device in low-power acce

资源文件列表:

user.zip 大约有18个文件
  1. user/
  2. user/delay.c 628B
  3. user/filter.c 4.86KB
  4. user/inc/
  5. user/inc/delay.h 166B
  6. user/inc/dmpKey.h 18.89KB
  7. user/inc/dmpmap.h 6.61KB
  8. user/inc/filter.h 760B
  9. user/inc/inv_mpu.h 4.23KB
  10. user/inc/inv_mpu_dmp_motion_driver.h 3.31KB
  11. user/inc/ioi2c.h 1.54KB
  12. user/inc/KF.h 322B
  13. user/inc/mpu6050.h 14.67KB
  14. user/inv_mpu.c 82.08KB
  15. user/inv_mpu_dmp_motion_driver.c 56.51KB
  16. user/IOI2C.c 4.82KB
  17. user/KF.c 6.37KB
  18. user/MPU6050.c 12.26KB
0评论
提交 加载更多评论
其他资源 熊猫精灵脚本助手V2.4.6
已完成功能:识图、识色、OCR、验证码、鼠标、键盘、输入、变量、操作集合、流程控制、窗口控制、外部程序控制等 支持后台操作,多窗口异步操作,键鼠录制,生成运行脚本运行,速度调节,逻辑判断 适用环境:游戏,浏览器,小程序,模拟器,手机投屏,fps游戏常见软件等环境
Template工程模板.zip
Template工程模板.zip
tongrds-mc-2.2.1.4 tongrds-node-2.2.1.4
东方通tongRDS aarch64
高度可配置化的企业管理系统!企业内部可免费使用!零代码/低代码快速搭建企业中台、CRM客户关系管理、WMS库存管理
开始使用 REBUILD 非常简单,无需配置复杂的运行环境,零依赖快速部署! 1. 使用已发布版本 生产环境强烈推荐使用此方式 !!! 首先 下载 安装包,我们同时提供 standalone 与 boot 两种安装包。standalone 为集成安装包(推荐),boot 为 SpringBoot 的 jar 包,两种安装包在功能上没有区别。 下载后解压(集成安装包),通过 start-rebuild.bat 或 start-rebuild.sh 启动,然后打开浏览器输入 http://localhost:18080/ 开始体验。 2. 通过源码编译 注意 !!! 生产环境请使用 master 分支(默认分支),其他分支为开发分支,功能存在不确定性! # 拉取 git clone --depth=1 https://github.com/getrebuild/rebuild.git # 编译 mvn package # 运行 java -jar target/rebuild.jar 运行后打开浏览器输入 http://localhost:18080/ 开始体验。
实时预览监控源码!!!1
对视频监控进行实时播放,抓图
手帐风旅游攻略小红书配图.zip
手帐风旅游攻略小红书配图.zip
BUSHOUND ,USB抓包工具,调试工具
BUSHOUND可以抓取通信过程中的通信数据 工具介绍: Bus Hound是是由美国perisoft公司研制的一款超级软件总线协议分析器,它是一种专用于PC机各种总线数据包监视和控制的开发工具软件,其名“hound”的中文意思为“猎犬”,即指其能敏锐地感知到总线的丝毫变化。主要可用于捕捉来自设备的协议包和输入输出操作。 Bus Hound对于正在研究USB相关协议,需要对USB数据进行抓取分析效果非常不错,是一看所见即所得的USB抓包工具。 1、支持所有版本的IDE,SCSI,USB,1394总线 2、支持各类设备如硬盘库,DVD,鼠标,扫描仪,网络照相机等 3、支持Windows9X,WindowsMe,NT4.0,2000,2003,XP和嵌入式XP操作系统 4、捕捉数据的总量仅受机器内存限制 5、可以设置触发信号自动停止捕获操作 6、测试读取,同步等设备性能 7、捕获设备驱动包,例如IRP 8、捕获任意数量的并行设备,而不管其总线类型 9、身材苗条,易于交换与下载 10、捕获的数据易于拷贝到其它环境生成
BUSHOUND ,USB抓包工具,调试工具 BUSHOUND ,USB抓包工具,调试工具 BUSHOUND ,USB抓包工具,调试工具
HBuilderX.4.24.2024072208.zip
H是HTML的首字母,Builder是构造者,X是HBuilder的下一代版本。我们也简称HX。 HX是轻如编辑器、强如IDE的合体版本