Frequency counter using GPS 1PPS signal and temperature controlled 50MHz Base clock. Ported from F411 Frequency Counter.
Dependencies: QEI DRV8830 PID ADT7410 TextLCD Frq_cuntr_Nucleo-F746ZG RingBuffer
Fork of Frequency_Counter_w_GPS_1PPS by
Please refer following.
/users/kenjiArai/notebook/frequency-counters/
Diff: main.cpp
- Revision:
- 14:ba6ea409ab05
- Parent:
- 13:1041596c416c
- Child:
- 15:ae0413277bc6
diff -r 1041596c416c -r ba6ea409ab05 main.cpp --- 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. } }