Skip to content

MCP3002 support #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Oct 29, 2019
Merged

MCP3002 support #20

merged 14 commits into from
Oct 29, 2019

Conversation

2bndy5
Copy link
Contributor

@2bndy5 2bndy5 commented Oct 25, 2019

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.

@ladyada ladyada requested a review from brentru October 25, 2019 17:48
Copy link
Member

@brentru brentru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@2bndy5 this looks great. thank you for the code improvements. req'ing a few changes...

@brentru
Copy link
Member

brentru commented Oct 29, 2019

@2bndy5 Travis is passing, merging in and releasing! Thanks for the contribution, this should close #2

@brentru brentru merged commit dba64ec into adafruit:master Oct 29, 2019
@brentru brentru mentioned this pull request Oct 29, 2019
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jan 22, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_ADXL34x to 1.10.4 from 1.10.3:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_ADXL34x#15 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_ADXL34x#14 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_ADXL34x#13 from kattni/readme-update
  > Merge pull request adafruit/Adafruit_CircuitPython_ADXL34x#12 from kattni/update-all-examples
  > Merge pull request adafruit/Adafruit_CircuitPython_ADXL34x#11 from kattni/add-adxl345-example-code

Updating https://github.com/adafruit/Adafruit_CircuitPython_AMG88xx to 1.1.6 from 1.1.5:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_AMG88xx#22 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_ATECC to 1.0.4 from 1.0.3:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_ATECC#8 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_CCS811 to 1.1.7 from 1.1.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_CCS811#38 from linusg/patch-1
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_CCS811#36 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_CCS811#35 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_CharLCD to 3.2.2 from 3.2.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_CharLCD#44 from caternuson/iss38
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_CharLCD#43 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_CharLCD#42 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306 to 1.1.3 from 1.1.2:
  > update pylint examples directive
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306#8 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306#6 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_DRV2605 to 1.0.4 from 1.0.3:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_DRV2605#18 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_DRV2605#17 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_HX8357 to 1.1.2 from 1.1.1:
  > update pylint examples directive
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_HX8357#7 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_HX8357#6 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_INA219 to 3.3.1 from 3.3.0:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_INA219#15 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_MCP3xxx to 1.3.0 from 1.1.2:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_MCP3xxx#22 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_MCP3xxx#20 from 2bndy5/mcp3002-support
  > Merge pull request adafruit/Adafruit_CircuitPython_MCP3xxx#19 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_MPR121 to 2.0.5 from 2.0.4:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_MPR121#22 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_MPR121#21 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_MSA301 to 1.1.1 from 1.1.0:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_MSA301#3 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_MSA301#2 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_Nunchuk to 0.1.2 from 0.1.1:
  > update pylint examples directive
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_Nunchuk#7 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_Nunchuk#6 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_PN532 to 2.0.9 from 2.0.8:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_PN532#29 from basil-huber/spi_buffer_fix
  > Merge pull request adafruit/Adafruit_CircuitPython_PN532#27 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_PN532#26 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_RFM9x to 1.2.1 from 1.2.0:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_RFM9x#35 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_SGP30 to 2.1.2 from 2.1.1:
  > update pylint examples directive

Updating https://github.com/adafruit/Adafruit_CircuitPython_TLV493D to 1.0.1 from 1.0.0:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_TLV493D#2 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_TLV493D#1 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_TSL2591 to 1.1.4 from 1.1.3:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_TSL2591#12 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_TSL2591#11 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_VS1053 to 1.1.2 from 1.1.1:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_VS1053#6 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_VS1053#5 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_GC_IOT_Core to 1.0.2 from 1.0.1:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_GC_IOT_Core#6 from brentru/pypi-setup
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_GC_IOT_Core#5 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_GC_IOT_Core#4 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT to 1.0.3 from 1.0.2:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_AzureIoT#6 from brentru/pypi-setup
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_AzureIoT#5 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_AzureIoT#4 from adafruit/dherrada-patch-1-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_binascii to 1.0.2 from 1.0.1:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_binascii#5 from brentru/pypi
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_binascii#4 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_binascii#3 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE to 5.0.2 from 4.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#64 from tannewt/fix_packaging
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#58 from dglaude/patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#56 from dhalbert/update-hid-for-bonding
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#63 from dhalbert/fix-lazy-advertising-fields
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#61 from adafruit/dherrada-patch-3

Updating https://github.com/adafruit/Adafruit_CircuitPython_BoardTest to 1.1.2 from 1.1.1:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_BoardTest#9 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_JWT to 1.0.1 from 1.0.0:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_JWT#4 from brentru/pypi-setup
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_JWT#3 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_JWT#2 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_Logging to 1.1.1 from 1.1.0:
  > update pylint examples directive
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_Logging#8 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_Logging#7 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_Logging#6 from magnusvmt/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_PYOA to 2.1.1 from 2.1.0:
  > update pylint examples directive
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_PYOA#17 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_RSA to 1.0.3 from 1.0.2:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_RSA#7 from brentru/pypi
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_RSA#6 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_RSA#5 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_GC_IOT_Core, Adafruit_CircuitPython_AzureIoT, Adafruit_CircuitPython_binascii, Adafruit_CircuitPython_JWT, Adafruit_CircuitPython_Pypixelbuf, Adafruit_CircuitPython_RSA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants