Skip to content

update busio & adafruit_bus_device docs #4928

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 4 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {"cpython": ('https://docs.python.org/3/', None),
"bus_device": ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),
"register": ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None)}

# Adapted from sphinxcontrib-redirects
Expand Down
4 changes: 4 additions & 0 deletions shared-bindings/adafruit_bus_device/I2CDevice.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
//|
//| """Represents a single I2C device and manages locking the bus and the device
//| address.
//|
//| :param ~busio.I2C i2c: The I2C bus the device is on
//| :param int device_address: The 7 bit device address
//| :param bool probe: Probe for the device upon object creation, default is true
Expand Down Expand Up @@ -114,6 +115,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(adafruit_bus_device_i2cdevice___exit_
//| If ``start`` or ``end`` is provided, then the buffer will be sliced
//| as if ``buf[start:end]``. This will not cause an allocation like
//| ``buf[start:end]`` will so it saves memory.
//|
//| :param bytearray buf: buffer to write into
//| :param int start: Index to start writing at
//| :param int end: Index to write up to but not include; if None, use ``len(buf)``"""
Expand Down Expand Up @@ -157,6 +159,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_readinto_obj, 2,
//| If ``start`` or ``end`` is provided, then the buffer will be sliced
//| as if ``buffer[start:end]``. This will not cause an allocation like
//| ``buffer[start:end]`` will so it saves memory.
//|
//| :param bytearray buf: buffer containing the bytes to write
//| :param int start: Index to start writing from
//| :param int end: Index to read up to but not include; if None, use ``len(buf)``
Expand Down Expand Up @@ -208,6 +211,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_write_obj, 2, adafruit_
//| will be sliced as if ``in_buffer[in_start:in_end]``. This will not
//| cause an allocation like ``in_buffer[in_start:in_end]`` will so
//| it saves memory.
//|
//| :param bytearray out_buffer: buffer containing the bytes to write
//| :param bytearray in_buffer: buffer containing the bytes to read into
//| :param int out_start: Index to start writing from
Expand Down
1 change: 1 addition & 0 deletions shared-bindings/adafruit_bus_device/SPIDevice.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
//|
//| """
//| Represents a single SPI device and manages locking the bus and the device address.
//|
//| :param ~busio.SPI spi: The SPI bus the device is on
//| :param ~digitalio.DigitalInOut chip_select: The chip select pin object that implements the DigitalInOut API.
//| :param int extra_clocks: The minimum number of clock cycles to cycle the bus after CS is high. (Used for SD cards.)
Expand Down
11 changes: 6 additions & 5 deletions shared-bindings/busio/I2C.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
//| lines respectively.
//|
//| .. seealso:: Using this class directly requires careful lock management.
//| Instead, use :class:`~adafruit_bus_device.i2c_device.I2CDevice` to
//| Instead, use :class:`~adafruit_bus_device.I2CDevice` to
//| manage locks.
//|
//| .. seealso:: Using this class to directly read registers requires manual
Expand All @@ -56,7 +56,8 @@
//| :param ~microcontroller.Pin scl: The clock pin
//| :param ~microcontroller.Pin sda: The data pin
//| :param int frequency: The clock frequency in Hertz
//| :param int timeout: The maximum clock stretching timeut - (used only for bitbangio.I2C; ignored for busio.I2C)
//| :param int timeout: The maximum clock stretching timeut - (used only for
//| :class:`bitbangio.I2C`; ignored for :class:`busio.I2C`)
//|
//| .. note:: On the nRF52840, only one I2C object may be created,
//| except on the Circuit Playground Bluefruit, which allows two,
Expand Down Expand Up @@ -239,7 +240,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_in
//| to poll for the existence of a device.
//|
//| :param int address: 7-bit device address
//| :param ~_typing.ReadbleBuffer buffer: buffer containing the bytes to write
//| :param ~_typing.ReadableBuffer buffer: buffer containing the bytes to write
//| :param int start: Index to start writing from
//| :param int end: Index to read up to but not include. Defaults to ``len(buffer)``"""
//| ...
Expand Down Expand Up @@ -286,12 +287,12 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto);
//| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and
//| ``in_buffer`` can be the same buffer because they are used sequentially.
//|
//| if ``start`` or ``end`` is provided, then the corresponding buffer will be sliced
//| If ``start`` or ``end`` is provided, then the corresponding buffer will be sliced
//| as if ``buffer[start:end]``. This will not cause an allocation like ``buf[start:end]``
//| will so it saves memory.
//|
//| :param int address: 7-bit device address
//| :param ~_typing.ReadbleBuffer out_buffer: buffer containing the bytes to write
//| :param ~_typing.ReadableBuffer out_buffer: buffer containing the bytes to write
//| :param ~_typing.WriteableBuffer in_buffer: buffer to write into
//| :param int out_start: Index to start writing from
//| :param int out_end: Index to read up to but not include. Defaults to ``len(buffer)``
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/busio/SPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
//| peripherals.
//|
//| .. seealso:: Using this class directly requires careful lock management.
//| Instead, use :class:`~adafruit_bus_device.spi_device.SPIDevice` to
//| Instead, use :class:`~adafruit_bus_device.SPIDevice` to
//| manage locks.
//|
//| .. seealso:: Using this class to directly read registers requires manual
Expand Down