Hi,
I’m completely new with platformio. I have a project that a fried has written. But he is sick at the moment, I can’t ask him.
At this project is a file wait.c:
#include "wait.h"
#include "clock.h"
#include <time.h>
#include <stdint.h>
static struct timespec sensor_prev;
void sensor_wait_mark(void)
{
clock_gettime(CLOCK_MONOTONIC, &sensor_prev);
}
float sensor_wait (float time)
{
struct timespec until = sensor_prev;
timespec_add_us(&until, time);
while (clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &until, NULL)) {}
struct timespec curtime;
clock_gettime(CLOCK_MONOTONIC, &curtime);
return timespec_delta_us(&curtime, &sensor_prev) - time;
}
If i click build I get this error:
src/wait.c: In function 'sensor_wait_mark':
src/wait.c:30:2: warning: implicit declaration of function 'clock_gettime' [-Wimplicit-function-declaration]
clock_gettime(CLOCK_MONOTONIC, &sensor_prev);
^
src/wait.c:30:16: error: 'CLOCK_MONOTONIC' undeclared (first use in this function)
clock_gettime(CLOCK_MONOTONIC, &sensor_prev);
^
src/wait.c:30:16: note: each undeclared identifier is reported only once for each function it appears in
src/wait.c: In function 'sensor_wait':
src/wait.c:37:9: warning: implicit declaration of function 'clock_nanosleep' [-Wimplicit-function-declaration]
while (clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &until, NULL)) {}
^
src/wait.c:37:25: error: 'CLOCK_MONOTONIC' undeclared (first use in this function)
while (clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &until, NULL)) {}
^
*** [.pio/build/esp32doit-devkit-v1/src/wait.c.o] Error 1
Compiling .pio/build/esp32doit-devkit-v1/lib6ca/MS5611/MS5611.cpp.o
I think it is a problem because of time.h, but I have no idea how to solve it