Skip to content

Commit 93d1e53

Browse files
committed
Hopefully fixed whitespace issues
1 parent 8cdc67a commit 93d1e53

File tree

2 files changed

+102
-102
lines changed

2 files changed

+102
-102
lines changed

shared-bindings/busio/SPI.c

Lines changed: 100 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -41,43 +41,43 @@
4141
#include "supervisor/shared/translate.h"
4242

4343

44-
//|class SPI:
45-
//|""".. currentmodule:: busio
44+
//| class SPI:
45+
//| """.. currentmodule:: busio
4646
//|
47-
//|`SPI` -- a 3-4 wire serial protocol
48-
//|-----------------------------------------------
47+
//| `SPI` -- a 3-4 wire serial protocol
48+
//| -----------------------------------------------
4949
//|
50-
//|SPI is a serial protocol that has exclusive pins for data in and out of the
51-
//|master. It is typically faster than :py:class:`~busio.I2C` because a
52-
//|separate pin is used to control the active slave rather than a transitted
53-
//|address. This class only manages three of the four SPI lines: `!clock`,
54-
//|`!MOSI`, `!MISO`. Its up to the client to manage the appropriate slave
55-
//|select line. (This is common because multiple slaves can share the `!clock`,
56-
//|`!MOSI` and `!MISO` lines and therefore the hardware.)"""
50+
//| SPI is a serial protocol that has exclusive pins for data in and out of the
51+
//| master. It is typically faster than :py:class:`~busio.I2C` because a
52+
//| separate pin is used to control the active slave rather than a transitted
53+
//| address. This class only manages three of the four SPI lines: `!clock`,
54+
//| `!MOSI`, `!MISO`. Its up to the client to manage the appropriate slave
55+
//| select line. (This is common because multiple slaves can share the `!clock`,
56+
//| `!MOSI` and `!MISO` lines and therefore the hardware.)"""
5757
//|
58-
//|def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None):
58+
//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None):
5959
//|
60-
//|"""Construct an SPI object on the given pins.
60+
//| """Construct an SPI object on the given pins.
6161
//|
62-
//|..note:: The SPI peripherals allocated in order of desirability, if possible,
63-
//|such as highest speed and not shared use first. For instance, on the nRF52840,
64-
//|there is a single 32MHz SPI peripheral, and multiple 8MHz peripherals,
65-
//|some of which may also be used for I2C. The 32MHz SPI peripheral is returned
66-
//|first, then the exclusive 8MHz SPI peripheral, and finally the shared 8MHz
67-
//|peripherals.
62+
//| ..note:: The SPI peripherals allocated in order of desirability, if possible,
63+
//| such as highest speed and not shared use first. For instance, on the nRF52840,
64+
//| there is a single 32MHz SPI peripheral, and multiple 8MHz peripherals,
65+
//| some of which may also be used for I2C. The 32MHz SPI peripheral is returned
66+
//| first, then the exclusive 8MHz SPI peripheral, and finally the shared 8MHz
67+
//| peripherals.
6868
//|
69-
//|.. seealso:: Using this class directly requires careful lock management.
70-
//|Instead, use :class:`~adafruit_bus_device.spi_device.SPIDevice` to
71-
//|manage locks.
69+
//| .. seealso:: Using this class directly requires careful lock management.
70+
//| Instead, use :class:`~adafruit_bus_device.spi_device.SPIDevice` to
71+
//| manage locks.
7272
//|
73-
//|.. seealso:: Using this class to directly read registers requires manual
74-
//|bit unpacking. Instead, use an existing driver or make one with
75-
//|:ref:`Register <register-module-reference>` data descriptors.
73+
//| .. seealso:: Using this class to directly read registers requires manual
74+
//| bit unpacking. Instead, use an existing driver or make one with
75+
//| :ref:`Register <register-module-reference>` data descriptors.
7676
//|
77-
//|:param ~microcontroller.Pin clock: the pin to use for the clock.
78-
//|:param ~microcontroller.Pin MOSI: the Master Out Slave In pin.
79-
//|:param ~microcontroller.Pin MISO: the Master In Slave Out pin."""
80-
//|...
77+
//| :param ~microcontroller.Pin clock: the pin to use for the clock.
78+
//| :param ~microcontroller.Pin MOSI: the Master Out Slave In pin.
79+
//| :param ~microcontroller.Pin MISO: the Master In Slave Out pin."""
80+
//| ...
8181

