diff --git a/usmbus/__init__.py b/usmbus/__init__.py index 4d413bd..7613834 100644 --- a/usmbus/__init__.py +++ b/usmbus/__init__.py @@ -49,14 +49,17 @@ def write_i2c_block_data(self, addr, register, data): data = bytes([data]) return self.writeto_mem(addr, register, data) - # The follwing haven't been implemented, but could be. - def read_byte(self, *args, **kwargs): - """ Not yet implemented """ - raise RuntimeError("Not yet implemented") + def read_byte(self, addr): + """ Read a single byte of data from the device at addr + Returns a bytes object with the data read """ + return self.readfrom(addr, 1) - def write_byte(self, *args, **kwargs): - """ Not yet implemented """ - raise RuntimeError("Not yet implemented") + def write_byte(self, addr, data): + """ Write a single byte of data to the device at addr + Returns None """ + if isinstance(data, int): + data = bytes([data]) + return self.writeto(addr, data) def read_word_data(self, *args, **kwargs): """ Not yet implemented """