Kenji Arai / Mbed OS Frequency_Cntr_1PPS_F746ZG

Dependencies:   QEI DRV8830 PID ADT7410 TextLCD Frq_cuntr_Nucleo-F746ZG RingBuffer

Fork of Frequency_Counter_w_GPS_1PPS by Kenji Arai

Files at this revision

API Documentation at this revision

Comitter:
kenjiArai
Date:
Tue Dec 17 11:41:18 2019 +0000
Parent:
13:1041596c416c
Child:
15:ae0413277bc6
Commit message:
Run on mbed-os5 & small modification

Changed in this revision

ADT7410.lib Show annotated file Show diff for this revision Revisions of this file
DRV8830.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
User_IF/uif.cpp Show annotated file Show diff for this revision Revisions of this file
User_IF/uif.h Show annotated file Show diff for this revision Revisions of this file
check_revision.cpp Show annotated file Show diff for this revision Revisions of this file
hw_tst.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show diff for this revision Revisions of this file
mbed.bld Show diff for this revision Revisions of this file
--- a/ADT7410.lib	Wed Nov 23 07:35:20 2016 +0000
+++ b/ADT7410.lib	Tue Dec 17 11:41:18 2019 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/kenjiArai/code/ADT7410/#912cd5ac1cce
+http://developer.mbed.org/users/kenjiArai/code/ADT7410/#523b5b34e0c9
--- a/DRV8830.lib	Wed Nov 23 07:35:20 2016 +0000
+++ b/DRV8830.lib	Tue Dec 17 11:41:18 2019 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/kenjiArai/code/DRV8830/#98a9369ed390
+http://mbed.org/users/kenjiArai/code/DRV8830/#323a62f5fff3
--- a/TextLCD.lib	Wed Nov 23 07:35:20 2016 +0000
+++ b/TextLCD.lib	Tue Dec 17 11:41:18 2019 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/kenjiArai/code/TextLCD/#986538f94abe
+https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
--- a/User_IF/uif.cpp	Wed Nov 23 07:35:20 2016 +0000
+++ b/User_IF/uif.cpp	Tue Dec 17 11:41:18 2019 +0000
@@ -1,19 +1,11 @@
 /*
  * mbed Application program / User Interface subroutines
  *
- * Copyright (c) 2016 Kenji Arai / JH1PJL
+ * Copyright (c) 2016,'19 Kenji Arai / JH1PJL
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  http://mbed.org/users/kenjiArai/
  *      Created:    September 28th, 2016
- *      Revised:    Novemeber 23rd, 2016
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
- * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *      Revised:    December  12th, 2019
  */
 
 #define     USE_COM         // use Communication with PC(UART)
@@ -94,12 +86,12 @@
 
 //  ROM / Constant data --------------------------------------------------------
                             //  12345678901234567890
-static char *const msg_clear = "                    ";
-static char *const msg_msg0  = "Frequency Counter   ";
-static char *const msg_msg1  = " mbed Nucleo F746ZG ";
-static char *const msg_msg2  = "   by JH1PJL K.Arai ";
-static char *const msg_msg3  = "   "__DATE__" UTC";
-static char *const msg_msg4  = "Getting GPS,pls wait";
+static const char *const msg_clear = "                    ";
+static const char *const msg_msg0  = "Frequency Counter   ";
+static const char *const msg_msg1  = " mbed Nucleo F746ZG ";
+static const char *const msg_msg2  = "   by JH1PJL K.Arai ";
+static const char *const msg_msg3  = "     " __DATE__" UTC";
+static const char *const msg_msg4  = "Getting GPS,pls wait";
 
 // function table
 void (*functptr[])(dispDef*) = {
@@ -543,7 +535,8 @@
     led_B_rotary = 0;
     // VCOM message
     BAUD(9600);
-    PRINTF("\r\nFrequency Counter by JH1PJL created on "__DATE__"\r\n");
+    //PRINTF("\r\nFrequency Counter by JH1PJL created on \r\n");
+    PRINTF("\r\nFrequency Counter by JH1PJL created on " __DATE__"\r\n");
     PRINTF("\r\nStarted!\r\n");
     PRINTF("SystemCoreClock = %d Hz\r\n", SystemCoreClock);
     // Rotary switch control
--- a/User_IF/uif.h	Wed Nov 23 07:35:20 2016 +0000
+++ b/User_IF/uif.h	Tue Dec 17 11:41:18 2019 +0000
@@ -1,19 +1,11 @@
 /*
  * mbed Application program / User Interface subroutines
  *
- * Copyright (c) 2016 Kenji Arai / JH1PJL
+ * Copyright (c) 2016,'19 Kenji Arai / JH1PJL
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  http://mbed.org/users/kenjiArai/
  *      Created:    September 28th, 2016
- *      Revised:    Novemeber 23rd, 2016
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
- * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *      Revised:    December  12th, 2019
  */
 
 //  Definition -----------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/check_revision.cpp	Tue Dec 17 11:41:18 2019 +0000
@@ -0,0 +1,21 @@
+/*
+ * Check Mbed revision
+ *
+ * Copyright (c) 2019 Kenji Arai / JH1PJL
+ *  http://www.page.sannet.ne.jp/kenjia/index.html
+ *  https://os.mbed.com/users/kenjiArai/
+ *      Created:    July      17th, 2019
+ *      Revised:    December  12th, 2019
+ */
+
+#include "mbed.h"
+
+//    RUN ONLY ON mbed-os5.14.2
+//      https://github.com/ARMmbed/mbed-os/releases/tag/mbed-os-5.14.2
+#if (MBED_MAJOR_VERSION == 5) &&\
+    (MBED_MINOR_VERSION == 14) &&\
+    (MBED_PATCH_VERSION == 2)
+#else
+    //#warning "Please use Mbed-os5.14.2"
+    #error "Please use Mbed-os5.14.2"
+#endif
\ No newline at end of file
--- a/hw_tst.h	Wed Nov 23 07:35:20 2016 +0000
+++ b/hw_tst.h	Tue Dec 17 11:41:18 2019 +0000
@@ -1,19 +1,11 @@
 /*
  * mbed Application program / HARDWARE TEST mode program
  *
- * Copyright (c) 2016 Kenji Arai / JH1PJL
+ * Copyright (c) 2016,'19 Kenji Arai / JH1PJL
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  http://mbed.org/users/kenjiArai/
  *      Created:    Novemeber  8th, 2016
- *      Revised:    Novemeber 23rd, 2016
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
- * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *      Revised:    December  12th, 2019
  */
 
 //  Include --------------------------------------------------------------------
@@ -58,7 +50,7 @@
 
 //  ROM / Constant data --------------------------------------------------------
 char *const test_msg0 = "F746ZG Frequency Counter Hardware Test on mbed";
-char *const test_msg1 = " system, created on UTC: "__DATE__"("__TIME__")";
+char *const test_msg1 = " system, created on UTC: " __DATE__"(" __TIME__")";
 
 //------------------------------------------------------------------------------
 //  Control Program
@@ -87,25 +79,25 @@
                 put_rn();
                 while (true){
                     led_R_gps1pps = 1;
-                    wait(0.4);
+                    ThisThread::sleep_for(400);
                     led_R_gps1pps = 0;
                     led_G_temp_ok = 1;
-                    wait(0.4);
+                    ThisThread::sleep_for(400);
                     led_G_temp_ok = 0;  
                     led_B_recipro = 1;
-                    wait(0.4);
+                    ThisThread::sleep_for(400);
                     led_B_recipro = 0;
                     led_W_prescaler = 1;
-                    wait(0.4);
+                    ThisThread::sleep_for(400);
                     led_W_prescaler = 0;
                     led_R_rotary = 1;
-                    wait(0.4);
+                    ThisThread::sleep_for(400);
                     led_R_rotary = 0;
                     led_G_rotary = 1;
-                    wait(0.4);
+                    ThisThread::sleep_for(400);
                     led_G_rotary = 0;
                     led_B_rotary = 1;
-                    wait(0.4);
+                    ThisThread::sleep_for(400);
                     led_B_rotary = 0;
                     if (READABLE()){ break;}
                 }
@@ -122,7 +114,7 @@
                     lcd.putc(i);
                 }
                 lcd.locate(0, 0);
-                wait(2.0);
+                ThisThread::sleep_for(2000);
                 for(char i = '.';'~' > i; i++){
                     lcd.putc(i);
                 }
@@ -241,7 +233,7 @@
                     PRINTF("Temperature: %+6.3f", read_temperature(1));
                     put_rn();
                     if (READABLE()){ break;}
-                    wait(1.0);
+                    ThisThread::sleep_for(1000);
                 }
                 c = GETC(); // read as dummy
                 break;
@@ -250,10 +242,9 @@
             //------------------------------------------------------------------
             case 'x' :
                 while (true){
-
                     put_rn();
                     if (READABLE()){ break;}
-                    wait(1.0);
+                    ThisThread::sleep_for(1000);
                 }
                 c = GETC(); // read as dummy
                 break;