8282

8383
// TODO(tannewt): Support LSB SPI.
@@ -101,25 +101,25 @@ STATIC mp_obj_t busio_spi_make_new(const mp_obj_type_t *type, size_t n_args, con
101101
return MP_OBJ_FROM_PTR(self);
102102
}
103103

104-
//|def deinit(self, ) -> Any:
105-
//|"""Turn off the SPI bus."""
106-
//|...
104+
//| def deinit(self, ) -> Any:
105+
//| """Turn off the SPI bus."""
106+
//| ...
107107
STATIC mp_obj_t busio_spi_obj_deinit(mp_obj_t self_in) {
108108
busio_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
109109
common_hal_busio_spi_deinit(self);
110110
return mp_const_none;
111111
}
112112
MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_deinit_obj, busio_spi_obj_deinit);
113113

114-
//|def __enter__(self, ) -> Any:
115-
//|"""No-op used by Context Managers.
116-
//|Provided by context manager helper."""
117-
//|...
114+
//| def __enter__(self, ) -> Any:
115+
//| """No-op used by Context Managers.
116+
//| Provided by context manager helper."""
117+
//| ...
118118

119-
//|def __exit__(self, ) -> Any:
120-
//|"""Automatically deinitializes the hardware when exiting a context. See
121-
//|:ref:`lifetime-and-contextmanagers` for more info."""
122-
//|...
119+
//| def __exit__(self, ) -> Any:
120+
//| """Automatically deinitializes the hardware when exiting a context. See
121+
//| :ref:`lifetime-and-contextmanagers` for more info."""
122+
//| ...
123123
STATIC mp_obj_t busio_spi_obj___exit__(size_t n_args, const mp_obj_t *args) {
124124
(void)n_args;
125125
common_hal_busio_spi_deinit(args[0]);
@@ -140,28 +140,28 @@ STATIC void check_for_deinit(busio_spi_obj_t *self) {
140140
}
141141
}
142142

143-
//|def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> Any:
144-
//|"""Configures the SPI bus. The SPI object must be locked.
143+
//| def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> Any:
144+
//| """Configures the SPI bus. The SPI object must be locked.
145145
//|
146-
//|:param int baudrate: the desired clock rate in Hertz. The actual clock rate may be higher or lower
147-
//|due to the granularity of available clock settings.
148-
//|Check the `frequency` attribute for the actual clock rate.
149-
//|:param int polarity: the base state of the clock line (0 or 1)
150-
//|:param int phase: the edge of the clock that data is captured. First (0)
151-
//|or second (1). Rising or falling depends on clock polarity.
152-
//|:param int bits: the number of bits per word
146+
//| :param int baudrate: the desired clock rate in Hertz. The actual clock rate may be higher or lower
147+
//| due to the granularity of available clock settings.
148+
//| Check the `frequency` attribute for the actual clock rate.
149+
//| :param int polarity: the base state of the clock line (0 or 1)
150+
//| :param int phase: the edge of the clock that data is captured. First (0)
151+
//| or second (1). Rising or falling depends on clock polarity.
152+
//| :param int bits: the number of bits per word
153153
//|
154-
//|.. note:: On the SAMD21, it is possible to set the baudrate to 24 MHz, but that
155-
//|speed is not guaranteed to work. 12 MHz is the next available lower speed, and is
156-
//|within spec for the SAMD21.
154+
//| .. note:: On the SAMD21, it is possible to set the baudrate to 24 MHz, but that
155+
//| speed is not guaranteed to work. 12 MHz is the next available lower speed, and is
156+
//| within spec for the SAMD21.
157157
//|
158-
//|.. note:: On the nRF52840, these baudrates are available: 125kHz, 250kHz, 1MHz, 2MHz, 4MHz,
159-
//|and 8MHz.
160-
//|If you pick a a baudrate other than one of these, the nearest lower
161-
//|baudrate will be chosen, with a minimum of 125kHz.
162-
//|Two SPI objects may be created, except on the Circuit Playground Bluefruit,
163-
//|which allows only one (to allow for an additional I2C object)."""
164-
//|...
158+
//| .. note:: On the nRF52840, these baudrates are available: 125kHz, 250kHz, 1MHz, 2MHz, 4MHz,
159+
//| and 8MHz.
160+
//| If you pick a a baudrate other than one of these, the nearest lower
161+
//| baudrate will be chosen, with a minimum of 125kHz.
162+
//| Two SPI objects may be created, except on the Circuit Playground Bluefruit,
163+
//| which allows only one (to allow for an additional I2C object)."""
164+
//| ...
165165

