Commit Graph

49 Commits

Author SHA1 Message Date
Jeff Epler d9ee2d28a0 atmel-samd: Use RUN_BACKGROUND_TASKS 2019-08-11 08:53:02 -05:00
Scott Shawcroft 6797ec6ed3
Add support for grayscale displays that are < 8 bit depth.
This also improves Palette so it stores the original RGB888 colors.

Lastly, it adds I2CDisplay as a display bus to talk over I2C. Particularly
useful for the SSD1306.

Fixes #1828. Fixes #1956
2019-07-19 16:06:11 -07:00
Scott Shawcroft f4a64a2e80
Merge pull request #1989 from rce1086/master
Added conditional compilation around selection of TX pad candidates
2019-07-08 14:07:04 -07:00
Carl Elkins 64507207da Added conditional compilation around selection of TX pad candidates
Original code was correct for SAMD21
New code for SAMD51 only permits pad-0 for TX
2019-07-08 02:08:39 +01:00
iot49 4c72a3991e updated samd and esp8266 ports 2019-07-05 10:01:51 -07:00
Radomir Dopieralski 8323721232 Stop hard-coding SPI frequency in FourWire
Instead remember and use the frequency, polarity and phase that was
set when the bus was first created.
2019-04-06 15:15:29 +02:00
Scott Shawcroft 37e10d4a81
Be more careful when initing the board outside the VM. 2019-03-12 11:18:29 -07:00
Dan Halbert cf545cd477 WIP: fix issues with remaining atmel-samd builds 2019-02-15 09:52:45 -05:00
Dan Halbert da5008f4d8 Fix atmel UART after ASF4 pruning. 2019-02-13 11:42:09 -05:00
Scott Shawcroft 1a6ad20943
Get space back by using less ASF4 and combining register writes 2019-02-11 17:36:34 -08:00
Scott Shawcroft 84292ad890
External fourwire works and blinka splash after 2019-01-17 00:20:16 -08:00
Scott Shawcroft 05d8885a1a
Rework displays in prep for dynamic support and 8bit parallel. 2019-01-16 12:05:20 -08:00
Dan Halbert 63cd9209f1 allow KeyboardInterrupt on UART read; fix nrf UART pin claiming; rename feather 52840 UART pins 2018-12-04 15:05:39 -05:00
Dan Halbert 80db2cec99 UART changes: timeout in secs, write bytes, etc. 2018-12-03 12:04:32 -05:00
Scott Shawcroft 9d91111b1b
Move atmel-samd to tinyusb and support nRF flash.
This started while adding USB MIDI support (and descriptor support is
in this change.) When seeing that I'd have to implement the MIDI class
logic twice, once for atmel-samd and once for nrf, I decided to refactor
the USB stack so its shared across ports. This has led to a number of
changes that remove items from the ports folder and move them into
supervisor.

Furthermore, we had external SPI flash support for nrf pending so I
factored out the connection between the usb stack and the flash API as
well. This PR also includes the QSPI support for nRF.
2018-11-08 17:25:30 -08:00
Dan Halbert bc510e714f merge 3.0.2 to master 2018-09-18 15:38:12 -04:00
Dan Halbert 6a046f55c4 UART fixes and enhancements; default board object fix 2018-09-12 17:19:43 -04:00
Paul Kierstead 02b3f62460 When UART timeout of zero is given, make read() return data already available 2018-09-12 13:25:49 -04:00
Dan Halbert 4c3b4cacfa Merge remote-tracking branch 'adafruit/master' into nrf-pin-claiming 2018-09-05 13:15:22 -04:00
Paul Kierstead 2d3f1a10bf When UART timeout of zero is given, make read() return data already available 2018-09-01 17:07:30 +00:00
Dan Halbert 9ea809bef7 add pin claiming to devices 2018-08-31 18:38:05 -04:00
Scott Shawcroft 4a4d84ba42
Merge pull request #1064 from notro/i2cslave
Add busio.I2CSlave
2018-08-17 16:51:45 -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 b6822b86ac busio/I2C: Split out samd_i2c_get_sercom()
It will be shared with I2CSlave.
2018-08-16 17:06:40 +02:00
Scott Shawcroft 86d2154d71
Change file mode back. 2018-08-09 09:14:14 -07:00
Scott Shawcroft 94c5ceab36
Initial SAMR board revision. 2018-08-09 05:36:46 -07:00
Jeff Epler b0e33f6a11 atmel-samd: UART: allocate rx buffer in long-lived region
This is not strictly needed in order for #1056 to be resolved,
because the "make long-lived" machinery is unaware of this pointer.

However, as UARTs are assumed to be long-lived, this change is
beneficial because it moves the long-lived buffer into the upper
memory area with other long-lived objects, instead of remaining in
the low heap.
2018-08-08 19:21:57 -05:00
Scott Shawcroft 933add6cd8
Support internationalisation. 2018-08-07 14:58:57 -07:00
Scott Shawcroft 168aa394db
Move pin struct to the peripherals library.
Its slimmed down by removing the qstr and bit packing TCC info.

