Commit Graph

8363 Commits

Author SHA1 Message Date
Scott Shawcroft
67ec52d7a9 atmel-samd: Swap out pulseio for touchio based on FreeTouch. 2017-04-18 09:44:04 -07:00
Henrik Sölver
1f3887dc28 stmhal/timer: Clear interrupt flag before setting callback.
Sometimes when setting a channel callback the callback fires immediately,
even if the compare register is set to a value far into the future. This
happens when the free running counter has previously been equal to what
happens to be in the compare register.

This patch make sure that there is no pending interrupt when setting a
callback.
2017-04-18 18:09:59 +10:00
Damien George
c7c14f1634 tests/micropython: Add test for micropython.kbd_intr(). 2017-04-18 17:24:30 +10:00
Damien George
bbb4b9822f py/modmicropython: Add micropython.kbd_intr() function.
It controls the character that's used to (asynchronously) raise a
KeyboardInterrupt exception.  Passing "-1" allows to disable the
interception of the interrupt character (as long as a port allows such a
behaviour).
2017-04-18 17:24:30 +10:00
Damien George
29b26f3922 docs/library/machine.SPI: Fix formatting of bullet list to stop warning. 2017-04-18 15:40:04 +10:00
Damien George
850f79e552 docs/library/machine.I2C: Remove WiPy-specific return values.
cc3200 has been updated to conform to the API and now returns None.
2017-04-18 15:39:27 +10:00
Damien George
9d7c53734c cc3200/mods/pybi2c: Make readfnom_mem_into/writeto_mem return None.
This aligns the I2C class to match the standard machine.I2C API.

Note that this is a (small) breaking change to the existing cc3200 API.
The original API just returned the size of the input buffer so there's no
information lost by this change.  To update scripts users should just use
the size of the buffer passed to these functions to get the number of bytes
that are read/written.
2017-04-18 15:31:08 +10:00
Damien George
daa5ba5629 docs/esp8266/quickref: Add links from quickref page to machine classes. 2017-04-18 15:28:18 +10:00
Damien George
d4675e7674 docs/library/machine.*: Add cross-reference label to individual classes. 2017-04-18 15:27:37 +10:00
Damien George
1f1a03d0c3 docs/library/machine.I2C: Deconditionalise all methods.
The cc3200 port is now similar enough to the standard machine.I2C API so
that all conditionals can be removed.
2017-04-18 15:04:51 +10:00
Damien George
c49b265389 docs/wipy/general: Add section about specifics of I2C implementation. 2017-04-18 15:04:30 +10:00
Damien George
27f0862550 docs/wipy/quickref: Update reference for change to I2C API. 2017-04-18 13:20:07 +10:00
Damien George
8f205c2c9b cc3200/mods/pybi2c: Make machine.I2C constructor/init conform to HW API.
This is a user-facing change to the cc3200's API, to make it conform to the
new machine hardware API.  The changes are:

- change I2C constructor to: I2C(id=0, *, freq=100000, scl=None, sda=None)
- change I2C init to: init(*, freq, scl, sda)
- removal of machine.I2C.MASTER constant
- I2C str/repr no longer prints I2C.MASTER

