| Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
I.e. make it work like btree.keys(), while still not using a separate
iterator type.
|
|
Each takes optional args of starting key, ending key, and flags (ending
key inclusive, reverse order).
|
|
Storing a chain of pbuf was an original design of @pfalcon's lwIP socket
module. The problem with storing just one, like modlwip does is that
"peer closed connection" notification is completely asynchronous and out of
band. So, there may be following sequence of actions:
1. pbuf #1 arrives, and stored in a socket.
2. pbuf #2 arrives, and rejected, which causes lwIP to put it into a
queue to re-deliver later.
3. "Peer closed connection" is signaled, and socket is set at such status.
4. pbuf #1 is processed.
5. There's no stored pbufs in teh socket, and socket status is "peer closed
connection", so EOF is returned to a client.
6. pbuf #2 gets redelivered.
Apparently, there's no easy workaround for this, except to queue all
incoming pbufs in a socket. This may lead to increased memory pressure,
as number of pending packets would be regulated only by TCP/IP flow
control, whereas with previous setup lwIP had a global overlook of number
packets waiting for redelivery and could regulate them centrally.
|
|
MP_ROM_PTR() is only for data structures initialization, code should use
MP_OBJ_FROM_PTR().
|
|
Allows to translate C-level pin API to Python-level pin API. In other
words, allows to implement a pin class and Python which will be usable
for efficient C-coded algorithms, like bitbanging SPI/I2C, time_pulse,
etc.
|
|
It's now used for more than just stream protocol (e.g. pin protocol), so
don't use false names.
|
|
It's not really in-memory though, just uses anonymous temporary file on
disk.
|
|
|
|
|
|
|
|
The time stamp is taken from the RTC for all newly generated
or changed files. RTC must be maintained separately.
The dummy time stamp of Jan 1, 2000 is set in vfs.stat() for the
root directory, avoiding invalid time values.
|
|
|
|
|
|
|
|
This implements basic wrapping of native get/put/seq API, and then dictionary
access protocol. Native API is intended to be superceded going forward.
|
|
Since not all ports that enable the machine module have the pin HAL
functions.
|
|
The C implementation is taken from the DHT driver.
|
|
|
|
The call to stat() returns a 10 element tuple consistent to the os.stat()
call. At the moment, the only relevant information returned are file
type and file size.
|
|
Copy-paste issue, with the original mistake in stmhal.
|
|
|
|
Ported from stmhal.
|
|
Ported from stmhal.
|
|
These changes are in line with similar changes in other modules, and
with standard Python interface.
|
|
Using usual method of virtual method tables. Single virtual method,
ioctl, is defined currently for all operations. This universal and
extensible vtable-based method is also defined as a default MPHAL
GPIO implementation, but a specific port may override it with its
own implementation (e.g. close-ended, but very efficient, e.g. avoiding
virtual method dispatch).
|
|
mp_hal_pin_config_od is renamed mp_hal_pin_open_drain, and mp_hal_pin_low
is mp_hal_pin_od_low.
|
|
|
|
Still not compatible with nanboxing.
|
|
Make dupterm subsystem close a term stream object when EOF or error occurs.
There's no other party than dupterm itself in a better position to do this,
and this is required to properly reclaim stream resources, especially if
multiple dupterm sessions may be established (e.g. as networking
connections).
|
|
|
|
|
|
|
|
Both read and write operations support variants where either a) a single
call is made to the undelying stream implementation and returned buffer
length may be less than requested, or b) calls are repeated until requested
amount of data is collected, shorter amount is returned only in case of
EOF or error.
These operations are available from the level of C support functions to be
used by other C modules to implementations of Python methods to be used in
user-facing objects.
The rationale of these changes is to allow to write concise and robust
code to work with *blocking* streams of types prone to short reads, like
serial interfaces and sockets. Particular object types may select "exact"
vs "once" types of methods depending on their needs. E.g., for sockets,
revc() and send() methods continue to be "once", while read() and write()
thus converted to "exactly" versions.
These changes don't affect non-blocking handling, e.g. trying "exact"
method on the non-blocking socket will return as much data as available
without blocking. No data available is continued to be signaled as None
return value to read() and write().
From the point of view of CPython compatibility, this model is a cross
between its io.RawIOBase and io.BufferedIOBase abstract classes. For
blocking streams, it works as io.BufferedIOBase model (guaranteeing
lack of short reads/writes), while for non-blocking - as io.RawIOBase,
returning None in case of lack of data (instead of raising expensive
exception, as required by io.BufferedIOBase). Such a cross-behavior
should be optimal for MicroPython needs.
|
|
Calling it from lwIP accept callback will lead incorrect functioning
and/or packet leaks if Python callback has any networking calls, due
to lwIP non-reentrancy. So, instead schedule "poll" callback to do
that, which will be called by lwIP when it does not perform networking
activities. "Poll" callback is called infrequently though (docs say
every 0.5s by default), so for better performance, lwIP needs to be
patched to call poll callback soon after accept callback, but when
current packet is already processed.
|
|
|
|
|
|
|
|
Request for password then becomes mandatory part of the protocol.
|
|
That's production setting. Also, extra UART output may affect behavior of
(subpar) network drivers.
|
|
Like ESP8266 has.
|
|
The smaller chunks we send (and receive), the more packets there to
receive, and higher chance to git internal packet buffer overflow in
WiFi driver.
|
|
So detailed that even commented by default.
|
|
A bit of optimization.
|
|
EAGAIN should be returned only if underlying socket returned it. Wrap
existing read function into external loop to process all data available.
|
|
|
|
While just a websocket is enough for handling terminal part of WebREPL,
handling file transfer operations requires demultiplexing and acting
upon, which is encapsulated in _webrepl class provided by this module,
which wraps a websocket object.
|