From 0863c30dec0525f3604cf0c669a6267277efea1b Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 17 Dec 2017 15:23:12 -0500 Subject: [PATCH] fix doc bug and add a little extra --- README.rst | 2 +- adafruit_bus_device/spi_device.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 94c0e0e..109a68e 100644 --- a/README.rst +++ b/README.rst @@ -30,7 +30,7 @@ bundle `. To install: #. Download and unzip the `latest release zip `_. -#. Copy the unzipped ``adafruit_bus_device`` to the ``lib`` directory on the ``CIRCUITPY`` or ``MICROPYTHON`` drive. +#. Copy the unzipped ``adafruit_bus_device`` to the ``lib`` directory on the ``CIRCUITPY`` drive. API --- diff --git a/adafruit_bus_device/spi_device.py b/adafruit_bus_device/spi_device.py index 57b5441..d1dd0bd 100644 --- a/adafruit_bus_device/spi_device.py +++ b/adafruit_bus_device/spi_device.py @@ -45,8 +45,11 @@ class SPIDevice: cs = digitalio.DigitalInOut(D10) device = SPIDevice(spi_bus, cs) bytes_read = bytearray(4) + # The object assigned to spi in the with statements below + # is the original spi_bus object. We are using the busio.SPI + # operations busio.SPI.readinto() and busio.SPI.write(). with device as spi: - spi_device.readinto(bytes_read) + spi.readinto(bytes_read) # A second transaction with device as spi: spi.write(bytes_read)