From 4c699c5fdb28c613cf2fa754ec5ffd414d67ab20 Mon Sep 17 00:00:00 2001 From: "Mr.Blinky" <4971163+MrBlinky@users.noreply.github.com> Date: Sat, 25 Apr 2020 17:53:00 +0200 Subject: [PATCH] I2C fix --- board-package-source/libraries/Arduboy2/src/Arduboy2Core.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/board-package-source/libraries/Arduboy2/src/Arduboy2Core.cpp b/board-package-source/libraries/Arduboy2/src/Arduboy2Core.cpp index 57b5fa3..25a3ec6 100644 --- a/board-package-source/libraries/Arduboy2/src/Arduboy2Core.cpp +++ b/board-package-source/libraries/Arduboy2/src/Arduboy2Core.cpp @@ -610,8 +610,8 @@ void Arduboy2Core::paintScreen(uint8_t image[], bool clear) //bitbanging I2C ~2Mbps (8 cycles per bit / 78 cycles per byte) asm volatile ( " dec %[clear] \n" // get clear mask 0:0xFF, 1:0x00 - "1: \n" " ld r24, %a[ptr] \n" // fetch display byte from buffer + "1: \n" " mov r0, r24 \n" // move to shift register " and r24, %[clear] \n" // apply clear mask " st %a[ptr]+, r24 \n" // update buffer @@ -630,7 +630,7 @@ void Arduboy2Core::paintScreen(uint8_t image[], bool clear) " \n" " out %[port], %[sda0] \n" // clear SDA for ACK " subi %A[len], 1 \n" // len-- part1 (moved here for 1 cycle delay) - "nop\n" + " ld r24, %a[ptr] \n" // fetch display byte from buffer (and delay) " out %[pin], %[scl] \n" // set SCL (2 cycles required) " sbci %B[len], 0 \n" // len-- part2 (moved here for 1 cycle delay) " out %[pin], %[scl] \n" // clear SCL (2 cycles required)