The trinket m0 build actually grows by 20 bytes. The arduino zero
build shrinks by 188 bytes.
2018-08-02 13:59:05 -07:00
Scott Shawcroft a5e03b76a6 Split out the peripherals library in preparation of sharing with MakeCode. 2018-06-15 16:16:21 -07:00
Scott Shawcroft ee817a2fa8 Correct UART reads to return error on timeout.
This causes read to correctly return None instead of b''.

Fixes #874
2018-06-12 14:03:27 -07:00
Scott Shawcroft 717199018b Adapt for feedback and hack around pIRkey size constraint. 2018-06-01 15:08:52 -07:00
Scott Shawcroft d0fb6e7a2f atmel-samd: Add rotary encoder support.
Fixes #283
2018-06-01 15:08:48 -07:00
Scott Shawcroft fd71e56891 atmel-samd: Re-org helper peripheral files into their own subdirectory.
Ideally in the future they won't depend on ASF4 or MicroPython.
2018-06-01 15:07:31 -07:00
Jerry Needell d6c26942a5 add timeout keyword to I2C - for bitbangio - ignored for busio 2018-05-13 21:54:44 -04:00
Scott Shawcroft cebcec5e63 Check for floating pins by pulling them low briefly before testing their values. 2018-03-26 16:32:16 -07:00
Scott Shawcroft 25ba8ee489 Add an s because grammar. 2018-03-26 15:21:08 -07:00
Scott Shawcroft 37538fc0e7 Fix I2C init hang when the SCL pin is pulled low.
We added a check to make sure the pins are in a high state before
initing the bus. This leads to a friendly error message when someone
forgets to add the pull up resistors to their circuit.
2018-03-26 15:13:52 -07:00
Jeff Epler dddfad6594 UART: Fix maybe-uninitialized diagnostic
The following error occurs when building with gcc 5.4.1 (debian stretch):

common-hal/busio/UART.c:104:83: error: 'sercom_index' may be used uninitialized in this function [-Werror=maybe-uninitialized]
                   sercom_insts[rx->sercom[j].index]->USART.CTRLA.bit.ENABLE == 0) ||

It may be related to the addition of rx-only UARTs; gcc is unable
to infer the intended relationship between have_tx and sercom_index
being set (I am still not entirely confident of it myself)
2018-03-19 20:40:04 -05:00
Scott Shawcroft 88aa0e2660 Remove SERCOM pointers from pin data structure because index is
enough.

This saves 380 bytes on the Arduino Zero build. (More pins ==
more savings.)
2018-03-14 11:14:32 -07:00
Scott Shawcroft e7fc0b6aa7 Use DMA for long SPI transactions including those to the SPI Flash.
QSPI is not currently working so its commented out.

This is progress on #652.
2018-03-09 12:45:46 -08:00
Bryan Siepert 942b7ffbe0 fixes hardware dotstar support for 3.0 and addresses issue #514 2018-03-08 20:39:47 -08:00
Dan Halbert 9b4477e1dc Implement UART for 3.0 + related fixes.
1. UART: ported to ASF4. Allow rx-only and tx-only. Add .baudrate r/w property.

2. Make NeoPixel timing deterministic by turning off caches during NeoPixel writes.
3. Incorporate asf4 updates:
  a. async USART driver
  b. bringing Atmel START configuration closer to what we use
  c. Clock initialization order now specified by CIRCUITPY_GCLK_INIT_1ST and _LAST.
4. supervisor/port.c: Move commented-out clock-test pin setting to correct location.
2018-02-21 17:18:49 -05:00
Dan Halbert e550b024c5 atmel-samd: Correct computation of SPI baud rate.
all: Add .frequency read-only property for busio.SPI to return actual frequency.

Fix esp8266/posix_helpers.c, which was not up to date for the new
long-lived/short-lived heap allocation scheme.
2018-01-30 12:08:41 -05:00
Dan Halbert 065e82015f merge from 2.2.0 + fix up board defs 2018-01-02 21:25:41 -05:00
Dan Halbert 72c911be97 Support SPI flash chips for CIRCUITPY, using non-DMA SPI for now. 2017-11-27 21:00:24 -05:00
Dan Halbert 312444bbd2 non-DMA SPI working; adding this now for testing; will continue with DMA
Also, fixed pin mappings for rev B Metro M4:
swap PA12 and PA13 on SPI 2x3 header
swap A3 and A5

Comment out all frozen modules in CPX again to make room while waiting
for SPI flash.
2017-11-16 19:09:35 -05:00
Dan Halbert 7292984204 Implement busio.I2c.
* Added asf4_conf/samd*/hpl_sercom_config.h
* Adjusted clocks in peripheral_clk_config.h.
* Put some frozen libs back in CPX for testing.
* Implement common-hal I2C
* Add samd*_peripherals.h in parallel with samd*_pins.h for common
  functions and data.
* Store SERCOM index in pins table for convenience.
* Canonicalize some #include guard names in various .h files.

simpler reset of SERCOMs; remove unused routine
2017-11-07 09:59:54 -08:00
Scott Shawcroft 73c15dcf8b Merge commit 'f869d6b2e339c04469c6c9ea3fb2fabd7bbb2d8c' into nrf2_merge
This is prep for merging in the NRF5 pull request.
2017-10-24 22:31:16 -07:00