Skip to content

Commit 76c1153

Browse files
committed
Fixed stubs
1 parent 5ea09fe commit 76c1153

File tree

2 files changed

+30
-25
lines changed

2 files changed

+30
-25
lines changed

shared-bindings/busdevice/I2CDevice.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
//| class I2CDevice:
4242
//| """I2C Device Manager"""
4343
//|
44-
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 100000, timeout: int = 255) -> None:
44+
//| def __init__(self, i2c: busio.I2C, device_address: int, probe: bool = True) -> None:
4545
//|
4646
//| """Represents a single I2C device and manages locking the bus and the device
4747
//| address.

shared-bindings/busdevice/SPIDevice.c

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
* THE SOFTWARE.
2525
*/
2626

27-
// This file contains all of the Python API definitions for the
28-
// busio.SPI class.
29-
3027
#include "shared-bindings/microcontroller/Pin.h"
3128
#include "shared-bindings/busdevice/SPIDevice.h"
3229
#include "shared-bindings/util.h"
@@ -42,27 +39,35 @@
4239

4340

4441
//| class SPIDevice:
45-
//| """
46-
//| Represents a single SPI device and manages locking the bus and the device
47-
//| address.
48-
//| :param ~busio.SPI spi: The SPI bus the device is on
49-
//| :param int device_address: The 7 bit device address
50-
//| :param bool probe: Probe for the device upon object creation, default is true
51-
//| .. note:: This class is **NOT** built into CircuitPython. See
52-
//| :ref:`here for install instructions <bus_device_installation>`.
53-
//| Example:
54-
//| .. code-block:: python
55-
//| import busio
56-
//| from board import *
57-
//| from adafruit_bus_device.spi_device import SPIDevice
58-
//| with busio.SPI(SCL, SDA) as spi:
59-
//| device = SPIDevice(spi, 0x70)
60-
//| bytes_read = bytearray(4)
61-
//| with device:
62-
//| device.readinto(bytes_read)
63-
//| # A second transaction
64-
//| with device:
65-
//| device.write(bytes_read)"""
42+
//| """SPI Device Manager"""
43+
//|
44+
//| def __init__(self, spi: busio.SPI, chip_select: microcontroller.Pin, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, extra_clocks : int = 0) -> None:
45+
//|
46+
//| """
47+
//| Represents a single SPI device and manages locking the bus and the device address.
48+
//| :param ~busio.SPI spi: The SPI bus the device is on
49+
//| :param ~digitalio.DigitalInOut chip_select: The chip select pin object that implements the
50+
//| DigitalInOut API.
51+
//| :param int extra_clocks: The minimum number of clock cycles to cycle the bus after CS is high.
52+
//| (Used for SD cards.)
53+
//| Example:
54+
//| .. code-block:: python
55+
//| import busio
56+
//| import digitalio
57+
//| from board import *
58+
//| from adafruit_bus_device.spi_device import SPIDevice
59+
//| with busio.SPI(SCK, MOSI, MISO) as spi_bus:
60+
//| cs = digitalio.DigitalInOut(D10)
61+
//| device = SPIDevice(spi_bus, cs)
62+
//| bytes_read = bytearray(4)
63+
//| # The object assigned to spi in the with statements below
64+
//| # is the original spi_bus object. We are using the busio.SPI
65+
//| # operations busio.SPI.readinto() and busio.SPI.write().
66+
//| with device as spi:
67+
//| spi.readinto(bytes_read)
68+
//| # A second transaction
69+
//| with device as spi:
70+
//| spi.write(bytes_read)"""
6671
//| ...
6772
//|
6873
STATIC mp_obj_t busdevice_spidevice_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {

0 commit comments

Comments
 (0)