Commit Graph

3508 Commits

Author SHA1 Message Date
Kathryn Lingel eb3cb4d99b Fix tests and clarify first character access 2019-05-07 09:30:55 -07:00
Kathryn Lingel 54aa1ce6de Filter private methods from tab completion 2019-05-06 12:16:29 -07:00
Scott Shawcroft 54ef87c6de
Correct collect of permanent pointers.
The previous implementation managed to keep all but the head
pointer of the list.

Fixes #1814
2019-04-18 15:44:44 -07:00
Scott Shawcroft 713a38d1a2
Merge pull request #1754 from dmazzella/dmazzella-patch-1
add support for USER_C_MODULES
2019-04-17 09:41:20 -07:00
Scott Shawcroft 6132a05fd9
Include cleanup and style tweaks 2019-04-16 10:19:07 -07:00
Scott Shawcroft 0e03a321e4
Fully split gamepadshift from gamepad 2019-04-16 10:11:54 -07:00
Scott Shawcroft c927e6b938
Split GamePadShift from GamePad to save space on most boards. 2019-04-15 15:40:06 -07:00
Radomir Dopieralski 4dc286fa14 Reorganize the gamepad code 2019-04-12 20:43:29 +02:00
Scott Shawcroft debff19126
Check for null local dictionaries 2019-04-10 14:48:27 -07:00
Scott Shawcroft a152ac1cef
Merge remote-tracking branch 'adafruit/master' into pybadge_revd 2019-04-10 10:58:45 -07:00
Scott Shawcroft 5028f87b09
Tweak pybadge and fix display bugs
* Update pybadge pins and flash for rev D
* TileGrid now validates the type of the pixel_shader.
* Display actually handles incoming subclass objects.
* MicroPython will inspect native parents to see if special
  accessors are used.
2019-04-09 18:32:52 -07:00
Scott Shawcroft ee7a77db65
Check that a never free pointer is on the heap.
This fixes a crash on boards with built-in displays which statically
allocate the display bus. When the pointer is provided to never
free, it tries to allocate on the non-existant heap and crashes.
2019-04-09 15:12:28 -07:00
Scott Shawcroft 72992070c5
Fix boards with no shared busses. 2019-04-09 11:36:10 -07:00
Scott Shawcroft 0f003ac5b8
Reorganize board busses into shared-bindings and shared-module. 2019-04-08 16:58:50 -07:00
Damiano Mazzella b6b5eaa878
Update mkrules.mk 2019-04-05 21:41:40 +02:00
Damiano Mazzella a20aab0491
Update obj.h 2019-04-05 21:41:10 +02:00
Damiano Mazzella af38f882ec
Update objmodule.c 2019-04-05 21:40:28 +02:00
Damiano Mazzella 7549326ceb
Update py.mk 2019-04-05 21:39:44 +02:00
Damiano Mazzella d1698230a1
Add files via upload 2019-04-05 21:38:32 +02:00
Dan Halbert c9571fe1ea ROTARYIO_MODULE mistakenly omitted from module list 2019-04-01 17:59:59 -04:00
Dan Halbert 35ab1a1983 Turn on frequencyio only on CIRCUITPY_FULL_BUILD 2019-03-27 16:57:35 -04:00
Dan Halbert 4c1849ae7c turn on reversed() for all builds 2019-03-26 22:15:26 -04:00
Scott Shawcroft 2c93ce5a28
Merge pull request #1672 from dhalbert/regular-fs-flush
flush flash filesystem once a second
2019-03-26 13:47:43 -07:00
Dan Halbert 26262cd477
Merge pull request #1670 from tannewt/fontio
Move Glyph and BuiltinFont into fontio
2019-03-20 17:36:04 -04:00
Dan Halbert fbf166af1a enable MICROPY_CPYTHON_COMPAT for most builds except CIRCUITPY_SMALL_BUILD; remove a few other things to make fit 2019-03-20 14:36:24 -04:00
Dan Halbert 2459eabd66 flush flash filesystem once a second 2019-03-20 12:21:36 -04:00
Scott Shawcroft 5e2fec714c
Move Glyph and BuiltinFont into fontio
It was confusing in displayio.

