Skip to content

Commit 5f4f667

Browse files
authored
Merge pull request #6360 from jepler/statemachine-improvements
Statemachine improvements
2 parents c1cc9b8 + 561ed37 commit 5f4f667

File tree

10 files changed

+128
-42
lines changed

10 files changed

+128
-42
lines changed

locale/circuitpython.pot

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,6 +1540,10 @@ msgstr ""
15401540
msgid "Mismatched data size"
15411541
msgstr ""
15421542

1543+
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
1544+
msgid "Mismatched swap flag"
1545+
msgstr ""
1546+
15431547
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
15441548
msgid "Missing MISO or MOSI Pin"
15451549
msgstr ""
@@ -2033,7 +2037,7 @@ msgstr ""
20332037
msgid "RNG Init Error"
20342038
msgstr ""
20352039

2036-
#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c
2040+
#: ports/nrf/common-hal/busio/UART.c
20372041
msgid "RS485 Not yet supported on this device"
20382042
msgstr ""
20392043

ports/raspberrypi/bindings/rp2pio/StateMachine.c

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ STATIC mp_obj_t rp2pio_statemachine_stop(mp_obj_t self_obj) {
378378
}
379379
MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_stop_obj, rp2pio_statemachine_stop);
380380

381-
//| def write(self, buffer: ReadableBuffer, *, start: int = 0, end: Optional[int] = None) -> None:
381+
//| def write(self, buffer: ReadableBuffer, *, start: int = 0, end: Optional[int] = None, swap: bool = False) -> None:
382382
//| """Write the data contained in ``buffer`` to the state machine. If the buffer is empty, nothing happens.
383383
//|
384384
//| Writes to the FIFO will match the input buffer's element size. For example, bytearray elements
@@ -390,15 +390,17 @@ MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_stop_obj, rp2pio_statemachine_stop
390390
//|
391391
//| :param ~circuitpython_typing.ReadableBuffer buffer: Write out the data in this buffer
392392
//| :param int start: Start of the slice of ``buffer`` to write out: ``buffer[start:end]``
393-
//| :param int end: End of the slice; this index is not included. Defaults to ``len(buffer)``"""
393+
//| :param int end: End of the slice; this index is not included. Defaults to ``len(buffer)``
394+
//| :param bool swap: For 2- and 4-byte elements, swap (reverse) the byte order"""
394395
//| ...
395396
//|
396397
STATIC mp_obj_t rp2pio_statemachine_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
397-
enum { ARG_buffer, ARG_start, ARG_end };
398+
enum { ARG_buffer, ARG_start, ARG_end, ARG_swap };
398399
static const mp_arg_t allowed_args[] = {
399400
{ MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
400401
{ MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
401402
{ MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} },
403+
{ MP_QSTR_swap, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
402404
};
403405
rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
404406
check_for_deinit(self);
@@ -420,7 +422,7 @@ STATIC mp_obj_t rp2pio_statemachine_write(size_t n_args, const mp_obj_t *pos_arg
420422
mp_raise_ValueError(translate("Buffer elements must be 4 bytes long or less"));
421423
}
422424

423-
bool ok = common_hal_rp2pio_statemachine_write(self, ((uint8_t *)bufinfo.buf) + start, length, stride_in_bytes);
425+
bool ok = common_hal_rp2pio_statemachine_write(self, ((uint8_t *)bufinfo.buf) + start, length, stride_in_bytes, args[ARG_swap].u_bool);
424426
if (mp_hal_is_interrupted()) {
425427
return mp_const_none;
426428
}
@@ -431,7 +433,7 @@ STATIC mp_obj_t rp2pio_statemachine_write(size_t n_args, const mp_obj_t *pos_arg
431433
}
432434
MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_write_obj, 2, rp2pio_statemachine_write);
433435

434-
//| def background_write(self, once: Optional[ReadableBuffer]=None, *, loop: Optional[ReadableBuffer]=None) -> None:
436+
//| def background_write(self, once: Optional[ReadableBuffer]=None, *, loop: Optional[ReadableBuffer]=None, swap: bool=False) -> None:
435437
//| """Write data to the TX fifo in the background, with optional looping.
436438
//|
437439
//| First, if any previous ``once`` or ``loop`` buffer has not been started, this function blocks until they have.
@@ -459,8 +461,13 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_write_obj, 2, rp2pio_statemachine
459461
//| where a change in duty cycle requires a special transitional buffer to be used exactly once. Most
460462
//| use cases will probably only use one of ``once`` or ``loop``.
461463
//|
464+
//| Having neither ``once`` nor ``loop`` terminates an existing
465+
//| background looping write after exactly a whole loop. This is in contrast to
466+
//| `stop_background_write`, which interrupts an ongoing DMA operation.
467+
//|
462468
//| :param ~Optional[circuitpython_typing.ReadableBuffer] once: Data to be written once
463469
//| :param ~Optional[circuitpython_typing.ReadableBuffer] loop: Data to be written repeatedly
470+
//| :param bool swap: For 2- and 4-byte elements, swap (reverse) the byte order
464471
//| """
465472
//| ...
466473
//|
@@ -483,10 +490,11 @@ STATIC void fill_buf_info(sm_buf_info *info, mp_obj_t obj, size_t *stride_in_byt
483490
}
484491

485492
STATIC mp_obj_t rp2pio_statemachine_background_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
486-
enum { ARG_once, ARG_loop };
493+
enum { ARG_once, ARG_loop, ARG_swap };
487494
static const mp_arg_t allowed_args[] = {
488495
{ MP_QSTR_once, MP_ARG_OBJ, {.u_obj = mp_const_none} },
489496
{ MP_QSTR_loop, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} },
497+
{ MP_QSTR_swap, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
490498
};
491499
rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
492500
check_for_deinit(self);
@@ -502,7 +510,7 @@ STATIC mp_obj_t rp2pio_statemachine_background_write(size_t n_args, const mp_obj
502510
return mp_const_none;
503511
}
504512

505-
bool ok = common_hal_rp2pio_statemachine_background_write(self, &once_info, &loop_info, stride_in_bytes);
513+
bool ok = common_hal_rp2pio_statemachine_background_write(self, &once_info, &loop_info, stride_in_bytes, args[ARG_swap].u_bool);
506514

507515
if (mp_hal_is_interrupted()) {
508516
return mp_const_none;
@@ -515,7 +523,9 @@ STATIC mp_obj_t rp2pio_statemachine_background_write(size_t n_args, const mp_obj
515523
MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_background_write_obj, 1, rp2pio_statemachine_background_write);
516524

517525
//| def stop_background_write(self) -> None:
518-
//| """Immediately stop a background write, if one is in progress. Items already in the TX FIFO are not affected."""
526+
//| """Immediately stop a background write, if one is in progress. Any
527+
//| DMA in progress is halted, but items already in the TX FIFO are not
528+
//| affected."""
519529
//|
520530
STATIC mp_obj_t rp2pio_statemachine_obj_stop_background_write(mp_obj_t self_in) {
521531
rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -567,7 +577,7 @@ const mp_obj_property_t rp2pio_statemachine_pending_obj = {
567577
MP_ROM_NONE},
568578
};
569579

570-
//| def readinto(self, buffer: WriteableBuffer, *, start: int = 0, end: Optional[int] = None) -> None:
580+
//| def readinto(self, buffer: WriteableBuffer, *, start: int = 0, end: Optional[int] = None, swap: bool=False) -> None:
571581
//| """Read into ``buffer``. If the number of bytes to read is 0, nothing happens. The buffer
572582
//| includes any data added to the fifo even if it was added before this was called.
573583
//|
@@ -581,16 +591,18 @@ const mp_obj_property_t rp2pio_statemachine_pending_obj = {
581591
//|
582592
//| :param ~circuitpython_typing.WriteableBuffer buffer: Read data into this buffer
583593
//| :param int start: Start of the slice of ``buffer`` to read into: ``buffer[start:end]``
584-
//| :param int end: End of the slice; this index is not included. Defaults to ``len(buffer)``"""
594+
//| :param int end: End of the slice; this index is not included. Defaults to ``len(buffer)``
595+
//| :param bool swap: For 2- and 4-byte elements, swap (reverse) the byte order"""
585596
//| ...
586597
//|
587598

588599
STATIC mp_obj_t rp2pio_statemachine_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
589-
enum { ARG_buffer, ARG_start, ARG_end };
600+
enum { ARG_buffer, ARG_start, ARG_end, ARG_swap };
590601
static const mp_arg_t allowed_args[] = {
591602
{ MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
592603
{ MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
593604
{ MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} },
605+
{ MP_QSTR_swap, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
594606
};
595607
rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
596608
check_for_deinit(self);
@@ -613,7 +625,7 @@ STATIC mp_obj_t rp2pio_statemachine_readinto(size_t n_args, const mp_obj_t *pos_
613625
mp_raise_ValueError(translate("Buffer elements must be 4 bytes long or less"));
614626
}
615627

616-
bool ok = common_hal_rp2pio_statemachine_readinto(self, ((uint8_t *)bufinfo.buf) + start, length, stride_in_bytes);
628+
bool ok = common_hal_rp2pio_statemachine_readinto(self, ((uint8_t *)bufinfo.buf) + start, length, stride_in_bytes, args[ARG_swap].u_bool);
617629
if (!ok) {
618630
mp_raise_OSError(MP_EIO);
619631
}
@@ -638,19 +650,23 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_readinto_obj, 2, rp2pio_statemach
638650
//| :param int out_start: Start of the slice of buffer_out to write out: ``buffer_out[out_start:out_end]``
639651
//| :param int out_end: End of the slice; this index is not included. Defaults to ``len(buffer_out)``
640652
//| :param int in_start: Start of the slice of ``buffer_in`` to read into: ``buffer_in[in_start:in_end]``
641-
//| :param int in_end: End of the slice; this index is not included. Defaults to ``len(buffer_in)``"""
653+
//| :param int in_end: End of the slice; this index is not included. Defaults to ``len(buffer_in)``
654+
//| :param bool swap_out: For 2- and 4-byte elements, swap (reverse) the byte order for the buffer being transmitted (written)
655+
//| :param bool swap_in: For 2- and 4-rx elements, swap (reverse) the byte order for the buffer being received (read)"""
642656
//| ...
643657
//|
644658

645659
STATIC mp_obj_t rp2pio_statemachine_write_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
646-
enum { ARG_buffer_out, ARG_buffer_in, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end };
660+
enum { ARG_buffer_out, ARG_buffer_in, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end, ARG_swap_out, ARG_swap_in };
647661
static const mp_arg_t allowed_args[] = {
648662
{ MP_QSTR_buffer_out, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
649663
{ MP_QSTR_buffer_in, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
650664
{ MP_QSTR_out_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
651665
{ MP_QSTR_out_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} },
652666
{ MP_QSTR_in_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
653667
{ MP_QSTR_in_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} },
668+
{ MP_QSTR_swap_out, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
669+
{ MP_QSTR_swap_in, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
654670
};
655671
rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
656672
check_for_deinit(self);
@@ -689,7 +705,7 @@ STATIC mp_obj_t rp2pio_statemachine_write_readinto(size_t n_args, const mp_obj_t
689705
out_stride_in_bytes,
690706
((uint8_t *)buf_in_info.buf) + in_start,
691707
in_length,
692-
in_stride_in_bytes);
708+
in_stride_in_bytes, args[ARG_swap_out].u_bool, args[ARG_swap_in].u_bool);
693709
if (!ok) {
694710
mp_raise_OSError(MP_EIO);
695711
}
@@ -708,6 +724,18 @@ STATIC mp_obj_t rp2pio_statemachine_obj_clear_rxfifo(mp_obj_t self_in) {
708724
}
709725
MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_clear_rxfifo_obj, rp2pio_statemachine_obj_clear_rxfifo);
710726

727+
//| def clear_txstall(self) -> None:
728+
//| """Clears the txstall flag."""
729+
//| ...
730+
//|
731+
STATIC mp_obj_t rp2pio_statemachine_obj_clear_txstall(mp_obj_t self_in) {
732+
rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in);
733+
common_hal_rp2pio_statemachine_clear_txstall(self);
734+
return mp_const_none;
735+
}
736+
MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_clear_txstall_obj, rp2pio_statemachine_obj_clear_txstall);
737+
738+
711739
//| frequency: int
712740
//| """The actual state machine frequency. This may not match the frequency requested
713741
//| due to internal limitations."""
@@ -733,6 +761,26 @@ MP_PROPERTY_GETSET(rp2pio_statemachine_frequency_obj,
733761
(mp_obj_t)&rp2pio_statemachine_get_frequency_obj,
734762
(mp_obj_t)&rp2pio_statemachine_set_frequency_obj);
735763

764+
//| txstall: bool
765+
//| """True when the state machine has stalled due to a full TX FIFO since the last
766+
//| `clear_txstall` call."""
767+
//|
768+
769+
STATIC mp_obj_t rp2pio_statemachine_obj_get_txstall(mp_obj_t self_in) {
770+
rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in);
771+
check_for_deinit(self);
772+
return MP_OBJ_NEW_SMALL_INT(common_hal_rp2pio_statemachine_get_txstall(self));
773+
}
774+
MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_get_txstall_obj, rp2pio_statemachine_obj_get_txstall);
775+
776+
const mp_obj_property_t rp2pio_statemachine_txstall_obj = {
777+
.base.type = &mp_type_property,
778+
.proxy = {(mp_obj_t)&rp2pio_statemachine_get_txstall_obj,
779+
MP_ROM_NONE,
780+
MP_ROM_NONE},
781+
};
782+
783+
736784
//| rxstall: bool
737785
//| """True when the state machine has stalled due to a full RX FIFO since the last
738786
//| `clear_rxfifo` call."""
@@ -771,6 +819,7 @@ STATIC const mp_rom_map_elem_t rp2pio_statemachine_locals_dict_table[] = {
771819
{ MP_ROM_QSTR(MP_QSTR_restart), MP_ROM_PTR(&rp2pio_statemachine_restart_obj) },
772820
{ MP_ROM_QSTR(MP_QSTR_run), MP_ROM_PTR(&rp2pio_statemachine_run_obj) },
773821
{ MP_ROM_QSTR(MP_QSTR_clear_rxfifo), MP_ROM_PTR(&rp2pio_statemachine_clear_rxfifo_obj) },
822+
{ MP_ROM_QSTR(MP_QSTR_clear_txstall), MP_ROM_PTR(&rp2pio_statemachine_clear_txstall_obj) },
774823

775824
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&rp2pio_statemachine_readinto_obj) },
776825
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&rp2pio_statemachine_write_obj) },
@@ -782,6 +831,7 @@ STATIC const mp_rom_map_elem_t rp2pio_statemachine_locals_dict_table[] = {
782831

783832
{ MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_PTR(&rp2pio_statemachine_frequency_obj) },
784833
{ MP_ROM_QSTR(MP_QSTR_rxstall), MP_ROM_PTR(&rp2pio_statemachine_rxstall_obj) },
834+
{ MP_ROM_QSTR(MP_QSTR_txstall), MP_ROM_PTR(&rp2pio_statemachine_txstall_obj) },
785835
{ MP_ROM_QSTR(MP_QSTR_in_waiting), MP_ROM_PTR(&rp2pio_statemachine_in_waiting_obj) },
786836
};
787837
STATIC MP_DEFINE_CONST_DICT(rp2pio_statemachine_locals_dict, rp2pio_statemachine_locals_dict_table);

