Commit Graph

10583 Commits

Author SHA1 Message Date
Dan Halbert
9a6a5ea2d9
Merge pull request #892 from tannewt/clock_w_crystal
Use the external crystal on SAMD21 again.
2018-06-02 18:43:23 -04:00
Kattni
47b60fd3fa
Merge pull request #896 from dhalbert/update_frozen_lis3dh
Update HID code and seesaw version
2018-06-02 18:09:52 -04:00
Dan Halbert
0ed946c5b8 Merge remote-tracking branch 'adafruit/master' into update_frozen_lis3dh 2018-06-02 17:44:56 -04:00
Dan Halbert
27eba65dc7 update HID, and update seesaw version 2018-06-02 17:43:08 -04:00
Kattni
41865887f7
Merge pull request #895 from dhalbert/update_frozen_lis3dh
Update frozen LIS3DH to 4.2.1 to save space
2018-06-02 17:37:41 -04:00
Dan Halbert
6e6bfc4d57 Update frozen LIS3DH to 4.2.1 to save space 2018-06-02 17:00:23 -04:00
Scott Shawcroft
e580d22f4a Use the external crystal on SAMD21 again.
Also, re-enable calibration storage for CircuitPlayground Express.
Tested with a 500hz PWMOut on Metro M0 with Saleae:
 * with crystal 500hz
 * with usb 500hz +- 0.1hz
 * without either 487hz += 0.1hz

SAMD51 is skipped due to DFLL errata and the fact it defaults to a
factory calibrated 48mhz that works fine for USB.

Fixes #648
2018-06-01 18:01:42 -07:00
Dan Halbert
de61bd0d05
Merge pull request #887 from tannewt/rotaryio
Add rotary encoder support.
2018-06-01 18:50:00 -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
Dan Halbert
ae31c4ac18
Merge pull request #889 from tannewt/audioio_timers_in_use
Turn off timer on AudioOut deinit.
2018-06-01 18:03:29 -04:00
Dan Halbert
ea95eb730a
Merge pull request #890 from tannewt/brownout3
Support brownout to safe mode. Fixes #870
2018-06-01 18:02:13 -04:00
Scott Shawcroft
317bb6d2ce
Merge pull request #888 from notro/samd51_clock_rework
atmel-samd/samd51: Refactor clock setup + implement samd.clock
2018-06-01 14:10:24 -07:00
Scott Shawcroft
f38ce1060c Support brownout to safe mode. Fixes #870 2018-06-01 13:45:28 -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
Noralf Trønnes
e158702a68 atmel-samd/samd51: Use crystal for RTC
This uses the crystal to clock the RTC on boards which have a crystal.

Disable clock generator 2 which was enabled in commit
8e2080411f ("atmel-samd: Add rtc module support").
samd51 differs from samd21 when it comes to the RTC clock. samd51 doesn't
have an explicit clock peripheral so no need for a clock generator.

The same commit didn't even setup XOSC32K correctly, it missed EN1K and XTALEN.

The RTC uses the 1k clock output, so enable it on the OSCULP32K even if it works without it.
2018-06-01 18:03:23 +02:00
Noralf Trønnes
ab7ddfddd5 atmel-samd/samd51: Refactor clock setup
Refactor the convoluted asf4 clock setup into something more readable.

enable_clock_generator() has 2 changes:
- Set 'Output enabled' to match the current clock setup
- Handle divisors above 511

Add an enable_clock_generator_sync() version which makes it possible to setup
clocks without waiting for syncing. The bootup would hang without this.

I have checked these registers:

 NVMCTRL->CTRLA = 0x00000004

 Peripheral clocks (only non-zero shown):
 PCHCTRL[1]=0x00000045
 PCHCTRL[10]=0x00000041

 Generator clocks (only non-zero shown):
 GENCTRL[0] = 0x00010907
 GENCTRL[1] = 0x00010906
-GENCTRL[2] = 0x00041104
+GENCTRL[2] = 0x00200904
 GENCTRL[4] = 0x00010907
 GENCTRL[5] = 0x00180906

 DFLL clock:
 OSCCTRL->DFLLCTRLA = 0x00000082
 OSCCTRL->DFLLCTRLB = 0x00000000
 OSCCTRL->DFLLVAL = 0x00008082
 OSCCTRL->DFLLMUL = 0x00000000

 DPLL clocks:
 OSCCTRL->Dpll[0].DPLLCTRLA=0x00000002
 OSCCTRL->Dpll[0].DPLLCTRLB=0x00000000
 OSCCTRL->Dpll[0].DPLLRATIO=0x0000003b
 OSCCTRL->Dpll[1].DPLLCTRLA=0x00000080
 OSCCTRL->Dpll[1].DPLLCTRLB=0x00000020
 OSCCTRL->Dpll[1].DPLLRATIO=0x00000000

 OSC32KCTRL clock:
 OSC32KCTRL->RTCCTRL = 0x00000000
 OSC32KCTRL->XOSC32K = 0x00002082
 OSC32KCTRL->CFDCTRL = 0x00000000
 OSC32KCTRL->EVCTRL = 0x00000000
 OSC32KCTRL->OSCULP32K = 0x00002300

