adafruit / Adafruit_CircuitPython_Register

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

Optimize UnaryStruct memory use for when its unused #9

Closed tannewt closed 6 years ago

tannewt commented 6 years ago

Having __init__ create a bytearray buffer costs 32 bytes for every UnaryStruct even when its not used. This makes code size a bit larger but its shared amongst all instances.

tannewt commented 6 years ago

Can someone review this please?

ladyada commented 6 years ago

hiya i dont see anything conceptually amiss here, want me to test with some i2c hardware that uses this library?

tannewt commented 6 years ago

@ladyada I've tested it on my end so its up to you if you want to test before approving.

ladyada commented 6 years ago

tested with AMG8833 - works good!