ports/raspberrypi/bindings/rp2pio/StateMachine.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,24 @@ void common_hal_rp2pio_statemachine_stop(rp2pio_statemachine_obj_t *self);
6565
void common_hal_rp2pio_statemachine_run(rp2pio_statemachine_obj_t *self, const uint16_t *instructions, size_t len);
6666

6767
// Writes out the given data.
68-
bool common_hal_rp2pio_statemachine_write(rp2pio_statemachine_obj_t *self, const uint8_t *data, size_t len, uint8_t stride_in_bytes);
69-
bool common_hal_rp2pio_statemachine_background_write(rp2pio_statemachine_obj_t *self, const sm_buf_info *once_obj, const sm_buf_info *loop_obj, uint8_t stride_in_bytes);
68+
bool common_hal_rp2pio_statemachine_write(rp2pio_statemachine_obj_t *self, const uint8_t *data, size_t len, uint8_t stride_in_bytes, bool swap);
69+
bool common_hal_rp2pio_statemachine_background_write(rp2pio_statemachine_obj_t *self, const sm_buf_info *once_obj, const sm_buf_info *loop_obj, uint8_t stride_in_bytes, bool swap);
7070
bool common_hal_rp2pio_statemachine_stop_background_write(rp2pio_statemachine_obj_t *self);
7171
mp_int_t common_hal_rp2pio_statemachine_get_pending(rp2pio_statemachine_obj_t *self);
7272
bool common_hal_rp2pio_statemachine_get_writing(rp2pio_statemachine_obj_t *self);
73-
bool common_hal_rp2pio_statemachine_readinto(rp2pio_statemachine_obj_t *self, uint8_t *data, size_t len, uint8_t stride_in_bytes);
73+
bool common_hal_rp2pio_statemachine_readinto(rp2pio_statemachine_obj_t *self, uint8_t *data, size_t len, uint8_t stride_in_bytes, bool swap);
7474
bool common_hal_rp2pio_statemachine_write_readinto(rp2pio_statemachine_obj_t *self,
7575
const uint8_t *data_out, size_t out_len, uint8_t out_stride_in_bytes,
76-
uint8_t *data_in, size_t in_len, uint8_t in_stride_in_bytes);
76+
uint8_t *data_in, size_t in_len, uint8_t in_stride_in_bytes, bool swap_out, bool swap_in);
7777

