Commit Graph

99 Commits

Author SHA1 Message Date
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
c3918bae57 PWMOut was not claming channels on shared TCCs 2018-09-11 19:46:47 -04:00
Jerry Needell
e8b94d0024 adjust SAMD51 neopixel_write timing 2018-08-24 07:01:50 -04:00
Scott Shawcroft
44de3d49a8
Speed up zero neopixel pulses.
SK6812 on 5v is pickier than WS2812 on 5v.

Hopefully fixes #1083.
2018-08-20 17:04: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
Dan Halbert
2e80f37709
Merge pull request #1096 from tannewt/tune_neopixel
Retune neopixel timings on SAMD51. They were too slow.
2018-08-07 21:33:12 -04:00
Scott Shawcroft
b0dd645e27
Retune neopixel timings on SAMD51. They were too slow.
Fixes #1083
2018-08-07 16:58:37 -07:00
Dan Halbert
8bb363f7c4 must set pull after setting direction with gpio_set_pin routines 2018-07-09 17:18:06 -04:00
Dan Halbert
52a11547cb fix OneWire timing and DigitalInOut.switch_to_input() 2018-06-28 23:32:20 -04: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
Dan Halbert
4691b30c02 PDMIn: turn serializer on when starting DMA 2018-06-12 12:35:51 -04:00
Dan Halbert
b2d98edb4e
Merge pull request #901 from tannewt/pulseio_too_fast
Prevent freezing USB during high frequency PulseIn.
2018-06-08 17:59:06 -04:00
Scott Shawcroft
8fb34a5846 Use bool not int. 2018-06-08 14:57:20 -07:00
Scott Shawcroft
2fbab8067a Prevent freezing USB during high frequency PulseIn.
We now track the last time the background task ran and bail on the
PulseIn if it starves the background work. In practice, this
happens after the numbers from pulsein are no longer accurate.

This also adjusts interrupt priorities so most are the lowest level
except for the tick and USB interrupts.

Fixes #516 and #876
2018-06-08 12:56:32 -07:00
Dan Halbert
218930d18b Check for PDMIn DMA getting stuck. 2018-06-08 08:23:52 -04:00
Scott Shawcroft
717199018b Adapt for feedback and hack around pIRkey size constraint. 2018-06-01 15:08:52 -07:00
Dan Halbert
f386144428 redo state algorithm 2018-06-01 15:08:52 -07:00
Scott Shawcroft
9920f0a5de atmel-samd: Make ticks more atomic.
Always use current_tick when sub millisecond precision is required.
Otherwise getting the ms/us to correspond is tricky.
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
Scott Shawcroft
bf1f0b3d11 Turn off timer on AudioOut deinit.
Thanks to @sommersoft for spotting the error.

Fixes #850
2018-06-01 13:32:45 -07:00
Scott Shawcroft
3607d3ba2c Correctly reset the PTC 2018-05-22 14:20:35 -07:00
Scott Shawcroft
31bcd1c45c Fixup gclk init 2018-05-22 13:56:12 -07:00
Scott Shawcroft
99123a8621 Turn on touchio for M0 boards. M4 will come later once its supported
by FreeTouch.

Fixes #670
2018-05-22 13:49:08 -07:00
Scott Shawcroft
6a8db03ade
Merge pull request #838 from rhooper/master
add supervisor.reload() to soft reboot from code
2018-05-16 17:52:16 -04:00
Scott Shawcroft
99e34e38eb
Merge pull request #829 from jerryneedell/jerryn_i2c
add keyword timeout to I2C -- only used for bitbangioi
2018-05-16 14:52:11 -04:00
Roy Hooper
3fd9900ea7 disable pins on trinket_m0 so that we can free a fair bit of flash - Issue #840 2018-05-15 13:13:59 -04:00
Roy Hooper
a0954b9e11 Fix for Issue #770 - Provide a better error message when timers are still available. 2018-05-14 13:52:32 -04:00
Jerry Needell
d6c26942a5 add timeout keyword to I2C - for bitbangio - ignored for busio 2018-05-13 21:54:44 -04:00
Dan Halbert
240659da0e PBxx pins were not setting DRVSTR or reporting PULL properly 2018-05-10 23:09:51 -04:00
Scott Shawcroft
50fc90bc5f Add pause/resume control to AudioOut and I2SOut
Fixes #808
2018-05-08 11:53:13 -07:00
Dan Halbert
9d484c4935
Merge pull request #789 from tannewt/pdmin3
Re-enable PDMIn without ASF
2018-05-02 19:59:20 -04:00
Scott Shawcroft
04f75b8903 Reduce the buffer size back to what 2.x has. Increase was leftover
from debugging.
2018-05-02 15:21:43 -07:00
Scott Shawcroft
22b7cd3d51 Fix 8 bit recordings on CPX.
The DMA trigger source was incorrect when using serializer 1 on
the SAMD21.

