Skip to content

Commit de38e40

Browse files
committed
ports/raspberrypi/bindings: apply black_bindings.py
1 parent a958a32 commit de38e40

File tree

1 file changed

+74
-43
lines changed

1 file changed

+74
-43
lines changed

ports/raspberrypi/bindings/rp2pio/StateMachine.c

Lines changed: 74 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -57,42 +57,43 @@
5757
//| in either PIO. State machines with the same program will be placed in the
5858
//| same PIO if possible."""
5959
//|
60-
//| def __init__(self,
61-
//| program: ReadableBuffer,
62-
//| frequency: int,
63-
//| *,
64-
//| init: Optional[ReadableBuffer] = None,
65-
//| first_out_pin: Optional[microcontroller.Pin] = None,
66-
//| out_pin_count: int = 1,
67-
//| initial_out_pin_state: int = 0,
68-
//| initial_out_pin_direction: int = 0xffffffff,
69-
//| first_in_pin: Optional[microcontroller.Pin] = None,
70-
//| in_pin_count: int = 1,
71-
//| pull_in_pin_up: int = 0,
72-
//| pull_in_pin_down: int = 0,
73-
//| first_set_pin: Optional[microcontroller.Pin] = None,
74-
//| set_pin_count: int = 1,
75-
//| initial_set_pin_state: int = 0,
76-
//| initial_set_pin_direction: int = 0x1f,
77-
//| first_sideset_pin: Optional[microcontroller.Pin] = None,
78-
//| sideset_pin_count: int = 1,
79-
//| initial_sideset_pin_state: int = 0,
80-
//| initial_sideset_pin_direction: int = 0x1f,
81-
//| sideset_enable: bool = False,
82-
//| jmp_pin: Optional[microcontroller.Pin] = None,
83-
//| jmp_pin_pull: Optional[digitalio.Pull] = None,
84-
//| exclusive_pin_use: bool = True,
85-
//| auto_pull: bool = False,
86-
//| pull_threshold: int = 32,
87-
//| out_shift_right: bool = True,
88-
//| wait_for_txstall: bool = True,
89-
//| auto_push: bool = False,
90-
//| push_threshold: int = 32,
91-
//| in_shift_right: bool = True,
92-
//| user_interruptible: bool = True,
93-
//| wrap_target: int = 0,
94-
//| wrap: int = -1,
95-
//| ) -> None:
60+
//| def __init__(
61+
//| self,
62+
//| program: ReadableBuffer,
63+
//| frequency: int,
64+
//| *,
65+
//| init: Optional[ReadableBuffer] = None,
66+
//| first_out_pin: Optional[microcontroller.Pin] = None,
67+
//| out_pin_count: int = 1,
68+
//| initial_out_pin_state: int = 0,
69+
//| initial_out_pin_direction: int = 0xFFFFFFFF,
70+
//| first_in_pin: Optional[microcontroller.Pin] = None,
71+
//| in_pin_count: int = 1,
72+
//| pull_in_pin_up: int = 0,
73+
//| pull_in_pin_down: int = 0,
74+
//| first_set_pin: Optional[microcontroller.Pin] = None,
75+
//| set_pin_count: int = 1,
76+
//| initial_set_pin_state: int = 0,
77+
//| initial_set_pin_direction: int = 0x1F,
78+
//| first_sideset_pin: Optional[microcontroller.Pin] = None,
79+
//| sideset_pin_count: int = 1,
80+
//| initial_sideset_pin_state: int = 0,
81+
//| initial_sideset_pin_direction: int = 0x1F,
82+
//| sideset_enable: bool = False,
83+
//| jmp_pin: Optional[microcontroller.Pin] = None,
84+
//| jmp_pin_pull: Optional[digitalio.Pull] = None,
85+
//| exclusive_pin_use: bool = True,
86+
//| auto_pull: bool = False,
87+
//| pull_threshold: int = 32,
88+
//| out_shift_right: bool = True,
89+
//| wait_for_txstall: bool = True,
90+
//| auto_push: bool = False,
91+
//| push_threshold: int = 32,
92+
//| in_shift_right: bool = True,
93+
//| user_interruptible: bool = True,
94+
//| wrap_target: int = 0,
95+
//| wrap: int = -1,
96+
//| ) -> None:
9697
//|
9798
//| """Construct a StateMachine object on the given pins with the given program.
9899
//|
@@ -314,6 +315,7 @@ STATIC void check_for_deinit(rp2pio_statemachine_obj_t *self) {
314315
//| def restart(self) -> None:
315316
//| """Resets this state machine, runs any init and enables the clock."""
316317
//| ...
318+
//|
317319
// TODO: "and any others given. They must share an underlying PIO. An exception will be raised otherwise.""
318320
STATIC mp_obj_t rp2pio_statemachine_restart(mp_obj_t self_obj) {
319321
rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_obj);
@@ -327,10 +329,10 @@ MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_restart_obj, rp2pio_statemachine_r
327329

328330
//| def run(self, instructions: ReadableBuffer) -> None:
329331
//| """Runs all given instructions. They will likely be interleaved with
330-
//| in-memory instructions. Make sure this doesn't wait for input!
332+
//| in-memory instructions. Make sure this doesn't wait for input!
331333
//|
332-
//| This can be used to output internal state to the RX FIFO and then
333-
//| read with `readinto`."""
334+
//| This can be used to output internal state to the RX FIFO and then
335+
//| read with `readinto`."""
334336
//| ...
335337
//|
336338
STATIC mp_obj_t rp2pio_statemachine_run(mp_obj_t self_obj, mp_obj_t instruction_obj) {
@@ -358,7 +360,14 @@ STATIC mp_obj_t rp2pio_statemachine_stop(mp_obj_t self_obj) {
358360
}
359361
MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_stop_obj, rp2pio_statemachine_stop);
360362

361-
//| def write(self, buffer: ReadableBuffer, *, start: int = 0, end: Optional[int] = None, swap: bool = False) -> None:
363+
//| def write(
364+
//| self,
365+
//| buffer: ReadableBuffer,
366+
//| *,
367+
//| start: int = 0,
368+
//| end: Optional[int] = None,
369+
//| swap: bool = False
370+
//| ) -> None:
362371
//| """Write the data contained in ``buffer`` to the state machine. If the buffer is empty, nothing happens.
363372
//|
364373
//| Writes to the FIFO will match the input buffer's element size. For example, bytearray elements
@@ -413,7 +422,13 @@ STATIC mp_obj_t rp2pio_statemachine_write(size_t n_args, const mp_obj_t *pos_arg
413422
}
414423
MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_write_obj, 2, rp2pio_statemachine_write);
415424

