Commit Graph

639 Commits

Author SHA1 Message Date
Nick Moore 66e8ceafad switch nvm.ByteArray to use new nrf_nvm_safe_flash_page_write
adafruit/circuitpython#1610
2019-04-16 14:53:44 +10:00
Nick Moore fd83cf2048 Add a peripherals/nrf/nvm.c to wrap flash page writes safely 2019-04-16 14:53:44 +10:00
Nick Moore d0e5af3b09 Working flash pages for nvm.ByteArray adafruit/circuitpython#1042
import microcontroller

def dump(n = microcontroller.nvm):
    for i in range(0,len(n)):
        print ("%02X " % n[i], end="")
        if i % 16 == 15: print('')

microcontroller.nvm[0:4096] = bytes([1,2,3,4,5,6,7,8]) * 512
microcontroller.nvm[4096:8192] = bytes([16,17,18,19]) * 1024
microcontroller.nvm[4090:4101] = b'thisisatest'
microcontroller.nvm[100:105] = b'hello'
microcontroller.nvm[8000:8007] = b'goodbye'
dump()
2019-04-16 14:53:44 +10:00
Nick Moore 531cf7eb4c switch CIRCUITPY_NVM on! 2019-04-16 14:53:44 +10:00
Nick Moore 933500c448 nvm.ByteArray reads & writes but no sensible erase yet adafruit/circuitpython#1042 2019-04-16 14:53:44 +10:00
Nick Moore df89156f2f Start on nRF nvm.ByteArray adafruit/circuitpython#1042 (doesn't do anything yet) 2019-04-16 14:53:44 +10:00
Scott Shawcroft 254d0a53ac
Revert "nrf nvm: touchups to nickzoic PR #1768" 2019-04-15 18:50:33 -07:00
Dan Halbert 864910559b fix subscripting 2019-04-10 21:41:55 -04:00
Dan Halbert 3618461f9b Merge remote-tracking branch 'adafruit/master' into circuitpython-nickzoic-1042-nrf-nvm-bytearray-2 2019-04-10 14:09:26 -04:00
Scott Shawcroft ac2fd2fa80
Merge pull request #1773 from dhalbert/no-recursive-background-tasks
Don't let a background task call run_background_tasks()
2019-04-09 18:39:28 -07:00
Dan Halbert d633928a16 Don't let a background task call run_background_tasks() 2019-04-09 20:23:01 -04:00
Nick Moore 18908c21f7 Fixups for adafruit/circuitpython#1042 2019-04-09 12:53:11 +10:00
Nick Moore fdaff00c78 Make some space for NVM adafruit/circuitpython#1042 2019-04-09 10:56:53 +10:00
Nick Moore bcb87ffd6c Switch supervisor/internal_flash to use new nrf_nvm_safe_flash_page_write
adafruit/circuitpython#1610
2019-04-09 10:56:53 +10:00
Nick Moore bc92441803 switch nvm.ByteArray to use new nrf_nvm_safe_flash_page_write
adafruit/circuitpython#1610
2019-04-09 10:55:39 +10:00
Nick Moore cd69db7770 Add a peripherals/nrf/nvm.c to wrap flash page writes safely 2019-04-09 10:55:39 +10:00
Nick Moore 8e7fee2246 Working flash pages for nvm.ByteArray adafruit/circuitpython#1042
import microcontroller

def dump(n = microcontroller.nvm):
    for i in range(0,len(n)):
        print ("%02X " % n[i], end="")
        if i % 16 == 15: print('')

