Reciprocal Frequency counter only for STM32F401、F411 and F466. Reciprocal Mode -> Pulse width measurement

Dependents:   Frequency_Counter_Recipro_for_STM32F4xx

Files at this revision

API Documentation at this revision

Comitter:
kenjiArai
Date:
Sun Jan 19 06:54:38 2020 +0000
Parent:
7:7fdff925855e
Commit message:
modified uint to int and others

Changed in this revision

fc_recipro.cpp Show annotated file Show diff for this revision Revisions of this file
fc_recipro.h Show annotated file Show diff for this revision Revisions of this file
--- a/fc_recipro.cpp	Sun Jan 19 06:42:22 2020 +0000
+++ b/fc_recipro.cpp	Sun Jan 19 06:54:38 2020 +0000
@@ -63,8 +63,8 @@
 
 // buffer for captured data
 freq_one captured_dt;               // frequency data in pack (interrupt)
-uint64_t rise_buf[2];
-uint64_t fall_buf[2];
+int64_t rise_buf[2];
+int64_t fall_buf[2];
 uint32_t rise_pointer;
 uint32_t fall_pointer;
 
@@ -210,7 +210,7 @@
 
 bool FRQ_CUNTR::recipro_check_status(Recipro_status_TypeDef *status)
 {
-    freq_one _temp0, _temp1;
+    freq_one _temp;
 
     bool _ready = false;
     _data_buf[0] = rise_buf[0];
@@ -226,18 +226,18 @@
         _ready = true;
         // change order
         if (_data_buf[0] > _data_buf[1]){
-            _temp0.f_64bit_dt = _data_buf[0];
+            _temp.f_64bit_dt = _data_buf[0];
             _data_buf[0] = _data_buf[1];
-            _data_buf[1] = _temp0.f_64bit_dt;
+            _data_buf[1] = _temp.f_64bit_dt;
         }
         _tp0 = _data_buf[1] - _data_buf[0];
         if (_tp0 < 0) {
             _tp0 = 0;
         }
         if (_data_buf[2] > _data_buf[3]){
-            _temp0.f_64bit_dt = _data_buf[2];
+            _temp.f_64bit_dt = _data_buf[2];
             _data_buf[2] = _data_buf[3];
-            _data_buf[3] = _temp0.f_64bit_dt;
+            _data_buf[3] = _temp.f_64bit_dt;
         }
         _tp1 = _data_buf[3] - _data_buf[2];
         if (_tp1 < 0) {
--- a/fc_recipro.h	Sun Jan 19 06:42:22 2020 +0000
+++ b/fc_recipro.h	Sun Jan 19 06:54:38 2020 +0000
@@ -137,11 +137,11 @@
     uint64_t get_diff(uint64_t new_dt, uint64_t old_dt);
 
 private:
-    uint64_t _data_buf[4];
-    uint64_t _tp0;
-    uint64_t _tp1;
-    uint64_t _tp2;
-    uint64_t _tp3;
+    int64_t _data_buf[4];
+    int64_t _tp0;
+    int64_t _tp1;
+    int64_t _tp2;
+    int64_t _tp3;
 
     float _base_clock;