Commit Graph

68 Commits

Author SHA1 Message Date
Damien George a11ceca807 Change int to uint for n_args in function with variable arguments. 2014-01-19 16:02:09 +00:00
Damien George 136b149e41 py: Add full traceback to exception printing. 2014-01-19 12:38:49 +00:00
Damien George 08335004cf Add source file name and line number to error messages.
Byte code has a map from byte-code offset to source-code line number,
used to give better error messages.
2014-01-18 23:24:36 +00:00
Damien George 8161a10de1 stm: Add stm import support. 2014-01-16 22:09:13 +00:00
Damien George 4899ff9470 Merge branch 'str-repr' of github.com:pfalcon/micropython into pfalcon-str-repr
Conflicts:
	tests/basics/tests/exception1.py
2014-01-15 22:39:03 +00:00
Damien George 9528cd66d7 Convert parse errors to exceptions.
Parser no longer prints an error, but instead returns an exception ID
and message.
2014-01-15 21:23:31 +00:00
Paul Sokolovsky 76d982ef34 type->print(): Distinguish str() and repr() variety by passing extra param. 2014-01-15 02:15:38 +02:00
Damien George 0367ad6214 stm: Include libgcc for __aeabi_d2f and __aeabi_f2d functions.
Thanks to Dave Hylands for this.
2014-01-14 23:48:11 +00:00
Damien George a04a33fee7 Merge pull request #175 from iabdalkader/master
Add missing ADC driver
2014-01-14 15:41:05 -08:00
mux 3591285091 Implement initial ADC support
* Add simple ADC driver, with support for ADC1 and all channels.
* Export MicroPython ADC object with read_channel function.
* Add stm32f4xx_adc.c and adc.c to Makefile.
2014-01-14 19:57:51 +02:00
Paul Sokolovsky 5d2499c638 Add "buffer management" and "shrink" API calls to vstr.
vstr is initially intended to deal with arbitrary-length strings. By
providing a bit lower-level API calls, it will be also useful to deal
with arbitrary-length I/O buffers (the difference from strings is that
buffers are filled from "outside", via I/O).

Another issue, especially aggravated by I/O buffer use, is alloc size
vs actual size length. If allocated 1Mb for buffer, but actually
read 1 byte, we don't want to keep rest of 1Mb be locked by this I/O
result, but rather return it to heap ASAP ("shrink" buffer before passing
it to qstr_from_str_take()).
2014-01-13 23:31:06 +02:00
Damien George f62d33aa1d Consolidate rt_make_function_[0123] to rt_make_function_n. 2014-01-13 19:50:05 +00:00
Damien George 328708eb25 stm: Re-instate C debugging USART port (disabled by default).
See pyb_usart_global_debug variable.

Also did some work on USB OTG, but nothing working yet.
2014-01-13 00:20:06 +00:00
Damien George cf11c961b4 stm: Disable usart calls from C.
Fixes Issue #132.
2014-01-11 10:01:22 +00:00
Damien George 2d45429122 Use memcpy instead of strncpy; add usart.status to stm. 2014-01-09 22:04:45 +00:00
mux c70ac7bf71 Add USART Micro Python Bindings
* Add Micro Python bindings to usart.c
* Export USART python object to namespace pyb
2014-01-09 13:36:13 +02:00
Damien George ea9e441a75 Merge pull request #112 from iabdalkader/master
Use LSI OSC for RTC clock when LSE is not detected
2014-01-08 07:34:38 -08:00
Damien George 9193f89296 Move lexerstr to main py directory (everyone uses it). 2014-01-08 15:28:26 +00:00
mux 5df3d47ee0 Use LSI OSC for RTC clock when LSE is not detected
* Fix rtc_init to use LSI for RTC clock source when LSE is not detected.
2014-01-08 11:26:18 +02:00
Dave Hylands 9b7b947b01 Updated teensy to use common code from stm directory.
Updated mconfigport.h to enable GC
2014-01-08 00:29:44 -08:00
Damien George 97209d38e1 Merge branch 'cplusplus' of https://github.com/ian-v/micropython into ian-v-cplusplus
Conflicts:
	py/objcomplex.c
