//----------------------------------------------------------------------------- int kuroBoxVectorNavStop(VectorNavDriver * nvp) { spiStop(nvp->spip); gptStop(nvp->gpdp); return KB_OK; }
void vMBPortTimerClose( void ) { gptStop (&GPTDRIVER); }
//----------------------------------------------------------------------------- static void cmd_tcxo_test(BaseSequentialStream * chp, int argc, char * argv[]) { uint32_t passes = 0; if ( argc == 0 ) { passes = PASSES; } else { passes = atoi(argv[0]); if ( passes > PASSES ) { chprintf(chp, "WARNING: you asked for too many passes (%d), doing just (%d)\n", passes, PASSES); passes = PASSES; } } //-------------------------------------------------------------------------- gptStart(&GPTD2, &one_sec_cfg); gptStartContinuous(&GPTD2, 84000000-(factory_config.tcxo_compensation/2)); // wait X seconds to make sure the GPS has started up... pps = 0; while (pps < 5) { st7565_clear(&ST7565D1); st7565_drawstring(&ST7565D1, 0, 0, "TCXO vs GPS TEST"); INIT_CBUF(); chprintf(bss, "Waiting on GPS: %d", 5-pps); st7565_drawstring(&ST7565D1, 0, 1, charbuf); st7565_display(&ST7565D1); chThdSleepMilliseconds(50); } kbg_setLED2(0); st7565_clear(&ST7565D1); chprintf(chp, "pass,PASSES,pps_diff\n"); for ( uint32_t pass = 0 ; pass < passes ; ) { chThdSleepMilliseconds(50); if ( one_sec_pps_changed ) { kbg_setLED3(1); times[pass] = one_sec_pps_diff; int32_t diff_from_parity = 168000000 - pps_diff; chprintf(chp, "%6d,%6d,%14d,%6d,%14d\n", pass+1, passes, one_sec_pps_diff, one_sec_pps_diff_diff, diff_from_parity); one_sec_pps_changed = FALSE; pass++; st7565_drawstring(&ST7565D1, 0, 0, "TCXO vs GPS CONF"); INIT_CBUF(); chprintf(bss,"Doing %d passes", passes); st7565_drawstring(&ST7565D1, 0, 1, charbuf); INIT_CBUF(); chprintf(bss,"Pass: %d", pass); st7565_drawstring(&ST7565D1, 0, 2, charbuf); INIT_CBUF(); chprintf(bss,"Time diff: %d", one_sec_pps_diff); st7565_drawstring(&ST7565D1, 0, 3, charbuf); st7565_display(&ST7565D1); st7565_clear(&ST7565D1); chThdSleepMilliseconds(10); kbg_setLED3(0); } } gptStopTimer(&GPTD2); gptStop(&GPTD2); }