mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 12:40:15 +01:00
Some checks failed
JavaScript code lint and formatting with Biome / eslint (push) Has been cancelled
Check code formatting / code-formatting (push) Has been cancelled
Check code size / build (push) Has been cancelled
Check spelling with codespell / codespell (push) Has been cancelled
Check commit message formatting / build (push) Has been cancelled
Build docs / build (push) Has been cancelled
Check examples / embedding (push) Has been cancelled
Package mpremote / build (push) Has been cancelled
.mpy file format and tools / test (push) Has been cancelled
Build ports metadata / build (push) Has been cancelled
cc3200 port / build (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3) (push) Has been cancelled
esp8266 port / build (push) Has been cancelled
mimxrt port / build (push) Has been cancelled
nrf port / build (push) Has been cancelled
powerpc port / build (push) Has been cancelled
qemu-arm port / build_and_test (push) Has been cancelled
qemu-riscv port / build_and_test (push) Has been cancelled
renesas-ra port / build_renesas_ra_board (push) Has been cancelled
rp2 port / build (push) Has been cancelled
samd port / build (push) Has been cancelled
stm32 port / build_stm32 (stm32_misc_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_nucleo_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_pyb_build) (push) Has been cancelled
unix port / minimal (push) Has been cancelled
unix port / reproducible (push) Has been cancelled
unix port / standard (push) Has been cancelled
unix port / standard_v2 (push) Has been cancelled
unix port / coverage (push) Has been cancelled
unix port / coverage_32bit (push) Has been cancelled
unix port / nanbox (push) Has been cancelled
unix port / float (push) Has been cancelled
unix port / stackless_clang (push) Has been cancelled
unix port / float_clang (push) Has been cancelled
unix port / settrace (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, x64, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x64, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, x86, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2019, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2019, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2022, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-latest, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2019, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2019, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2022, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-latest, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
Signed-off-by: Damien George <damien@micropython.org>
99 lines
2.6 KiB
ReStructuredText
99 lines
2.6 KiB
ReStructuredText
.. currentmodule:: network
|
|
.. _network.PPP:
|
|
|
|
class PPP -- create network connections over serial PPP
|
|
=======================================================
|
|
|
|
This class allows you to create a network connection over a serial port using
|
|
the PPP protocol. It is only available on selected ports and boards.
|
|
|
|
Example usage::
|
|
|
|
import network
|
|
|
|
ppp = network.PPP(uart)
|
|
ppp.connect()
|
|
|
|
while not ppp.isconnected():
|
|
pass
|
|
|
|
print(ppp.ipconfig("addr4"))
|
|
|
|
# use the socket module as usual, etc
|
|
|
|
ppp.disconnect()
|
|
|
|
Constructors
|
|
------------
|
|
|
|
.. class:: PPP(stream)
|
|
|
|
Create a PPP driver object.
|
|
|
|
Arguments are:
|
|
|
|
- *stream* is any object that supports the stream protocol, but is most commonly a
|
|
:class:`machine.UART` instance. This stream object must have an ``irq()`` method
|
|
and an ``IRQ_RXIDLE`` constant, for use by `PPP.connect`.
|
|
|
|
Methods
|
|
-------
|
|
|
|
.. method:: PPP.connect(security=SEC_NONE, user=None, key=None)
|
|
|
|
Initiate a PPP connection with the given parameters:
|
|
|
|
- *security* is the type of security, either ``PPP.SEC_NONE``, ``PPP.SEC_PAP``,
|
|
or ``PPP.SEC_CHAP``.
|
|
- *user* is an optional user name to use with the security mode.
|
|
- *key* is an optional password to use with the security mode.
|
|
|
|
When this method is called the underlying stream has its interrupt configured to call
|
|
`PPP.poll` via ``stream.irq(ppp.poll, stream.IRQ_RXIDLE)``. This makes sure the
|
|
stream is polled, and data passed up the PPP stack, wheverver data becomes available
|
|
on the stream.
|
|
|
|
The connection proceeds asynchronously, in the background.
|
|
|
|
.. method:: PPP.disconnect()
|
|
|
|
Terminate the connection. This must be called to cleanly close the PPP connection.
|
|
|
|
.. method:: PPP.isconnected()
|
|
|
|
Returns ``True`` if the PPP link is connected and up.
|
|
Returns ``False`` otherwise.
|
|
|
|
.. method:: PPP.status()
|
|
|
|
Returns the PPP status.
|
|
|
|
.. method:: PPP.config(config_parameters)
|
|
|
|
Sets or gets parameters of the PPP interface. There are currently no parameter that
|
|
can be set or retrieved.
|
|
|
|
.. method:: PPP.ipconfig('param')
|
|
PPP.ipconfig(param=value, ...)
|
|
|
|
See `AbstractNIC.ipconfig`.
|
|
|
|
.. method:: PPP.ifconfig([(ip, subnet, gateway, dns)])
|
|
|
|
See `AbstractNIC.ifconfig`.
|
|
|
|
.. method:: PPP.poll()
|
|
|
|
Poll the underlying stream for data, and pass it up the PPP stack.
|
|
This is called automatically if the stream is a UART with a RXIDLE interrupt,
|
|
so it's not usually necessary to call it manually.
|
|
|
|
Constants
|
|
---------
|
|
|
|
.. data:: PPP.SEC_NONE
|
|
PPP.SEC_PAP
|
|
PPP.SEC_CHAP
|
|
|
|
The type of connection security.
|