Fixes #1662
2019-03-19 16:22:09 -07:00
Scott Shawcroft 911509c80c
Fix function signature 2019-03-12 14:05:31 -07:00
Scott Shawcroft 03be42ab84
Enter safe mode when an allocation is attempted on an uninitialized heap. 2019-03-12 11:18:26 -07:00
sommersoft 2cd6a79016 better handle frequencyio inclusion 2019-03-01 22:46:57 -06:00
sommersoft a44bfc2730 Merge branch 'master' of https://github.com/adafruit/circuitpython into new_freq_in 2019-03-01 21:24:30 -06:00
Radomir Dopieralski 89b2788d11 Apply review fixes:
* fix formatting
* fix copyrights
* fix CIRCUITPYTHON_GAMEPAD guards
* add CIRCUITPYTHON_PEW guards to reset
* fix module list order
2019-03-01 16:05:15 +01:00
Radomir Dopieralski 45fea86554 Rebase on top of CircuitPython 4.x 2019-03-01 14:59:21 +01:00
Radomir Dopieralski 88e40193ae Add a _pew module 2019-02-28 23:32:58 +01:00
sommersoft 9d3fcf9a0d add frequencyio to circuipy_ configs 2019-02-24 18:05:51 -06:00
Scott Shawcroft 0261c57d32
Merge pull request #1582 from dhalbert/remove-u-names
rename ure, ujson, and uerrno to re, json, and errno
2019-02-21 13:24:07 -08:00
Dan Halbert 10d3a20f8a Add CIRCUITPY macro; rename u* only when CIRCUITPY=1 2019-02-21 11:09:44 -05:00
Dan Halbert c5dbdbe88c rename ure, ujson, and uerrno to re, json, and errno 2019-02-21 00:33:36 -05:00
Scott Shawcroft 46fd60c703
Prevent infinite display update recursion and fix VFS mounting
Fixes #1529
2019-02-19 14:50:31 -08:00
Dan Halbert 1177c32679
Merge pull request #1562 from debrouxl/minor_improvements_and_fixes
Minor fixes
2019-02-19 13:22:42 -05:00
Dan Halbert 263e9822ea typo 2019-02-18 12:21:31 -05:00
Dan Halbert ba77a9ca80 move non-u names for native modules to circuitpy_mpconfig.h 2019-02-18 12:08:23 -05:00
Dan Halbert 5c884bf6d6 forgot json 2019-02-18 07:57:54 -05:00
Dan Halbert c1144a288f regularize how module weak links and alternate names are listed 2019-02-18 00:45:43 -05:00
Dan Halbert 97aeb1953b correct weak module links; samd module only in m4 ports; update libraries 2019-02-17 23:48:08 -05:00
Dan Halbert 5ec92415b0 fix module weak links; add missing nrf features 2019-02-17 17:29:28 -05:00
Lionel Debroux 94e51de166 Define MP_SSIZE_MAX for LONGINT_IMPL_LONGLONG as well.
Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
2019-02-17 11:21:35 +01:00
Dan Halbert 619b4f13fd
Merge pull request #1555 from tannewt/print_flush
Support print("", flush=True)
2019-02-15 21:46:16 -05:00
Dan Halbert 7b3f7605b8 address @tannewt changes: move and rename common files; remove PORT_HEAP_SIZE 2019-02-15 20:32:32 -05:00
Scott Shawcroft e6b140e7a0
Support print("", flush=True)
Fixes #1127
2019-02-15 16:53:19 -08:00
Noralf Trønnes 0865c9d381 extmod/ure: Support search/match() pos and endpos parameters
MICROPY_PY_URE_MATCH_SPAN_START_END is used to enable the functionality
since it's similar.
2019-02-14 15:42:28 +01:00
Damien George b9dc23c070 extmod/modure: Add ure.sub() function and method, and tests.
This feature is controlled at compile time by MICROPY_PY_URE_SUB, disabled
by default.

Thanks to @dmazzella for the original patch for this feature; see #3770.
2019-02-14 15:42:22 +01:00
Damien George cbeac094ef extmod/modure: Add match.span(), start() and end() methods, and tests.
This feature is controlled at compile time by
MICROPY_PY_URE_MATCH_SPAN_START_END, disabled by default.

Thanks to @dmazzella for the original patch for this feature; see #3770.
2019-02-14 15:42:21 +01:00
Damien George a24fabbb6f extmod/modure: Add match.groups() method, and tests.
This feature is controlled at compile time by MICROPY_PY_URE_MATCH_GROUPS,
disabled by default.

Thanks to @dmazzella for the original patch for this feature; see #3770.
2019-02-14 15:42:19 +01:00
Scott Shawcroft c17f147be9
A variety of displayio improvements
This changes a number of things in displayio:
* Introduces BuiltinFont and Glyph so the built in font can be used by libraries. For boards with
  a font it is available as board.TERMINAL_FONT. Fixes #1172
* Remove _load_row from Bitmap in favor of bitmap[] access. Index can be x/y tuple or overall index. Fixes #1191
* Add width and height properties to Bitmap.
* Add insert and [] access to Group. Fixes #1518
* Add index param to pop on Group.
* Terminal no longer takes unicode character info. It takes a BuiltinFont instead.
* Fix Terminal's handling of [###D vt100 commands used when up arrowing into repl history.
* Add x and y positions to Group plus scale as well.
* Add bitmap accessor for BuiltinFont
2019-02-11 20:55:05 -08:00
Craig Forbes 1662e02c1b Add human readable text for ENOSPC. 2019-02-06 14:59:01 -06:00
Scott Shawcroft 0c50154c83
Use generic overflow so 64 bit is handled ok. 2019-02-04 16:11:16 -08:00
Scott Shawcroft c60f77d5ab
Check sequence multiply for length overflow
Fixes #1279
2019-02-04 15:33:36 -08:00
Scott Shawcroft 5555a24479
Never long live the main dictionary.
It's contents change often and may be referenced elsewhere.

Fixes #1443
2019-02-01 16:05:37 -08:00
Scott Shawcroft a39fc94dde
Don't long live class attributes
When they are added later, they are also referenced in the main
dictionary.

Fixes #1218
2019-02-01 16:04:16 -08:00
Dan Halbert e170e03f8c Merge remote-tracking branch 'adafruit/master' into bleio2 2019-01-21 20:38:26 -05:00
Dan Halbert a8f4aa4796 Merge remote-tracking branch 'adafruit/master' into struct-compat 2019-01-20 21:47:13 -05:00
Scott Shawcroft 479b286600
Fix dict_make_new 2019-01-20 17:32:43 -08:00
Scott Shawcroft 5ddc50473a
Check for null kw_args 2019-01-20 16:18:34 -08:00
Dan Halbert 7a09af73ec Improve struct compatibility with CPython 2019-01-20 15:12:34 -05:00
Dan Halbert 62df7ab730 Improve struct compatibility with CPython 2019-01-20 15:10:09 -05:00
Dan Halbert 28cfd8a513 CharacteristicBuffer: make it be a stream class; add locking 2019-01-19 19:45:35 -05:00
Scott Shawcroft b569e8bab0
More make_new updates 2019-01-18 17:09:56 -08:00
Scott Shawcroft 0318a9a9bc
More make_new fixes for unix build 2019-01-18 11:53:09 -08:00
Scott Shawcroft c271754962
fixup micropy 2019-01-14 18:09:02 -08:00
Scott Shawcroft 12c8b00556
Don't build machine class we don't use. 2019-01-14 17:30:01 -08:00
Scott Shawcroft 72d993d60c
py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
Dan Halbert 1dc3957e72 LocalPeripheral is now Peripheral; more work on basic GATTS support; UART not working yet 2018-12-30 22:33:49 -05:00
Dan Halbert 4167bf5b24 wip: advertising works, but not connection 2018-12-27 00:04:04 -05:00
Dan Halbert bfa66861ef Merge remote-tracking branch 'adafruit/master' into bleio-rev 2018-12-13 16:33:15 -05:00
Scott Shawcroft 6ef8639971
Rework safe mode and have heap overwrite trigger it.
This creates a common safe mode mechanic that ports can share.
As a result, the nRF52 now has safe mode support as well.

The common safe mode adds a 700ms delay at startup where a reset
during that window will cause a reset into safe mode. This window
is designated by a yellow status pixel and flashing the single led
three times.

A couple NeoPixel fixes are included for the nRF52 as well.

Fixes #1034. Fixes #990. Fixes #615.
2018-12-06 14:24:20 -08:00
Dan Halbert 125901e4e2 Merge remote-tracking branch 'adafruit/master' into bleio-rev 2018-12-06 12:41:38 -05:00
Scott Shawcroft 7ad2e6ace3
Add stack validity check and raise an error when it happens.
The backtrace cannot be given because it relies on the validity
of the qstr data structures on the heap which may have been
corrupted.

In fact, it still can crash hard when the bytecode itself is
overwritten. To fix, we'd need a way to skip gathering the
backtrace completely.

