CuriosityでmTouchを試してみる。その11 ボタンの詳細設定

正直、mTouch でここまでネタが続くとは思っていなかったんですが、結構奥が深いですね。

さて、ここまでやってきた mTouch ですが、現状の設定ではボタンをホールドすると裏で定期的に動いているキャリブレーションが働いて、「ボタンの容量が定常状態である」と判断し、「ボタンはタッチされていない」と判定されてしまいます。これは内部で MTOUCH_BUTTON_PRESSTIMEOUT に定義された回数のカウンタ値で動作しているようです。

ということで、MCC のドキュメントから、ボタンの詳細設定について和訳してみます。元のドキュメントはmTouch® Button/Proximity Sensor Configurationです。

The Button or Proximity Sensor is an abstraction layer over the physical sensor which decouples the signal acquisition module and the decoding module. The benefit of this abstraction is that, regardless of what acquisition method is being used for the sensor, the Button or Proximity Sensor decoding works the same way.

ボタンあるいは近接センサは物理センサ上の抽象レイヤで、信号取得モジュールとデコードモジュールを分離するものである。この抽象化の利点は、センサに対する取得メソッドがどうであれ、ボタンあるいは近接センサのデコードが同じ方法で動作することである。
(ちょっと意味がわかりません…)

Common Button/Proximity Sensor Configuration

Interface Method

The mTouch Sensing Solutions library allows your application code to obtain button/proximity sensor status in two ways: through a callback function or through polling. There are examples of how to use these two methods in the "Step by Step Example" section.

mTouchセンシングソリューションライブラリは、アプリケーションにボタン/近接センサの状態を利用できる2つの方法を提供する: コールバック関数またはポーリングである。「ステップバイステップ例」セクションにはこの2つのメソッドの利用法がある。

Press/Activation Timeout

Press/Activation Timeout is a mechanism used to release a stuck proximity sensor. If a button/proximity sensor is pressed or activated for a number of consecutive counts, the button’s or proximity sensor's state will be reset. Each button/proximity sensor has its own time-out counter to track the press time. The underlying press time-out counter will increment each time the MTOUCH_Service_Mainloop() call is performed. The counts parameter acts as a threshold to each button’s or proximity sensor's press time-out counter. Upon the time-out’s counter exceeding the counts value, the button/proximity sensor state will be reset.

プレス/アクティベーションタイムアウトは、近接センサが固まった(動作しなくなった)のをリリースするためのメカニズムである。もしボタン/近接センサが一定の連続カウント時間押されあるいは活性化されることが続いたときに、ボタンあるいは近接センサの状態がリセットされる。それぞれのボタン/近接センサは押下時間を測定するための独自のタイムカウンタを持っている。タイムアウトカウンタは MTOUCH_Service_Mainloop() が呼ばれるたびに加算される。(MCC設定の)カウントパラメータはそれぞれのボタン/近接センサのタイムアウトカウンタのスレッショルドとして振る舞い、タイムアウトカウンタがこのカウント値を超えた場合には、ボタン/近接センサの状態がリセットされる。

Negative Capacitance Recovery

Enabling this feature allows the quick recovery of a button’s or proximity's baseline if negative capacitance is detected. The negative capacitance means the baseline value is greater than the reading for a button. The consecutive decodes parameter specifies the number of consecutive decoding cycles (MTOUCH_Service_Mainloop() call) with negative capacitance that the program has to detect before resetting the button/proximity state.

この機能を有効にすると、負の容量が検出されたときにボタンまたは近接のベースラインを速やかに復帰させることができる。負の容量とは、ボタンの読み値よりもベースラインの値が大きい状態を指す。連続的なデコードパラメータは、プログラムがボタン/近接状態のリセットをする前に検出しなくてはならない連続した負の容量のデコードサイクル(MTOUCH_Service_Mainloop()の呼び出し)の数を指定する。

Reading Filter