--- a/main.cpp	Wed Nov 23 07:35:20 2016 +0000
+++ b/main.cpp	Tue Dec 17 11:41:18 2019 +0000
@@ -1,25 +1,17 @@
 /*
  * mbed Application program / Frequency Counter with GPS 1PPS Compensation
- *      Only for ST Nucleo-F746ZG
+ *      Only for ST Nucleo-F746ZG on mbed-OS5
  *
- * Copyright (c) 2014,'15,'16 Kenji Arai / JH1PJL
+ * Copyright (c) 2014,'15,'16,'19 Kenji Arai / JH1PJL
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  http://mbed.org/users/kenjiArai/
  *      Created:    October   18th, 2014
  *      Revised:    January    2nd, 2015
  *      Re-started: June      25th, 2016    ported from F411 to F746
- *      Revised:    Novemeber 23rd, 2016
+ *      Revised:    December  12th, 2019
  *
  * Base program: Frequency_counter_w_GPS_1PPS (only for Nucleo-F411RE board)
  * https://developer.mbed.org/users/kenjiArai/code/Frequency_Counter_w_GPS_1PPS/
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
- * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
 /*
@@ -55,7 +47,7 @@
 
 //  Include --------------------------------------------------------------------
 #include    "mbed.h"
-#include    "rtos.h"
+//#include    "rtos.h"
 #include    "GPSrcvr.h"
 #include    "DRV8830.h"
 #include    "ADT7410.h"
@@ -161,7 +153,7 @@
             disp_data.b_1pps_new = fc.read_newest_1pps();
             disp_data.b_1pps_lng = fc.read_avarage_1pps();
         }
-        Thread::wait(100);  // 0.1sec
+        ThisThread::sleep_for(100);  // 0.1sec
     }
 }
 
@@ -175,7 +167,7 @@
         tmr0.start();
         fc.recipro_start_measure();
         while (fc.recipro_check_trigger() == 0){
-            Thread::wait(1);  // 1mS
+            ThisThread::sleep_for(1);  // 1mS
             run2stop = tmr0.read_ms();
             if (run2stop >= RECIPRO_TIMEOUT){
                 break;
@@ -199,11 +191,11 @@
         disp_data.recipro_of = recipro_overflow;
         run2stop = tmr0.read_ms();
         if (run2stop > 1000){
-            Thread::wait(run2stop % 1000);  // next interval          
+            ThisThread::sleep_for(run2stop % 1000);  // next interval          
         } else {
             run2stop = 1000 - run2stop;
             /* Wait until it is time to check again. */
-            Thread::wait(run2stop);         // 1sec interval
+            ThisThread::sleep_for(run2stop);         // 1sec interval
         }
     }
 }
@@ -261,7 +253,7 @@
         pc.printf(", Diff=%3.1f-x= %+6.3f \r\n", TRGT_TEMP, TRGT_TEMP - tmp);
 #endif
         keep_1sec = 1000 - keep_1sec;
-        Thread::wait(keep_1sec);         // 1sec interval
+        ThisThread::sleep_for(keep_1sec);         // 1sec interval
     }
 }
 
@@ -278,7 +270,7 @@
         dispay_LCD_and_UART(&disp_data); // separate files uif.cpp & uif.h
         /* Wait */
         tim_remain = 1000 - tmr1.read_ms();
-        Thread::wait(tim_remain);
+        ThisThread::sleep_for(tim_remain);
     }
 }
 
@@ -299,7 +291,7 @@
 
 int main(){
     disp_first_msg();
-    Thread::wait(1000); // 1sec
+    ThisThread::sleep_for(1000); // 1sec
     disp_wait_gps();
     osThreadCreate(osThread(receive_gps), NULL);
     PRINTF("\r\nStart GPS receiving!\r\n");
@@ -307,17 +299,17 @@
     PRINTF("GPS data is valid!\r\n");
     fc.debug_printf_internal_data();
     osThreadCreate(osThread(measure_freq), NULL);
-    Thread::wait(5);    //wait
+    ThisThread::sleep_for(5);    //wait
     osThreadCreate(osThread(temp_control), NULL);
-    Thread::wait(8);    //wait
+    ThisThread::sleep_for(8);    //wait
     osThreadCreate(osThread(measure_freq_recipro), NULL);
-    Thread::wait(3);    //wait
+    ThisThread::sleep_for(3);    //wait
     osThreadCreate(osThread(display_data), NULL);
-    Thread::wait(10);   //wait
+    ThisThread::sleep_for(10);   //wait
     select_input_div_1or10or20(0);  // BNC (none presclaer)
     while(true) {
         /* Wait until it is time to check again. */
-        Thread::wait(60000);        // 1min.
+        ThisThread::sleep_for(60000);        // 1min.
     }
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Tue Dec 17 11:41:18 2019 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#cf4f12a123c05fcae83fc56d76442015cb8a39e9
--- a/mbed-rtos.lib	Wed Nov 23 07:35:20 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#58563e6cba1e
--- a/mbed.bld	Wed Nov 23 07:35:20 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/0ab6a29f35bf
\ No newline at end of file