Commit Graph

556 Commits

Author SHA1 Message Date
Scott Shawcroft 73dadb0669 Update to the latest ASF4 which includes an I2C timeout extension while waiting for clock stretching.
Fixes #778
2018-06-11 18:37:48 -07:00
Dan Halbert 068ffd04a6
Merge pull request #919 from adafruit/jerryneedell-patch-2
fix #918
2018-06-10 09:17:49 -04:00
Nick Moore f72dcc64e6 Fixes #918 (PulseIn.get_paused) ... 2018-06-10 22:37:15 +10:00
Nick Moore b25cbd340b Merge commit '2129bbe160278f7cd2cece939f81900a41f8aa86' into circuitpython-nickzoic-716-pulseio-esp8266 2018-06-10 22:08:58 +10:00
Nick Moore 972b03850f Merge branch 'master' into circuitpython-nickzoic-716-pulseio-esp8266 2018-06-10 22:01:35 +10:00
jerryneedell 8150150a24
return "false" for stub call
See #918 for discussion
2018-06-10 07:11:44 -04:00
jerryneedell 2129bbe160
Update PulseIn.c 2018-06-10 07:08:56 -04:00
jerryneedell 5724fd795a
fix #918
Add stub for common_hal_pulseio_pulsein_get_paused  to make ESP8266 build compatible with PR #901
2018-06-10 05:59:20 -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 8195df1b55 Stub out get_paused in nrf builds. 2018-06-08 14:01:54 -07:00
Scott Shawcroft 66b79723b6 Add code size analysis tool and shrink samd.clock a smidge. 2018-06-08 12:56:32 -07:00
Scott Shawcroft 769788d3c7 Turn off USB pin objects since they are always used for USB. 2018-06-08 12:56:32 -07:00
Scott Shawcroft 383bf9a59e Wait for the DFLL to be stable. 2018-06-08 12:56:32 -07:00
Scott Shawcroft 07a8899c72 Support M4 2018-06-08 12:56:32 -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
Nick Moore 6af1fbacc9 Work on pulseio.PulseOut for #716 ESP8266
Switch to ets_delay_us but the PWM is still way too slow to be useful.
2018-06-08 16:41:42 +10:00
Nick Moore 011edf2472 Clean up interrupt handling for pulseio.PulseIn implementation for #716 ESP8266 2018-06-08 15:31:16 +10:00
Nick Moore c4cf1c5221 Initial pulseio.PulseOut implementation for #716 ESP8266 2018-06-08 15:28:05 +10:00
Nick Moore 7adc69baf9 Initial pulseio.PulseIn implmentation for #716 ESP8266 2018-06-08 15:27:59 +10:00
Kattni Rembor ba7e0e2f86 Add Adafruit to other M4 board name strings 2018-06-07 13:39:04 -04:00
Kattni Rembor 7b2875d54a Add Adafruit to board name string 2018-06-07 13:33:13 -04:00
Kattni Rembor 0ab2a60dcd Update ItsyBitsy board name to one word 2018-06-07 13:12:44 -04:00
Dan Halbert 9ba6990228 Feather M0 Express build with Crickit libraries 2018-06-05 18:21:47 -04:00
Dan Halbert 74ced174ce
Merge pull request #898 from dhalbert/feather_m4_d4
add PA14 as D4 to Feather M4 Express
2018-06-05 11:41:31 -04:00
Dan Halbert 7e7e33e460 add PA14 as D4 to Feather M4 Exprses 2018-06-05 08:15:34 -04:00
Scott Shawcroft 0c7c0821fc
Merge pull request #891 from godlygeek/low_flash_errno_fixes
Human readable OSError messages for low flash devices
2018-06-04 17:22:57 -07:00
Matt Wozniski d0e6bb269f Use the system errno's on nrf 2018-06-02 12:55:07 -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
Matt Wozniski 22f4438787 Prune atmel-samd errno list
Remove errnos that are only raised by modules that aren't linked into
the atmel-samd port.
2018-06-01 19:04:14 -04:00
Matt Wozniski e798b67ca2 Begin a custom list of errnos for atmel-samd
The uerrno module was written to allow boards to customize the list of
errnos they can raise.  Start by copying the default list.
2018-06-01 19:04:04 -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 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
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
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 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
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
Scott Shawcroft aa86a1457f Use merged in FreeTouch 2018-05-23 11:57:35 -07: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
Scott Shawcroft 641caaa6dd Gain space back in non-Express builds by using -finline-limit 2018-05-23 10:36:59 -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
Dan Halbert 22405d6bdb
Merge pull request #860 from dhalbert/3.0-cpx-crickit
turn off longint on cpx crickit; update frozen libs
2018-05-22 16:28:42 -04:00
Scott Shawcroft 165b28438a
Merge pull request #854 from python-ugame/extra-override
Allow overriding EXTRA_BUILTIN_MODULES in mpconfigboard.h
2018-05-22 10:22:35 -07:00
Dan Halbert 0d7db29630 turn off longint on cpx crickit; update frozen libs 2018-05-22 13:03:13 -04:00
Dan Halbert 49a81d5c4b LONGLONG typo 2018-05-22 09:35:29 -04:00
Dan Halbert 45db48bbaa make longint choice mechanism more readable 2018-05-22 08:04:14 -04:00
Dan Halbert 5680933483 refactor longint settings; make crickit cpx build 2018-05-21 23:58:03 -04:00
Radomir Dopieralski 6a6ab2b0ec Allow overriding EXTRA_BUILTIN_MODULES in mpconfigboard.h
Some boards (like the uGame10) may want to have their own set of extra
modules. This change lets them override EXTRA_BUILTIN_MODULES in their
mpconfigboard.h and makes the ugame10 board do that.
2018-05-21 09:23:58 +02:00
Noralf Trønnes cf33ad9a54 atmel-samd/samd21: Enable long int on Express boards
This is necessary for using 1970 epoch in the time module.
2018-05-18 12:35:26 +02:00
Matt Land 06b293af29 pirkey, trinket, ugame 2018-05-17 13:56:10 -04:00
Matt Land a84845c0ae itsbitsy, metro 2018-05-17 13:48:33 -04:00
Matt Land 173a0a5faa arduino, circuitplayground, feather boards 2018-05-17 13:42:08 -04:00
Matt Land fc2b4526d3 worked 2018-05-17 13:33:26 -04:00
Matt Land e1cccd3dac rename to UART 2018-05-17 13:21:15 -04:00
Matt Land 2210fc60b1 Merge branch 'master' of https://github.com/adafruit/circuitpython into feature-default-serial 2018-05-17 13:08:43 -04:00
Matt Land c846f4bdae remove newline 2018-05-17 12:17:06 -04:00
Matt Land 4fd4adf974 not working 2018-05-17 12:14:51 -04:00
Matt Land 30c625ff46 Merge branch 'feature-i2c-gemma' into feature-default-spi-circuit-playground 2018-05-16 17:58:03 -04:00
Matt Land 0511becd55 Merge branch 'master' of https://github.com/adafruit/circuitpython into feature-i2c-gemma 2018-05-16 17:55:43 -04: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
Matt Land b9b742cc69 add spi def to all boards pins file 2018-05-16 17:43:14 -04:00
Matt Land c2fa892a02 fix formatting 2018-05-16 17:38:44 -04:00
Matt Land cc52f8efd9 Merge branch 'feature-i2c-gemma' into feature-default-spi-circuit-playground 2018-05-16 17:32:50 -04:00
Matt Land 0a185c4d2d Merge branch 'master' of https://github.com/adafruit/circuitpython into feature-i2c-gemma 2018-05-16 17:07:58 -04:00
Matt Land e8e75c056a For the two boards without SCL and SDA can you still add the board global entry for I2C? That way they'll raise the NotImplementedError with the better message instead of a NameError. 2018-05-16 17:02:41 -04:00
Jerry Needell 4f93467841 set #define MICROPY_USE_INTERNAL_ERRNO (0) in mpconfigport for ESP8266 to fix compile error 2018-05-16 16:10:32 -04:00
Matt Land de885e81b1 Merge branch 'feature-i2c-gemma' into feature-default-spi-circuit-playground 2018-05-16 16:07:55 -04:00
Matt Land 8a351595ef formatting, trailing newlines 2018-05-16 15:57:25 -04:00
Matt Land 2c067edf54 used pins.c instead of README.rst 2018-05-16 15:54:01 -04:00
Matt Land 3144654854 SPI for all boards 2018-05-16 15:36:36 -04:00
Matt Land 244866c2c3 spi on much 2018-05-16 15:25:24 -04:00
Matt Land 10888be8e8 fixed pins 2018-05-16 15:07:12 -04:00
Matt Land 8d1d821876 pin issue 2018-05-16 14:58:57 -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
Matt Land fbb57f902d better error message 2018-05-15 15:37:48 -04:00
Matt Land ff6e6b5155 best effort 2018-05-15 15:33:27 -04:00
Matt Land 4e65752d6e feather m0 boards 2018-05-15 15:28:23 -04:00
Roy Hooper 90a09dba59 Merge branch 'master' of github.com:adafruit/circuitpython 2018-05-15 14:54:54 -04:00
Matt Land cdeb7ddff8 fix non- builds 2018-05-15 14:27:05 -04:00
Matt Land cd1f6627e4 formatting 2018-05-15 14:09:00 -04:00
Matt Land bd7f603748 zero + feather logger 2018-05-15 14:06:01 -04:00
Roy Hooper 7d443c87b3 Add gemma_m0 pin exclusions 2018-05-15 14:03:39 -04:00
Matt Land a10f04ad6e support for 2 2018-05-15 13:53:53 -04:00