This also increases the default stack size on M4s so it can
accomodate the stack needed by ASF4s nvm API.
2018-12-04 23:26:04 -08:00
Dan Halbert 80db2cec99 UART changes: timeout in secs, write bytes, etc. 2018-12-03 12:04:32 -05:00
Scott Shawcroft 9d07e95351
Add support for adding release info into adafruit/circuitpython-org
This also changes the build script to python with better output.
2018-11-30 00:30:57 -08:00
Dan Halbert 1763ffe245 More UUID work; use mp_raise for exceptions 2018-11-20 23:04:58 -05:00
Noralf Trønnes c5aa2e9300 Support OSError attributes
This adds support for the OSError attributes : errno, strerror, filename and filename2.
CPython only sets errno if 2 arguments has been passed in. This has not been implemented here.

CPython OSError.args is capped at 2 items for backward compatibility reasons. This has not been
implemented here.

MICROPY_CPYTHON_COMPAT has to be enabled to get these attributes.

mp_common_errno_to_str() has been extended to check mp_errno_to_str() as well. This is done to ease
reuse for the strerror argument.
2018-11-13 22:04:44 +01:00
Scott Shawcroft 355abc835e
Fix output overflow and make help translatable 2018-11-09 16:41:08 -08:00
Scott Shawcroft 168e23e466
Build refinement to handle warnings and quiet output 2018-11-09 00:11:43 -08:00
Scott Shawcroft dc9d338612
Merge pull request #1167 from notro/cpython_stdlib
Support CPython standard library
2018-10-24 12:57:41 -07:00
Scott Shawcroft cb0126131a
Use python3 for mpy-tool 2018-10-18 10:37:42 -07:00
Scott Shawcroft 4f9c8b7361
Add debug info to the generated frozen_mpy.c
It adds size info and uses macros for byte code to make it more
readable.
2018-10-17 17:45:47 -07:00
Noralf Trønnes db4a8f5d1a modsys: exc_info: Add traceback
Add traceback chain to sys.exec_info()[2].
No actual frame info is added, but just enough to recreate the printed
exception traceback.

Used by the unittest module which collects errors and failures and prints
them at the end.
2018-10-07 19:37:49 +02:00
Noralf Trønnes b897603cfa py/objboundmeth: Support __func__ property as in CPython
This gives access to the function underlying the bound method.

Used in the converted CPython stdlib logging.Formatter class to handle
overrriding a default converter method bound to a class variable.
The method becomes bound when accessed from an instance of that class.

I didn't investigate why CircuitPython turns it into a bound method.
2018-10-07 19:36:24 +02:00
Noralf Trønnes a63555abc1 py/builtinimport: Set __file__ on MPY modules
This sets the __file__ property on MPY modules like how it's done on pure python modules.
2018-10-07 19:36:12 +02:00
Uri Shaked cea079a022
fix compilation errors in emitinlinethumb.c 2018-10-07 02:09:44 +03:00
Noralf Trønnes 2d1fecc804 Revert "py/vm: Improve performance of opcode dispatch when using switch stmt."
This reverts commit 869024dd6e.

Ctrl-C stopped producing KeyboardInterrupt with this change on CircuitPython.

The Unix and stm32 ports handles Ctrl-C differently with a handler which is
probably why they where not affected.

Fixes #1092
2018-08-25 13:14:58 +02:00
Scott Shawcroft 4a4d84ba42
Merge pull request #1064 from notro/i2cslave
Add busio.I2CSlave
2018-08-17 16:51:45 -07:00
Scott Shawcroft c3c5951d44
Fix test that broke due to decompressing to too small of a scope. 2018-08-16 17:41:53 -07:00
Scott Shawcroft 2cd166b573
Fix esp and samd 2018-08-16 17:41:35 -07:00
Scott Shawcroft 137a30ad75
fix mpy-cross 2018-08-16 17:40:57 -07:00
Scott Shawcroft de5a9d72dc
Compress all translated strings with Huffman coding.
This saves code space in builds which use link-time optimization.
The optimization drops the untranslated strings and replaces them
with a compressed_string_t struct. It can then be decompressed to
a c string.

Builds without LTO work as well but include both untranslated
strings and compressed strings.

This work could be expanded to include QSTRs and loaded strings if
a compress method is added to C. Its tracked in #531.
2018-08-16 17:40:57 -07:00
Noralf Trønnes 1ed0e45fc2 Add i2cslave.I2CSlave bindings 2018-08-16 17:11:20 +02:00
Scott Shawcroft 4513bd6ea3
Fix translation newlines
Escape table was incorrect
2018-08-10 16:17:03 -07:00
Scott Shawcroft 24e53ad591
Rework escaping and fix ESP build. 2018-08-09 15:58:45 -07:00