linux驅動開發:重力傳感器的瞭解

板子上有一顆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我們就先介紹到這裏.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章