Add examples of non-applicable cases and SPI link

This commit is contained in:
Scott Shawcroft 2022-08-11 11:01:16 -07:00
parent 1ae88c3131
commit 553367105f
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA

View File

@ -497,10 +497,16 @@ backticks ``:class:`~adafruit_motor.servo.Servo```. You must also add the refer
Use ``adafruit_register`` when possible
--------------------------------------------------------------------------------
`Register <https://github.com/adafruit/Adafruit_CircuitPython_Register>`_ is
a foundational library that manages packing and unpacking data from device
registers. When possible, use it for unpacking and packing registers. This
ensures the packing code is shared amongst all registers. Furthermore, it
simplifies device definitions by making them declarative (only data.)
a foundational library that manages packing and unpacking data from I2C device
registers. There is also `Register SPI <https://github.com/adafruit/Adafruit_CircuitPython_Register_SPI>`_
for SPI devices. When possible, use one of these libraries for unpacking and
packing registers. This ensures the packing code is shared amongst all
registers (even across drivers). Furthermore, it simplifies device definitions
by making them declarative (only data.)
Values with non-consecutive bits in a register or that represent FIFO endpoints
may not map well to existing register classes. In unique cases like these, it is
ok to read and write the register directly.
*Do not* add all registers from a datasheet upfront. Instead, only add the ones
necessary for the functionality the driver exposes. Adding them all will lead to