Skip to content

Commit ed0a06a

Browse files
deshipudpgeorge
authored andcommitted
docs/esp8266/quickref: Fix and update the SPI docs
Use the `SPI` factory function in the examples, and use proper baud rate of 80 000 000.
1 parent 263aaa7 commit ed0a06a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

docs/esp8266/quickref.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,14 @@ Use the ``machine.ADC`` class::
165165
SPI bus
166166
-------
167167

168-
The SPI driver is implemented in software and works on all pins::
168+
There are two SPI drivers. One is implemented in software and works on all pins::
169169

170170
from machine import Pin, SPI
171171

172172
# construct an SPI bus on the given pins
173173
# polarity is the idle state of SCK
174174
# phase=0 means sample on the first edge of SCK, phase=1 means the second
175-
spi = SPI(baudrate=100000, polarity=1, phase=0, sck=Pin(0), mosi=Pin(2), miso=Pin(4))
175+
spi = SPI(-1, baudrate=100000, polarity=1, phase=0, sck=Pin(0), mosi=Pin(2), miso=Pin(4))
176176

177177
spi.init(baudrate=200000) # set the baudrate
178178

@@ -194,13 +194,13 @@ Hardware SPI
194194
------------
195195

196196
The hardware SPI is faster (up to 80Mhz), but only works on following pins:
197-
``MISO`` is gpio2, ``MOSI`` is gpio13, and ``SCK`` is gpio14. It has the same
197+
``MISO`` is gpio12, ``MOSI`` is gpio13, and ``SCK`` is gpio14. It has the same
198198
methods as SPI, except for the pin parameters for the constructor and init
199199
(as those are fixed).
200200

201-
from machine import Pin, HSPI
201+
from machine import Pin, SPI
202202

203-
hspi = HSPI(baudrate=800000000, polarity=0, phase=0)
203+
hspi = SPI(0, baudrate=80000000, polarity=0, phase=0)
204204

205205

206206
I2C bus

0 commit comments

Comments
 (0)