Scott Shawcroft
bda6ee9a14
shared-bindings: Stop using max and min because C doesn't define them.
2016-11-28 19:48:48 -08:00
Scott Shawcroft
55c8c91e07
atmel-samd: Hook in bitbangio
2016-11-28 19:48:17 -08:00
Scott Shawcroft
6292f937da
esp8266: Make work with python 3 as default python impl.
2016-11-28 19:47:59 -08:00
Damien George
029f215ead
stmhal/adc: Add "mask" selection parameter to pyb.ADCAll constructor.
...
The "mask" parameter is used to select which pins the ADCAll constructor
will initialise to analog mode. It defaults to all pins (0xffffffff),
which is backwards compatible with previous behaviour.
2016-11-29 14:32:05 +11:00
Scott Shawcroft
77db3d450e
Add links to two more libraries.
2016-11-28 19:24:16 -08:00
Scott Shawcroft
b8bf15de16
atmel-samd: Add Circuit Playground M0 board. Its experimental.
2016-11-28 19:21:40 -08:00
Scott Shawcroft
f8898d01ce
py: fix python3 compatibility error
2016-11-28 19:20:51 -08:00
Scott Shawcroft
78f8565270
Add start and end kwargs to writeto and readfrom_into so a single buffer can be used to save memory.
2016-11-28 18:35:19 -08:00
Nicholas Graumann
0d75b0d962
stmhal: Add address parameters to openocd config files.
...
Also make l4 config the default for STM32L476DISC board.
2016-11-28 15:27:36 +11:00
Nicholas Graumann
50a2966913
stmhal: Add OpenOCD configuration for STM32L4.
2016-11-28 15:27:36 +11:00
Damien George
139b891d6d
stmhal: Add back GPIO_BSRRL and GPIO_BSRRH constants to stm module.
...
These were inadvertently removed with a recent upgrade to CMSIS, where
those registers were no longer defined in the CMSIS headers, and hence
no longer extracted.
2016-11-28 15:02:42 +11:00
Damien George
612599587b
py: Factor out common code from assemblers into asmbase.[ch].
...
All assemblers should "derive" from mp_asm_base_t.
2016-11-28 09:24:50 +11:00
Dave Hylands
21e1703d37
stmhal: Add support for flash storage on STM32F415.
2016-11-26 16:47:45 +11:00
Damien George
dbc09d03f6
tests/basics: Enable tests for list slice getting with 3rd arg.
...
Also add a test to check case when 3rd arg is 0.
2016-11-26 16:39:25 +11:00
Damien George
4c3c515bd1
tests/basics: Change dict_fromkeys test so it doesn't use generators.
...
And then it can run with the native emitter.
2016-11-26 16:38:38 +11:00
Damien George
e6cf5fb2cc
py/compile: Remove comment about TODO for short circuiting for if-stmt.
...
Short circuiting is handled correctly by c_if_cond, and constants within
short-circuit expressions are optimised by the parser.
2016-11-26 16:15:55 +11:00
Damien George
a4f96c8c2a
tests/basics: Add tests for if-expressions.
2016-11-26 16:15:31 +11:00
Damien George
a31a3a9fd5
tests/basics: Add test for dict.fromkeys where arg is a generator.
...
Improves coverage because it tests the case where the arg does not have a
__len__ slot.
2016-11-26 15:38:48 +11:00
Damien George
f8b71aabb4
stmhal/machine_i2c: Provide HW implementation of I2C peripherals for F4.
...
With this patch machine.I2C() uses HW I2C peripheral blocks on F4 MCUs.
Software I2C is used for other MCUs.
2016-11-25 16:31:43 +11:00
Damien George
49dcc253e3
stmhal/i2c: Expose the pyb_i2c_obj_t struct and some relevant functions.
...
So they can be used by other parts of the code.
2016-11-25 16:30:51 +11:00
Damien George
652ca2017d
stmhal/i2c: Add support for I2C4 hardware block on F7 MCUs.
2016-11-25 11:21:18 +11:00
Scott Shawcroft
a319ac2f4e
uheap: Switch to using gc_nbytes to measure allcoation size so we stop undercounting.
2016-11-23 17:32:50 -08:00
Scott Shawcroft
a8fbad5d8b
Add heap analysis scripts based on GDB breakpoint logs.
2016-11-23 17:31:53 -08:00
Damien George
3053748987
stmhal: Add beginnings of port-specific machine.I2C implementation.
...
This allows one to construct an I2C object using ids that are specific
to the stmhal port, eg machine.I2C('X'). Right now the implementation
of I2C uses software I2C but the idea is to just change the C-level I2C
protocol functions to hardware implementations later on.
2016-11-24 00:20:51 +11:00
Damien George
5d2279bec1
extmod/machine_i2c: Add hook to constructor to call port-specific code.
...
If MICROPY_PY_MACHINE_I2C_MAKE_NEW is defined then it is called when an
I2C object is constructed with an id which is not -1.
2016-11-24 00:12:51 +11:00
Damien George
8b74048d2a
extmod/machine_i2c: Expose soft I2C obj and readfrom/writeto funcs.
...
For external use by ports if needed.
2016-11-24 00:11:45 +11:00
Damien George
4c905616f0
extmod/machine_i2c: Remove trivial function wrappers.
2016-11-23 17:05:38 +11:00
Damien George
37333cb00a
extmod/machine_i2c: Add 'stop' argument to i2c readfrom/writeto meths.
2016-11-23 17:05:38 +11:00
Damien George
0bc99b4836
extmod/machine_i2c: Make i2c.write[to] methods return num of ACKs recvd.
2016-11-23 17:05:38 +11:00
Damien George
07e83573c8
extmod/machine_i2c: Add 'nack' argument to i2c.readinto.
2016-11-23 17:05:38 +11:00
Damien George
ced240e72a
extmod/machine_i2c: Make C-level functions return -errno on I2C error.
2016-11-23 17:05:38 +11:00
Damien George
946f8dd46f
extmod/machine_i2c: Remove unneeded i2c_write_mem/i2c_read_mem funcs.
2016-11-23 17:05:38 +11:00
Damien George
96c3911a0a
extmod/machine_i2c: Rewrite mem xfer funcs in terms of C-level protocol.
2016-11-23 17:05:37 +11:00
Damien George
c81247f1ab
extmod/machine_i2c: Rewrite i2c.scan in terms of C-level protocol.
2016-11-23 17:05:37 +11:00
Damien George
bc4ea69795
extmod/machine_i2c: Add argument to C funcs to control stop generation.
2016-11-23 17:05:37 +11:00
Damien George
b983cfaf41
extmod/machine_i2c: Add a C-level I2C-protocol, refactoring soft I2C.
2016-11-23 17:05:37 +11:00
Damien George
63a5df3cb4
docs/library/machine.I2C: Refine definitions of I2C methods.
2016-11-23 17:05:02 +11:00
Scott Shawcroft
ea1320bee7
Add uheap for debugging the size of objects. Still not perfect though.
2016-11-22 17:32:28 -08:00
Scott Shawcroft
cc412a80ad
atmel-samd: Support Trinket and Gemma M0 prototypes.
2016-11-22 12:03:42 -08:00
Damien George
a3320e7811
stmhal/i2c: Remove use of legacy I2C_NOSTRETCH_DISABLED option.
...
In the new HAL this is renamed to I2C_NOSTRETCH_DISABLE.
2016-11-22 17:40:50 +11:00
Rami Ali
2eff9c29a1
tests/basics: Improve user class coverage.
2016-11-22 15:49:02 +11:00
Rami Ali
1b41cacac7
tests/extmod: Improve ujson coverage.
2016-11-22 15:48:42 +11:00
Scott Shawcroft
8d5c90b0d0
Add script to build bins for Adafruit boards.
2016-11-21 14:40:28 -08:00
Paul Sokolovsky
037e6912c6
py/objtype: Implement __call__ handling for an instance w/o heap alloc.
...
By refactoring and reusing code from objboundmeth.
2016-11-22 01:33:55 +03:00
Scott Shawcroft
575d2e7998
atmel-samd: Default to code.txt instead of main.py (main.py will still work on its own.)
2016-11-21 14:32:11 -08:00
Scott Shawcroft
3b1109c47b
Merge pull request #50 from tannewt/microcontroller
...
Introduce shared APIs: nativeio, microcontroller and board modules. These are the only hardware API on the atmel-samd port.
2016-11-21 14:30:57 -08:00
Scott Shawcroft
ccbb5e84f9
This introduces an alternative hardware API called nativeio structured around different functions that are typically accelerated by native hardware. Its not meant to reflect the structure of the hardware.
...
Docs are here: http://tannewt-micropython.readthedocs.io/en/microcontroller/
It differs from upstream's machine in the following ways:
* Python API is identical across ports due to code structure. (Lives in shared-bindings)
* Focuses on abstracting common functionality (AnalogIn) and not representing structure (ADC).
* Documentation lives with code making it easy to ensure they match.
* Pin is split into references (board.D13 and microcontroller.pin.PA17) and functionality (DigitalInOut).
* All nativeio classes claim underlying hardware resources when inited on construction, support Context Managers (aka with statements) and have deinit methods which release the claimed hardware.
* All constructors take pin references rather than peripheral ids. Its up to the implementation to find hardware or throw and exception.
2016-11-21 14:11:52 -08:00
Scott Shawcroft
9321828158
py: Add ability to manually mark blocks during collect.
2016-11-21 14:11:49 -08:00
Damien George
7e820792da
stmhal: Updates to get F411 MCUs compiling with latest ST HAL.
2016-11-21 23:24:24 +11:00
Damien George
1f43d49f9e
tests/micropython: Move alloc-less traceback test to separate test file.
...
The native emitter doesn't provide proper traceback info so this test
should not be run in that case.
2016-11-21 17:39:23 +11:00