Wykres commitów

103 Commity (134c10e776a5d75cfdd6bf98697cb50d7da7adf6)

Autor SHA1 Wiadomość Data
Damien George 2137bc7124 stmhal: in EXTI interrupt handler wrap uPy calls in gc_lock and nlr_buf. 2014-04-08 15:21:26 +01:00
Damien George 26cf55ae05 Add a check for NULL nlr_top in nlr_jump.
If no nlr_buf has been pushed, and an nlr_jump is called, then control
is transferred to nlr_jump_fail (which should bail out with a fatal
error).
2014-04-08 14:08:14 +00:00
Damien George 97790455fe Improve REPL detecting when input needs to continue.
Full CPython compatibility with this requires actually parsing the
input so far collected, and if it fails parsing due to lack of tokens,
then continue collecting input.  It's not worth doing it this way.  Not
having compatibility at this level does not hurt the goals of Micro
Python.
2014-04-08 11:04:29 +00:00
Paul Sokolovsky 72d70cb045 unix, stmhal: Consistently use "FileIO" as class name for file objects.
They correspond to io.FileIO in io module hierarchy (with small caveat
that io.FileIO is raw file and works with bytes, not strings).
2014-04-08 04:08:16 +03:00
Andrew Scheller 902d9552c5 Replace some Makefile commands with variables in py/mkenv.mk 2014-04-07 01:35:45 +01:00
Damien George 65cad12d38 py: Add option to compiler to specify default code emitter.
Also add command line option to unix port to select emitter.
2014-04-06 11:48:15 +01:00
Damien George 27e735fd18 py: Replace stream_p with *stream_p in mp_obj_type_t.
This is to reduce ROM usage.  stream_p is used in file and socket types
only (at the moment), so seems a good idea to make the protocol
functions a pointer instead of the actual structure.

It saves 308 bytes of ROM in the stmhal/ port, 928 in unix/.
2014-04-05 23:02:23 +01:00
Damien George 7efc5b3f34 py: Make globals and locals proper dictionary objects.
Finishes addressing issue #424.

In the end this was a very neat refactor that now makes things a lot
more consistent across the py code base.  It allowed some
simplifications in certain places, now that everything is a dict object.

Also converted builtins tables to dictionaries.  This will be useful
when we need to turn builtins into a proper module.
2014-04-05 22:36:42 +01:00
Damien George 8b0535e23f py: Change module globals from mp_map_t* to mp_obj_dict_t*.
Towards addressing issue #424.

Had a small increase to ROM usage (order 60 bytes).
2014-04-05 21:53:54 +01:00
Damien George 12bab72d93 Improve GC finalisation code; add option to disable it. 2014-04-05 20:35:48 +01:00
Damien George ea13f407a3 py: Change nlr_jump to nlr_raise, to aid in debugging.
This does not affect code size or performance when debugging turned off.

To address issue #420.
2014-04-05 18:32:08 +01:00
Damien George e20b6b418c stmhal: autoflash now enters serial comms after flashing. 2014-04-05 17:16:00 +01:00
Damien George 38d3430320 stmhal: Add more escape seqs; add debugging output for escape seq. 2014-04-05 11:45:59 +01:00
Paul Sokolovsky cdffa32699 stmhal readline: Parse XTERM Home/End key codes.
Which are ESC O H, ESC O F.
2014-04-05 02:47:26 +03:00
Dave Hylands bf7d690e36 Add the git version to the banner 2014-04-03 16:55:15 -07:00
Damien George 3996611c1b stmhal: Add home/end cursor support in readline.
Home/end work in picocom and screen (different codes in those 2
programs).  Also, CTRL-A (for non-empty liny) and CTRL-E act as
home/end.
2014-04-03 23:30:24 +01:00
Damien George 3269cf2f93 Merge pull request #419 from pfalcon/stmhal-file-streams
stmhal: Reimplement file support using stream protocol API.
2014-04-03 22:48:32 +01:00
Damien George 57ad7aa66b stmhal: On soft reset, if in raw REPL mode, don't run main.py. 2014-04-03 22:44:08 +01:00
Damien George d8b47d3e02 stmhal: Fix raw REPL so that it passes through more ASCII chars. 2014-04-03 22:11:43 +01:00
Damien George 769b23a9c6 stmhal: Add powf, logf, log2f, log10f. 2014-04-03 22:11:28 +01:00
Damien George aba9f51fef stmhal: #undef log2f if it's defined. 2014-04-03 21:16:37 +01:00
Paul Sokolovsky 1d4d9ddd9e stmhal: Reimplement file support using stream protocol API.
This adds readline(), readall(), etc. methods. Also other fixes to make
Python API compliant and "with" support.
2014-04-03 22:14:29 +03:00
Damien George e90eefc84b stmhal: Fix servo object; add fpclassify to math functions. 2014-04-02 19:55:08 +01:00
Damien George a12be917a4 stmhal: Add timer module; move servo PWM from TIM2 to TIM5.
As per issue #257, servo is better on TIM5 because TIM2 is connected to
more GPIO.
2014-04-02 15:09:36 +01:00
Damien George 69dee59ce4 stmhal: Add backspace key to readline (along with delete key). 2014-04-02 14:28:58 +01:00
Dave Hylands 18d21d1abd Fix pyb.Led(n) code to work properly. 2014-04-01 10:41:22 -07:00
Dave Hylands baf6f14deb Enhance str.format support
This adds support for almost everything (the comma isn't currently
supported).