166166
STATIC mp_obj_t busio_spi_configure(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
167167
enum { ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits };
@@ -198,22 +198,22 @@ STATIC mp_obj_t busio_spi_configure(size_t n_args, const mp_obj_t *pos_args, mp_
198198
}
199199
MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_configure_obj, 1, busio_spi_configure);
200200

201-
//|def try_lock(self, ) -> Any:
202-
//|"""Attempts to grab the SPI lock. Returns True on success.
201+
//| def try_lock(self, ) -> Any:
202+
//| """Attempts to grab the SPI lock. Returns True on success.
203203
//|
204-
//|:return: True when lock has been grabbed
205-
//|:rtype: bool"""
206-
//|...
204+
//| :return: True when lock has been grabbed
205+
//| :rtype: bool"""
206+
//| ...
207207

208208
STATIC mp_obj_t busio_spi_obj_try_lock(mp_obj_t self_in) {
209209
busio_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
210210
return mp_obj_new_bool(common_hal_busio_spi_try_lock(self));
211211
}
212212
MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_try_lock_obj, busio_spi_obj_try_lock);
213213

214-
//|unlock(self, ) -> Any:
215-
//|"""Releases the SPI lock."""
216-
//|...
214+
//| def unlock(self, ) -> Any:
215+
//| """Releases the SPI lock."""
216+
//| ...
217217

218218
STATIC mp_obj_t busio_spi_obj_unlock(mp_obj_t self_in) {
219219
busio_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -223,14 +223,14 @@ STATIC mp_obj_t busio_spi_obj_unlock(mp_obj_t self_in) {
223223
}
224224
MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_unlock_obj, busio_spi_obj_unlock);
225225

226-
//|def write(self, buffer: bytearray, *, start: Any = 0, end: int = None) -> Any: ...
227-
//|"""Write the data contained in ``buffer``. The SPI object must be locked.
228-
//|If the buffer is empty, nothing happens.
226+
//| def write(self, buffer: bytearray, *, start: Any = 0, end: int = None) -> Any:
227+
//| """Write the data contained in ``buffer``. The SPI object must be locked.
228+
//| If the buffer is empty, nothing happens.
229229
//|
230-
//|:param bytearray buffer: Write out the data in this buffer
231-
//|:param int start: Start of the slice of ``buffer`` to write out: ``buffer[start:end]``
232-
//|:param int end: End of the slice; this index is not included. Defaults to ``len(buffer)``"""
233-
//|...
230+
//| :param bytearray buffer: Write out the data in this buffer
231+
//| :param int start: Start of the slice of ``buffer`` to write out: ``buffer[start:end]``
232+
//| :param int end: End of the slice; this index is not included. Defaults to ``len(buffer)``"""
233+
//| ...
234234

235235
STATIC mp_obj_t busio_spi_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
236236
enum { ARG_buffer, ARG_start, ARG_end };
@@ -264,16 +264,16 @@ STATIC mp_obj_t busio_spi_write(size_t n_args, const mp_obj_t *pos_args, mp_map_
264264
MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_obj, 2, busio_spi_write);
265265

266266

267-
//|def readinto(self, buffer: bytearray, *, start: Any = 0, end: int = None, write_value: int = 0) -> Any:
268-
//|"""Read into ``buffer`` while writing ``write_value`` for each byte read.
269-
//|The SPI object must be locked.
270-
//|If the number of bytes to read is 0, nothing happens.
267+
//| def readinto(self, buffer: bytearray, *, start: Any = 0, end: int = None, write_value: int = 0) -> Any:
268+
//| """Read into ``buffer`` while writing ``write_value`` for each byte read.
269+
//| The SPI object must be locked.
270+
//| If the number of bytes to read is 0, nothing happens.
271271
//|
272-
//|:param bytearray buffer: Read data into this buffer
273-
//|:param int start: Start of the slice of ``buffer`` to read into: ``buffer[start:end]``
274-
//|:param int end: End of the slice; this index is not included. Defaults to ``len(buffer)``
275-
//|:param int write_value: Value to write while reading. (Usually ignored.)"""
276-
//|...
272+
//| :param bytearray buffer: Read data into this buffer
273+
//| :param int start: Start of the slice of ``buffer`` to read into: ``buffer[start:end]``
274+
//| :param int end: End of the slice; this index is not included. Defaults to ``len(buffer)``
275+
//| :param int write_value: Value to write while reading. (Usually ignored.)"""
276+
//| ...
277277

