Skip to content

Commit 855c203

Browse files
committed
Reogranized pyi in spi.c
1 parent a18b991 commit 855c203

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

  • shared-bindings/busio

shared-bindings/busio/SPI.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,6 @@
4040
#include "py/runtime.h"
4141
#include "supervisor/shared/translate.h"
4242

43-
class SPI:
44-
def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None): ...
45-
def deinit(self, ) -> Any: ...
46-
def __enter__(self, ) -> Any: ...
47-
def __exit__(self, ) -> Any: ...
48-
def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> Any: ...
49-
def try_lock(self, ) -> Any: ...
50-
def unlock(self, ) -> Any: ...
51-
def write(self, buffer: bytearray, *, start: Any = 0, end: int = None) -> Any: ...
52-
def readinto(self, buffer: bytearray, *, start: Any = 0, end: int = None, write_value: int = 0) -> Any: ...
53-
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: ...
54-
frequency: Any = ...
5543

5644
//| .. currentmodule:: busio
5745
//|
@@ -89,6 +77,8 @@ class SPI:
8977
//| :param ~microcontroller.Pin MOSI: the Master Out Slave In pin.
9078
//| :param ~microcontroller.Pin MISO: the Master In Slave Out pin.
9179
//|
80+
// class SPI:
81+
// def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None): ...
9282

9383
// TODO(tannewt): Support LSB SPI.
9484
STATIC mp_obj_t busio_spi_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
@@ -115,6 +105,7 @@ STATIC mp_obj_t busio_spi_make_new(const mp_obj_type_t *type, size_t n_args, con
115105
//|
116106
//| Turn off the SPI bus.
117107
//|
108+
// def deinit(self, ) -> Any: ...
118109
STATIC mp_obj_t busio_spi_obj_deinit(mp_obj_t self_in) {
119110
busio_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
120111
common_hal_busio_spi_deinit(self);
@@ -127,12 +118,14 @@ MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_deinit_obj, busio_spi_obj_deinit);
127118
//| No-op used by Context Managers.
128119
//|
129120
// Provided by context manager helper.
121+
// def __enter__(self, ) -> Any: ...
130122

131123
//| .. method:: __exit__()
132124
//|
133125
//| Automatically deinitializes the hardware when exiting a context. See
134126
//| :ref:`lifetime-and-contextmanagers` for more info.
135127
//|
128+
// def __exit__(self, ) -> Any: ...
136129
STATIC mp_obj_t busio_spi_obj___exit__(size_t n_args, const mp_obj_t *args) {
137130
(void)n_args;
138131
common_hal_busio_spi_deinit(args[0]);
@@ -176,6 +169,7 @@ STATIC void check_for_deinit(busio_spi_obj_t *self) {
176169
//| Two SPI objects may be created, except on the Circuit Playground Bluefruit,
177170
//| which allows only one (to allow for an additional I2C object).
178171
//|
172+
// def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> Any: ...
179173
STATIC mp_obj_t busio_spi_configure(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
180174
enum { ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits };
181175
static const mp_arg_t allowed_args[] = {
@@ -218,6 +212,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_configure_obj, 1, busio_spi_configure);
218212
//| :return: True when lock has been grabbed
219213
//| :rtype: bool
220214
//|
215+
// def try_lock(self, ) -> Any: ...
221216
STATIC mp_obj_t busio_spi_obj_try_lock(mp_obj_t self_in) {
222217
busio_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
223218
return mp_obj_new_bool(common_hal_busio_spi_try_lock(self));
@@ -228,6 +223,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_try_lock_obj, busio_spi_obj_try_lock);
228223
//|
229224
//| Releases the SPI lock.
230225
//|
226+
// def unlock(self, ) -> Any: ...
231227
STATIC mp_obj_t busio_spi_obj_unlock(mp_obj_t self_in) {
232228
busio_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
233229
check_for_deinit(self);
@@ -245,6 +241,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_unlock_obj, busio_spi_obj_unlock);
245241
//| :param int start: Start of the slice of ``buffer`` to write out: ``buffer[start:end]``
246242
//| :param int end: End of the slice; this index is not included. Defaults to ``len(buffer)``
247243
//|
244+
// def write(self, buffer: bytearray, *, start: Any = 0, end: int = None) -> Any: ...
248245
STATIC mp_obj_t busio_spi_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
249246
enum { ARG_buffer, ARG_start, ARG_end };
250247
static const mp_arg_t allowed_args[] = {
@@ -288,6 +285,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_obj, 2, busio_spi_write);
288285
//| :param int end: End of the slice; this index is not included. Defaults to ``len(buffer)``
289286
//| :param int write_value: Value to write while reading. (Usually ignored.)
290287
//|
288+
// def readinto(self, buffer: bytearray, *, start: Any = 0, end: int = None, write_value: int = 0) -> Any: ...
291289
STATIC mp_obj_t busio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
292290
enum { ARG_buffer, ARG_start, ARG_end, ARG_write_value };
293291
static const mp_arg_t allowed_args[] = {
@@ -335,6 +333,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_readinto_obj, 2, busio_spi_readinto);
335333
//| :param int in_start: Start of the slice of ``buffer_in`` to read into: ``buffer_in[in_start:in_end]``
336334
//| :param int in_end: End of the slice; this index is not included. Defaults to ``len(buffer_in)``
337335
//|
336+
// 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: ...
338337
STATIC mp_obj_t busio_spi_write_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
339338
enum { ARG_buffer_out, ARG_buffer_in, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end };
340339
static const mp_arg_t allowed_args[] = {
@@ -387,6 +386,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_readinto_obj, 2, busio_spi_write_read
387386
//| The actual SPI bus frequency. This may not match the frequency requested
388387
//| due to internal limitations.
389388
//|
389+
// frequency: Any = ...
390390
STATIC mp_obj_t busio_spi_obj_get_frequency(mp_obj_t self_in) {
391391
busio_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
392392
check_for_deinit(self);

0 commit comments

Comments
 (0)