求取lis2dh驱动例程,我自己配置的驱动,在运行一段时间后,数据就不发生变化了。
配置部分代码,请大神帮忙看一下哪里配置的问题!!!调了好久了
- uint8_t buffer = 0x10;
- lis2dh12_write_reg(&ctx,CTRL_REG0,&buffer,1);
-
- buffer = 0x00;
- lis2dh12_write_reg(&ctx,TEMP_CFG_REG,&buffer,1);
-
- buffer = 0x87;//ODR选择10Hz;低功耗模式;X,Y,Z轴使能
- lis2dh12_write_reg(&ctx,CTRL_REG1,&buffer,1);
-
- buffer = 0x88;//FDS,
- lis2dh12_write_reg(&ctx,CTRL_REG2,&buffer,1);
-
- buffer = 0x00;
- lis2dh12_write_reg(&ctx,CTRL_REG3,&buffer,1);
-
- buffer = 0x08;
- lis2dh12_write_reg(&ctx,CTRL_REG4,&buffer,1);
-
- buffer = 0x40;
- lis2dh12_write_reg(&ctx,CTRL_REG5,&buffer,1);
-
- buffer = 0x00;
- lis2dh12_write_reg(&ctx,CTRL_REG6,&buffer,1);
-
- buffer = 0x00;
- lis2dh12_write_reg(&ctx,REFERENCE,&buffer,1);
-
- buffer = 0x40;
- lis2dh12_write_reg(&ctx,FIFO_CTRL_REG,&buffer,1);
复制代码
|
LIS2DH12: MEMS digital output motion sensor ultra-low-power high-performance 3-axis "nano" accelerometer
去www.st.com 搜索下载。