diff --git a/uCNC/src/modules/softi2c.c b/uCNC/src/modules/softi2c.c index 41496e6c6..45b197748 100644 --- a/uCNC/src/modules/softi2c.c +++ b/uCNC/src/modules/softi2c.c @@ -15,6 +15,7 @@ Also without the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ +#include "../cnc.h" #include "softi2c.h" void softi2c_delay(uint8_t loops_100ns) @@ -60,7 +61,7 @@ static uint8_t softi2c_clock_stretch(softi2c_port_t *port) static uint8_t softi2c_write(softi2c_port_t *port, uint8_t c, bool send_start, bool send_stop) { uint8_t ack = 0; - + cnc_dotasks(); if (send_start) { // init @@ -125,6 +126,7 @@ static uint8_t softi2c_read(softi2c_port_t *port, bool with_ack, bool send_stop) { uint8_t c = 0xFF; uint8_t i = 8; + cnc_dotasks(); do { softi2c_delay(port->i2cdelay); diff --git a/uCNC/src/modules/softspi.c b/uCNC/src/modules/softspi.c index 20f376096..9ef667356 100644 --- a/uCNC/src/modules/softspi.c +++ b/uCNC/src/modules/softspi.c @@ -42,6 +42,7 @@ void softspi_config(softspi_port_t *port, uint8_t mode, uint32_t frequency) uint8_t softspi_xmit(softspi_port_t *port, uint8_t c) { + cnc_dotasks(); if (!port) { #ifdef MCU_HAS_SPI diff --git a/uCNC/src/modules/softuart.c b/uCNC/src/modules/softuart.c index f4eee6fb4..f31cc95c9 100644 --- a/uCNC/src/modules/softuart.c +++ b/uCNC/src/modules/softuart.c @@ -19,6 +19,7 @@ void softuart_putc(softuart_port_t *port, char c) { + cnc_dotasks(); if (!port) { #if (defined(MCU_HAS_UART2) && defined(DETACH_UART2_FROM_MAIN_PROTOCOL)) @@ -61,11 +62,11 @@ int16_t softuart_getc(softuart_port_t *port, uint32_t ms_timeout) ms_timeout *= 1000; while (port->rx()) { - mcu_delay_us(1); if (!ms_timeout--) { return -1; } + cnc_dotasks(); } port->waithalf();