Skip to content
Snippets Groups Projects
Commit 80eafb7e authored by Gijs Schoonderbeek's avatar Gijs Schoonderbeek
Browse files

update EEPROM reading after testing

parent cddee538
No related branches found
No related tags found
No related merge requests found
......@@ -50,21 +50,20 @@ class ApspuClass:
#
ret_ack, ret_value = self.dev_i2c_eeprom.read_bytes(0)
if ret_ack < 1:
if DEBUG:
print("no device found")
print("no device found during write")
return False
else:
self.dev_i2c_eeprom.write_bytes(0x00, data)
sleep(0.1)
return True
def read_eeprom(self):
#
# Read the EEPROM with the serial number etc.
#
ret_ack, ret_value = self.dev_i2c_eeprom.read_bytes(0)
ret_ack, ret_value = self.dev_i2c_eeprom.read_last_reg(1)
if ret_ack < 1:
if DEBUG:
print("no EEPROM found")
print("no EEPROM found during read")
return False
else:
ret_ack, ret_value = self.dev_i2c_eeprom.read_bytes(0x00, 1)
......@@ -74,7 +73,7 @@ class ApspuClass:
#
# Write and Read the EEPROM to check functionality
#
self.write_eeprom(value)
if self.write_eeprom(value):
ret_value = self.read_eeprom()
stri = "Wrote to EEPROM: 0x{0:X}, Read from EEPROM: 0x{1} ".format(value, ret_value)
print(stri)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment