8000 mimxrt: Implement the review comments. · micropython/micropython@46565d0 · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 46565d0

Browse files
committed
mimxrt: Implement the review comments.
1 parent 6730c39 commit 46565d0

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

docs/mimxrt/quickref.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,16 @@ rates (up to 30Mhz). Hardware SPI is accessed via the
303303

304304
from machine import SPI, Pin
305305

306+
spi = SPI(0, 10000000)
306307
cs_pin = Pin(6, Pin.OUT, value=1)
308+
cs_pin(0)
307309
spi.write('Hello World')
310+
cs_pin(1)
308311

309312
For the assignment of Pins to SPI signals, refer to
310313
:ref:`Hardware SPI pinout <mimxrt_spi_pinout>`.
311314
The keyword option cs=n can be used to enable the cs pin 0 or 1 for an automatic cs signal. The
312-
default is cs=0. Using cs=-1 the automatic cs signal is not created.
315+
default is cs=-1. Using cs=-1 the automatic cs signal is not created.
313316
In that case, cs has to be set by the script. Clearing that assignment requires a power cycle.
314317

315318
Notes:

ports/mimxrt/machine_spi.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
131131
{ MP_QSTR_firstbit, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = DEFAULT_SPI_FIRSTBIT} },
132132
{ MP_QSTR_gap_ns, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} },
133133
{ MP_QSTR_drive, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = DEFAULT_SPI_DRIVE} },
134-
{ MP_QSTR_cs, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
134+
{ MP_QSTR_cs, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} },
135135
};
136136

137137
// Parse the arguments.
@@ -174,7 +174,9 @@ mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
174174
self->master_config->lastSckToPcsDelayInNanoSec = self->master_config->betweenTransferDelayInNanoSec;
175175
self->master_config->pcsToSckDelayInNanoSec = self->master_config->betweenTransferDelayInNanoSec;
176176
int8_t cs = args[ARG_cs].u_int;
177-
// The default value 0 is set already, so only cs=1 has to be set.
177+
// In the SPI master_config for automatic CS the value cs=0 is set already,
178+
// so only cs=1 has to be addressed here. The case cs == -1 for manual CS is handled
179+
// in the function spi_set_iomux() and the value in the master_config can stay at 0.
178180
if (cs == 1) {
179181
self->master_config->whichPcs = cs;
180182
}

ports/mimxrt/machine_uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ STATIC mp_uint_t machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint
438438
ret |= MP_STREAM_POLL_RD;
439439
}
440440
}
441-
if ((flags & MP_STREAM_POLL_WR) && (self->tx_status == kStatus_LPUART_TxIdle)) {
441+
if ((flags & MP_STREAM_POLL_WR) && (self->txbuf_len > self->handle.txDataSize)) {
442442
ret |= MP_STREAM_POLL_WR;
443443
}
444444
} else if (request == MP_STREAM_FLUSH) {

0 commit comments

Comments
 (0)
0