mimxrt/machine_spi: Allow a setting of -1 for cs in the constructor.

In that case, no Pin will be configured for the CS signal, even if it is
internally still generated.  That setting allows to use any pin for CS,
which then must be controlled by the Python script.

Also make the default cs=-1 to match other ports (software CS).
This commit is contained in:
robert-hh
2022-07-31 11:09:57 +02:00
committed by Damien George
parent 8e54225140
commit 0f048a5a2a
3 changed files with 17 additions and 7 deletions

View File

@@ -322,7 +322,8 @@ Olimex RT1010Py - CS0/-/SDO/SDI/SCK SDCARD wi
Seeed ARCH MIX J4_12/-/J4_14/J4_13/J4_15 J3_09/J3_05/J3_08_J3_11
================= ========================= ======================= ===============
Pins denoted with (*) are by default not wired at the board.
Pins denoted with (*) are by default not wired at the board. The CS0 and CS1 signals
are enabled with the keyword option cs=0 or cs=1 of the SPI object constructor.
.. _mimxrt_i2c_pinout:

View File

@@ -301,13 +301,19 @@ There are up to four hardware SPI channels that allow faster transmission
rates (up to 30Mhz). Hardware SPI is accessed via the
:ref:`machine.SPI <machine.SPI>` class and has the same methods as software SPI above::
from machine import SPI
from machine import SPI, Pin
spi = SPI(0, 10000000)
cs_pin = Pin(6, Pin.OUT, value=1)
cs_pin(0)
spi.write('Hello World')
cs_pin(1)
For the assignment of Pins to SPI signals, refer to
:ref:`Hardware SPI pinout <mimxrt_spi_pinout>`.
The keyword option cs=n can be used to enable the cs pin 0 or 1 for an automatic cs signal. The
default is cs=-1. Using cs=-1 the automatic cs signal is not created.
In that case, cs has to be set by the script. Clearing that assignment requires a power cycle.
Notes: