Paul Sokolovsky
9ae0912496
modffi: Update for MP_OBJ_STOP_ITERATION refactor.
2014-04-19 20:05:47 +03:00
Damien George
27dd471098
Merge branch 'master' of github.com:micropython/micropython
2014-04-19 02:18:19 +01:00
Damien George
3d19137442
stmhal: Add pyb.Pin.init method to re-init GPIO pin mode.
2014-04-19 02:17:57 +01:00
Damien George
6e44381cce
stmhal: Improve RTC class; make fatfs use RTC for time stamping files.
2014-04-19 02:17:30 +01:00
Damien George
ed5117f6a8
stmhal: Add pyb.unique_id, to get unique id of MCU.
2014-04-19 01:28:18 +01:00
Paul Sokolovsky
206dd2a905
stmhal: Update for mp_binary_get_size() refactor.
2014-04-19 03:27:37 +03:00
Paul Sokolovsky
6204460461
modstruct: Initial implementation of struct.pack().
2014-04-19 03:22:08 +03:00
Paul Sokolovsky
504e23388c
objstr: Init hash in mp_obj_str_builder_start() to 0.
2014-04-19 03:21:06 +03:00
Paul Sokolovsky
4602b9a79f
obj.h: Typo fix in comment.
2014-04-19 03:21:06 +03:00
Paul Sokolovsky
1355cf42f2
modstruct: Fix .calcsize() to account for struct type/alignment.
2014-04-19 03:21:06 +03:00
Paul Sokolovsky
5695e07256
modstruct: Support 'q' & 'Q' type codes.
2014-04-19 03:18:14 +03:00
Paul Sokolovsky
752d2080b7
modffi: Mark 'p' type spec deprecated, replace with 'P'.
...
'p' in struct module is "pascal string". 'P' is void*.
2014-04-19 03:18:14 +03:00
Damien George
44ee42de50
stmhal: Rename pyb.Led to pyb.LED to conform to naming rules.
...
It's Light Emitting Diode, so should be LED.
2014-04-19 00:54:33 +01:00
Damien George
8cf08a58a1
stmhal: Remove pyb.input (use sys.stdio.read(1) instead).
2014-04-19 00:50:50 +01:00
Damien George
f20e093b9b
stmhal: Add lots of constants to stm module.
2014-04-19 00:32:25 +01:00
Damien George
561f83c9cf
Merge branch 'master' of github.com:micropython/micropython
2014-04-18 23:35:24 +01:00
Damien George
38ae014e42
stmhal: Update ADC, DAC and I2C objects to use new buffer protocol.
...
Main reason for expanding buffer protocol API was to support writes to a
buffer in ADC module (see read_timed). With this change you can now
create an array of arbitrary type and ADC.read_timed will store into
that array in the correct format (byte, int, float). I wonder though if
all these changes were really worth it to support just this function.
Hopefully this enhanced buffer protocol API (with typecode specified)
will be used elsewhere.
2014-04-18 23:28:56 +01:00
Damien George
71e9bfa20d
py: Add mp_binary_set_val_array_from_int, to store an int directly.
2014-04-18 23:28:12 +01:00
Damien George
b11b85adaa
py: Allow to pass buffer protocol flags to get_buffer helper funcs.
2014-04-18 22:59:24 +01:00
Damien George
a8f5d15fc6
stmhal: Update help and comments re gpio changing to Pin.
2014-04-18 22:48:59 +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
738bdeb73a
unix: Update to use new buffer protocol interface with typecode.
2014-04-18 22:31:24 +01:00
Damien George
57a4b4f178
py: Add typecode to buffer protocol.
...
When querying an object that supports the buffer protocol, that object
must now return a typecode (as per binary.[ch]). This does not have to
be honoured by the caller, but can be useful for determining element
size.
2014-04-18 22:29:21 +01:00
Damien George
3fd2d7fad2
py: Tidy up function argument error messages.
...
We are not as verbose as CPython, and maybe a bit too cryptic sometimes.
2014-04-18 22:06:55 +01:00
Damien George
32ca164992
py: Tidy up array.array; add more error handling.
2014-04-18 22:04:06 +01:00
Paul Sokolovsky
0fc4775cd6
sequence: Further simplify sequence comparison.
2014-04-18 21:47:58 +03:00
Paul Sokolovsky
83eba5dec5
sequence: Fix glaring bug in sequence comparison.
2014-04-18 21:42:54 +03:00
Paul Sokolovsky
7de5377ca7
objfloat: Try to achieve the same float printing format as CPython does.
...
Test usecase I used is print(time.time()) and print(time.time() - time.time()).
On Linux/Glibc they now give the same output as CPython 3.3. Specifically,
time.time() gives non-exponential output with 7 decimal digits, and subtraction
gives exponential output e-06/e-07.
2014-04-18 21:21:59 +03:00
Damien George
90edf9e13b
inlinethumb: Add wfi, cpsid and cpsie instructions.
2014-04-18 16:56:54 +01:00
Damien George
906d383850
stmhal: Remove non-ascii character from include file.
2014-04-18 16:17:40 +01:00
Damien George
90ac822097
Add Python code conventions to CODECONVENTIONS.
2014-04-18 12:46:46 +01:00
Paul Sokolovsky
599bbc111c
py: from import * should not import symbols starting with underscore.
...
I skipped implementing this initially, but then it causes __name__
of current module be overwritten and relative imports fail.
2014-04-18 04:20:17 +03:00
Damien George
5b65f0c7d3
py: Rename USE_COMPUTED_GOTOS to USE_COMPUTED_GOTO and enable on stmhal.
...
On stmhal, computed gotos make the binary about 1k bigger, but makes it
run faster, and we have the room, so why not. All tests pass on
pyboard using computed gotos.
2014-04-17 23:24:13 +01:00
Damien George
559d8239ca
tests: Move gen_context to import tests, because it relies on import.
2014-04-17 23:21:52 +01:00
Damien George
ea8d06c39d
py: Add MP_OBJ_STOP_ITERATION and make good use of it.
...
Also make consistent use of MP_OBJ_NOT_SUPPORTED and MP_OBJ_NULL.
This helps a lot in debugging and understanding of function API.
2014-04-17 23:19:36 +01:00
Damien George
1e935d8689
Merge branch 'master' of github.com:micropython/micropython
2014-04-17 22:11:48 +01:00
Damien George
729f7b42d6
py: Merge BINARY_OP_SUBSCR and store_subscr (w/ delete) into subscr.
...
mp_obj_t->subscr now does load/store/delete.
2014-04-17 22:10:53 +01:00
Paul Sokolovsky
4abaa1b12b
unix modffi: Convert to static module structures.
2014-04-18 00:05:27 +03:00
Damien George
de7c425139
py: Simplify objfun/objgenerator connection, no need to call bc_get.
2014-04-17 19:16:11 +01:00
Damien George
d89b69eb3a
Merge branch 'master' of github.com:micropython/micropython
2014-04-17 18:58:46 +01:00
Damien George
d0f9f6cd3f
py: Fix pfenv_print_strn to return correct number of chars printed.
...
With this fix, all tests in tests/basics pass on pyboard.
2014-04-17 18:58:09 +01:00
Paul Sokolovsky
e1e4249a67
unix modsocket: Convert to static module structures.
2014-04-17 20:34:04 +03:00
Paul Sokolovsky
59a2f4828d
unix: Make mem_info() dump GC info too.
...
mem_info() is already pretty hacky, let it be more hacky.
2014-04-17 20:27:01 +03:00
Paul Sokolovsky
eb2fc9787a
unix modtime: Convert to static module structures.
2014-04-17 20:27:01 +03:00
Paul Sokolovsky
de8292202e
unix modtime: Adhere to MICROPY_ENABLE_FLOAT better.
2014-04-17 20:27:00 +03:00
Paul Sokolovsky
b7e90ea078
objgenerator: Generator must execute in its defining lexical context.
...
I.e. with its own globals. So, just as for functions, we need to switch
globals when resuming a generator.
2014-04-17 20:27:00 +03:00
Paul Sokolovsky
f26a30710c
objfun: Add local header.
...
This follows pattern already used for objtuple, etc.: objfun.h's content
is not public - each and every piece of code should not have access to it.
It's not private either - with out architecture and implementation language
(C) it doesn't make sense to keep implementation of each object strictly
private and maintain cumbersome accessors. It's "local" - intended to be
used by a small set of "friend" (in C++ terms) objects.
2014-04-17 20:27:00 +03:00
Damien George
71d3112f7e
py: Make built-in 'range' a class.
...
Addresses issue #487 .
2014-04-17 18:18:55 +01:00
Damien George
d553be5982
build: Simplify build directory layout by putting all headers in genhdr.
...
Any generated headers go in $(BUILD)/genhdr/, and are #included as
'genhdr/xxx.h'.
2014-04-17 18:03:27 +01:00
Damien George
2d1f865d16
Merge branch 'relocatable-build-dir' of github.com:lurch/micropython into lurch-relocatable-build-dir
2014-04-17 17:44:52 +01:00