kopia lustrzana https://github.com/RPiks/pico-hf-oscillator
GPS reference test works.
rodzic
e319558b9c
commit
ca62cc4ab0
|
@ -39,7 +39,7 @@ target_sources(pico-hf-oscillator-test PUBLIC
|
|||
pico_set_program_name(pico-hf-oscillator-test "pico-hf-oscillator-test")
|
||||
pico_set_program_version(pico-hf-oscillator-test "0.9")
|
||||
|
||||
pico_enable_stdio_uart(pico-hf-oscillator-test 0)
|
||||
pico_enable_stdio_uart(pico-hf-oscillator-test 1)
|
||||
pico_enable_stdio_usb(pico-hf-oscillator-test 1)
|
||||
|
||||
# Add the standard include files to the build
|
||||
|
@ -49,6 +49,8 @@ target_include_directories(pico-hf-oscillator-test PRIVATE
|
|||
${CMAKE_CURRENT_LIST_DIR}/..
|
||||
)
|
||||
|
||||
add_compile_options(-Wall)
|
||||
|
||||
# Add any user requested libraries
|
||||
target_link_libraries(
|
||||
pico-hf-oscillator-test
|
||||
|
|
|
@ -93,6 +93,9 @@ GPStimeContext *GPStimeInit(int uart_id, int uart_baud, int pps_gpio)
|
|||
gpio_set_dir(pps_gpio, GPIO_IN);
|
||||
gpio_set_irq_enabled_with_callback(pps_gpio, GPIO_IRQ_EDGE_RISE, true, &GPStimePPScallback);
|
||||
|
||||
uart_set_hw_flow(uart_id ? uart1 : uart0, false, false);
|
||||
uart_set_format(uart_id ? uart1 : uart0, 8, 1, UART_PARITY_NONE);
|
||||
uart_set_fifo_enabled(uart_id ? uart1 : uart0, false);
|
||||
irq_set_exclusive_handler(uart_id ? UART1_IRQ : UART0_IRQ, GPStimeUartRxIsr);
|
||||
irq_set_enabled(uart_id ? UART1_IRQ : UART0_IRQ, true);
|
||||
uart_set_irq_enables(uart_id ? uart1 : uart0, true, false);
|
||||
|
@ -221,6 +224,8 @@ int GPStimeProcNMEAsentence(GPStimeContext *pg)
|
|||
uint8_t *prmc = (uint8_t *)strnstr((char *)pg->_pbytebuff, "$GPRMC,", sizeof(pg->_pbytebuff));
|
||||
if(prmc)
|
||||
{
|
||||
++pg->_time_data._u32_nmea_gprmc_count;
|
||||
|
||||
uint64_t tm_fix = GetUptime64();
|
||||
uint8_t u8ixcollector[16] = {0};
|
||||
uint8_t chksum = 0;
|
||||
|
@ -273,8 +278,6 @@ int GPStimeProcNMEAsentence(GPStimeContext *pg)
|
|||
pg->_time_data._u32_utime_nmea_last = GPStime2UNIX(prmc + u8ixcollector[8], prmc + u8ixcollector[0]);
|
||||
pg->_time_data._u64_sysclk_nmea_last = tm_fix;
|
||||
}
|
||||
|
||||
++pg->_time_data._u32_nmea_gprmc_count;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
26
test.c
26
test.c
|
@ -234,20 +234,20 @@ void RAM (SpinnerGPSreferenceTest)(void)
|
|||
|
||||
/* LED signal */
|
||||
gpio_put(PICO_DEFAULT_LED_PIN, 1);
|
||||
sleep_ms(500);
|
||||
sleep_ms(2500);
|
||||
|
||||
i32_compensation_millis =
|
||||
PioDCOGetFreqShiftMilliHertz(&DCO, (uint64_t)(ku32_freq * 1000LL));
|
||||
|
||||
StampPrintf("GPS solution status: %s | GPS-based freq compensation: %ld milliHz",
|
||||
pGPS->_time_data._u8_is_solution_active ? "Active" : "No solution",
|
||||
i32_compensation_millis);
|
||||
|
||||
gpio_put(PICO_DEFAULT_LED_PIN, 0);
|
||||
sleep_ms(500);
|
||||
sleep_ms(2500);
|
||||
|
||||
if(0 == ++tick % 30)
|
||||
if(0 == ++tick % 6)
|
||||
{
|
||||
stdio_set_driver_enabled(&stdio_uart, false);
|
||||
GPStimeDump(&(pGPS->_time_data));
|
||||
stdio_set_driver_enabled(&stdio_uart, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,18 +260,6 @@ int main()
|
|||
sleep_ms(1000);
|
||||
printf("Start\n");
|
||||
|
||||
/*
|
||||
for(;;)
|
||||
{
|
||||
char ch = uart_getc(uart0);
|
||||
if(ch)
|
||||
{
|
||||
stdio_set_driver_enabled(&stdio_uart, false);
|
||||
printf("%c", ch);
|
||||
stdio_set_driver_enabled(&stdio_uart, true);
|
||||
}
|
||||
}
|
||||
*/
|
||||
gpio_init(PICO_DEFAULT_LED_PIN);
|
||||
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue