Commit Graph

12 Commits

Author SHA1 Message Date
Scott Shawcroft 790c38e18c atmel-samd: Rework boot, main and REPL order.
Boot will only run once now before USB is started. Its output goes to
boot_out.txt. After main and REPL will run with VM and hardware resets
between each.
2017-05-12 18:26:14 -07:00
Scott Shawcroft e1a6f6d584 atmel-samd: Rework SPI flash defines for clarity.
Also add sector protection support for the SAMD Xplained board.
2017-05-12 14:47:39 -07:00
Scott Shawcroft 24a5752f94 atmel-samd: Use DMA for SPI flash block transfers.
Fixes #99
2017-05-02 15:25:06 -07:00
Scott Shawcroft e3f9ee839a Add frequency changing support to PWMOut.
You can either set it once up front, or set variable_frequency on custruction to
indicate that the frequency must be able to change. This informs whether a timer
can be shared amongst pins.

This also adds persistent clock calibration on atmel-samd. Once the device has
synced its clock frequency over USB it will remember that config value until USB
is used again. This helps ensure the clock frequency is similar on and off USB.

Lastly, this also corrects time.sleep() when on USB by correcting the tick counter.
2017-01-30 15:02:01 -08:00
Scott Shawcroft b6f1eebab3 atmel-samd: Add APA102 support and flash more advanced status.
The new sequence is as follows:
* Solid blue during the boot/settings script.
* Solid green during the main/code script.
* After main while waiting to enter repl or reset:
  * Fading green once main is done successfully.
  * On error produce a series of flashes:
    * Long flash color of script.
    * Long flash color of error:
      * Green = IndentationError
      * Cyan = SyntaxError
      * White = NameError
      * Orange = OSError
      * Yellow = Other error
    * Line number of the exception by digit. Number of flashes represents value.
      * Thousands = White
      * Hundreds = Blue
      * Tens = Yellow
      * Ones = Cyan
    * Off for a period and then repeats.

At any point a write to the flash storage will flicker red.

Fixes #63
2016-12-09 19:35:56 -08:00
Scott Shawcroft 2d9a0c76c5 atmel-samd: Switch to MICROPY_PORT_ROOT_POINTERS for the flash cache. 2016-11-29 14:29:33 -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 5b3a143ffe atmel-samd: Rework tick timer to use TC5 and support neopixel status LED.
The tick timer needed to be reworked because the ASF delay functions also
use the SysTick timer. Now, it uses TC5 and calls out to the autoreset
logic every tick. Fixes #43.

Added neopixel status colors and corrected the latch time from ms to us.
Fixes #42.
2016-10-28 20:16:39 -07:00
Scott Shawcroft d189a3f3cf atmel-samd: Support auto-reset based on USB write activity.
It will soft-reboot micropython after a burst of writes to the
file system. This means that after you save files on your computer
they will be automatically rerun.

This can be disabled in the build by unsetting AUTORESET_TIMER in
mpconfigboard.h.

Using the REPL will also prevent the soft resets until you reset
with CTRL-D manually.
2016-10-25 18:36:37 -07:00
Scott Shawcroft d05299f57a atmel-samd: Add D13 led as mass storage write indicator. 2016-10-25 15:06:05 -07:00
Scott Shawcroft 9eb86e8015 Add support for USB writeable, MicroPython read-only volumes.
This prevents file system corruption due to two systems mutating
it at once.
2016-10-21 15:44:09 -07:00
Scott Shawcroft 306c921ed1 atmel-samd: Rework mass storage interaction with underlying block
storage to use micropython's VFS interface.

This makes mass storage work with any VFS implementation rather
than a single one.
2016-10-21 15:36:59 -07:00