7878
// Return actual state machine frequency.
7979
uint32_t common_hal_rp2pio_statemachine_get_frequency(rp2pio_statemachine_obj_t *self);
8080
void common_hal_rp2pio_statemachine_set_frequency(rp2pio_statemachine_obj_t *self, uint32_t frequency);
8181

8282
bool common_hal_rp2pio_statemachine_get_rxstall(rp2pio_statemachine_obj_t *self);
8383
void common_hal_rp2pio_statemachine_clear_rxfifo(rp2pio_statemachine_obj_t *self);
84+
bool common_hal_rp2pio_statemachine_get_txstall(rp2pio_statemachine_obj_t *self);
85+
void common_hal_rp2pio_statemachine_clear_txstall(rp2pio_statemachine_obj_t *self);
8486
size_t common_hal_rp2pio_statemachine_get_in_waiting(rp2pio_statemachine_obj_t *self);
8587

8688
void common_hal_rp2pio_statemachine_set_interrupt_handler(rp2pio_statemachine_obj_t *self, void (*handler)(void *), void *arg, int mask);

ports/raspberrypi/common-hal/audiobusio/PDMIn.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t *se
157157
size_t output_count = 0;
158158
common_hal_rp2pio_statemachine_clear_rxfifo(&self->state_machine);
159159
// Do one read to get the mic going and throw it away.
160-
common_hal_rp2pio_statemachine_readinto(&self->state_machine, (uint8_t *)samples, 2 * sizeof(uint32_t), sizeof(uint32_t));
160+
common_hal_rp2pio_statemachine_readinto(&self->state_machine, (uint8_t *)samples, 2 * sizeof(uint32_t), sizeof(uint32_t), false);
161161
while (output_count < output_buffer_length && !common_hal_rp2pio_statemachine_get_rxstall(&self->state_machine)) {
162-
common_hal_rp2pio_statemachine_readinto(&self->state_machine, (uint8_t *)samples, 2 * sizeof(uint32_t), sizeof(uint32_t));
162+
common_hal_rp2pio_statemachine_readinto(&self->state_machine, (uint8_t *)samples, 2 * sizeof(uint32_t), sizeof(uint32_t), false);
163163
// Call filter_sample just one place so it can be inlined.
164164
uint16_t value = filter_sample(samples);
165165
if (self->bit_depth == 8) {

ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void common_hal_imagecapture_parallelimagecapture_singleshot_capture(imagecaptur
153153
pio_sm_exec(pio, sm, pio_encode_jmp(offset));
154154
pio_sm_set_enabled(pio, sm, true);
155155

156-
common_hal_rp2pio_statemachine_readinto(&self->state_machine, bufinfo.buf, bufinfo.len, 4);
156+
common_hal_rp2pio_statemachine_readinto(&self->state_machine, bufinfo.buf, bufinfo.len, 4, false);
157157

158158
pio_sm_set_enabled(pio, sm, false);
159159
}

ports/raspberrypi/common-hal/neopixel_write/__init__.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t *digitalinout,
6363
uint32_t pins_we_use = 1 << digitalinout->pin->number;
6464
bool ok = rp2pio_statemachine_construct(&state_machine,
6565
neopixel_program, sizeof(neopixel_program) / sizeof(neopixel_program[0]),
66-
12800000, // MHz, to get about appropriate sub-bit times in PIO program.
66+
12800000, // 12.8MHz, to get appropriate sub-bit times in PIO program.
6767
NULL, 0, // init program
6868
NULL, 1, // out
6969
NULL, 1, // in
@@ -90,7 +90,7 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t *digitalinout,
9090
while (port_get_raw_ticks(NULL) < next_start_raw_ticks) {
9191
}
9292

93-
common_hal_rp2pio_statemachine_write(&state_machine, pixels, num_bytes, 1 /* stride in bytes */);
93+
common_hal_rp2pio_statemachine_write(&state_machine, pixels, num_bytes, 1 /* stride in bytes */, false);
9494

9595
// Use a private deinit of the state machine that doesn't reset the pin.
9696
rp2pio_statemachine_deinit(&state_machine, true);

ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type
161161
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
162162

163163
common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA);
164-
common_hal_rp2pio_statemachine_write(&self->state_machine, data, data_length, 1);
164+
common_hal_rp2pio_statemachine_write(&self->state_machine, data, data_length, 1, false);
165165
}
166166

167167
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t obj) {

0 commit comments

Comments
 (0)