[ion] Sharing millis & micros for blackbox and simulator

This commit is contained in:
Damien Nicolet
2018-11-08 23:54:11 +01:00
parent bc8d9746c8
commit f93bf97182
13 changed files with 33 additions and 49 deletions

View File

@@ -34,13 +34,15 @@
void delay_ms(mp_uint_t delay) {
uint32_t start = millis();
while (millis() - start < delay && !micropython_port_should_interrupt()) {
while (millis() - start < delay && !micropython_port_should_interrupt(true)) {
msleep(1);
}
}
void delay_us(mp_uint_t delay) {
uint32_t start = micros();
while (micros() - start < delay && !micropython_port_should_interrupt()) {
while (micros() - start < delay && !micropython_port_should_interrupt(false)) {
usleep(1);
}
}