Paul Sokolovsky
c07a03a36d
examples/http_server.py: Introduce main() function.
Allows to re-run code if it was imported as a module (e.g., on bare-metal
ports).
9 years ago
Paul Sokolovsky
aa3fb7b387
examples/http_server.py: Refactor/simplify for Python 3.5.
9 years ago
Paul Sokolovsky
fd2b71f972
examples/http_client.py: Introduce main() function.
Allows to re-run code if it was imported as a module (e.g., on bare-metal
ports).
9 years ago
Paul Sokolovsky
a5d07c3aba
examples/http_client.py: Improve CPython compatibility in stream mode.
9 years ago
Paul Sokolovsky
a5d2af7949
unix/file: "encoding" arg to open() isn't kw-only.
And with "buffering" arg introduced, it's non possible to make it
non-kwonly.
9 years ago
Paul Sokolovsky
e5fa163a4c
unix/file: Parse "buffering" argument of open() builtin.
It's ignored (unbuffered, raw I/O is used), but least makes it compatible
with CPython.
9 years ago
Damien George
a0cb4eda9a
esp8266: Use VM_HOOK to call ets_loop_iter within the VM.
Starting with a divisor of 10, pystone_lowmem gives a score of 256.
9 years ago
Paul Sokolovsky
cef073877b
example/http_client.py: Remove unused code.
9 years ago
Paul Sokolovsky
cf4b72bf13
examples: http_client.py, http_server.py aren't just unix, move to network/.
9 years ago
Stephen Kyle
b475327ffa
py/map: Prevent map resize failure from destroying map.
9 years ago
Damien George
6a051a8e0b
esp8266/uart: Get ctrl-C working now that event-based REPL is disabled.
9 years ago
Damien George
fb6cc96951
esp8266/uart: Comment out old, unused rx buffering code.
This was originally used for non-event based REPL processing. Then it
was unused when event-based processing was activated. But now that event
based is disabled, and non-event based is back, there has been new ring
buffer code to process the chars.
9 years ago
Paul Sokolovsky
fc4c43a72e
esp8266: Switch to non event-driven REPL to support paste mode.
9 years ago
Paul Sokolovsky
785cf9a61f
esp8266: Support dedicated REPL loop (aka pull-style).
Event-driven loop (push-style) is still supported and default (controlled
by MICROPY_REPL_EVENT_DRIVEN setting, as expected).
Dedicated loop worked even without adding ets_loop_iter(), though that
needs to be revisited later.
9 years ago
Paul Sokolovsky
777232c9a5
esp8266: Disallow recursive calls to REPL.
Before this change, if REPL blocked executing some code, it was possible
to still input new statememts and excuting them, all leading to weird,
and portentially dangerous interaction.
TODO: Current implementation may have issues processing input accumulated
while REPL was blocked.
9 years ago
Pavol Rusnak
3d4a535208
unix: implement -i option (inspect - start REPL after script is finished)
9 years ago
Paul Sokolovsky
5531437941
esp8266: Move PHY mode constants from modesp to modnetwork.
9 years ago
Damien George
4b597a1c1a
esp8266: Reset term_obj on reboot.
Also, term_obj can be NULL if socket enables REPL duplication signalling
before os.dupterm is called, so it should be checked.
9 years ago
Paul Sokolovsky
98af891610
esp8266: Implement input part of dupterm handling.
The idea is following: underlying interrupt-driven or push-style data source
signals that more data is available for dupterm processing via call to
mp_hal_signal_dupterm_input(). This triggers a task which pumps data between
actual dupterm object (which may perform additional processing on data from
low-level data source) and input ring buffer.
9 years ago
Paul Sokolovsky
61fa7c8152
esp8266: Switch back to accumulating input data via ring buffer.
But now it's generic ring buffer implemented via ringbuf.h, and is intended
for any type of input, including dupterm's, not just UART. The general
process work like this: an interrupt-driven input source puts data into
input_buf, and then signals new data available via call to
mp_hal_signal_input().
9 years ago
Paul Sokolovsky
2e75a17bab
esp8266: Fix issue when current repl line was garbage-collected.
Reference it from root pointers section.
9 years ago
Paul Sokolovsky
b1dfdaf6cb
py/ringbuf.h: Add reusable ring buffer class.
Features inline get/put operations for the highest performance. Locking
is not part of implementation, operation should be wrapped with locking
externally as needed.
9 years ago
Paul Sokolovsky
f50d9477c1
docs: network: esp8266: .scan() is now synchronous and returns result list.
9 years ago
Paul Sokolovsky
d7019d0628
docs: network: esp8266: status is WLAN object method.
9 years ago
Damien George
9475cc59e6
esp8266: Support synchronous wifi scanning.
That is: aps = if0.scan()
TODO: make sure that returned list has tuple with values in "standard"
order (whatever that standard is).
9 years ago
Damien George
2599672384
py/parsenum: Use pow function to apply exponent to decimal number.
Pow is already a dependency when compiling with floats, so may as well
use it here to reduce code size and speed up the conversion for most
cases.
9 years ago
Damien George
e1e7657277
py/formatfloat: Fix further cases of buffer overflow in formatting.
Includes extensive test cases to catch hopefully all cases where
buffer might overflow.
9 years ago
Damien George
03b8bb7ec9
py/formatfloat: Fix case of float format where leading digit was "10".
When taking the logarithm of the float to determine the exponent, there
are some edge cases that finish the log loop too large. Eg for an
input value of 1e32-epsilon, this is actually less than 1e32 from the
log-loop table and finishes as 10.0e31 when it should be 1.0e32. It
is thus rendered as :e32 (: comes after 9 in ascii).
There was the same problem with numbers less than 1.
9 years ago
Paul Sokolovsky
d88250c06e
esp8266: Reduce heap size for now to avoid random segfaults on WiFi connect.
9 years ago
Paul Sokolovsky
c4506ed869
esp8266: Let esp8266 "os" messages go to standard (REPL) UART.
That's definitely helpful for debugging.
9 years ago
Paul Sokolovsky
402a743821
esp8266/esp_mphal: Add support for debug UART-only output.
Helpful when debugging dupterm support (because otherwise all output is
spooled to dupterm too).
To use:
mp_printf(&mp_debug_print, "...");
9 years ago
Paul Sokolovsky
8fc5e56a6a
esp8266: Enable uos.dupterm() method.
9 years ago
Paul Sokolovsky
c961889e34
esp8266: Add basic support for duplicating REPL output.
9 years ago
Damien George
6ca17c1922
esp8266: Implement os.urandom function.
Uses what is suspected to be a hardware random number generator.
9 years ago
Paul Sokolovsky
b4070ee8a4
esp8266: Allow to build without FatFs support again.
9 years ago
Paul Sokolovsky
2f02302e22
esp8266: Support importing modules from filesystem.
9 years ago
danicampora
193795398d
docs: Correct pin interrupt example code for the WiPy.
9 years ago
Damien George
71d40f132d
esp8266: Zero out fs_user_mount state on (soft) reset.
Otherwise device stays mounted on soft reset and leads to corruption
(since block device object is now gone).
9 years ago
Paul Sokolovsky
9edd736ee6
esp8266/moduos: Add os.remove(), proxying to VFS object.
9 years ago
Paul Sokolovsky
e8e116e7fc
esp8266/moduos: Factor out VFS method proxy helper.
9 years ago
Paul Sokolovsky
8b08a0d9ed
esp8266/moduos: Add listdir() proxy for MP_STATE_PORT(fs_user_mount)[0].
I.e. os.listdir(...) will redirect to
MP_STATE_PORT(fs_user_mount)[0].listdir(...).
9 years ago
Damien George
61230e007d
esp8266/moduos: Use mp_rom_map_elem_t for static const dictionary.
9 years ago
Paul Sokolovsky
b01a373adb
esp8266: deploy: Use --flash_size=8m option to esptool.py.
Most esp8266 modules have at least 1MB (8Mbit) of flash. If not set, vendor
functions allow to access only first 512K.
9 years ago
Paul Sokolovsky
cd6194aefc
esp8266/esp8266.ld: Put FatFs to FlashROM.
9 years ago
Paul Sokolovsky
374654f2b8
esp8266: Enable FatFs support.
9 years ago
Paul Sokolovsky
fe9bc0c573
esp8266/README: Update for the current status of the port.
9 years ago
Paul Sokolovsky
bbc65d4eda
esp8266/modesp: flash_read(): Accept buffer to read to as a second argument.
9 years ago
Paul Sokolovsky
fd86bf5917
esp8266/modesp: flash_write(): Writes in multiples of 4 bytes.
9 years ago
Paul Sokolovsky
53302f1616
esp8266: Set up UART handling task soon into init process.
Otherwise, events may be posted to non-initialized task, which leads to
segfaults.
9 years ago
Paul Sokolovsky
651a188299
extmod/vfs_fat_diskio: Actually support sectors != 512 with Python blockdevs.
9 years ago