Commit Graph

43 Commits

Author SHA1 Message Date
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 ceeac4791e atmel-samd: Add Feather M0 with flash 2016-11-18 16:18:13 -08:00
Scott Shawcroft fe9c28538c atmel-samd: Turn off using the red LED to show mass storage writes. 2016-11-18 16:18:13 -08:00
Scott Shawcroft f42b41e1e9 atmel-samd: Increase autoreset delay to reduce duplicate resets. 2016-10-31 11:31:33 -07: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 fc78f6950f atmel-samd: Add D13 as flash write indicator on Arduino Zero. 2016-10-27 17:49:52 -07:00
Scott Shawcroft 3a9cb1ac49 atmel-samd: Fix Arduino SPI pin. Datasheet net name is wrong. :-( 2016-10-26 20:16:53 -07:00
Scott Shawcroft 85e4d3572d atmel-samd: Add named pins for Arduino Zero SPI. Fixes #11. 2016-10-26 18:02:34 -07:00
Scott Shawcroft 2098515f6a atmel-samd: Rework pin definitions to share most of the data structures and included based on ASF defines. 2016-10-26 17:57:47 -07:00
Scott Shawcroft 34fa81eaf3 atmel-samd: Hook in DTR for more ports and make the serial TX more resiliant to long strings. 2016-10-26 13:32:41 -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 614c1fdba2 atmel-samd: Only output to USB after DTR and don't send anything larger than the room left in the USB TX buffer. 2016-10-25 18:29:04 -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 fff96a0ce6 atmel-samd: Fix include guard. 2016-10-25 15:03:22 -07:00
Scott Shawcroft 16584dfee6 atmel-samd: Fix the Feather builds by switching to the VFS mass storage implementation. 2016-10-24 12:42:09 -07:00
Scott Shawcroft eb62d03e33 atmel-samd: Add flash write activity LED. 2016-10-21 15:44:09 -07:00
Scott Shawcroft bb1822faea atmel-samd: Support external flash on the Metro M0 w/Flash.
This uses a scratch flash sector to save data before writing a full sector.
2016-10-21 15:44:09 -07:00
Scott Shawcroft aacb1adcd1 atmel-samd: Add linker file for bootloaderless board with external flash. 2016-10-21 15:44:08 -07:00
Scott Shawcroft 853e5fc652 atmel-samd: Ensure at least 2k is left for the stack. 2016-10-21 15:43:24 -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
Sebastian Plamauer 9b1170a65d [atmel-samd] add adalogger board definitions 2016-10-19 10:02:01 +02:00
Scott Shawcroft cb99ae5032 atmel-samd: Rename Feather M0 Bluefruit files to Feather M0 Basic because there isn't anything Bluefruit specific yet. 2016-10-14 13:10:17 -07:00
Scott Shawcroft 343ff4faed atmel-samd: Make the Arduino Zero build use a bootloader. 2016-10-14 13:10:16 -07:00
Scott Shawcroft 011056af15 atmel-samd: Add support for SPI.
Also separate out the ASF config headers that are shared across all boards.
2016-10-11 15:48:43 -07:00
Scott Shawcroft a6254f4344 atmel-samd: Add basic support for experimental Metro M0 with an external flash chip. 2016-10-07 15:09:01 -07:00
Scott Shawcroft 5d6c4109e9 atmel-samd: Change USB Manufacturer from Adafruit to Adafruit Industries. 2016-10-07 15:06:42 -07:00
Scott Shawcroft 284d3414e1 atmel-samd: Make UART REPL Arduino Zero specific. Most will use USB REPL. 2016-10-07 15:06:07 -07:00
Scott Shawcroft 67372b369e atmel-samd: Fix A1 and A2 analog inputs.
Fixes #3.
2016-10-07 15:01:26 -07:00
Scott Shawcroft 90bf13efd5 atmel-samd: Correct USB PIDs.
Arduino and Adafruit convention is for user programs to have PIDs
starting with 8 and bootloaders starting with 0.
2016-10-05 12:55:48 -07:00
Scott Shawcroft 7e08347d5c atmel-samd: Support composite CDC and mass storage USB device.
Be careful to not use the flash file system while using mass storage
because both pieces of code attempting to change the fs can corrupt it.
2016-10-05 11:07:29 -07:00
Scott Shawcroft 7fd84e93f4 atmel-samd: Support raw repl and soft reset to support ampy.
Closes #1. Also adds TX and RX led support on the Arduino Zero.
2016-09-15 17:01:19 -07:00
Scott Shawcroft 7d8929c470 atmel-samd: Add I2C support.
This commit also introduces a new shared-bindings directory which is used to store the common Python -> C binding code. By having a shared directory we can ensure that the Python API across ports is the same. Each port will have a corresponding common-hal directory which provides definitions for the C api used in the shared-bindings code. That way the compiler can enforce the C api.

To migrate to this new shared API create a common-hal directory within your port and change the Makefile to compile both the shared-bindings and common-hal files. See atmel-samd/Makefile SRC_BINDINGS for an example.
2016-09-13 11:46:22 -07:00
Scott Shawcroft 09be96a6aa atmel/samd: Add filesystem support. 64k is stored in flash. 2016-09-02 17:00:30 -07:00
Scott Shawcroft 1725710feb atmel-samd: Rename the Feather M0 BLE to Feather M0 Bluefruit LE. 2016-08-31 09:56:06 -07:00
Scott Shawcroft eff137a5f5 atmel/samd: Support CTRL-C on USB. This won't escape native code but it will cause Python code to stop. 2016-08-31 00:11:56 -07:00
Scott Shawcroft ccb309bd5c atmel/samd: Add basic PWM support which only allows for changing the duty. 2016-08-30 13:10:52 -07:00
Scott Shawcroft b883a15d82 atmel-samd: Rename module classes so they don't conflict with names from ASF. 2016-08-28 00:02:05 -07:00
Scott Shawcroft 259ae8a39d atmel-samd: Initial ADC support. 2016-08-26 17:01:38 -07:00
Scott Shawcroft 3cb4938c63 atmel-samd: Support Digital IO pins.
Also bumps up the heap size.
2016-08-24 17:38:08 -07:00
Scott Shawcroft 0c4f9b878a Enable REPL over USB.
All of the code was there except the linker was failing to clear the bss section because I added too many .zeros. The should have only been the exported globals that start with _ like _szero = .. Fixing that and turn on the usb transmit fixed everything.
2016-08-24 00:14:11 -07:00
Scott Shawcroft 386ab580cd Change the board information used in the header to be board specific. 2016-08-23 17:36:29 -07:00
Scott Shawcroft 9485634d41 Add support for REPL on Arduino Zero through EDBG via UART. 2016-08-23 16:47:53 -07:00
Scott Shawcroft 8f26d181c3 Blinking the LED works. Clocks should be set up correctly.
Everything works fine without USB being plugged in but faults (I think) when USB is plugged in. This is switched away from the USB code from the bootloader onto the USB code thats generated by Atmel Studio using the high level classes from ASF.
2016-08-22 23:53:11 -07:00