To update existing code it should be enough to just remove the I2C.MASTER
constant from contructor/init for I2C.
2017-04-18 13:16:05 +10:00
Damien George
fabaa61437 docs/library/machine.UART: Remove pyboard-specific section.
stmhal doesn't have a machine.UART class so this section is not needed.
2017-04-18 12:13:51 +10:00
Damien George
e75fd3a8e9 minimal/main: Make Cortex-M vector table constant. 2017-04-18 10:17:24 +10:00
Paul Sokolovsky
57b5ee2fcf tests/run-tests: Don't post-process CRASH result in any way.
If we got a CRASH result, return early, similar to SKIP. This is important
because previous refactor changed branching logic a bit, so CRASH now gets
post-processed into CRASH\n, which broke remote hardware tests.
2017-04-16 17:59:11 +03:00
Paul Sokolovsky
a78703f188 docs/library/machine: Typo fix in machine_callbacks section. 2017-04-16 10:14:05 +03:00
Paul Sokolovsky
9ef6bb5480 docs/machine: Move machine.main() misnomer to wipy's known issues. 2017-04-16 10:12:01 +03:00
Paul Sokolovsky
a8ece0358f docs/machine.UART: Deconditionalize normal methods. 2017-04-16 09:54:55 +03:00
Paul Sokolovsky
ac8843ceec docs/library/ussl: Deconditionalize, wipy notes moved to its documentation. 2017-04-16 09:41:32 +03:00
Paul Sokolovsky
a0fb360f1b docs/library/uos: urandom: Generalize description.
Don't give a guarantee of HW RNG, only a possibility of its usage.
2017-04-16 09:22:47 +03:00
Paul Sokolovsky
ae831ec0a8 docs/library/micropython: Deconditionalize. 2017-04-16 09:18:47 +03:00
Scott Shawcroft
225fdb0307 Merge pull request #118 from dhalbert/master
atmel-samd: HID report descriptor for mouse had to be COMPILER_WORD_ALIGNED
2017-04-15 11:05:48 -07:00
Damien George
61616e84ce extmod/machine_signal: Rename "inverted" arg to "invert", it's shorter.
A shorter name takes less code size, less room in scripts and is faster to
type at the REPL.

Tests and HW-API examples are updated to reflect the change.
2017-04-15 21:01:47 +03:00
Dan Halbert
2fe6b74e90 atmel-samd: HID report descriptor for mouse had to be COMPILER_WORD_ALIGNED. 2017-04-15 10:18:56 -04:00
Paul Sokolovsky
209eaec599 socket_send: Don't send more than MTU allows.
As Zephyr currently doesn't handle MTU itself (ZEP-1998), limit amount
of data we send on our side.

Also, if we get unsuccessful result from net_nbuf_append(), calculate
how much data it has added still. This works around ZEP-1984.
2017-04-14 19:46:27 +03:00
Paul Sokolovsky
5b8122f2bb tests/run-tests: Search feature checks wrt to main script location.
If run-tests script is run from another dir, we still want to look up
feature checks in run-tests' dir.
2017-04-14 17:07:13 +03:00
Scott Shawcroft
b653c3c8fc Correct PulseOut example code 2017-04-13 17:52:13 -07:00
Scott Shawcroft
f37ce1c595 atmel-samd: Turn off PulseIn interrupts on reset. Can hardfault otherwise. 2017-04-13 17:50:06 -07:00
Paul Sokolovsky
a1c39ffb69 docs/esp8266/tutorial/intro: Reword section on flash size requirement.
Give a clearly dissuading tone on end users trying 512KB version
- it has to many end-usery features lacking.
2017-04-14 01:12:04 +03:00
Paul Sokolovsky
fbe7a81e30 esp8266/README: Add notice about 512K version. 2017-04-14 01:03:46 +03:00
Paul Sokolovsky
40acbc2e10 esp8266/README: Replace reference of alpha status to beta status. 2017-04-14 00:56:41 +03:00
Scott Shawcroft
f0e24bd812 atmel-samd: Account for pending ticks in PulseIn. Fixes #116. 2017-04-13 14:47:34 -07:00
Scott Shawcroft
d1b15cf1a3 esp8266: Don't reset TX and RX lines. The pullup is required for
the Adafruit Huzzah Breakout because it has a diode to protect
against 5v logic which effectively blocks 1s and relies on the
pull up to produce them.
2017-04-13 14:15:06 -07:00
Paul Sokolovsky
84e17063c3 zephyr/modusocket: Strip packet header right in the receive callback.
Instead of complicating recv() implementation.
2017-04-13 22:19:16 +03:00
Damien George
967cad7434 tests/extmod/utimeq1: Improve coverage of utimeq module. 2017-04-13 23:34:28 +10:00
Scott Shawcroft
4a4f29b8f9 atmel-samd: Rework status LED implementation
* Track status pin use by user code separately so it can take over the pins and then give them back.
* Switch to hardware SPI for APA102 on Gemma and Trinket.
* Merge microcontroller/types.h into microcontroller/Pin.h to better match approach going forwards.
2017-04-12 15:24:50 -07:00
Damien George
c7e8c6f7de py/gc: Execute finaliser code in a protected environment.
If a finaliser raises an exception then it must not propagate through the
GC sweep function.  This patch protects against such a thing by running
finaliser code via the mp_call_function_1_protected call.

