概述
板子上有一颗IC:MMA7660FC,我们来试着读一下它的芯片手册,当然读的目的是为了驱动它。这也是我们驱动开发的目的:拿过来一块未知的IC,去读它的芯片手册,支持那种通讯协议,然后编码让它动起来。
he sensor has three power modes: Off Mode, Standby Mode, and Active Mode to offer the customer different power
consumption options. The sensor is only capable of running in one of these modes at a time.
支持三种模式:off mode,standby mode,active mode.
During the Active Mode, continuous measurement on all three axes is enabled. In addition, the user can choose to enable:Shake Detection, Tap Detection, Orientation Detection, and/or Auto-Wake/Sleep Feature and in this mode the digital analysis for any of these functions is done. The user can configure the samples per second to any of the following: 1 sample/second,2 samples/second, 4 samples/second, 8 samples/second, 16 samples/second, 32 samples/second, 64 samples/second, and 120 samples/second, for the Auto-Sleep state. If the user is configuring the Auto-Wake feature, the selectable ranges are:
1 sample/second, 8 samples/second, 16 samples/seconds and 32 samples/second. Depending on the samples per second selected the power consumption will vary.
在active mode下,3轴的连续测量是开启的。用户可选择开启:抖动检测,敲击检测,方向检测。或者 auto-wake auto sleep模式的切换。也可以配置每秒采样的率.
采样率配置:this can be configured in the SR (0x08) register.Once the user configurable samples per
second is chosen, the device will update the data for all 3 axes in the register at a resolution of 6-bits/axis
The user can choose to enable/disable any of the following interrupts in the INTSU (0x06) register: Front/Back Interrupt,
Up/Down/Left/Right Interrupt, Tap Detection Interrupt, GINT (real-time motion tracking), Shake on X-axis, Shake on Y-axis, and
Shake on Z-axis. If the GINT is enabled, real-time motion tracking can be configured to trigger an interrupt after every sensor data update
中断的配置在 INTSU(0x06) 寄存器里面.
寄存器相关:
slave addr:0x4c
write方式:
read方式:
相关的说明就这么多,至于后面的编程实现,我们需要参考这边的芯片手册来实现。所以芯片手册读懂,读通很重要。虽然很难读,可是读不懂没办法写代码。所以英文阅读和理解能力一定要好。猜测能力也要好些,剩下的就是经验和实验了。任何驱动不可能一下子就明白它的实现原理并立即把它实现出来,大多的需要try。
关于这颗IC我们就先介绍到这里.
最后
以上就是知性大门为你收集整理的linux驱动开发:重力传感器的了解的全部内容,希望文章能够帮你解决linux驱动开发:重力传感器的了解所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复