microcontroller.nvm[0:4096] = bytes([1,2,3,4,5,6,7,8]) * 512
microcontroller.nvm[4096:8192] = bytes([16,17,18,19]) * 1024
microcontroller.nvm[4090:4101] = b'thisisatest'
microcontroller.nvm[100:105] = b'hello'
microcontroller.nvm[8000:8007] = b'goodbye'
dump()
2019-04-09 10:55:39 +10:00
Nick Moore 592bd0140a switch CIRCUITPY_NVM on! 2019-04-09 10:55:15 +10:00
Nick Moore 492431a694 nvm.ByteArray reads & writes but no sensible erase yet adafruit/circuitpython#1042 2019-04-09 10:54:11 +10:00
Nick Moore f8e5e2da64 Start on nRF nvm.ByteArray adafruit/circuitpython#1042 (doesn't do anything yet) 2019-04-09 10:54:11 +10:00
Scott Shawcroft de48e4b262
Merge remote-tracking branch 'adafruit/master' into fix_cpx_display 2019-04-08 17:15:08 -07:00
Scott Shawcroft 0f003ac5b8
Reorganize board busses into shared-bindings and shared-module. 2019-04-08 16:58:50 -07:00
Scott Shawcroft 049b9ca094
Remove terse TODOs 2019-04-08 14:46:45 -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
Damiano Mazzella 8428fa0f64
Update Makefile 2019-04-05 21:42:29 +02:00
Scott Shawcroft ceb6f2e4fc
Rework flash flush so it preserves the cache
This should make filesystem writes quicker and cause less heap
churn.
2019-04-03 18:28:27 -07:00
Nick Moore 781d301bb6 Remove unnecessary MP_WEAK declarations 2019-04-02 13:33:22 +11:00
Scott Shawcroft 92095eb666 Update comment 2019-04-02 13:28:35 +11:00
Nick Moore 94bda3bde1 Change nRF RTC implementation to use RTC2 #1046
(to avoid interference with Bluetooth Softdevice. See
https://github.com/adafruit/circuitpython/pull/1534#issuecomment-478776240
with thanks to @bboser for pointing it out)
2019-04-02 13:28:22 +11:00
Nick Moore 6afe23d0b0 There isn't really a good way to calibrate this RTC adafruit/circuitpython#1046 2019-04-02 13:28:03 +11:00
Nick Moore 6206fa9a82 adafruit/circuitpython#1046 handle overflows in the RTC counter 2019-04-02 13:27:45 +11:00
Nick Moore f846fa109e enable NRFX RTC adafruit/circuitpython#1046 2019-04-02 13:27:28 +11:00
Nick Moore f88f9fd748 more fake RTC code ... adafruit/circuitpython#1046
(works if MP_WEAK common_hal_rtc_get_time is removed)
2019-04-02 13:27:13 +11:00
Nick Moore 4a5c52fbd6 starting on #1046 rtc for nRF 2019-04-02 13:27:00 +11:00
Dan Halbert 0653bca323
Revert "Circuitpython nickzoic 1046 nrf rtc" 2019-03-29 16:41:29 -04:00
Scott Shawcroft 98811a9675
Update comment 2019-03-28 09:29:18 -07:00
Nick Moore 71622a4515 There isn't really a good way to calibrate this RTC adafruit/circuitpython#1046 2019-03-28 09:50:09 +11:00
Nick Moore 28254def0b adafruit/circuitpython#1046 handle overflows in the RTC counter 2019-03-28 09:50:09 +11:00
Nick Moore b09d2c3c62 enable NRFX RTC adafruit/circuitpython#1046 2019-03-28 09:50:09 +11:00
Nick Moore 69cf33e6a1 more fake RTC code ... adafruit/circuitpython#1046
(works if MP_WEAK common_hal_rtc_get_time is removed)
2019-03-28 09:50:09 +11:00
Nick Moore 77f307c642 starting on #1046 rtc for nRF 2019-03-28 09:50:09 +11:00
Scott Shawcroft 2c93ce5a28
Merge pull request #1672 from dhalbert/regular-fs-flush
flush flash filesystem once a second
2019-03-26 13:47:43 -07:00
Radomir Dopieralski f440e41819 Really fix the error messages in bleio, this time 2019-03-25 14:04:50 +01:00
Radomir Dopieralski bb10a8aaa1 Fix error messages in bleio 2019-03-25 09:19:48 +01:00
Dan Halbert fe555a4098 Allow NFC pins to be used for other purposes. 2019-03-21 11:22:58 -04:00
Dan Halbert fbf166af1a enable MICROPY_CPYTHON_COMPAT for most builds except CIRCUITPY_SMALL_BUILD; remove a few other things to make fit 2019-03-20 14:36:24 -04:00
Dan Halbert 2459eabd66 flush flash filesystem once a second 2019-03-20 12:21:36 -04:00
Dan Halbert 9cceea0d68 nrf: fix internal flash writes 2019-03-18 09:11:40 -04:00
Dan Halbert c4586c0531 nrf: Disable SPIM3; add SPIM1; remove TWIM1 2019-03-12 08:31:03 -04:00
sommersoft 2cd6a79016 better handle frequencyio inclusion 2019-03-01 22:46:57 -06:00
Jerry Needell bd13834a74 implement default busses for particle boards 2019-02-24 09:34:33 -05:00
Kattni f3e50b9df2
Merge pull request #1581 from dhalbert/ble-drv-root-pointer
Use critical section, not lock, in CharacteristicBuffer; use a root pointer for ble_drv list
2019-02-21 12:28:41 -05:00
Dan Halbert 99da3b9646 Use critical section, not lock, in CharacteristicBuffer; use a root pointer for ble_drv list 2019-02-21 00:19:31 -05:00
Dan Halbert 9c24c804fb Fix #ifdefs in port.c to call xxx_reset() rroutines properly. Remove most uses of EXPRESS_BOARD. 2019-02-18 22:44:31 -05:00
Dan Halbert 5ec92415b0 fix module weak links; add missing nrf features 2019-02-17 17:29:28 -05:00
Dan Halbert 7b3f7605b8 address @tannewt changes: move and rename common files; remove PORT_HEAP_SIZE 2019-02-15 20:32:32 -05:00
Dan Halbert a345ef28f2 finish Makefile refactoring; nrf builds work 2019-02-15 18:55:10 -05:00
Dan Halbert 5154e0581e WIP: atmel-samd trinket build works 2019-02-15 00:28:20 -05:00
Dan Halbert ab4194f752 don't allocate DMA buffer as long-lived 2019-02-13 19:49:57 -05:00
Dan Halbert e92d90ce9c Add second UARTE to busio.UART. Init uarts on startup. 2019-02-12 22:34:05 -05:00
Scott Shawcroft 9f7d19a937
Change EMERGENCY_EXCEPTION_BUF settings to match samd. 2019-02-11 20:55:06 -08:00
Scott Shawcroft c17f147be9
A variety of displayio improvements
This changes a number of things in displayio:
* Introduces BuiltinFont and Glyph so the built in font can be used by libraries. For boards with
  a font it is available as board.TERMINAL_FONT. Fixes #1172