416-
//| def background_write(self, once: Optional[ReadableBuffer]=None, *, loop: Optional[ReadableBuffer]=None, swap: bool=False) -> None:
425+
//| def background_write(
426+
//| self,
427+
//| once: Optional[ReadableBuffer] = None,
428+
//| *,
429+
//| loop: Optional[ReadableBuffer] = None,
430+
//| swap: bool = False
431+
//| ) -> None:
417432
//| """Write data to the TX fifo in the background, with optional looping.
418433
//|
419434
//| First, if any previous ``once`` or ``loop`` buffer has not been started, this function blocks until they have.
@@ -555,7 +570,14 @@ const mp_obj_property_t rp2pio_statemachine_pending_obj = {
555570
MP_ROM_NONE},
556571
};
557572

558-
//| def readinto(self, buffer: WriteableBuffer, *, start: int = 0, end: Optional[int] = None, swap: bool=False) -> None:
573+
//| def readinto(
574+
//| self,
575+
//| buffer: WriteableBuffer,
576+
//| *,
577+
//| start: int = 0,
578+
//| end: Optional[int] = None,
579+
//| swap: bool = False
580+
//| ) -> None:
559581
//| """Read into ``buffer``. If the number of bytes to read is 0, nothing happens. The buffer
560582
//| includes any data added to the fifo even if it was added before this was called.
561583
//|
@@ -611,7 +633,16 @@ STATIC mp_obj_t rp2pio_statemachine_readinto(size_t n_args, const mp_obj_t *pos_
611633
}
612634
MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_readinto_obj, 2, rp2pio_statemachine_readinto);
613635

614-
//| def write_readinto(self, buffer_out: ReadableBuffer, buffer_in: WriteableBuffer, *, out_start: int = 0, out_end: Optional[int] = None, in_start: int = 0, in_end: Optional[int] = None) -> None:
636+
//| def write_readinto(
637+
//| self,
638+
//| buffer_out: ReadableBuffer,
639+
//| buffer_in: WriteableBuffer,
640+
//| *,
641+
//| out_start: int = 0,
642+
//| out_end: Optional[int] = None,
643+
//| in_start: int = 0,
644+
//| in_end: Optional[int] = None
645+
//| ) -> None:
615646
//| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``.
616647
//| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]``
617648
//| may be different. The function will return once both are filled.

0 commit comments

Comments
 (0)