To minimize the impact of impulse noise, the sensor output goes through a low-pass filter. The output of the filter is the reading of the button/proximity sensor. A higher filter level setting provides an improved signal-to-noise ratio (SNR) under noisy conditions while increasing the total time for measurement, possibly resulting in increased power consumption and response time.

インパルスノイズの影響を最小化するため、センサ出力はローパスフィルタを通過する。フィルタの出力はボタン/近接センサの読み値である。より高いフィルタレベルが設定されると信号-ノイズ比(SNR)を改善するが、ノイズの多い環境下での測定時間が増加し、おそらく消費電力と応答時間が増大する。

Deviation Integration Filter

To help the sensitivity of the proximity sensor, a deviation integrator is used. A larger gain value results in more sensitivity.

近接センサの感度を改善するため、偏差値積分が使用される。ゲイン値を大きくすると、感度が増大する。
(よく意味がわかりません)

Median Filter

To gain a greater SNR for the proximity sensor, a median filter can be used after the reading filter. The value of the median filter window decides how much historical data will be stored. Similar to the reading filter, a higher value provides more noise immunity but longer response time.

近接センサでより大きなSNRを得るために、読み値フィルタのあとでメディアンフィルタを使用することができる。メディアンフィルタウィンドウの値は、いくつの過去データを保存するかを決定する。読み値フィルタと同様に、高い値はノイズ除去に優れるが応答時間が伸びる。

Debounce

To prevent multiple detect events for a single touch action, a debounce algorithm is used. The algorithm works in a similar manner to debounce on a mechanical pushbutton. The Count parameter defines the number of consecutive touches that exceed the detect threshold. Once the consecutive touch count is exceeded the touch is reported as valid. If any single touch does not exceed the touch threshold while the debounce algorithm is running then the consecutive touch count is reset to and the debounce algorithm will restart. The debounce algorithm is applied to both touch/press debounce and release debounce for buttons/proximity sensors.

シングルタッチ動作での複数のイベント検出を防ぐため、デバウンスアルゴリズムが使用される。アルゴリズムはメカ的プッシュボタンのでバウンスと同様の働きをする。カウントパラメータは検出閾値を超えた連続タッチの数を定義する。連続タッチのカウントが閾値を超えたら、タッチが有効とレポートされる。デバウンスアルゴリズムが動作しているときにシングルタッチがタッチ閾値を超えない場合には、連続タッチカウントはリセットされてデバウンスアルゴリズムが再起動される。デバウンスアルゴリズムはボタン/近接センサでのタッチ/プレスデバウンスとリリースデバウンスの両方に適用される。

Suspend / Disable

Individual buttons and proximity sensors can now be suspended or disabled by application code.
  • Use MTOUCH_Button_Disable() / MTOUCH_Proximity_Disable() to disable a button / proximity sensor. A disabled button/proximity sensor will stop its sensor scanning and baseline updating.
  • Use MTOUCH_Button_Suspend() / MTOUCH_Proximity_Suspend() to suspend a button/proximity sensor. A suspended button/proximity sensor will stop its sensor scanning but will scan periodically for baseline updating.
  • Use MTOUCH_Button_Resume() / MTOUCH_Proximity_Resume() to reactivate a disabled/suspended button / proximity sensor. The button/proximity sensor will continue with the existing sensor configuration.

個々のボタンと近接センサはアプリケーションコードからサスペンドあるいは無効にできる。(以下略)

Reburst

Reburst is used to improve the system response time while resolving detect state for both buttons and proximity sensors. When a sensor threshold is exceeded, multiple measurements are taken on that sensor to resolve the detect status. Sensors that are not part of the AKSGroup or may be disabled to reduce the processing time. Three modes for Reburst are used:
  • Reburst All : No sensor suspension takes place, all sensors reburst to determine detect status.
  • Reburst Unresolved : Reburst sensors only part of same AKS Group, all others suspended (reduced processing).
  • Reburst None : standard acquisition only.

