Fixed issue with single gpio not working
authorAndrey Miroshnikov <andrey@technepisteme.xyz>
Wed, 9 Mar 2022 17:28:20 +0000 (17:28 +0000)
committerAndrey Miroshnikov <andrey@technepisteme.xyz>
Wed, 9 Mar 2022 17:28:20 +0000 (17:28 +0000)
src/spec/simple_gpio.py

index 2e0d31b9027bc0c05adac7878e24f47e92ebd383..25c3b5ac14260d9b9ee5a15dee8d1b13f4f93bec 100644 (file)
@@ -297,7 +297,7 @@ class GPIOManager():
         curr_gpio = row_addr * self.wordsize
         config_word = 0
         for byte in range(0, self.wordsize):
-            if curr_gpio > self.n_gpios:
+            if curr_gpio >= self.n_gpios:
                 break
             config_word += self.shadow_csr[curr_gpio].packed << (8 * byte)
             #print("Reading GPIO{} shadow reg".format(curr_gpio))
@@ -317,7 +317,7 @@ class GPIOManager():
         curr_gpio = row_addr * self.wordsize
         single_csr = 0
         for byte in range(0, self.wordsize):
-            if curr_gpio > self.n_gpios:
+            if curr_gpio >= self.n_gpios:
                 break
             single_csr = (read_word >> (8 * byte)) & 0xFF
             #print("Updating GPIO{0} shadow reg to {1:x}"