Playback register was incorrect for 8 bit as well. Now fixed.
2018-05-02 15:15:25 -07:00
Dan Halbert
3a2b4af830 Implement microcontroller.cpu.temperature on '21 and '51. 2018-05-01 21:35:55 -04:00
Noralf Trønnes
681399f8db atmel-samd: RTC: Improve precision when setting datetime
The prescaler is not reset when setting the counter so we can be off by
as much as 1023/1024 seconds. Fix this by resetting the RTC module.
2018-05-01 21:35:24 -04:00
Scott Shawcroft
cfea51ec68 Re-enable PDMIn without ASF and using the helpers added with
I2SOut.

The API is almost the same except the frequency attribute has been
renamed to sample_rate so that its less likely to be confused with
frequencies within the audio itself.

Fixes #263.
2018-05-01 14:35:43 -07:00
Noralf Trønnes
62d7a800d7 atmel-samd: RTC: Improve precision when setting datetime
The prescaler is not reset when setting the counter so we can be off by
as much as 1023/1024 seconds. Fix this by resetting the RTC module.
2018-04-29 20:43:07 +02:00
Dan Halbert
9daa1a68d8 HID gamepad support 2018-04-23 23:51:23 -04:00
Jerry Needell
fe738598da modify tick.c to simplify - remove interupt disable from common_hal_pulseio_pulsein_resume 2018-04-20 11:59:33 -04:00
Jerry Needell
3399d541c3 Merge remote-tracking branch 'origin/master' into jerryn_tick 2018-04-19 20:54:47 -04:00
Jerry Needell
e09d95067c update tick.c (fix LOAD value) update PulseIn.c (do not enable interrupts for trigger_duration > 1000 2018-04-17 21:46:15 -04:00
Scott Shawcroft
81d395d825
Merge pull request #745 from notro/time_rtc
RFC: Add rtc module
2018-04-16 15:26:54 -07:00
Jerry Needell
e55e06d501 modify tick.c to work when interrupts disabled - modify PulseIn.c to cast argument to common_hal_delay_us 2018-04-16 08:11:14 -04:00
Noralf Trønnes
8e2080411f atmel-samd: Add rtc module support
Support the rtc module by using hal_calendar.
2018-04-16 13:15:08 +02:00
Scott Shawcroft
812fe0c93f Turn on nvm in 3.0.
Its 256b on M0 and 8k on M4 to match flash erase sizes.

Fixes #758
2018-04-13 16:22:28 -07:00
Scott Shawcroft
22194d5977 Tweaks based on dhalbert's feedback. 2018-04-13 10:51:01 -07:00
Scott Shawcroft
28642ab10d Add audio output support!
This evolves the API from 2.x (and breaks it). Playback devices are now
separate from the samples themselves. This allows for greater playback
flexibility. Two sample sources are audioio.RawSample and audioio.WaveFile.
They can both be mono or stereo. They can be output to audioio.AudioOut or
audiobusio.I2SOut.

Internally, the dma tracking has changed from a TC counting block transfers
to an interrupt generated by the block event sent to the EVSYS. This reduces
the overhead of each DMA transfer so multiple can occure without using up TCs.

Fixes #652. Fixes #522. Huge progress on #263
2018-04-12 16:35:13 -07:00
Dan Halbert
5f98953ed8 esp8266 and nrf: raise NotImplementedError 2018-04-10 12:08:41 -04:00