Wykres commitów

11 Commity (c4dc1b5c230e2383ea2975d0afd34e11d23ead5d)

Autor SHA1 Wiadomość Data
Damien George 7f9d1d6ab9 py: Overhaul and simplify printf/pfenv mechanism.
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-04-16 14:30:16 +00:00
Damien George 2cf6dfa280 stmhal: Prefix includes with py/; remove need for -I../py. 2015-01-01 21:06:20 +00:00
Damien George 3b603f29ec Use MP_DEFINE_CONST_DICT macro to define module dicts.
This is just a clean-up of the code.  Generated code is exactly the
same.
2014-11-29 14:39:27 +00:00
Emmanuel Blot f6932d6506 Prefix ARRAY_SIZE with micropython prefix MP_ 2014-06-19 18:54:34 +02:00
Damien George 6ac5dced24 py: Rename MP_OBJ_NOT_SUPPORTED to MP_OBJ_NULL.
See issue #608 for justification.
2014-05-21 19:42:43 +01:00
Damien George 04b9147e15 Add license header to (almost) all files.
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-05-03 23:27:38 +01:00
Paul Sokolovsky 9b71b16a94 unix,stmhal: Make "mpconfig.h" be first included, as other headers depend on it. 2014-05-02 18:08:16 +03:00
Damien George 6d3c5e4301 Add ARRAY_SIZE macro, and use it where possible. 2014-04-26 10:47:29 +01:00
Damien George f20e093b9b stmhal: Add lots of constants to stm module. 2014-04-19 00:32:25 +01:00
Damien George c66d86c5ce stmhal: Big cleanup; merge gpio into Pin; make names consistent.
This is an attempt to clean up the Micro Python API on the pyboard.
Gpio functionality is now in the Pin object, which seems more natural.
Constants for MODE and PULL are now in pyb.Pin.  Names of some
classes have been adjusted to conform to CamelCase.  Other
miscellaneous changes and clean up here and there.
2014-04-18 22:38:09 +01:00
Damien George 3f4898456b stmhal: Add stm module, which contains some constants for the MCU.
Also contains raw memory read/write functions, read8, read16, read32,
write8, write16, write32.  Can now do:

stm.write16(stm.GPIOA + stm.GPIO_BSRRL, 1 << 13)

This turns on the red LED.

With the new constant folding, the above constants for the GPIO address
are actually compiled to constants (and the addition done) at compile
time.  For viper code and inline assembler, this optimisation will make
a big difference.  In the inline assembler, using these constants would
not be possible without this constant folding.
2014-04-10 22:46:40 +01:00