timing cleanup for esp32
This commit is contained in:
parent
f6f86ba18a
commit
c9a2b39116
2 changed files with 14 additions and 12 deletions
|
@ -43,18 +43,10 @@ void kw11_l::operator()()
|
|||
if (b->get_lf_crs() & 64)
|
||||
b->getCpu()->queue_interrupt(6, 0100);
|
||||
|
||||
#if defined(ESP32)
|
||||
vTaskDelay(100 / portTICK_RATE_MS);
|
||||
#else
|
||||
myusleep(1000000 / 50); // 20ms
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#if defined(ESP32)
|
||||
vTaskDelay(100 / portTICK_RATE_MS);
|
||||
#else
|
||||
myusleep(1000000 / 10); // 100ms
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
16
utils.cpp
16
utils.cpp
|
@ -72,10 +72,20 @@ int parity(int v)
|
|||
void myusleep(uint64_t us)
|
||||
{
|
||||
#if defined(ESP32)
|
||||
if (us >= 1000)
|
||||
vTaskDelay(us / 1000 / portTICK_RATE_MS);
|
||||
else
|
||||
for(;;) {
|
||||
uint64_t n_ms = us / 1000;
|
||||
|
||||
if (n_ms >= portTICK_RATE_MS) {
|
||||
vTaskDelay(n_ms / portTICK_RATE_MS);
|
||||
|
||||
us -= n_ms * 1000;
|
||||
}
|
||||
else {
|
||||
delayMicroseconds(us);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
struct timespec req;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue