Commit Graph

10362 Commits

Author SHA1 Message Date
Glenn Ruben Bakke f10abda60a nrf5/sdk: Updating bluetooth le driver to extract data length and pointer from the event structure upon gatts write operation. 2017-02-22 19:54:02 +01:00
Glenn Ruben Bakke 7fee0cdde1 nrf5/modules: Expose ubluepy characteristic and peripheral types as external declaration in ublupy header. 2017-02-22 19:10:18 +01:00
Scott Shawcroft fc718d9437 ESP8266: Stop supporting 400khz neopixels through old esp module API.
It still accepts the parameter for backwards compatibility and to
provide a good error when it can't work.

Using the `neopixel_write` module instead is recommended because its
available on all CircuitPython supported ports.
2017-02-22 12:59:04 +01:00
Damien George 1034d9acc8 tools/gen-cpydiff.py: Set the Python import path to find test modules. 2017-02-22 15:50:58 +11:00
Damien George 047af9b10b cc3200: Remove socket.timeout class, use OSError(ETIMEDOUT) instead.
socket.timeout is a subclass of OSError, and using the latter is more
efficient than having a dedicated class.  The argument of OSError is
ETIMEDOUT so the error can be distinguished from other kinds of
OSErrors.  This follows how the esp8266 port does it.
2017-02-22 15:08:32 +11:00
Damien George d03f089baa cc3200/mods/modusocket: Init vars to 0 to silence compiler warnings.
Some compilers can't analyse the code to determine that these variables
are always set before being used.
2017-02-22 14:58:37 +11:00
Damien George e859ddf3e1 cc3200: Enable uerrno module with short, custom list of error codes.
Since we recently replaced the OSError string messages with simple error
codes, having the uerrno module gets back some user friendly error
messages.  The total code size (after removing strings, replacing with
uerrno module) is decreased.
2017-02-22 12:58:11 +11:00
Damien George b1b090255c py/moduerrno: Make list of errno codes configurable.
It's configurable by defining MICROPY_PY_UERRNO_LIST.  If this is not
defined then a default is provided.
2017-02-22 12:58:11 +11:00
Damien George f563406d2e py/moduerrno: Make uerrno.errorcode dict configurable.
It's configured by MICROPY_PY_UERRNO_ERRORCODE and enabled by default
(since that's the behaviour before this patch).

Without this dict the lookup of errno codes to strings must use the
uerrno module itself.
2017-02-22 12:58:11 +11:00
Damien George 22a6344ebe cc3200: When raising OSError's use MP_Exxx as arg instead of a string. 2017-02-22 12:58:11 +11:00
Damien George 8bb8e97dfe cc3200: Convert to using uPy internal errno numbers. 2017-02-22 12:58:11 +11:00
Damien George 85ab469c64 cc3200: Move wlan socket glue functions from modwlan to modusocket.
It saves about 400 bytes of code space because the functions can now be
inlined.
2017-02-22 11:29:19 +11:00
Glenn Ruben Bakke 09fd2b86d1 nrf5: Updating main to initialize bluetooth le uart module right before bluetooth REPL is started. 2017-02-21 23:38:35 +01:00
Glenn Ruben Bakke 3e66898c37 nrf5/sdk: Updating bluetooth le uart implemenatation to block until cccd is written. 2017-02-21 23:37:52 +01:00
Scott Shawcroft 44e5d36086 ESP8266: Add reset note to webrepl init. 2017-02-21 11:50:32 +01:00
Damien George 71ae3f389d cc3200: Remove remaining references to std.h. 2017-02-21 18:01:43 +11:00
Damien George b0a6dda115 drivers/display/lcd160cr: Fix bugs with lcd.get_pixel().
Fixes issues #2880 and #2881.
2017-02-21 17:40:34 +11:00
Damien George 8c5988bf61 cc3200/mods/modwlan: Add int casts to silence compiler warnings. 2017-02-21 17:29:40 +11:00
Damien George 0258f819bd cc3200/mods/modwlan: Allow antenna diversity to be fully compiled out. 2017-02-21 17:29:02 +11:00
Damien George a162832b1a cc3200/mods/modwlan: Make multi-threaded a proper compile-time option. 2017-02-21 17:28:14 +11:00
Damien George 26ddd4b621 cc3200/mods/modwlan: Remove unused header includes; simplify others. 2017-02-21 17:27:17 +11:00
Damien George 1c35270667 cc3200: Remove util/std.h, can just use stdio.h instead. 2017-02-21 17:26:21 +11:00
Damien George d9f7120af1 cc3200: Use simplelink API instead of emulated BSD API.
Most of cc3200 uses explicit simplelink calls anyway, and this means there
are no longer any clashes with macros from the C stdlib.
2017-02-21 17:24:12 +11:00
Damien George 29551ba566 cc3200: Move stoupper to ftp.c and define in terms of unichar_toupper.
ftp.c is the only user of this function so making it static in that file
allows it to be inlined.  Also, reusing unichar_toupper means we no longer
depend on the C stdlib for toupper, saving about 300 bytes of code space.
2017-02-21 17:20:58 +11:00
Glenn Ruben Bakke 80b2d7e4ad nrf5/sdk: Backing up ubluepy version of ble uart service for Bluetooth LE REPL. 2017-02-21 00:15:51 +01:00
Glenn Ruben Bakke acb5c7b4ee nrf5/modules: Updating ubluepy example in header to align with bluetooth uart service characteristic's. 2017-02-20 21:28:07 +01:00
Glenn Ruben Bakke c9bfcb5bc5 nrf5/modules: Implementing characteristic write method. Possible to use write for both write and notifications. 2017-02-20 21:27:21 +01:00
Glenn Ruben Bakke 7223950864 nrf5/sdk: Remaning bluetooth driver function ble_drv_attr_notif to *_notify. 2017-02-20 21:26:19 +01:00
Glenn Ruben Bakke 601f07cbf2 nrf5/modules: Adding props and attrs parameter to ubluepy characteristic constructor to override default values. Adding method for reading characteristic properties. Adding values to the local dict table that gives possibility to OR together a configuration of properties and attributes in the keyword argument during construction. 2017-02-20 20:28:19 +01:00
Glenn Ruben Bakke a973dde603 nrf5/sdk: Adding parsing of characteristic properties and attributes (extra descriptions for the characteristic, for now cccd). 2017-02-20 20:24:27 +01:00
Glenn Ruben Bakke 89fc67a9f8 nrf5/modules: Adding new members to ubluepy characteristic object, props and attrs. Adding enum typedefs for various properties and attributes. 2017-02-20 20:22:23 +01:00
Damien George 465a604547 tests/cpydiff: Add a test for storing iterable to a list slice. 2017-02-20 17:22:12 +11:00
Rami Ali 3218ccd70d docs: Modify Makefile and indexes to generate cPy-differences pages. 2017-02-20 17:14:35 +11:00
Rami Ali b7fa63c7ce tools: Add gen-cpydiff.py to generate docs differences.
This patch introduces the a small framework to track differences between
uPy and CPython.  The framework consists of:

- A set of "tests" which test for an individual feature that differs between
  uPy and CPy.  Each test is like a normal uPy test in the test suite, but
  has a special comment at the start with some meta-data: a category (eg
  syntax, core language), a human-readable description of the difference, a
  cause, and a workaround.  Following the meta-data there is a short code
  snippet which demonstrates the difference.  See tests/cpydiff directory
  for the initial set of tests.

- A program (this patch) which runs all the tests (on uPy and CPy) and
  generates nicely-formated .rst documenting the differences.

- Integration into the docs build so that everything is automatic, and the
  differences appear in a way that is easy for users to read/reference (see
  latter commits).

The idea with using this new framework is:

- When a new difference is found it's easy to write a short test for it,
  along with a description, and add it to the existing ones.  It's also easy
  for contributors to submit tests for differences they find.

- When something is no longer different the tool will give an error and
  difference can be removed (or promoted to a proper feature test).
2017-02-20 17:14:34 +11:00
Rami Ali 86c7507233 tests/cpydiff: Add initial set of tests for uPy-CPython differences.
These tests are intended to fail, as they provide a programatic record of
differences between uPy and CPython.  They also contain a special comment
at the start of the file which has meta-data describing the difference,
including known causes and known workarounds.
2017-02-20 16:50:34 +11:00
Damien George 89267886cc py/objlist: For list slice assignment, allow RHS to be a tuple or list.
Before this patch, assigning anything other than a list would lead to a
crash.  Fixes issue #2886.
2017-02-20 15:09:59 +11:00
Paul Sokolovsky 6fc6f10b1e tests/heapalloc_exc_raise.py: Heap alloc test for raising/catching exc. 2017-02-20 04:22:32 +03:00
Glenn Ruben Bakke 7c0195da6c nrf5/modules: Syncing uart module code after upmerge with upstream master. 2017-02-19 19:06:12 +01:00
Glenn Ruben Bakke f69c1acbbe Merge branch 'nrf52' into nrf5_no_sdk 2017-02-19 19:03:20 +01:00
Glenn Ruben Bakke 05ec4f64e2 Merge branch 'master' into nrf52 2017-02-19 19:02:29 +01:00
Glenn Ruben Bakke 486d05ff17 nrf5/boards: Releasing more RAM for heap use in the nrf51 s110 linker script. 2017-02-19 19:00:31 +01:00
Scott Shawcroft 261a6ff0bb atmel-samd: Fix build by correcting internal neopixel writes. 2017-02-19 17:39:34 +01:00
Scott Shawcroft a5a41d7163 atmel-samd: Save a little space by tweaking error messages. 2017-02-19 17:24:15 +01:00
Scott Shawcroft 8584f5fece atmel-samd: Remove support for UART REPL from Arduino Zero. 2017-02-19 17:23:31 +01:00
Scott Shawcroft f0b62a2b0e Save space by only supporting 800khz neopixels. 2017-02-19 17:22:42 +01:00
Scott Shawcroft 710b5d8aff Two I2C fixes:
1) Bus error will be thrown on read/write errors with errno set. (Read didn't used to fail at all.)
2) try_lock correctly returns boolean whether lock was grabbed.

Fixes #87
2017-02-19 17:02:29 +01:00
Scott Shawcroft e9659e61f8 Switch enum-like attributes to all caps and add print support for them. Make room for this functionality by adding a shared __enter__ function object. #76 2017-02-19 16:11:33 +01:00
Scott Shawcroft c4ee6d5716 atmel-samd: Remove pin reference from AnalogOut error. Fixes #83 2017-02-19 14:38:24 +01:00
Scott Shawcroft d67968e3c3 Add print support to Pin. #83 #76 2017-02-19 14:23:29 +01:00
Scott Shawcroft 39ac7240a8 Add CircuitPlayground, Trinket and Gemma to Travis build. 2017-02-19 14:11:55 +01:00