From 62afacaba7b595d61d2a1e42171c86dd40a422d0 Mon Sep 17 00:00:00 2001
From: GijsSchoonderbeek <schoonderbeek@astron.nl>
Date: Mon, 10 May 2021 10:54:04 +0200
Subject: [PATCH] Made small modification to rd_unb2c.py to test on the
 hardware.

---
 rd_unb2c.py | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/rd_unb2c.py b/rd_unb2c.py
index b84d415..a1099b7 100644
--- a/rd_unb2c.py
+++ b/rd_unb2c.py
@@ -1,6 +1,7 @@
-'''
-Read Hardware info form UNB2C
-'''
+#******************************************#
+# Read hardware info from UNB2c
+# Created: 2021-05-10
+#******************************************#
 
 import sys
 import time
@@ -29,13 +30,17 @@ def rw_eeprom(value=0xAB):
     if ret_ack < 1:
         print("no device found")
     else:
-        I2C_eeprom.write_bytes(0x00, value)
+        pr_stri = "Found device at address 0x{:02x}".format(I2C_eeprom.I2C_Address)
+        print(pr_stri)
+#       ret_ack = I2C_eeprom.write_bytes(0x00, value)
+        value = []
         ret_ack, ret_value = I2C_eeprom.read_bytes(0x00, 1)
+        print("read = ", ret_value)
         stri = "Wrote to EEPROM: {0}, Read from EEPROM: {1} ".format(value, ret_value)
         print(stri)
 
-def front_led(value=0xFF, ADDRESS=0x71):
-    main_switch = I2C(ADDRESS)
+def front_led(value=0xFF):
+    main_switch = I2C(0x71)
     main_switch.bus = I2CBUSNR
     ret_ack = main_switch.write_pointer(0x20) #select LED
     if ret_ack < 1:
-- 
GitLab