From 325f6007dfd5b17b34471450c2437ee1f666f46d Mon Sep 17 00:00:00 2001 From: Aurel Date: Mon, 11 Dec 2023 11:45:42 +0100 Subject: [PATCH] Bitbangio writes incorrectly in registers in connection with https://github.com/adafruit/Adafruit_CircuitPython_BitbangIO/issues/20 tested on max31856 (phase 1) and st7735R (phase 0) on a raspberry pico/u2if. Also solves the problem of a max31856 on raspberry pi (impossible to set the thresholds) --- adafruit_bitbangio.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_bitbangio.py b/adafruit_bitbangio.py index cd40adb..95c5d38 100644 --- a/adafruit_bitbangio.py +++ b/adafruit_bitbangio.py @@ -398,13 +398,13 @@ def write( # Set clock to base if not self._phase: # Mode 0, 2 self._mosi.value = bit_value - self._sclk.value = self._polarity + self._sclk.value = not self._polarity start_time = self._wait(start_time) # Flip clock off base if self._phase: # Mode 1, 3 self._mosi.value = bit_value - self._sclk.value = not self._polarity + self._sclk.value = self._polarity start_time = self._wait(start_time) # Return pins to base positions