Commit Graph

301 Commits

Author SHA1 Message Date
Dan Halbert 6df99b5d0e Merge 2.1.0 changes into master. 2017-10-23 15:26:36 -07:00
Radomir Dopieralski 1c97b7f4df Gracefully reset the gamepad module
If a soft reset happens while the gamepad module is scanning for button
presses, there is a moment when the pins get de-initialized, but the
gamepad module is still trying to read them, which ends in a crash.
We can avoid it by disabling scanning on reset.

(cherry picked from commit 470a23d4c9)

Conflicts:
	atmel-samd/main.c
2017-10-22 20:54:10 -07:00
Scott Shawcroft a1be272b1e atmel-samd: Correct the UF2 bootloader offset when converting the bin to uf2. 2017-10-22 12:39:01 -07:00
mrmcwethy bb008cdbc9 First attempt to move py/modmath.c to shared-bindings/math 2017-10-21 10:34:25 -07:00
Scott Shawcroft 536bcb42c9 atmel-samd: Re-enable pin reset. Fixes #352 (#353) 2017-10-20 07:49:33 -04:00
Scott Shawcroft a800a25e88 atmel-samd: Switch Metro M4 Express to SAMD51J19. (#351) 2017-10-19 22:39:16 -04:00
Scott Shawcroft 535c0059d7 atmel-samd: Turn on SAMD51 bootloader build layout. (#348) 2017-10-18 16:07:38 -04:00
Michael McWethy b41cbe9256 CircuitPython now has struct instead of ustruct (#302)
Added struct module to shared-bindings and shared-module.  removed ustruct
2017-10-18 12:50:20 -07:00
Scott Shawcroft 88c6d2349b atmel-samd: Update asf4 to include USB fix for SAMD51. 2017-10-18 15:46:26 -04:00
Scott Shawcroft f31a7b70e8 atmel-samd: Fix CDC now that its clear its async. 2017-10-18 15:46:26 -04:00
Scott Shawcroft 51cd4da76e atmel-samd: Add mass storage support.
Fixes #260
2017-10-18 11:52:51 -07:00
Dan Halbert 3c54e2c03c TEMPORARY changes to get build to work on all boards. Make space on CPX; turn off -finline-limit 2017-10-12 21:54:38 -04:00
Dan Halbert fabaa2ec30 merge 2.x changes into master; touch up Makefile CFLAGS logic 2017-10-12 20:10:31 -04:00
Dan Halbert 922006dd59 Don't create a new filesystem if we restart in safe mode. (#319) 2017-10-12 14:35:39 -04:00
Dan Halbert b7591cfd19 Replace asf4 tree with submodule repo adafruit/asf4, branch circuitpython. 2017-10-12 10:55:15 -07:00
Scott Shawcroft 80654779e1 atmel-samd: Add support for internal filesystems. (#311)
* atmel-samd: Add support for internal filesystems.

This allows us to re-enable `os`. `random` is also enabled because
it solely depends on `os`.

Fixes #266. Its also a pre-requisite for #260.

* atmel-samd: Update SAMD51 linker script comments and MICROPY_MAX_STACK_USAGE enabling.
2017-10-10 14:36:00 -04:00
Dan Halbert ef65ee78c5 Freeze libraries needed by adafruit_circuitplayground library into firmware.
This saves a lot of RAM. Fixes #287.
Also fixed compilation of frozen_mpy.c to use supplied make rule rather than
builtin rule (supplied rule suppresses printing out the gcc command line).
2017-10-08 10:54:46 -06:00
Radomir Dopieralski f4981677b0 Add a `gamepad` module for handling buttons in the background. (#295)
The `GamePad` singleton monitors buttons in the background to make sure a button press is never missed and debouncing happens consistently.
2017-10-03 13:35:57 -07:00
Dan Halbert c478c10923 Do not allow a *io object to be used after deinit().
Fixes #278, #277, #276, #275.
2017-10-03 12:07:17 -07:00
Radomir Dopieralski c2bb9e2eb5 Add board file for the hacked Trinket M0 Haxpress (#303)
Add a hacked Tinket M0 Haxpress board definition

Based on https://daveastels.com/2017/09/01/trinket-m0-express-hack/
2017-10-03 11:24:48 -07:00
Dan Halbert 7f74412882 Make touch more sensitive. Add .raw_value and .threshold attributes. 2017-10-02 11:15:51 -07:00
Scott Shawcroft 211b44e630 Update `time` to use SysTick (#274)
* atmel-samd: Add time back using the SysTick counter in the core. Fixes #261

* Switch to SysTick_Config
2017-09-29 16:58:13 -04:00
Scott Shawcroft bac841df61 atmel-samd: Fix CDC by making sure we define (#294)
CONF_USB_COMPOSITE_CDC_ACM_EN before including ASF4 files.
2017-09-29 16:03:05 -04:00
Dan Halbert b2dcc5bb6c reset pins on PDMIn deinit(). Fixes #275. 2017-09-29 08:54:05 -07:00
Scott Shawcroft 0bbb7a8199 Add support for patching newer ASF4 code. (#292)
* atmel-samd: Support patching after updating ASF4.

This makes it possible to automatically fix newer code.

* atmel-samd: Update ASF4 to include flash APIs for SAMD51.

This is the first automatic update that has caused a few deletions
where code was previously copied instead of moved.

This is a prerequisite for #260.
2017-09-28 23:33:44 -04:00
Scott Shawcroft 8466d760f9 atmel-samd: Port baudrate reset to asf4 so we no longer hose Rosie.
We still won't be able to run tests but we will be reset into the
bootloader to test other stuff.
2017-09-27 21:58:54 -04:00
Scott Shawcroft 6839fff313 Move to ASF4 and introduce SAMD51 support. (#258)
* atmel-samd: Remove ASF3. This will break builds.

* atmel-samd: Add ASF4 for the SAMD21 and SAMD51.

* Introduce the supervisor concept to facilitate porting.

The supervisor is the code which runs individual MicroPython VMs. By
splitting it out we make it more consistent and easier to find.

This also adds very basic SAMD21 and SAMD51 support using the
supervisor. Only the REPL currently works.

This begins the work for #178.
2017-09-22 21:05:51 -04:00
Jerry Needell 3ad01ddb04 Add Ananlog Pin aliases to trinket_m0 pins.c 2017-09-19 21:36:06 -07:00
Dan Halbert 75c3be37ac Re-initialize ADC before every AnalogIn read. (#255)
`microcontroller.cpu.temperature` uses different ADC settings, and caused
AnalogIn to give wrong answers. AnalogIn can no longer assume it's the
only user of the ADC.
2017-09-16 13:06:23 -04:00
Asher Lieber 5aa8922038 add set_rgb_status_brightness (#246)
Add set_rgb_status_brightness() via `samd.rgb_status_brightness`.

Fixes #162.
2017-09-12 12:09:22 -07:00
Dan Halbert acbca44512 Ctrl-C was causing a soft-reset in REPL.
Also allow an immediate ctrl-c in `input()`.
2017-09-06 14:47:23 -07:00
Scott Shawcroft c0159c5e80 atmel-samd: Ensure MTB is off in case we ran a debug build before
a non-debug build.
2017-09-06 11:56:41 -07:00
Scott Shawcroft 6d9d683443 atmel-samd: Enable 8-bit audio recording support even though it'll be
quiet. Also update the examples.

Fixes #226
2017-09-05 16:37:02 -07:00
Dan Halbert a0d0b27faf Fix issue #207, esp8266 file operations problems (#222)
The frozen module `_boot.py` was not being loaded on restart
because `pyexec_frozen_module()` did not know about the new `.frozen`
pseudo-directory. Updated lower-level routine to look in the right place.
Also made ".frozen" and related values be `#define`s.
2017-09-01 16:12:26 -04:00
Scott Shawcroft e2f39a8d93 atmel-samd: Remember SPI baudrate.
This prevents the SERCOM from blipping the data line on each
transaction and therefore fixes #219.
2017-09-01 12:44:52 -07:00
Scott Shawcroft 17ec02a77d atmel-samd: Add SPI pin names to the Trinket. Fixes #213 (#217) 2017-08-31 15:05:43 -04:00
Dan Halbert 59faa05a10 Add ".frozen" to end of sys.path, so that internal frozen modules are visible on boot. 2017-08-31 11:38:00 -07:00
Dan Halbert fdb97eda09 Add microcontroller.cpu.temperature, for use as a simple sensor on minimal boards. (#211)
* Add microcontroller.cpu, the sole instance of microcontroller.Processor.
microcontroller.cpu.frequency is the clock frequency, in Hz.
microcontroller.cpu.temperature is the reading from the internal temperature sensor, in Celsius. None if not available.

* Squeeze firmware size by using -finline-limit. Otherwise non-Express builds were slightly too big.

* Update submodules.

* Fix documentation glitches
2017-08-31 13:48:30 -04:00
Dan Halbert c679c80c71 Modernize module and class static dicts; update freetouch 2017-08-27 15:02:50 -04:00
Dan Halbert ef61b5ecb5 Initial merge of micropython v1.9.2 into circuitpython 2.0.0 (in development) master.
cpx build compiles and loads and works in repl; test suite not run yet
esp8266 not tested yet
2017-08-25 22:17:07 -04:00
Scott Shawcroft 266be30777 atmel-samd: Introduce a nvm module for non-volatile byte-level memory access. (#203)
* atmel-samd: Introduce a nvm module for non-volatile byte-level memory access.

This allows for persisting small configuration values even when the file system
is read-only from CircuitPython.

Fixes #160

* Review feedback:
* Add tests.
* Fix non-zero index.
* Fix len()
2017-08-25 16:00:27 -04:00
Dan Halbert 74cfdeb316 Added ability to freeze multiple directories; freeze neopixel library in cpx build (#199)
Reworked frozen module support: clean up makefiles and handle multiple directories.
Modules to freeze are included as git submodules.

Add neopixel to circuitplayground express build.

Fixes #56
2017-08-23 11:05:59 -07:00
Scott Shawcroft 45a31b1c2a Fix ADC input def for PB07. (#195)
Fixes #194
2017-08-22 15:19:05 -04:00
Scott Shawcroft fab634e3ee Turn on Rosie CI testing to test new builds on real hardware.
This introduces a skip_if module that can be used by tests to
determine when they should be skipped due to the environment.

Some tests have been split in order to have finer grained skip
control.
2017-08-11 17:16:13 -07:00
Scott Shawcroft 42156484ae shared-bindings/atmel-samd: Fix and improve trigger duration timing on PulseIn.resume. 2017-08-10 11:55:34 -07:00
Scott Shawcroft 509d5223ea atmel-samd: Fix crash when fs mount fails and fix mounting internal flash. It was broken by the update to 1.9.1. Related to #82 2017-08-07 15:56:10 -07:00
Dan Halbert 5d509ecace Allow max stack checking to be used with -flto build by determining top
of stack in a different way.
2017-08-05 17:48:16 -07:00
Dan Halbert 91d4cdb476 Increase heap size at the expense of stack size, from 16k to 16k+4k. 2017-08-05 17:47:00 -07:00
Scott Shawcroft 13cb4aa89d atmel-samd: Add support for a second flash chip so either may be used. 2017-08-03 13:44:31 -07:00
Scott Shawcroft 8f3c5ebdc8 atmel-samd: Clear the error bit after the known buffer overflow and be explicit about dst increase. 2017-08-03 13:44:31 -07:00