added MCP3002 support via new module and corresponding examples to address #2
docs improvements
Since I had to test differential reads pretty thoroughly, I ended up
making the docs a bit more concise concerning the differential channel mappings and the driver class' channel aliases
added return value ranges to applicable attributes
added some links to datasheets for wiring/pinout (yea I screwed it up on the first try)
AnalogIn's API contains a warning about the ADCs' neglect of negative numbers for differential read results and hints behavior for voltages outside reference voltage bounds. Although, I feel the placement of this warning might serve better at the top of the API references, but its fine for now.
code improvements
MCP3002's SPI calls transact over 2 bytes while MCP3004/MCP3008 still transact over 3 bytes
removed redundantly setting each byte in the MCP3xxx's internal output buffer and removed the local variable command
removed the constants used for the differential read flag & the start bit as the start bit is now set upon instantiation while differential read flag is still set during every read() call.
modified the handling of the received data in the input buffer to use 1 less computation and removed local variable result
removed unused object instance attributes negative_pin and channel from AnalogIn class as well as the __getitem__() related to the channel attribute.
All these changes were tested on a MCP3002 and MCP3008 for verification with consistent results.
docs improvements
Since I had to test differential reads pretty thoroughly, I ended up
AnalogIn
's API contains a warning about the ADCs' neglect of negative numbers for differential read results and hints behavior for voltages outside reference voltage bounds. Although, I feel the placement of this warning might serve better at the top of the API references, but its fine for now.code improvements
command
read()
call.result
negative_pin
andchannel
fromAnalogIn
class as well as the__getitem__()
related to thechannel
attribute.All these changes were tested on a MCP3002 and MCP3008 for verification with consistent results.