adafruit / Adafruit_CircuitPython_Register

Python data descriptor classes to represent hardware registers on I2C devices.
MIT License
52 stars 24 forks source link

Feature request: be able to indicate a register needs to be set/read byte-by-byte. #43

Open rpavlik opened 3 years ago

rpavlik commented 3 years ago

Ran across this in the context of the emc2101 library. https://github.com/adafruit/Adafruit_CircuitPython_EMC2101 The EMC2101 supports only a small portion of SMBus (i2c) and specifically, can only read or write a single "data" byte per transaction. This means there's a bunch of registers in the code that are, e.g. ..._h and ..._l for two-byte integers, and a place where I'm now trying a StructArray of 16 bytes instead of a StructArray of 8 structs each with 2 bytes. It would simplify the code a lot, and decrease memory usage, if there was a way to indicate byte-at-a-time, perhaps even just a separate few classes for this purpose to avoid increasing memory usage elsewhere.