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.
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.
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.
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/.
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 :)
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.