viewtopic.php?p=1290845#p1291239
I only needed small changes to get q32.c running on Pico with USB output:
https://stamm-wilbrandt.de/en/forum/q32.c
Code: Select all
$ diff q32.c ../../../hello_world/usb/hello_usb.c
3a4
> #include "pico/stdlib.h"
21,22c22,25
< gettimeofday(&tv1, NULL); // wait for usec change
< do gettimeofday(&tv0, NULL); while (tv0.tv_usec == tv1.tv_usec);
---
> stdio_init_all();
> sleep_ms(5000);
>
> gettimeofday(&tv0, NULL);
$
It was strange that loop waiting for microsecond change did not work and I had to remove.
But final microsecond duration output of 0 seems to indicate that gettimeofday() is not implemented as on Raspberry Pi OS:
Code: Select all
Compiled on Aug 13 2017, 15:25:34.
Port /dev/ttyACM0, 21:47:03
Press CTRL-A Z for help on special keys
47| 29|101|
113| 59| 5|
17| 89| 71|
0us
Is it correct that gettimeofday() cannot be used to measure microsecond precision time deltas?
If that is true, is there an alternative microsecond precision time delta measurement method in Pico SDK?