From 120decefd8643ace49b214fadf4a5a7e95f9bbe8 Mon Sep 17 00:00:00 2001 From: kraus Date: Thu, 23 Aug 2018 22:38:50 +0200 Subject: [PATCH] add yield(), issue #530 --- cppsrc/U8x8lib.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cppsrc/U8x8lib.cpp b/cppsrc/U8x8lib.cpp index 61fa4015..4b08ae76 100644 --- a/cppsrc/U8x8lib.cpp +++ b/cppsrc/U8x8lib.cpp @@ -147,6 +147,11 @@ extern "C" uint8_t u8x8_gpio_and_delay_arduino(u8x8_t *u8x8, uint8_t msg, uint8_ } else { + if ( u8x8_GetPinIndex(u8x8, msg) == U8X8_PIN_OUTPUT_CNT ) + { + // call yield() for the first pin only, u8x8 will always request all the pins, so this should be ok + yield(); + } u8x8_SetGPIOResult(u8x8, digitalRead(i) == 0 ? 0 : 1); } }