278278
STATIC mp_obj_t busio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
279279
enum { ARG_buffer, ARG_start, ARG_end, ARG_write_value };
@@ -307,20 +307,20 @@ STATIC mp_obj_t busio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_m
307307
}
308308
MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_readinto_obj, 2, busio_spi_readinto);
309309

310-
//|def write_readinto(self, buffer_out: bytearray, buffer_in: bytearray, *, out_start: Any = 0, out_end: int = None, in_start: Any = 0, in_end: int = None) -> Any:
311-
//|"""Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``.
312-
//|The SPI object must be locked.
313-
//|The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]``
314-
//|must be equal.
315-
//|If buffer slice lengths are both 0, nothing happens.
310+
//| def write_readinto(self, buffer_out: bytearray, buffer_in: bytearray, *, out_start: Any = 0, out_end: int = None, in_start: Any = 0, in_end: int = None) -> Any:
311+
//| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``.
312+
//| The SPI object must be locked.
313+
//| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]``
314+
//| must be equal.
315+
//| If buffer slice lengths are both 0, nothing happens.
316316
//|
317-
//|:param bytearray buffer_out: Write out the data in this buffer
318-
//|:param bytearray buffer_in: Read data into this buffer
319-
//|:param int out_start: Start of the slice of buffer_out to write out: ``buffer_out[out_start:out_end]``
320-
//|:param int out_end: End of the slice; this index is not included. Defaults to ``len(buffer_out)``
321-
//|:param int in_start: Start of the slice of ``buffer_in`` to read into: ``buffer_in[in_start:in_end]``
322-
//|:param int in_end: End of the slice; this index is not included. Defaults to ``len(buffer_in)``"""
323-
//|...
317+
//| :param bytearray buffer_out: Write out the data in this buffer
318+
//| :param bytearray buffer_in: Read data into this buffer
319+
//| :param int out_start: Start of the slice of buffer_out to write out: ``buffer_out[out_start:out_end]``
320+
//| :param int out_end: End of the slice; this index is not included. Defaults to ``len(buffer_out)``
321+
//| :param int in_start: Start of the slice of ``buffer_in`` to read into: ``buffer_in[in_start:in_end]``
322+
//| :param int in_end: End of the slice; this index is not included. Defaults to ``len(buffer_in)``"""
323+
//| ...
324324

325325
STATIC mp_obj_t busio_spi_write_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
326326
enum { ARG_buffer_out, ARG_buffer_in, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end };
@@ -369,10 +369,10 @@ STATIC mp_obj_t busio_spi_write_readinto(size_t n_args, const mp_obj_t *pos_args
369369
}
370370
MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_readinto_obj, 2, busio_spi_write_readinto);
371371

372-
//|frequency: Any =
373-
//|"""The actual SPI bus frequency. This may not match the frequency requested
374-
//|due to internal limitations."""
375-
//|...
372+
//| frequency: Any = ...
373+
//| """The actual SPI bus frequency. This may not match the frequency requested
374+
//| due to internal limitations."""
375+
//|
376376

377377
STATIC mp_obj_t busio_spi_obj_get_frequency(mp_obj_t self_in) {
378378
busio_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);

shared-bindings/busio/__init__.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
#include "py/runtime.h"
4040

41-
//| :mod:`busio` --- Hardware accelerated behavior
41+
//| """:mod:`busio` --- Hardware accelerated behavior
4242
//| =================================================
4343
//|
4444
//| .. module:: busio
@@ -81,7 +81,7 @@
8181
//| This example will initialize the the device, run
8282
//| :py:meth:`~busio.I2C.scan` and then :py:meth:`~busio.I2C.deinit` the
8383
//| hardware. The last step is optional because CircuitPython automatically
84-
//| resets hardware after a program finishes.
84+
//| resets hardware after a program finishes."""
8585
//|
8686

8787
STATIC const mp_rom_map_elem_t busio_module_globals_table[] = {

0 commit comments

Comments
 (0)