Only gen2 changed which is due to samd51 having more bits in the simple
division register so DIVSEL wasn't necessary, and it didn't have OE set.
2018-06-01 18:02:35 +02:00
Noralf Trønnes
5c6aea9fd8 atmel-samd/samd51: Implement samd.clock
Fill out the dummy implementation.
2018-06-01 18:01:08 +02:00
Scott Shawcroft
6479cb0806
Merge pull request #868 from pewpew-game/gamepad-longlive
Make the gamepad singleton long-living and add it to root pointers
2018-05-30 17:19:12 -07:00
Radomir Dopieralski
d02899f822 Add gamepad_singleto to root pointers for the nrf port 2018-05-30 23:11:23 +02:00
Radomir Dopieralski
b219ce6d37 Add gamepad_singleton to root pointers 2018-05-30 23:11:22 +02:00
Radomir Dopieralski
c37b69e1a5 Make the gamepad singleton long-lived
So that it is not later moved.
2018-05-30 23:11:22 +02:00
Dan Halbert
1897ce478b restore I2C and UART. Don't do port.c resets and inits for modules that are not available. 2018-05-30 23:11:00 +02:00
Scott Shawcroft
09504159b8
Merge pull request #885 from dhalbert/feather_m4_reve
rev E feather M4 express; remove named AREF pins
2018-05-30 10:40:06 -07:00
Dan Halbert
eab8e43188 rev E feather M4 express; remove named AREF pins 2018-05-29 20:25:28 -04:00
Dan Halbert
754c36bb37
Merge pull request #867 from dhalbert/fix_pirkey_apa102
3.0 pirkey build including appropriate frozen modules
2018-05-24 22:07:14 -04:00
Dan Halbert
052a9ff378 update cpx lib 2018-05-24 21:40:49 -04:00
Dan Halbert
e1762f5bf1
Merge pull request #873 from dhalbert/travis-cpx-crickit-build
add cpx-crickit build to travis
2018-05-24 21:35:37 -04:00
Dan Halbert
a5e1174926 add cpx-crickit build to travis 2018-05-24 21:18:56 -04:00
Dan Halbert
ee896cdd41 restore I2C and UART. Don't do port.c resets and inits for modules that are not available. 2018-05-24 20:20:18 -04:00
Dan Halbert
7380e077ae
Merge pull request #871 from tannewt/remove_old_nvm_code
Remove asf3 nvm code.
2018-05-24 16:59:35 -04:00
Scott Shawcroft
42bf3a1306 Remove asf3 nvm code. 2018-05-24 13:14:40 -07:00
Dan Halbert
b9f36184f5 refine pirkey build 2018-05-24 13:28:03 -04:00
Dan Halbert
083f91363a pirkey APA102 defs were commented out in mpconfigboard.h 2018-05-23 18:21:07 -04:00
Dan Halbert
ff592ac791
Merge pull request #864 from pewpew-game/master
Multiple fixes in gamepad
2018-05-23 16:26:20 -04:00
Scott Shawcroft
8e6feecf11
Merge pull request #863 from dhalbert/3.0_doc_updates
RTD documentation updates
2018-05-23 12:57:34 -07:00
Radomir Dopieralski
42e36a883b Remove volatile from the gamepad struct 2018-05-23 21:49:20 +02:00
Radomir Dopieralski
f17a235b40 Raise an error if more than 8 buttons passed to gamepad 2018-05-23 21:41:56 +02:00
Radomir Dopieralski
240678e714 Avoid uninitialized gamepad on exception
Raise exceptions before the gamepad_singleton is created.
Also, use mp_raise for creating the exceptions.
2018-05-23 21:39:06 +02:00
Dan Halbert
65cfbda79b
Merge pull request #866 from tannewt/touchio3
Use merged in FreeTouch
2018-05-23 15:29:53 -04:00
Dan Halbert
2fd9e9a744
Merge pull request #865 from tannewt/fix_rtd_build
Fix ReadTheDocs build due to c2rst.
2018-05-23 15:15:21 -04:00
Dan Halbert
bbdca2f352 typos in builtins.rst 2018-05-23 15:07:32 -04:00
Dan Halbert
6a63ff096a ustruct -> struct in design_guide.rst 2018-05-23 15:05:38 -04:00
Scott Shawcroft
aa86a1457f Use merged in FreeTouch 2018-05-23 11:57:35 -07:00
Scott Shawcroft
27551cbb4d Fix ReadTheDocs build due to c2rst. 2018-05-23 11:53:00 -07:00
Dan Halbert
079c20e58e use shared-bindings struct doc; remove docs/library one 2018-05-23 14:24:02 -04:00
Dan Halbert
6af5fc2796
Merge pull request #861 from tannewt/touchio3
Turn on touchio for M0 boards.
2018-05-23 14:20:15 -04:00