summaryrefslogtreecommitdiff
path: root/stmhal/pybstdio.c
AgeCommit message (Collapse)Author
2015-05-24stmhal: Implement sys.std{in,out,err}.buffer, for raw byte mode.Damien George
It's configurable and only enabled for stmhal port.
2015-05-13stmhal: Add readinto and readlines methods to sys.stdin, pyb.USB_VCP().Damien George
Addresses issue #1255.
2015-04-16py: Overhaul and simplify printf/pfenv mechanism.Damien George
Previous to this patch the printing mechanism was a bit of a tangled mess. This patch attempts to consolidate printing into one interface. All (non-debug) printing now uses the mp_print* family of functions, mainly mp_printf. All these functions take an mp_print_t structure as their first argument, and this structure defines the printing backend through the "print_strn" function of said structure. Printing from the uPy core can reach the platform-defined print code via two paths: either through mp_sys_stdout_obj (defined pert port) in conjunction with mp_stream_write; or through the mp_plat_print structure which uses the MP_PLAT_PRINT_STRN macro to define how string are printed on the platform. The former is only used when MICROPY_PY_IO is defined. With this new scheme printing is generally more efficient (less layers to go through, less arguments to pass), and, given an mp_print_t* structure, one can call mp_print_str for efficiency instead of mp_printf("%s", ...). Code size is also reduced by around 200 bytes on Thumb2 archs.
2015-02-13stmhal: Make pybstdio usable by other ports, and use it.Damien George
Now all ports can use pybstdio.c to provide sys.stdin/stdout/stderr, so long as they implement mp_hal_stdin_* and mp_hal_stdout_* functions.
2015-01-07stmhal: Collect all root pointers together in 1 place.Damien George
A GC in stmhal port now only scans true root pointers, not entire BSS. This reduces base GC time from 1700ms to 900ms.
2015-01-01stmhal: Prefix includes with py/; remove need for -I../py.Damien George
2014-08-30Change some parts of the core API to use mp_uint_t instead of uint/int.Damien George
Addressing issue #50, still some way to go yet.
2014-08-10doc: Document gc, sys, math, cmath.Damien George
2014-07-31stmhal: Add USB_VCP class/object, for direct USB VCP control.Damien George
Before, pyb.stdin/pyb.stdout allowed some kind of access to the USB VCP device, but it was basic access. This patch adds a proper USB_VCP class and object with much more control over the USB VCP device. Create an object with pyb.USB_VCP(), then use this object as if it were a UART object. It has send, recv, read, write, and other methods. send and recv allow a timeout to be specified. Addresses issue 774.
2014-07-27py: Change stream protocol API: fns return uint; is_text for text.Damien George
2014-07-20stmhal: Fix REPL printing by cooking output sent to stdout_obj.Damien George
Recent changes to builtin print meant that print was printing to the mp_sys_stdout_obj, which was sending data raw to the USB CDC device. The data should be cooked so that \n turns into \r\n.
2014-07-03Rename machine_(u)int_t to mp_(u)int_t.Damien George
See discussion in issue #50.
2014-07-02Merge branch 'teensy-new' of github.com:dhylands/micropython into ↵Damien George
dhylands-teensy-new Conflicts: stmhal/pin_named_pins.c stmhal/readline.c Renamed HAL_H to MICROPY_HAL_H. Made stmhal/mphal.h which intends to define the generic Micro Python HAL, which in stmhal sits above the ST HAL.
2014-06-28stmhal: Include mpconfig.h before all other includes.Paul Sokolovsky
It defines types used by all other headers. Fixes #691.
2014-06-15Updated teensy to build.Dave Hylands
Refactored some stmhal files which are shared with teensy.
2014-06-15stmhal: Fix file print methods to use print instead of printf.Damien George
Also make stdout_print_strn static (ultimately this function needs to be merged with stdout_tx_strn).
2014-06-15stmhal: Update and improve LCD driver.Damien George
Still some method names to iron out, and funtionality to add, but this will do for the first, basic version.
2014-05-03Add license header to (almost) all files.Damien George
Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
2014-04-21stmhal: Rename USART to UART.Damien George
It's really a UART because there is no external clock line (and hence no synchronous ability, at least in the implementation of this module). USART should be reserved for a module that has "S"ynchronous capabilities. Also, UART is shorter and easier to type :)
2014-04-16stmhal: Improve flash storage cache management.Damien George
Internal flash used for the filesystem is now written (from the cache) only after a 5s delay, or when a file is closed, or when the drive is unmounted from the host. This delay means that multiple writes can accumulate in the cache, and leads to less writes to the flash, making it last longer. It's implemented by a high-priority interrupt that takes care of flash erase and write, and flushing the cache. This is still only an interim solution for the flash filesystem. It eventually needs to be replaced with something that uses less RAM for the cache, something that can use more of the flash, and something that does proper wear levelling.
2014-04-13stmhal: Add stdin/stdout/stderr objects.Damien George
Available via sys.std{in,out,err}. Basic reading and writing supported. Even sys.stdin.readline!
2014-03-29stmhal: Factor out stdio and readline to separate files.Damien George
Adds readline_init() to clear readline history on soft reset. Addresses issue #387.