Make yield() overridable (#2991)

This commit is contained in:
Dirk O. Kaar 2019-10-04 11:49:39 +02:00 committed by Me No Dev
parent 8fb8e7d060
commit c2b3f2d6af
3 changed files with 7 additions and 2 deletions

View File

@ -97,10 +97,12 @@ protected:
uart_t* _uart; uart_t* _uart;
}; };
extern void serialEventRun(void) __attribute__((weak));
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL) #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
extern HardwareSerial Serial; extern HardwareSerial Serial;
extern HardwareSerial Serial1; extern HardwareSerial Serial1;
extern HardwareSerial Serial2; extern HardwareSerial Serial2;
#endif #endif
#endif #endif // HardwareSerial_h

View File

@ -44,11 +44,13 @@ float temperatureRead()
return (temprature_sens_read() - 32) / 1.8; return (temprature_sens_read() - 32) / 1.8;
} }
void yield() void __yield()
{ {
vPortYield(); vPortYield();
} }
void yield() __attribute__ ((weak, alias("__yield")));
#if CONFIG_AUTOSTART_ARDUINO #if CONFIG_AUTOSTART_ARDUINO
extern TaskHandle_t loopTaskHandle; extern TaskHandle_t loopTaskHandle;

View File

@ -17,6 +17,7 @@ void loopTask(void *pvParameters)
esp_task_wdt_reset(); esp_task_wdt_reset();
} }
loop(); loop();
if (serialEventRun) serialEventRun();
} }
} }