Damien George
6125ba4a7f
stmhal: Make switch a class, to follow suit of all other modules.
...
Instead of pyb.switch() as a function, it's more consistent (with
respect to all the other modules and peripherals) to have
pyb.Switch() create a switch object. This then generalises to having
multiple switches. Call the object to get its state. Use sw.callback
to set the callback function for when the switch is pressed.
2014-04-21 18:23:50 +01:00
Damien George
af797f476f
stmhal, servo: Rename calibrate method to calibration.
...
It should be a noun, since it supports getting and setting depending on
the number of arguments given.
2014-04-21 18:21:07 +01:00
Damien George
6691c9e655
stmhal, timer: Remove obsolete global variable.
2014-04-21 18:19:50 +01:00
Damien George
7fdfa93700
stmhal: Add Timer class: simple TIM control, incl callback on IRQ.
...
Simple but functional timer control. More sophistication will
eventually be added, or for now just use direct register access :)
Also added pyb.freq() function to get MCU clock frequencies.
2014-04-21 16:48:16 +01:00
Damien George
e5f8a77db6
py: Add 'align' and 'data' meta-instructions to inline assembler.
2014-04-21 13:33:15 +01:00
Damien George
764af4b7c5
stmhal: Make DAC dynamically allocate instances; rename dma->write_timed.
2014-04-21 13:06:19 +01:00
Damien George
83407ad082
stmhal: Clean up rtc.c a bit.
2014-04-21 12:45:59 +01:00
Damien George
7533700393
stmhal: Rename USART to UART.
...
It's really a UART because there is no external clock line (and hence no
synchronous ability, at least in the implementation of this module).
USART should be reserved for a module that has "S"ynchronous capabilities.
Also, UART is shorter and easier to type :)
2014-04-21 12:03:09 +01:00
Damien George
806f4aef9a
py: Fix super() bug, where it didn't allow instance access.
...
This is a one-liner fix. It gets the class-super.py test passing, but
is probably not a complete fix.
2014-04-21 02:11:07 +01:00
Damien George
b33d72aa89
Merge branch 'master' of github.com:micropython/micropython
2014-04-21 02:00:03 +01:00
Damien George
34f01c2ca1
stmhal: Add some documentation to I2C, SPI and USART modules.
2014-04-21 01:59:43 +01:00
Damien George
c7d2b10b85
Merge pull request #513 from errordeveloper/misc_fix/modffi_pkg_config
...
modffi: Fix how we call `pkg-config`
2014-04-21 01:22:27 +01:00
Damien George
0ae21a81f7
Merge branch 'master' of github.com:micropython/micropython
2014-04-21 01:18:05 +01:00
Damien George
3771a097da
stmhal: Improve USART class, to be more like SPI and I2C.
...
The three classes I2C, SPI and USART now have a fairly uniform (Python)
API. All are constructed, initialised and deinitialised in the same
way. They can have most of their parameters set, using keyword arguments.
All have send and recv (although slightly different with I2C requiring an
address in master mode). recv can do inplace receiving (ie store the
data in a previously-created bytearray).
It's just polling mode at the moment, but interrupt and DMA would be
nice to add.
2014-04-21 01:14:14 +01:00
Damien George
eb8bdf4df3
stmhal, SPI and I2C: Improvements to functionality and consistency.
2014-04-21 00:10:04 +01:00
Damien George
64ba6ca127
py: Small change to mp_arg_parse_all.
2014-04-21 00:09:44 +01:00
Paul Sokolovsky
521de04ce2
windows: Add README with basic cross-compile instructions.
2014-04-20 22:35:11 +03:00
Paul Sokolovsky
7f7c7aa76a
windows: Unbreak mingw32 build (cross-compiling under Linux).
2014-04-20 22:24:44 +03:00
Paul Sokolovsky
a196d08dfc
unix windows: mingw32 doesn't have realpath(), use _fullpath() instead.
2014-04-20 22:24:44 +03:00
Paul Sokolovsky
1f2ca1c1f9
unix file: mingw32 has STDIN_FILENO and friends in stdio.h .
...
TODO: Never "optimize" includes any more!
2014-04-20 22:24:44 +03:00
Paul Sokolovsky
353b0289f3
py: Add win32-specific header for alloca().
2014-04-20 22:24:44 +03:00
Paul Sokolovsky
41809a1ced
nlrx86.S: Another ifdef for win32 symbol underscoring issues.
2014-04-20 22:24:44 +03:00
Paul Sokolovsky
b76fd842f0
unix mem_info(): Dump GC info only if it's enabled.
2014-04-20 22:24:43 +03:00
Damien George
643284fc8e
Merge branch 'master' of github.com:micropython/micropython
2014-04-20 19:08:46 +01:00
Damien George
ff91156d34
stmhal: Improved configurability for I2C and SPI busses.
...
The HAL handles for the I2C/SPI objects are rather large, so we don't
want to unnecessarily include them.
2014-04-20 19:06:15 +01:00
Paul Sokolovsky
26905259d0
objarray: Slice subscription operation: properly test for op subtype.
...
Also, checked that both bytearray and array.array actually support generic
(a-la list) slice assignment and deletion. Added TODOs.
2014-04-20 20:58:33 +03:00
Paul Sokolovsky
5b991ae2d3
gc: gc_realloc(): Fix byte-to-block calculation.
2014-04-20 20:46:39 +03:00
Damien George
2b925d7696
Merge branch 'fix-netduino-i2c-spi' of github.com:dhylands/micropython into dhylands-fix-netduino-i2c-spi
2014-04-20 18:32:17 +01:00
Damien George
dde739d364
py, gc: Further simplify coding-style of gc_realloc.
...
No logic changes, just coding style to make it easy to read.
2014-04-20 18:16:25 +01:00
Damien George
5f6a25fc50
py: Wrap #if's around emitter functions that are used only by emitcpy.
...
3 emitter functions are needed only for emitcpy, and so we can #if them
out when compiling with emitcpy support.
Also remove unused SETUP_LOOP bytecode.
2014-04-20 18:02:27 +01:00
Damien George
3558f62fb5
py: Making closures now passes pointer to stack, not a tuple for vars.
...
Closed over variables are now passed on the stack, instead of creating a
tuple and passing that. This way memory for the closed over variables
can be allocated within the closure object itself. See issue #510 for
background.
2014-04-20 17:50:40 +01:00
Paul Sokolovsky
bc5f0c1977
objclosure: Store reference to entire closed variables tuple.
...
Avoids pointer-to-field garbage collection issue. Fixes #510 .
2014-04-20 13:08:33 +03:00
Paul Sokolovsky
2758b7d3e2
objcell: Add disabled by default print method for debugging.
2014-04-20 13:08:33 +03:00
Paul Sokolovsky
c86889dafb
gc: "new" gc_realloc: Rewrite in plain C, fixing bunch of bugs.
...
There were typos, various rounding errors trying to do concurrent counting
in bytes vs blocks, complex conditional paths, superfluous variables, etc.,
etc., all leading to obscure segfaults.
2014-04-20 13:08:33 +03:00
Paul Sokolovsky
ed162b5ef2
gc: Recover simple gc_realloc implementation, make easier to switch between.
2014-04-20 13:08:33 +03:00
Paul Sokolovsky
9fd02e186d
modsocket: Add setblocking() method.
2014-04-20 13:08:33 +03:00
Paul Sokolovsky
0f836ef893
modstruct: Add 'O' typecode for passing mp_obj_t.
...
Useful as callback data, etc.
2014-04-20 13:08:33 +03:00
Paul Sokolovsky
4e4fa94c4c
modstruct: Use proper int accessor which checks input value type.
2014-04-20 13:08:33 +03:00
Ilya Dmitrichenko
8e998ed280
modffi: Fix how we call pkg-config
2014-04-20 09:30:46 +01:00
Dave Hylands
f70630c58f
Fix i2c and spi to compile for Netduino Plus 2
2014-04-20 00:06:03 -07:00
Damien George
53775026e7
Merge branch 'master' of github.com:micropython/micropython
2014-04-20 01:26:25 +01:00
Damien George
fd6925b4b9
stmhal: Small bug fixes and simplifications.
2014-04-20 01:25:58 +01:00
Damien George
f87b35e779
py: Fix mp_arg_parse_all.
2014-04-20 01:25:15 +01:00
Damien George
13c19c57a0
stmhal: Only init RNG if it's used.
2014-04-20 00:45:59 +01:00
Damien George
0a6e9f562f
stmhal: Update ExtInt to allow keyword arguments in constructor.
2014-04-20 00:38:50 +01:00
Damien George
57e415859a
stmhal: Tidy up and improve consistency across modules.
2014-04-20 00:30:09 +01:00
Damien George
d689430e79
stmhal: Add SPI class.
...
Also some updates to compile with latest changes to core py.
2014-04-20 00:16:30 +01:00
Damien George
c7c4a84397
stm: Update to compile with latest changes to core py.
2014-04-20 00:15:35 +01:00
Damien George
a3f94e0030
py: Add arg checking helper functions.
...
These are to assist in writing native C functions that take positional
and keyword arguments. mp_arg_check_num is for just checking the
number of arguments is correct. mp_arg_parse_all is for parsing
positional and keyword arguments with default values.
2014-04-20 00:13:22 +01:00
Paul Sokolovsky
efc36f0cea
test/class-super: Expose super() breakage.
2014-04-19 21:54:06 +03:00