リバーストはボタンと近接センサの両方で状態検出を解決する際のシステム応答時間を改善する。センサ閾値を超えた際に、状態検出のために当該センサに対して複数の計測がなされる。処理時間を削減するために、AKSグループに属さない、あるいは無効化されたセンサ。リバーストには3つのモードがある。(以下略 - というか文章が不明瞭)

Hysteresis

Hysteresis provides a band gap for detect thresholds when moving between detect and no detect states. It is expressed as a percentage of the detect threshold. Once a sensor goes into detect, the threshold level is reduced (by the hysteresis % value). This prevents sensor dither in and out of detect if the signal level is close to original threshold level.

ヒステリシスは検出およち非検出状態の間で移行する際の検出閾値のバンドギャップを提供する。(以下略)

Individual Button/Proximity Sensor Configuration

Name

This input field allows you to modify the name of the selected button/proximity sensor. This name can be used in the code to reference this button/proximity sensor.

(省略)

Sensor

This selection box allows you to select a hardware sensor to be associated with this button. A hardware sensor can be associated with multiple buttons/proximity sensors. For example, if you want to achieve proximity detection and touch detection on the same physical sensor, this sensor can be associated with a button and a proximity sensor.

この選択ボックスはこのボタンに関連付けるハードウェアセンサを選択する。ハードウェアセンサは複数のボタン/近接センサに関連付けることができる。たとえば、近接検出とタッチ検出を同じ物理センサで実現したいときには、このセンサをボタンと近接センサの両方に関連付けられる。

Threshold

The signal deviation is defined as the difference between a button’s reading and the baseline value. The threshold input field allows you to determine the press threshold value for signal deviation before the button will be in the pressed state. The release threshold is 50% of the press threshold so that there is a hysteresis to release the button.

(省略)

Deviation Scaling

The signal deviation will be scaled down from a signed 16-bit integer to a signed 8-bit. If the deviation after scaling down is greater than 127, then the value will be clipped to 127 (0x7F). The deviation scaling parameter controls how many bits will shift to the right. The smaller the value is, the more sensitive the button will get. The goal is to shift the scaled-down deviation to be a value between 64 and 127 when the button is pressed, in order to get the full dynamic range.

(省略)

AKS Group

AKS® stands for Adjacent Key Suppression. In designs where the sensors are placed close together or configured for high sensitivity, multiple buttons might report a detection simultaneously. To allow applications to determine the intended single touch, the mTouch library makes it possible to configure multiple buttons/proximity sensors in an AKS group. When a group of buttons/proximity sensors is in the same AKS group, only the first strongest button/proximity sensor will report detection. The button/proximity sensor continues to report detection until its deviation or delta falls below its detection threshold. As long as this sensor is in the pressed state, no other button/proximity sensors in the same AKS group will report detection even if another button/proximity sensor's deviation becomes stronger in the same AKS group.

AKSとは隣接キー抑制のこと。センサ同士が近い状態に配置され、あるいは高感度に設定された場合、複数のボタンが同時に検出されたことをレポートするかもしれない。(以下略)

Individual Hysteresis

The common hysteresis levels can be replaced for each button/proximity sensor by activating the individual hysteresis checkbox. Then a hysteresis level can be selected from the dropdown menu. Other sensors will be assigned the common hysteresis level unless they are also modified.

共通ヒステリシスレベルは個別のヒステリシスチェックボックを有効にすることでボタン/近接センサごとに上書きできる。(以下略)

という感じでしょうか。以下略の部分は必要な人は頑張ってください。

0 件のコメント:

コメントを投稿

AstroNvimでtelescope.nvimがエラーを吐いたとき。

Windowsの環境でAstroNvimをインストールして、Find Fileしたらtelescopeがエラーを吐いてきました。 メッセージは、 Failed to run `config` for telescope.nvim ...a/lazy/telescope.nvim/...