Fixed stubs

This commit is contained in:
gamblor21 2020-11-01 08:57:31 -06:00
parent 5ea09fe348
commit 76c1153380
2 changed files with 30 additions and 25 deletions

View File

@ -41,7 +41,7 @@
//| class I2CDevice: //| class I2CDevice:
//| """I2C Device Manager""" //| """I2C Device Manager"""
//| //|
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 100000, timeout: int = 255) -> None: //| def __init__(self, i2c: busio.I2C, device_address: int, probe: bool = True) -> None:
//| //|
//| """Represents a single I2C device and manages locking the bus and the device //| """Represents a single I2C device and manages locking the bus and the device
//| address. //| address.

View File

@ -24,9 +24,6 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
// This file contains all of the Python API definitions for the
// busio.SPI class.
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/busdevice/SPIDevice.h" #include "shared-bindings/busdevice/SPIDevice.h"
#include "shared-bindings/util.h" #include "shared-bindings/util.h"
@ -42,27 +39,35 @@
//| class SPIDevice: //| class SPIDevice:
//| """SPI Device Manager"""
//|
//| def __init__(self, spi: busio.SPI, chip_select: microcontroller.Pin, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, extra_clocks : int = 0) -> None:
//|
//| """ //| """
//| Represents a single SPI device and manages locking the bus and the device //| Represents a single SPI device and manages locking the bus and the device address.
//| address.
//| :param ~busio.SPI spi: The SPI bus the device is on //| :param ~busio.SPI spi: The SPI bus the device is on
//| :param int device_address: The 7 bit device address //| :param ~digitalio.DigitalInOut chip_select: The chip select pin object that implements the
//| :param bool probe: Probe for the device upon object creation, default is true //| DigitalInOut API.
//| .. note:: This class is **NOT** built into CircuitPython. See //| :param int extra_clocks: The minimum number of clock cycles to cycle the bus after CS is high.
//| :ref:`here for install instructions <bus_device_installation>`. //| (Used for SD cards.)
//| Example: //| Example:
//| .. code-block:: python //| .. code-block:: python
//| import busio //| import busio
//| import digitalio
//| from board import * //| from board import *
//| from adafruit_bus_device.spi_device import SPIDevice //| from adafruit_bus_device.spi_device import SPIDevice
//| with busio.SPI(SCL, SDA) as spi: //| with busio.SPI(SCK, MOSI, MISO) as spi_bus:
//| device = SPIDevice(spi, 0x70) //| cs = digitalio.DigitalInOut(D10)
//| device = SPIDevice(spi_bus, cs)
//| bytes_read = bytearray(4) //| bytes_read = bytearray(4)
//| with device: //| # The object assigned to spi in the with statements below
//| device.readinto(bytes_read) //| # 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.readinto(bytes_read)
//| # A second transaction //| # A second transaction
//| with device: //| with device as spi:
//| device.write(bytes_read)""" //| spi.write(bytes_read)"""
//| ... //| ...
//| //|
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) { 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) {