This patch also adds scheduler lock/unlock calls around the finaliser
execution to further protect against any possible reentrancy issues: the
memory manager is already locked when doing a collection, but we also don't
want to allow any scheduled code to run, KeyboardInterrupts to interupt the
code, nor threads to switch.
2017-04-12 13:52:04 +10:00
Damien George
08242eed26 py/nlrsetjmp: Add check for failed NLR jump.
Also optimise the function so it only needs to call the MP_STATE_THREAD
macro once (following how other nlr code is written).
2017-04-12 13:50:31 +10:00
Damien George
fe79234ca0 unix: Enabled high-quality float hashing in coverage build. 2017-04-12 13:38:17 +10:00
Damien George
a73501b1d6 py/objfloat: Add implementation of high-quality float hashing.
Disabled by default.
2017-04-12 13:38:17 +10:00
Damien George
816413e4b2 py: Optimise types for common case where type has a single parent type.
The common cases for inheritance are 0 or 1 parent types, for both built-in
types (eg built-in exceptions) as well as user defined types.  So it makes
sense to optimise the case of 1 parent type by storing just the type and
not a tuple of 1 value (that value being the single parent type).

This patch makes such an optimisation.  Even though there is a bit more
code to handle the two cases (either a single type or a tuple with 2 or
more values) it helps reduce overall code size because it eliminates the
need to create a static tuple to hold single parents (eg for the built-in
exceptions).  It also helps reduce RAM usage for user defined types that
only derive from a single parent.

Changes in code size (in bytes) due to this patch:

    bare-arm:       -16
    minimal (x86): -176
    unix (x86-64): -320
    unix nanbox:   -384
    stmhal:         -64
    cc3200:         -32
    esp8266:       -108
2017-04-12 13:22:21 +10:00
Damien George
fc710169b7 py/obj: Clean up and add comments describing mp_obj_type_t struct. 2017-04-12 13:20:26 +10:00
Scott Shawcroft
8505de1ced atmel-samd: rename cplay_m0_flash to circuitplayground_express and update for new rev (F). 2017-04-11 17:59:02 -07:00
Scott Shawcroft
45dfaa835f atmel-samd: Reset PulseIn correctly on soft reset. 2017-04-11 16:56:06 -07:00
Scott Shawcroft
1e8fc15a41 atmel-samd: Fix PulseIn duration math to handle case when current us time is after the last one but more than a ms has passed. 2017-04-11 16:55:42 -07:00
Paul Sokolovsky
81d302b8f8 zephyr/modusocket: Call net_nbuf_print_frags() in recv callback if DEBUG > 1. 2017-04-11 15:25:42 +03:00
Damien George
e31fbd9b41 py/objint: Use unsigned arithmetic when formatting an integer.
Otherwise the edge case of the most negative integer value will not convert
correctly.
2017-04-11 15:18:35 +10:00
Damien George
f66df1efc8 py/objint: Extract small int value directly because type is known. 2017-04-11 15:16:09 +10:00
Damien George
6c564aa408 unix, windows: Use core-provided KeyboardInterrupt exception object. 2017-04-11 13:31:49 +10:00