The "unspecified" type with floats also doesn't behave exactly like
python.

Tested under unix with float and double
Spot tested on stmhal
2014-04-01 01:17:33 -07:00
Damien George 15d18069c5 py: Remove old "run time" functions that were 1 liners. 2014-03-31 16:28:13 +01:00
Damien George df6567e634 Merge map.h into obj.h.
Pretty much everyone needs to include map.h, since it's such an integral
part of the Micro Python object implementation.  Thus, the definitions
are now in obj.h instead.  map.h is removed.
2014-03-30 13:54:02 +01:00
Damien George d17926db71 Rename rt_* to mp_*.
Mostly just a global search and replace.  Except rt_is_true which
becomes mp_obj_is_true.

Still would like to tidy up some of the names, but this will do for now.
2014-03-30 13:35:08 +01:00
Damien George 09d207785c stmhal: Unify naming of HW config; make SD detect configurable.
All board config macros now begin with MICROPY_HW_.

Renamed PYBv10 to PYBV10, since macros should be all uppercase.

Made SDCARD_DETECT configurable in mpconfigport.h, so that the SD
detect pin can be easily configured.
2014-03-30 12:30:35 +01:00
Damien George 038df43183 stmhal: Implement selector for USB device mode; improve boot up.
Can now choose at boot up whether the USB device is CDC+MSC or CDC+HID.
Choice is made by an option in boot.py, with default being CDC+MSC.
HID+MSC is not currently supported, but should be easy to implement.

Boot up now has ability to change the reset mode: hold down USR switch
while booting and LEDs will count from 1 to 7 to indicate the boot mode.
Release USR when correct mode is selected.  Current modes are 1 (normal
boot), 2 (safe mode), 3 (reset FS mode).
2014-03-30 00:00:15 +00:00
Damien George 64563e39b3 stmhal: Add CDC+HID USB device.
The HID device must appear before the CDC in order for both to work at
the same time.

Whilst the code is working, it's not currently used.
2014-03-29 21:57:30 +00:00
Damien George f4417a1f95 stmhal: Add Windows .inf file for USB CDC device. 2014-03-29 17:43:02 +00:00
Damien George c9fd6645b0 stmhal: Factor out stdio and readline to separate files.
Adds readline_init() to clear readline history on soft reset.  Addresses
issue #387.
2014-03-29 14:20:05 +00:00
Damien George 3e1a5c10c5 py: Rename old const type objects to mp_type_* for consistency. 2014-03-29 13:43:38 +00:00
Damien George bcc9298e5b stmhal: Add TODO's to exti.c; fix delay in lcd.c. 2014-03-29 01:24:44 +00:00
Damien George eed6f26bed stmhal: Use rt_check_nargs to check number of arguments. 2014-03-26 22:46:03 +00:00
Damien George 174bca7b5a stmhal: Remove ExtiMeta object and clean up class constants. 2014-03-26 22:35:55 +00:00
Damien George 9b196cddab Remove mp_obj_type_t.methods entry and use .locals_dict instead.
Originally, .methods was used for methods in a ROM class, and
locals_dict for methods in a user-created class.  That distinction is
unnecessary, and we can use locals_dict for ROM classes now that we have
ROMable maps.

This removes an entry in the bloated mp_obj_type_t struct, saving a word
for each ROM object and each RAM object.  ROM objects that have a
methods table (now a locals_dict) need an extra word in total (removed
the methods pointer (1 word), no longer need the sentinel (2 words), but
now need an mp_obj_dict_t wrapper (4 words)).  But RAM objects save a
word because they never used the methods entry.

Overall the ROM usage is down by a few hundred bytes, and RAM usage is
down 1 word per user-defined type/class.

There is less code (no need to check 2 tables), and now consistent with
the way ROM modules have their tables initialised.

Efficiency is very close to equivaluent.
2014-03-26 21:47:19 +00:00
Damien George c12b2213c1 Change mp_method_t.name from const char * to qstr.
Addresses issue #377.
2014-03-26 20:15:40 +00:00
Damien George 38f0c607b0 stmhal: Change Usart creation function to class make_new. 2014-03-25 23:40:54 +00:00
Damien George 3021632501 stmhal: Shuffle around some init functions in main(). 2014-03-25 23:33:47 +00:00
Damien George 6cfda3084d stmhal: Add I2C support; change accel driver to use new I2C. 2014-03-25 23:26:14 +00:00
Damien George caac542b23 Proper support for registering builtin modules in ROM.
Comes with some refactoring of code and renaming of files.  All modules
are now named mod*.[ch].
2014-03-25 14:18:18 +00:00
Dave Hylands f0729b19ad Fix netduino to build
Fix adc to work with resolution changes.
2014-03-24 23:26:41 -07:00
Damien George da5e269e51 stmhal: Make pyb.ADC the ADC class (not a function). 2014-03-24 19:27:13 +00:00
Dave Hylands 1403298a65 stmhal - fixed up adc stuff
Added support for the ADC channels and mappings to make_pins.py

I'm not sure if the hal properly deals with the channel 16/18 differences
between the 40x and 42x. It seems to deal with it partially. This particular
aspect will need testing on a 42x or 43x.
2014-03-24 11:16:35 -07:00
Damien George 6609d636d0 stmhal: Add comment to DAC driver for function to implement. 2014-03-24 15:17:40 +00:00
Damien George b13492f8ad stmhal: Add DAC driver. 2014-03-24 15:15:33 +00:00