mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 19:50:30 +01:00
docs: Several corrections to the classes in the machine module.
This commit is contained in:
@@ -18,11 +18,9 @@ Before applying power
|
||||
|
||||
The GPIO pins of the WiPy are NOT 5V tolerant, connecting them to voltages higer
|
||||
than 3.6V will cause irreparable damage to the board. ADC pins, when configured
|
||||
in analog mode cannot withstand volatges above 1.8V. Keep these considerations in
|
||||
in analog mode cannot withstand voltages above 1.8V. Keep these considerations in
|
||||
mind when wiring your electronics.
|
||||
|
||||
|
||||
|
||||
WLAN default behaviour
|
||||
----------------------
|
||||
|
||||
@@ -33,29 +31,43 @@ to gain access to the interactive prompt, open a telnet session to that IP addre
|
||||
the default port (23). You will be asked for credentials:
|
||||
``login: micro`` and ``password: python``
|
||||
|
||||
Local file system and SD card
|
||||
-----------------------------
|
||||
Telnet REPL
|
||||
-----------
|
||||
|
||||
Linux stock telnet works like a charm (also on OSX), but other tools like putty
|
||||
work quite too. The default credentials are: **user:** ``micro``, **password:** ``python``.
|
||||
See :ref:`network.server <network.server>` for info on how to change the defaults.
|
||||
For instance, on a linux shell (when connected to the WiPy in AP mode)::
|
||||
|
||||
$ telnet 192.168.1.1
|
||||
|
||||
Local file system and FTP access
|
||||
--------------------------------
|
||||
|
||||
There is a small internal file system (a drive) on the WiPy, called ``/flash``,
|
||||
which is stored within the external serial flash memory. If a micro SD card
|
||||
is hooked-up and enabled, it is available as ``/sd``.
|
||||
is hooked-up and mounted, it will be available as well.
|
||||
|
||||
When the WiPy boots up, it always boots from the ``boot.py`` located in the
|
||||
``/flash`` file system. If during the boot process the SD card is enabled and
|
||||
it's selected as the current drive then the WiPy will try to execute ``main.py``
|
||||
that should be located in the SD card.
|
||||
When the WiPy starts up, it always boots from the ``boot.py`` located in the
|
||||
``/flash`` file system.
|
||||
|
||||
The file system is accessible via the native FTP server running in the WiPy.
|
||||
Open your FTP client of choice and connect to:
|
||||
|
||||
``ftp://192.168.1.1``, ``user: micro``, ``password: python``
|
||||
**url:** ``ftp://192.168.1.1``, **user:** ``micro``, **password:** ``python``
|
||||
|
||||
The FTP server on the WiPy doesn't support active mode, only passive, so for instance
|
||||
if using the native unix ftp client, just after logging in::
|
||||
See :ref:`network.server <network.server>` for info on how to change the defaults.
|
||||
The recommended clients are: Linux stock FTP (also in OSX), Filezilla and FireFTP.
|
||||
For example, on a linux shell::
|
||||
|
||||
$ ftp 192.168.1.1
|
||||
|
||||
The FTP server on the WiPy doesn't support active mode, only passive, therefore,
|
||||
if using the native unix ftp client, just after logging in do::
|
||||
|
||||
ftp> passive
|
||||
|
||||
Besides that, the FTP server only supports onw data connection at a time. Check out
|
||||
Besides that, the FTP server only supports one data connection at a time. Check out
|
||||
the Filezilla settings section below for more info.
|
||||
|
||||
FileZilla settings
|
||||
@@ -74,16 +86,17 @@ Upgrading the firmware Over The Air
|
||||
|
||||
OTA software updates can be performed through the FTP server. Upload the ``mcuimg.bin`` file
|
||||
to: ``/flash/sys/mcuimg.bin`` it will take around 6s. You won't see the file being stored
|
||||
inside ``/flash/sys/`` because it's actually saved bypassing the user file system, but rest
|
||||
assured that it was successfully transferred, and it has been signed with a MD5 checksum to
|
||||
verify its integrity. Now, reset the MCU by pressing the switch on the board, or by typing::
|
||||
inside ``/flash/sys/`` because it's actually saved bypassing the user file system, so it
|
||||
ends up inside the internal **hidden** file system, but rest assured that it was successfully
|
||||
transferred, and it has been signed with a MD5 checksum to verify its integrity. Now, reset
|
||||
the WiPy by pressing the switch on the board, or by typing::
|
||||
|
||||
import machine
|
||||
machine.reset()
|
||||
|
||||
Software updates can be found in: https://github.com/wipy/wipy/releases
|
||||
It's always recommended to update to the latest software, but make sure to
|
||||
read the ``release notes`` before.
|
||||
read the **release notes** before.
|
||||
|
||||
Boot modes
|
||||
----------
|
||||
|
||||
@@ -88,9 +88,9 @@ See :ref:`machine.ADC <machine.ADC>`. ::
|
||||
UART (serial bus)
|
||||
-----------------
|
||||
|
||||
See :ref:`machine.Pin <machine.Pin>` and :ref:`machine.UART <machine.UART>`. ::
|
||||
See :ref:`machine.UART <machine.UART>`. ::
|
||||
|
||||
from machine import Pin, UART
|
||||
from machine import UART
|
||||
uart = UART(0, baudrate=9600)
|
||||
uart.write('hello')
|
||||
uart.read(5) # read up to 5 bytes
|
||||
@@ -100,7 +100,7 @@ SPI bus
|
||||
|
||||
See :ref:`machine.SPI <machine.SPI>`. ::
|
||||
|
||||
from machine SPI
|
||||
from machine import SPI
|
||||
|
||||
# configure the SPI master @ 2MHz
|
||||
spi = SPI(0, SPI.MASTER, baudrate=200000, polarity=0, phase=0)
|
||||
@@ -112,9 +112,9 @@ See :ref:`machine.SPI <machine.SPI>`. ::
|
||||
I2C bus
|
||||
-------
|
||||
|
||||
See :ref:`machine.Pin <machine.Pin>` and :ref:`machine.I2C <machine.I2C>`. ::
|
||||
See :ref:`machine.I2C <machine.I2C>`. ::
|
||||
|
||||
from machine import Pin, I2C
|
||||
from machine import I2C
|
||||
# configure the I2C bus
|
||||
i2c = I2C(0, I2C.MASTER, baudrate=100000)
|
||||
i2c.scan() # returns list of slave addresses
|
||||
@@ -203,7 +203,7 @@ Telnet and FTP server
|
||||
|
||||
See :ref:`network.server <network.server>` ::
|
||||
|
||||
from network import network
|
||||
from network import server
|
||||
|
||||
# init with new user, pass word and seconds timeout
|
||||
server = server.init(login=('user', 'password'), timeout=60)
|
||||
@@ -211,8 +211,8 @@ See :ref:`network.server <network.server>` ::
|
||||
server.timeout() # get the timeout
|
||||
server.isrunning() # check wether the server is running or not
|
||||
|
||||
HeartBeat LED
|
||||
-------------
|
||||
Heart beat LED
|
||||
--------------
|
||||
|
||||
See :mod:`wipy`. ::
|
||||
|
||||
|
||||
Reference in New Issue
Block a user