Skip to content

Commit 14f8e9b

Browse files
Copilotppsx
andcommitted
qspibus: three low-cost cleanups consistent with CircuitPython conventions
Co-authored-by: ppsx <7107135+ppsx@users.noreply.github.com>
1 parent d0984b4 commit 14f8e9b

4 files changed

Lines changed: 4 additions & 21 deletions

File tree

locale/circuitpython.pot

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,7 @@ msgstr ""
978978

979979
#: ports/espressif/common-hal/busio/SPI.c
980980
#: ports/espressif/common-hal/canio/CAN.c
981+
#: ports/espressif/common-hal/qspibus/QSPIBus.c
981982
msgid "ESP-IDF memory allocation failed"
982983
msgstr ""
983984

@@ -1065,10 +1066,6 @@ msgstr ""
10651066
msgid "Failed to create continuous channels: not found"
10661067
msgstr ""
10671068

1068-
#: ports/espressif/common-hal/qspibus/QSPIBus.c
1069-
msgid "Failed to create semaphore"
1070-
msgstr ""
1071-
10721069
#: ports/espressif/common-hal/audioio/AudioOut.c
10731070
msgid "Failed to enable continuous"
10741071
msgstr ""

ports/espressif/common-hal/qspibus/QSPIBus.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ void common_hal_qspibus_qspibus_construct(
287287

288288
self->transfer_done_sem = xSemaphoreCreateCounting(QSPI_DMA_BUFFER_COUNT, 0);
289289
if (self->transfer_done_sem == NULL) {
290-
mp_raise_msg(&mp_type_MemoryError, MP_ERROR_TEXT("Failed to create semaphore"));
290+
mp_raise_msg(&mp_type_MemoryError, MP_ERROR_TEXT("ESP-IDF memory allocation failed"));
291291
}
292292

293293
if (!qspibus_allocate_dma_buffers(self)) {
@@ -428,15 +428,6 @@ bool common_hal_qspibus_qspibus_deinited(qspibus_qspibus_obj_t *self) {
428428
return !self->bus_initialized;
429429
}
430430

431-
void common_hal_qspibus_qspibus_send_command(
432-
qspibus_qspibus_obj_t *self,
433-
uint8_t command,
434-
const uint8_t *data,
435-
size_t len) {
436-
qspibus_send_command_bytes(self, command, data, len);
437-
}
438-
439-
440431
void common_hal_qspibus_qspibus_write_command(
441432
qspibus_qspibus_obj_t *self,
442433
uint8_t command) {

shared-bindings/qspibus/QSPIBus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static mp_obj_t qspibus_qspibus_obj_reset(mp_obj_t self_in) {
106106
}
107107
static MP_DEFINE_CONST_FUN_OBJ_1(qspibus_qspibus_reset_obj, qspibus_qspibus_obj_reset);
108108

109-
//| def send(self, command: int, data: ReadableBuffer = b"") -> None:
109+
//| def send(self, command: int, data: Optional[ReadableBuffer] = None) -> None:
110110
//| """Send command with optional payload bytes.
111111
//|
112112
//| This mirrors FourWire-style convenience API:
@@ -119,7 +119,7 @@ static mp_obj_t qspibus_qspibus_send(size_t n_args, const mp_obj_t *pos_args, mp
119119
enum { ARG_command, ARG_data };
120120
static const mp_arg_t allowed_args[] = {
121121
{ MP_QSTR_command, MP_ARG_INT | MP_ARG_REQUIRED },
122-
{ MP_QSTR_data, MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} },
122+
{ MP_QSTR_data, MP_ARG_OBJ, {.u_obj = mp_const_none} },
123123
};
124124

125125
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];

shared-bindings/qspibus/QSPIBus.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ void common_hal_qspibus_qspibus_construct(
3131
void common_hal_qspibus_qspibus_deinit(qspibus_qspibus_obj_t *self);
3232
bool common_hal_qspibus_qspibus_deinited(qspibus_qspibus_obj_t *self);
3333

34-
void common_hal_qspibus_qspibus_send_command(
35-
qspibus_qspibus_obj_t *self,
36-
uint8_t command,
37-
const uint8_t *data,
38-
size_t len);
3934
void common_hal_qspibus_qspibus_write_command(
4035
qspibus_qspibus_obj_t *self,
4136
uint8_t command);

0 commit comments

Comments
 (0)