PIP_NO_FILESYSTEM and PIP_NO_THREADS
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
# include "pisystemtests.h"
|
||||
#elif defined(ARDUINO)
|
||||
# include <Arduino.h>
|
||||
#elif defined(PICO_SDK)
|
||||
# include "hardware/time.h"
|
||||
#endif
|
||||
#ifdef MICRO_PIP
|
||||
# include <sys/time.h>
|
||||
@@ -48,28 +50,13 @@
|
||||
void piUSleep(int usecs) {
|
||||
if (usecs <= 0) return;
|
||||
#ifdef WINDOWS
|
||||
// printf("Sleep %d\n", usecs / 1000);
|
||||
if (usecs > 0) Sleep(usecs / 1000);
|
||||
// printf("Sleep end");
|
||||
#else
|
||||
# ifdef FREERTOS
|
||||
Sleep(usecs / 1000);
|
||||
#elif defined(FREERTOS)
|
||||
vTaskDelay(usecs / 1000 / portTICK_PERIOD_MS);
|
||||
# else
|
||||
# ifdef MICRO_PIP
|
||||
if (usecs > 0) {
|
||||
struct timeval start;
|
||||
gettimeofday(&start, nullptr);
|
||||
long long elapsed = 0;
|
||||
while (elapsed < usecs) {
|
||||
struct timeval now;
|
||||
gettimeofday(&now, nullptr);
|
||||
elapsed = (now.tv_sec - start.tv_sec) * 1000000LL + (now.tv_usec - start.tv_usec);
|
||||
}
|
||||
}
|
||||
# else
|
||||
#elif defined(PICO_SDK)
|
||||
sleep_us(usecs);
|
||||
#else
|
||||
usecs -= PISystemTests::usleep_offset_us;
|
||||
if (usecs > 0) usleep(usecs);
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user