* Remove _load_row from Bitmap in favor of bitmap[] access. Index can be x/y tuple or overall index. Fixes #1191
* Add width and height properties to Bitmap.
* Add insert and [] access to Group. Fixes #1518
* Add index param to pop on Group.
* Terminal no longer takes unicode character info. It takes a BuiltinFont instead.
* Fix Terminal's handling of [###D vt100 commands used when up arrowing into repl history.
* Add x and y positions to Group plus scale as well.
* Add bitmap accessor for BuiltinFont
2019-02-11 20:55:05 -08:00
Scott Shawcroft 37b9cd5974
Merge pull request #1521 from nickzoic/circuitpython-nickzoic-1045-nrf-rotaryio
Circuitpython nickzoic 1045 nrf rotaryio
2019-02-07 10:38:20 -08:00
Nick Moore b9db977a2d Change pin mode to pullup for adafruit/circuitpython#1045 2019-02-07 09:47:56 +11:00
Nick Moore a7c349bc6e Add quarter-click logic to adafruit/circuitpython#1045 2019-02-05 16:41:33 +11:00
Nick Moore 95454ecde0 useful output from rotaryio adafruit/circuitpython#1045 2019-02-05 16:41:33 +11:00
Nick Moore 21eb7e8e64 GPIOTE handlers for rotaryio.IncrementalEncoder adafruit/circuitpython#1045 2019-02-05 14:15:13 +11:00
Nick Moore ee21cc163f Start on rotaryio.IncrementalEncoder adafruit/circuitpython#1045 (does nothing yet!) 2019-02-05 14:15:03 +11:00
Scott Shawcroft ec03887040
Fix hallowing and nrf builds 2019-01-31 11:42:15 -08:00
hathach a51f2b0716 refactor nrfx from supervisor/usb.c 2019-01-30 22:30:23 +07:00
hathach 164e1e2341 re-init usb hardware when enable/disable SD 2019-01-30 14:13:07 +07:00
hathach d1fb384a4a
update tinyusb, work better with sd 2019-01-29 21:03:18 +07:00
Scott Shawcroft 765d877dfa
Merge pull request #1499 from nickzoic/nickzoic/circuitpython-nrf-touchin-1048
Nickzoic/circuitpython nrf touchin 1048
2019-01-28 00:22:34 -08:00
Nick Moore 294b026aca Automatically set a default threshold for touchio.TouchIn channels 2019-01-28 18:22:57 +11:00
Nick Moore 539aaf08b5 speed up measurement loop 2019-01-27 21:54:59 +11:00
Nick Moore 4a093294ac hugely simplified version of the touchio.TouchIn.get_raw_reading code (adafruit/circuitpython#1048) 2019-01-27 15:08:03 +11:00
Dan Halbert 7998a7696d also handle BLE_GATTS_EVT_SYS_ATTR_MISSING: fixes Android: 2019-01-23 22:12:38 -05:00
Dan Halbert b1f1bb1389 support BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST, sent by newer devices 2019-01-23 21:07:23 -05:00
Scott Shawcroft a380865655
Merge remote-tracking branch 'adafruit/master' into HEAD 2019-01-22 14:02:07 -08:00
Dan Halbert e170e03f8c Merge remote-tracking branch 'adafruit/master' into bleio2 2019-01-21 20:38:26 -05:00
Dan Halbert 28cfd8a513 CharacteristicBuffer: make it be a stream class; add locking 2019-01-19 19:45:35 -05:00
Roy Hooper 50af08a6f3 Merge branch 'master' into pixelbuf 2019-01-19 16:33:59 -05:00
Scott Shawcroft edc8383e22
Improvements thanks to danh's review 2019-01-18 16:37:06 -08:00
Scott Shawcroft fddc98858a
fix nonetype handling and nrf never reset 2019-01-17 18:51:40 -08:00
Scott Shawcroft 6404aaf411
Fix up nrf and using board.SPI in FourWire 2019-01-17 18:19:07 -08:00
Scott Shawcroft 760bd8d8a4
share fourwire and make nrf compile 2019-01-17 15:15:59 -08:00
Scott Shawcroft c1e6624f8f
Merge pull request #1470 from gpshead/mdk_usb_dongle
Add Makerdiary nRF52840 MDK USB dongle support.
2019-01-15 23:05:15 -08:00
Gregory P. Smith 91452ec9cb Mention the MDK USB Dongle. 2019-01-15 21:24:36 -08:00
dsiee af0f1a7542
Update pins.c
whitespace
2019-01-16 15:02:48 +11:00
dsiee c2d39a7ab7
Update pins.c 2019-01-16 14:58:16 +11:00
dsiee ac238838f2
Update pins.c
add declaration for RED_LED as D3 to match silkscreen.
2019-01-16 14:48:41 +11:00
Gregory P. Smith 7296b647ef Add MDK nRF52840 MDK USB Dongle support.
Adds support for https://wiki.makerdiary.com/nrf52840-mdk-usb-dongle/.

A cheap nRF52840 USB stick with optional headers, very Trinket and Itsy like.
2019-01-15 01:37:22 -08:00
Roy Hooper ffe734edf7 Fresh combined checkin of _pixelbuf library. 2019-01-13 23:51:13 -05:00
Scott Shawcroft 62a8cc2825
Merge pull request #1453 from tannewt/text_on_pyportal
Enable the display on pyportal
2019-01-11 10:33:16 -08:00
Dan Halbert 50ee5ef24c merge translations; add bleio comments; fix minor sphinx issues in midi 2019-01-10 21:12:17 -05:00
Scott Shawcroft 19db886645
Support the display on the pyportal.
Also fix #1390, reload during sleep broken.
2019-01-10 17:29:34 -08:00
Dan Halbert 516d7da641
Merge pull request #1449 from tannewt/midi
Add USB MIDI support for SAMD and nRF.
2019-01-10 19:49:33 -05:00
hathach ee410b2cf1 Merge branch 'master' into nrf52_pulsein 2019-01-10 10:54:40 +07:00
Dan Halbert d3b8581ce0 fix merge conflicts; address some comments 2019-01-09 19:59:48 -05:00
Scott Shawcroft b5e40f52c2
Add USB MIDI support for SAMD and nRF.
The API should be identical to using a UART for MIDI.

Fixes #672
2019-01-09 14:02:11 -08:00
Dan Halbert d41ed768dc Fix sphinx build issues; add better travis fold reporting; update author info 2019-01-09 16:22:19 -05:00
Dan Halbert 89af666093 fix sphinx complaint; more travis fold status reporting 2019-01-09 10:36:38 -05:00
hathach f366e3feea Merge branch 'master' into nrf52_pulsein 2019-01-09 20:39:35 +07:00
hathach cfc4c8cbfa
minor clean up 2019-01-09 15:43:54 +07:00
hathach db82160eef
fix pulsein incorrect compute 2019-01-09 15:15:30 +07:00
Dan Halbert 13d607698e m_tx_in_progress might underflow (check on this) 2019-01-08 16:37:14 -05:00
Dan Halbert 50641c4152 remove debugging printf's 2019-01-08 15:52:21 -05:00
Dan Halbert f66f55b4ed add CharacteristicBuffer; UART seems to work! 2019-01-07 22:46:20 -05:00
hathach 215008f78c
clean up neopixel write !! 2019-01-08 00:21:31 +07:00
Dan Halbert a77b2363ef evt handler list bugs; unique evt handler names; remove uuid128_reference 2019-01-03 21:42:42 -05:00
Dan Halbert 8dea6f53bb forgot to store data when reading a gatts value 2019-01-03 14:16:41 -05:00
Dan Halbert 87c6f33bcc Broadcaster now takes whole packet. Also should be scannable 2019-01-01 14:11:59 -05:00
Dan Halbert 941ccf87c8 don't free event handler list manually; let gc do it 2018-12-31 09:02:43 -05:00
Dan Halbert b6b5ed9c89 Remove nRF52832 support 2018-12-30 22:49:20 -05:00
Dan Halbert 1dc3957e72 LocalPeripheral is now Peripheral; more work on basic GATTS support; UART not working yet 2018-12-30 22:33:49 -05:00
Dan Halbert ef39e72c7c free event handlers on reset; fix typo in Broadcaster 2018-12-29 13:55:10 -05:00
Dan Halbert de7cadb9b2 fix typos in internal_flash.c 2018-12-29 00:08:04 -05:00
Dan Halbert 145e110915 Merge remote-tracking branch 'adafruit/master' into bleio-rev 2018-12-29 00:00:39 -05:00
Dan Halbert 4d1f0ec07b Add Broadcaster. Reset correctly on reload. 2018-12-28 23:34:23 -05:00
hathach 6b0d93cea3
correct i2c max len 2018-12-28 21:14:27 +07:00
hathach a4ee80832a
fix #1422 correct i2c max xfer len (size in bits) 2018-12-28 16:30:11 +07:00
hathach 3ee766bc01
put received bytes to fifo when error 2018-12-28 01:05:30 +07:00
hathach d092722ae8
fix #1407 keep receiving in case of error 2018-12-28 00:40:29 +07:00
Jerry Needell 55084b30ef remome FRAMEBUF from nrf builds - use QSPI for particle ARGON 2018-12-27 09:38:35 -05:00
Dan Halbert 4167bf5b24 wip: advertising works, but not connection 2018-12-27 00:04:04 -05:00
Dan Halbert f5b15c9b4d Merge remote-tracking branch 'origin/feather52840-rgb-qspi-fixes' into bleio-rev 2018-12-21 21:28:24 -05:00
Dan Halbert 0dfe2dbff0 return error status on more routines; minor simplification of freq setting 2018-12-21 12:30:54 -05:00
Dan Halbert bce6d124af Don't check for corrupt heap too early; Fix QSPI timing 2018-12-20 21:28:36 -05:00
hathach 6752266673 added pulsein using gpiote (gpio interrupt) 2018-12-18 22:05:17 +07:00
Dan Halbert bfa66861ef Merge remote-tracking branch 'adafruit/master' into bleio-rev 2018-12-13 16:33:15 -05:00
hathach b37b2fa7e7 overwrite old data if fifo is full 2018-12-13 23:56:06 +07:00
hathach e136222ae2 use rbuf for busio uart 2018-12-13 23:48:53 +07:00
Scott Shawcroft 70939ad517
Merge pull request #1395 from jerryneedell/jerryn_cpython
enable MICROPY_CPYTHON_COMPAT
2018-12-11 10:54:17 -08:00
Scott Shawcroft 8fc72e8978
Add SPI and I2C to SparkFun nRF52840 mini definition and add it to Travis. 2018-12-10 20:32:19 -08:00
Scott Shawcroft 8a981dc8e8
Merge remote-tracking branch 'adafruit/master' into sfe840 2018-12-10 20:13:36 -08:00
Nick Moore 1dc4c4757e touchio.TouchIn sensing working on a single pin! adafruit/circuitpython#1048 2018-12-11 14:33:35 +11:00
Jerry Needell a90343022a enble MICROPYTHON_CPYTHON_COMPAT - fix mpconfigport.h to allow and enable a few more items for compatiblilty with other builds 2018-12-10 16:35:40 -05:00
Nick Moore 901db4797e progress on NRF touchio.TouchIn #1048 2018-12-09 16:48:33 +11:00
Scott Shawcroft 801d9a5abc
Fix running the USB task on nRF.
It wasn't being run due to a rework done only on the atmel-samd port.
The rework itself isn't needed now that the heap check triggers safe
mode instead of throwing a Python exception. So, I've removed the
rework.
2018-12-07 16:11:21 -08:00
Dan Halbert a7a24096f4 bleio WIP: redo for more immutability; use sd_* routines for internal flash write 2018-12-07 16:52:47 -05:00
Scott Shawcroft 332ea8853f
Macro guard VDDH inclusion. 2018-12-06 16:38:14 -08:00
Scott Shawcroft 6ef8639971
Rework safe mode and have heap overwrite trigger it.
This creates a common safe mode mechanic that ports can share.
As a result, the nRF52 now has safe mode support as well.

The common safe mode adds a 700ms delay at startup where a reset
during that window will cause a reset into safe mode. This window
is designated by a yellow status pixel and flashing the single led
three times.

A couple NeoPixel fixes are included for the nRF52 as well.

Fixes #1034. Fixes #990. Fixes #615.
2018-12-06 14:24:20 -08:00
Dan Halbert 125901e4e2 Merge remote-tracking branch 'adafruit/master' into bleio-rev 2018-12-06 12:41:38 -05:00
Scott Shawcroft b25bf062fb
Add correct flash chip for Particle Mesh boards 2018-12-04 18:20:51 -08:00
Scott Shawcroft 15c1fc873c
Add particle boards, fix cp32 and try to speed up atmel build 2018-12-04 18:20:48 -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
Nick Moore 452a622459 Set up structure for touchio adafruit/circuitpython#1048 (does nothing yet) 2018-12-04 17:12:02 +11:00
Dan Halbert 80db2cec99 UART changes: timeout in secs, write bytes, etc. 2018-12-03 12:04:32 -05:00
jimblom 09316b35d7 remove non-broken-out nrf pins. re-organize pins.c list. 2018-11-30 14:58:36 -07:00
Scott Shawcroft 6e15ab6385
Stop ignoring SD hex files and improve the error when its missing. 2018-11-30 13:26:12 -08:00