2014-01-07 15:58:30 +00:00
ian-v 5fd8fd2c16 Revert MP_BOOL, etc. and use <stdbool.h> instead 2014-01-06 13:51:53 -08:00
ian-v 7a16fadbf8 Co-exist with C++ (issue #85) 2014-01-06 09:52:29 -08:00
Paul Sokolovsky 860ffb0a43 Convert many object types structs to use C99 tagged initializer syntax. 2014-01-05 22:34:09 +02:00
Damien George 823877bce0 stm: rename sw_xx to switch_xx; change Python bindings to new version. 2014-01-05 14:04:55 +00:00
mux de7fcc0c06 Move user switch code into a separate module
* Move user switch code from main.c into a separate module (usrsw)
* Add usrsw.c to Makefile
2014-01-05 14:56:46 +02:00
Damien George 71c5181a8d Convert Python types to proper Python type hierarchy.
Now much more inline with how CPython does types.
2014-01-04 20:21:15 +00:00
Damien George eb7bfcb286 Split qstr into pools, and put initial pool in ROM.
Qstr's are now split into a linked-list of qstr pools.  This has 2
benefits: the first pool can be in ROM (huge benefit, since we no longer
use RAM for the core qstrs), and subsequent pools use m_new for the next
pool instead of m_renew (thus avoiding a huge single table for all the
qstrs).

Still would be better to use a hash table, but this scheme takes us part
of the way (eventually convert the pools to hash tables).

Also fixed bug with import.

Also improved the way the module code is referenced (not magic number 1
anymore).
2014-01-04 15:57:35 +00:00
Damien George 1fb031744f Change mp_compile so that it returns a function object for the module. 2014-01-03 14:22:03 +00:00
Damien George 2870862601 Add module object, to be used eventually for import. 2014-01-02 21:30:26 +00:00
Damien 732407f1bf Change memory allocation API to require size for free and realloc. 2013-12-29 19:33:23 +00:00
Hagen Kaye 07590c2739 changes to Makefile and main.c to add i2c.c 2013-12-28 20:22:12 -05:00
Damien d99b05282d Change object representation from 1 big union to individual structs.
A big change.  Micro Python objects are allocated as individual structs
with the first element being a pointer to the type information (which
is itself an object).  This scheme follows CPython.  Much more flexible,
not necessarily slower, uses same heap memory, and can allocate objects
statically.

Also change name prefix, from py_ to mp_ (mp for Micro Python).
2013-12-21 18:17:45 +00:00
Damien b73085d288 stm: add pyb.sd_test; flash cache flushed only via MSD. 2013-12-20 11:45:06 +00:00
Damien 8c3da5c2c5 stm: flush storage cache immediately; improve user interface. 2013-12-17 18:36:19 +00:00
Damien 5285155ef7 stm: add basic Servo class, and stop and standby functions. 2013-12-11 00:40:15 +00:00
Damien d6b4c66565 stm: add Led object; add option to reset filesystem. 2013-12-06 00:41:33 +00:00
Damien 065f8a5e0e stm: initial commit of working CC3000 driver, based on Adafruit. 2013-12-05 20:38:23 +00:00
Damien 8fe8413b56 stm: servos on PA0-3; MMA filtering; timer for Python REPL. 2013-11-30 15:06:24 +00:00
Damien 39c6c59868 STM: add LCD functions for pixel access; add RNG Py bindings. 2013-11-09 20:15:48 +00:00
Damien bd8e110207 Add to STM code timer functionality to call Python on interrupt. 2013-11-06 23:04:33 +00:00
Damien 1c62d04e2e Add DAC, and simple audio driver to STM code. 2013-11-04 23:05:48 +00:00
Damien 0c70f88734 Add simple PWM control command to STM code. 2013-11-03 18:30:57 +00:00
Damien 0e496733fe Add simple file support to board. 2013-11-03 14:53:34 +00:00
Damien fecee2b0ae Floats work with MP on board; function for LCD pixel manipulation. 2013-11-02 16:41:51 +00:00
Damien 5892f4710e Working SD card, but no functionality yet (was hardware error). 2013-10-26 18:02:46 +01:00
Damien 8f7491a109 Add USART support, connected to stdio for REPL. 2013-10-26 18:01:48 +01:00
Damien 9281cd66c9 Add simple readline history. 2013-10-26 02:29:02 +01:00
Damien 8128941e6c Add support for RTC, used as a calendar. 2013-10-26 02:06:37 +01:00
Damien 58a1b4c6cf Add USB HID support. Runs as an alternative to VCP+MSC. 2013-10-25 20:53:54 +01:00