自分用ロータリーエンコーダのライブラリ. Z相のパルスは一切使用していない. タイマ割り込みを使ってRPSをとる場合,MvgAve的なものが含まれる関数によって可能だが,正直いらない気がする.

Files at this revision

API Documentation at this revision

Comitter:
ttrist
Date:
Thu Nov 19 16:16:19 2020 +0000
Parent:
8:6597cf4c8ce4
Commit message:
refix; "uint32_t ~~~_time" -> "float ~~~_time"

Changed in this revision

QEI.cpp Show annotated file Show diff for this revision Revisions of this file
QEI.h Show annotated file Show diff for this revision Revisions of this file
--- a/QEI.cpp	Thu Nov 19 16:02:19 2020 +0000
+++ b/QEI.cpp	Thu Nov 19 16:16:19 2020 +0000
@@ -124,7 +124,7 @@
 // 移動平均していないRPSを計算する関数
 float QEI::getRPS()
 {
-    uint32_t current_time = _timer -> read();
+    float current_time = _timer -> read();
 
     //RPS算出
     float rps =
@@ -165,7 +165,7 @@
 void QEI::culculateMvgAveRPS()
 {
     //時間計測
-    uint32_t current_time = _timer -> read();
+    float current_time = _timer -> read();
 
     //移動平均算出
     pulse_data[editing_num] = pulse;
--- a/QEI.h	Thu Nov 19 16:02:19 2020 +0000
+++ b/QEI.h	Thu Nov 19 16:16:19 2020 +0000
@@ -44,7 +44,7 @@
     int             editing_num;
     float           pulse_average;
     float           mvg_ave_rps; // 移動平均RPS
-    uint32_t        pre_time;   //修正1:関数内staticからグローバルへ
+    float           pre_time;   //修正1:関数内staticからグローバルへ
 
 //#undef _MVGAVE_ARRAY_SIZE
 };