Damien George
f6d25ecf7b
stmhal: Add simple README.txt to freshly-created filesystem.
2014-04-15 19:20:25 +01:00
Damien George
c13d0b3304
stmhal: Wrap skin-named-usarts in PYBV10 #if.
2014-04-15 11:52:47 +01:00
Damien George
cce7119a2b
stmhal: Work around crazy bug in USB CDC.
...
Packets of 64 bytes length are not send to the host until the following
packet is sent. Fixed by never sending packets of 64 bytes length.
2014-04-14 01:46:25 +01:00
Damien George
7e5be0b1b4
stmhal: Improved usart module a bit.
2014-04-14 01:45:58 +01:00
Damien George
6dba016a56
stmhal: Add pyb.wfi() function (calls __WFI).
2014-04-14 01:45:24 +01:00
Damien George
86a03044e3
stmhal: Add stdin/stdout/stderr objects.
...
Available via sys.std{in,out,err}. Basic reading and writing supported.
Even sys.stdin.readline!
2014-04-13 19:00:56 +01:00
Damien George
212f89e61a
stmhal: Improve USB CDC write function (increase timeout).
2014-04-13 16:39:04 +01:00
Damien George
73496fbbe4
py: Fix up source-line calculation.
...
Should address issue #475 .
2014-04-13 14:51:56 +01:00
Damien George
cb861a5c6a
stm[hal]: Init mp_sys_path and mp_sys_argv correctly.
2014-04-13 13:19:09 +01:00
Damien George
640e7e4779
Merge pull request #476 from pfalcon/static-sys
...
Convert sys module to static allocation
2014-04-13 12:52:39 +01:00
Damien George
8a1cab952f
py: Fix mp_get_buffer, and use it in more places.
...
Must use mp_obj_get_type to get the type of an object. Can't assume
mp_obj_t is castable to mp_obj_base_t.
2014-04-13 12:08:52 +01:00
Damien George
0aab675108
stmhal: Little hack to dump GC allocation table using pyb.info().
...
Pass a single parameter (doesn't matter what): pyb.info(1), will dump
the GC alloc table.
2014-04-13 11:10:58 +01:00
Paul Sokolovsky
4165cd1c0c
stmhal: Update for static mod sys.
2014-04-13 07:02:57 +03:00
Damien George
82c7b1b1d5
stmhal: Put a USB structure in ROM; GC doesn't scan the data segment.
2014-04-12 18:50:20 +01:00
Damien George
b96c7c03ca
stmhal: Move fatfs volume/partition lookup table to ROM.
2014-04-12 00:51:57 +01:00
Damien George
60427864b1
stmhal: Move I2C objects to ROM.
2014-04-12 00:51:41 +01:00
Damien George
037b3e0e21
Merge pull request #458 from lurch/patch-1
...
Tweak pybcdc.inf to match recent changes to pybcdc.h
2014-04-10 22:51:48 +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
Andrew Scheller
fec6f018ee
Tweak pybcdc.inf to match recent changes to pybcdc.h
2014-04-10 02:07:55 +01:00
Damien George
7a5f9e94ad
stmhal: Make /src/main.py just /main.py; allow SD to be used as root device.
2014-04-09 23:30:34 +01:00
Damien George
a5c18f3285
stmhal: Update windows driver; \r\n newlines and addition USB id.
2014-04-09 02:23:24 +01:00
Damien George
b99ca2cdde
stmhal: Add windows cdc .inf driver to flash filesystem.
2014-04-09 01:16:49 +01:00
Damien George
8e6f98b166
stmhal: Improve help() function.
2014-04-09 01:16:29 +01:00
Damien George
229347139b
stmhal: Add functionality to Servo object.
...
Can now calibrate, set pulse width, angle and speed.
2014-04-09 00:45:45 +01:00
Dave Hylands
3bbceeaaf7
Fix make-pins.py to support having multiple names for a pin.
...
SW and X17 now both map to PB3
2014-04-08 15:45:47 -07:00
Damien George
b04488151e
stmhal: Make USRSW re-register the EXTI callback each time it's set.
2014-04-08 22:35:42 +01:00
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