Commit Graph

1699 Commits

Author SHA1 Message Date
Dan Halbert 5bb3c321e9 merge from main 2020-11-19 00:29:14 -05:00
sabas1080 33ca357094 fix VID and PID 2020-11-16 22:10:37 -06:00
sabas1080 089fa82067 Fix pre-commit 2020-11-16 21:21:24 -06:00
Scott Shawcroft 66fb095069
Merge pull request #3667 from microDev1/watchdog-s2
ESP32S2: Support for WatchDog
2020-11-16 15:01:54 -08:00
Dan Halbert ffff02c053 Merge remote-tracking branch 'adafruit/main' into sleep 2020-11-16 12:06:11 -05:00
Dan Halbert bb77f1d130 wip: initial code changes, starting from @tannewt's sleepio branch 2020-11-16 11:56:20 -05:00
Scott Shawcroft 68eb809fbf
Update parallel bus signatures 2020-11-13 18:57:52 -08:00
microDev 10e8b8cf45
move port specific check 2020-11-11 00:24:01 +05:30
sabas1080 6a6e998ea5 Added BastBLE 2020-11-07 19:21:36 -06:00
cyz 92cd599ea3 Modify the pins of the hiibot_bluefi. 2020-11-05 09:14:53 +08:00
Scott Shawcroft 09ae9aefa8
Merge pull request #3610 from Edrig/main
Add new board to nrf port: holyiot_nrf52840
2020-10-30 12:03:34 -07:00
Gaetan 5ab2f16f64 Change Board Name to ADM_B_NRF52840_1
edit   :         .github/workflows/build.yml
rename :         ports/nrf/boards/holyiot_nrf52840/board.c -> ports/nrf/boards/ADM_B_NRF52840_1/board.c
rename :         ports/nrf/boards/holyiot_nrf52840/mpconfigboard.h -> ports/nrf/boards/ADM_B_NRF52840_1/mpconfigboard.h
rename :         ports/nrf/boards/holyiot_nrf52840/mpconfigboard.mk -> ports/nrf/boards/ADM_B_NRF52840_1/mpconfigboard.mk
rename :         ports/nrf/boards/holyiot_nrf52840/pins.c -> ports/nrf/boards/ADM_B_NRF52840_1/pins.c
2020-10-28 22:08:10 +01:00
Gaetan b44011d196 fix railing Whitespace pin.c 2020-10-28 01:43:42 +01:00
Gaetan b5c95e3b1a Merge branch 'main' of https://github.com/Edrig/circuitpython into main
modifié :         boards/holyiot_nrf52840/pins.c
2020-10-28 00:40:46 +01:00
Gaetan 9b911b2211 modifié : pins.c 2020-10-28 00:38:07 +01:00
Gaetan 27827a4fef Fix EOF error
modifié :         mpconfigboard.mk
modifié :         pins.c
2020-10-28 00:34:07 +01:00
microDev 930cf14dce
Add check for invalid io, function to disable all alarms 2020-10-27 16:17:26 -07:00
microDev e35938971a
Add description of alarm modules 2020-10-27 16:16:55 -07:00
Noel Gaetan d0426b3438
Update pins.c
fix mistake
2020-10-27 23:54:46 +01:00
Gaetan 5deb045a81 Ready to PR
* ../../.github/workflows/build.yml
	+ boards/holyiot_nrf52840/board.c
	+ boards/holyiot_nrf52840/mpconfigboard.h
	+ boards/holyiot_nrf52840/mpconfigboard.mk
	+ boards/holyiot_nrf52840/pins.c
2020-10-26 23:32:57 +01:00
Jerry Needell ff69ab603d fix CPB SPI pin definitions 2020-10-21 17:07:30 -04:00
Damien George 18518e26a7 ports: Use correct in/out endpoint size in TUD_CDC_DESCRIPTOR.
The last argument of TUD_CDC_DESCRIPTOR() is the endpoint size (or
wMaxPacketSize), not the CDC RX buffer size (which can be larger than the
endpoint size).

Signed-off-by: Damien George <damien@micropython.org>
2020-10-17 15:49:16 +11:00
Dan Halbert 82b49afe43 enable CIRCUITPY_BLEIO_HCI on non-nRF boards where it will fit 2020-10-15 11:27:21 -04:00
Dan Halbert f1e8f2b404
Merge pull request #3554 from gamblor21/move_ordereddict
Moved ORDEREDDICT define to central location
2020-10-14 22:39:04 -04:00
gamblor21 4270061db4 Moved ORDEREDDICT define to central location 2020-10-13 18:52:27 -05:00
Scott Shawcroft 379e73af2e
Finer grained, per port tick locking
Fixes #3504 hopefully.
2020-10-12 18:43:21 -07:00
Kenny 94beeabc51 remove unnecessary board configuration and address feedback 2020-10-11 22:42:59 -07:00
warriorofwire f5f1e29dc0 disable async/await on a several small ucontrollers 2020-10-10 15:43:12 -07:00
Scott Shawcroft 9fcf96cb64
Replace _bleio.ConnectionError with the native version
Replace uses of _bleio.ConnectionError with regular ConnectionError

Fixes #3008
2020-10-07 17:11:32 -07:00
Scott Shawcroft d62ac24493
Merge pull request #3469 from jepler/noreturn
Add some NORETURN attributes
2020-10-01 11:18:36 -07:00
Damien George 71f3ade770 ports: Support legacy soft I2C/SPI construction via id=-1 arg.
With a warning that this way of constructing software I2C/SPI is
deprecated.  The check and warning will be removed in a future release.

This should help existing code to migrate to the new SoftI2C/SoftSPI types.

Signed-off-by: Damien George <damien@micropython.org>
2020-10-01 12:57:10 +10:00
Damien George 39d50d129c ports: Add SoftI2C and SoftSPI to machine module where appropriate.
Previous commits removed the ability for one I2C/SPI constructor to
construct both software- or hardware-based peripheral instances.  Such
construction is now split to explicit soft and non-soft types.

This commit makes both types available in all ports that previously could
create both software and hardware peripherals: machine.I2C and machine.SPI
construct hardware instances, while machine.SoftI2C and machine.SoftSPI
create software instances.

This is a breaking change for use of software-based I2C and SPI.  Code that
constructed I2C/SPI peripherals in the following way will need to be
changed:

    machine.I2C(-1, ...)            ->  machine.SoftI2C(...)
    machine.I2C(scl=scl, sda=sda)   ->  machine.SoftI2C(scl=scl, sda=sda)

    machine.SPI(-1, ...)            ->  machine.SoftSPI(...)
    machine.SPI(sck=sck, mosi=mosi, miso=miso)
                        ->  machine.SoftSPI(sck=sck, mosi=mosi, miso=miso)

Code which uses machine.I2C and machine.SPI classes to access hardware
peripherals does not need to change.

Signed-off-by: Damien George <damien@micropython.org>
2020-10-01 12:57:10 +10:00
Damien George aaed33896b extmod/machine_i2c: Remove "id" arg in SoftI2C constructor.
The SoftI2C constructor is now used soley to create SoftI2C instances, it
can no longer delegate to create a hardware-based I2C instance.

Signed-off-by: Damien George <damien@micropython.org>
2020-10-01 12:57:10 +10:00
Damien George c35deb2625 extmod/machine_i2c: Rename type to SoftI2C and add custom print method.
Also rename machine_i2c_type to mp_machine_soft_i2c_type.  These changes
make it clear that it's a soft-I2C implementation, and match SoftSPI.

Signed-off-by: Damien George <damien@micropython.org>
2020-10-01 12:57:10 +10:00
Jeff Epler 726dcdb60a Add some NORETURN attributes
I have a function where it should be impossible to reach the end, so I put in a safe-mode reset at the bottom:
```
int find_unused_slot(void) {
    // precondition: you already verified that a slot was available
    for (int i=0; i<NUM_SLOTS; i++) {
        if( slot_free(i)) {
            return i;
        }
    }
    safe_mode_reset(MICROPY_FATAL_ERROR);
}
```
However, the compiler still gave a diagnostic, because safe_mode_reset was not declared NORETURN.

So I started by teaching the compiler that reset_into_safe_mode never returned.  This leads at least one level deeper due to reset_cpu needing to be a NORETURN function.  Each port is a little different in this area.  I also marked reset_to_bootloader as NORETURN.
Additional notes:

 * stm32's reset_to_bootloader was not implemented, but now does a bare reset.  Most stm32s are not fitted with uf2 bootloaders anyway.
 * ditto cxd56
 * esp32s2 did not implement reset_cpu at all.  I used esp_restart().  (not tested)
 * litex did not implement reset_cpu at all.  I used reboot_ctrl_write.  But notably this is what reset_to_bootloader already did, so one or the other must be incorrect (not tested).  reboot_ctrl_write cannot be declared NORETURN, as it returns unless the special value 0xac is written), so a new unreachable forever-loop is added.
 * cxd56's reset is via a boardctl() call which can't generically be declared NORETURN, so a new unreacahble "for(;;)" forever-loop is added.
 * In several places, NVIC_SystemReset is redeclared with NORETURN applied.  This is accepted just fine by gcc.  I chose this as preferable to editing the multiple copies of CMSIS headers where it is normally declared.
 * the stub safe_mode reset simply aborts.  This is used in mpy-cross.
2020-09-28 18:55:56 -05:00
Mark Roberts b921543571 Requested changes take 1 2020-09-25 21:27:29 -04:00
nitz 8d6a28a9ff
Update user button names. 2020-09-18 17:01:44 -04:00
nitz 5249a228a0
More pin names cleanup. 2020-09-18 14:27:00 -04:00
nitz db078922e4
Removed TXD/RXD, fixed whitespace. 2020-09-17 21:32:19 -04:00
Chris Dailey be3e478fce
Add SDA & SDL, RX & TX to pins.c
Despite the [silk on the dock board](https://wiki.makerdiary.com/nrf52840-m2-devkit/resources/nrf52840_m2_devkit_hw_diagram_v1_0.pdf), the SDA/SCL pins weren't defined. Though, they were already defined in `mpconfigboard.h`.

Same for RX/TX. It looks like it declared `TXD` and `RXD`, so I didn't want to remove those, but I think it makes sense to have the "standard" pin names, but I moved ithem to illustrate they were all referencing the same pins.

I mimicked the whitespace I saw in the metro_nrf52840_express port.
2020-09-17 20:46:59 -04:00
Scott Shawcroft 4b827b25ad
Merge pull request #2966 from sommersoft/ci_check_vid_pid
Automate USB VID/PID Uniqueness Check
2020-09-17 11:48:46 -07:00
Scott Shawcroft 95e27bb8bf
Add more PIDs for unique boards 2020-09-15 13:43:35 -07:00
Jeff Epler b3bdd4686b PacketBuffer: add missing 'break's, remove unneeded {} 2020-09-13 15:10:38 -05:00
Scott Shawcroft 9e722c8c99
Merge pull request #3375 from DavePutz/issue3296
Correction for Issue #3296 - ble hanging on nrf52840
2020-09-10 12:36:17 -07:00
Damien George 27e117307d nrf: Remove unnecessary includes of mpconfigport.h and its header guard.
The mpconfigport.h file is an internal header and should only ever be
included once by mpconfig.h.

Signed-off-by: Damien George <damien@micropython.org>
2020-09-09 00:13:34 +10:00
Damien George 75344af4ca nrf/main: Make mp_builtin_open signature match that in py/builtin.h.
Signed-off-by: Damien George <damien@micropython.org>
2020-09-09 00:13:34 +10:00
root 2690faec43 Moved checks for invalid pin to common-hal/microcontroller/Pin.c 2020-09-05 11:42:06 -05:00
root ed6cc64c49 Corrected issue with BLE not working on nrf52840 2020-09-04 16:59:41 -05:00
Dan Halbert 6dbd369272 merge from upstream 2020-08-30 14:39:03 -04:00
Damien George 06659077a8 all: Update Python code to conform to latest black formatting.
Updating to Black v20.8b1 there are two changes that affect the code in
this repository:

- If there is a trailing comma in a list (eg [], () or function call) then
  that list is now written out with one line per element.  So remove such
  trailing commas where the list should stay on one line.

- Spaces at the start of """ doc strings are removed.

Signed-off-by: Damien George <damien@micropython.org>
2020-08-29 15:18:01 +10:00
Lucian Copeland 8021da08d3 Fix problematic whitespace on pulseout parameter errors 2020-08-27 11:07:47 -04:00
Roberto Colistete Jr 91c5d168c0 nrf/Makefile: Improve user C modules support.
Add CFLAGS_EXTRA to CFLAGS. Include LDFLAGS_MOD to the compilation.
And, add SRC_MOD to SRC_QSTR.
2020-08-26 22:14:40 +02:00
Scott Shawcroft 1527a3ce92
Merge remote-tracking branch 'adafruit/main' into add_pwmio 2020-08-24 18:25:18 -07:00
Scott Shawcroft 644d2ba7a2 Add more "extern" declarations for gcc10 compat
gcc has tightened the restrictions on forward declarations that lack
"extern".  Fix them up.
2020-08-21 14:39:37 -05:00
Scott Shawcroft a5b01f7361
Merge remote-tracking branch 'adafruit/main' into add_pwmio 2020-08-21 11:13:53 -07:00
Dan Halbert f714f53552 Merge remote-tracking branch 'adafruit/main' into ble_hci 2020-08-21 10:45:05 -04:00
Dan Halbert 0e30dd8bcc merge from upstream; working; includes debug_out code for debugging via Saleae for posterity 2020-08-20 20:29:57 -04:00
Scott Shawcroft 400701004b
Merge pull request #3279 from hierophect/esp32-pulseinout
ESP32-S2: Add PulseOut and PulseIn
2020-08-20 11:24:08 -07:00
Scott Shawcroft 6857f98426
Split pulseio.PWMOut into pwmio
This gives us better granularity when implementing new ports because
PWMOut is commonly implemented before PulseIn and PulseOut.

Fixes #3211
2020-08-18 13:08:33 -07:00
Scott Shawcroft 8e77981ad5
Merge pull request #3297 from simmel-project/i2c
Update Simmel board definition to reflect DVT hardware
2020-08-18 12:55:45 -07:00
Scott Shawcroft 771388cde2
Remove trailing space. 2020-08-18 11:44:31 -07:00
Lucian Copeland da75445cd5 Style changes, reposition runtime errors 2020-08-18 11:42:06 -04:00
bunnie 211c134950 add I2C, remove unused pins 2020-08-18 19:02:23 +08:00
bunnie a4508f846d stash config 2020-08-18 18:16:49 +08:00
Dan Halbert 94ecf33a5c
Merge pull request #3281 from dhalbert/fix-spim3-buffer-location
SPIM3 buffer must be in first 64kB of RAM
2020-08-17 19:28:03 -04:00
Scott Shawcroft 377503e61c
Merge pull request #3284 from dhalbert/fix-3171-evt-handler
Remove event handler before setting it to NULL
2020-08-17 15:02:29 -07:00
Dan Halbert ef40f83f99 Remove event handler before setting it to NULL 2020-08-15 14:39:53 -04:00
Dan Halbert cf0f3d70b5 SPIM3 buffer must be in first 64kB of RAM 2020-08-15 10:31:56 -04:00
Lucian Copeland 0fc730bc5a Expand PulseOut API, debug cleanup 2020-08-14 16:36:02 -04:00
Yihui Xiong 52990a332d fix 2020-08-14 17:48:15 +08:00
Yihui Xiong e7da652711 able to change ble mac address 2020-08-13 16:54:29 +08:00
Dan Halbert 44c9c43cd1 ble_uart_echo_test works 2020-08-13 00:03:39 -04:00
Jeff Epler 06f6cd067d nrf: Improve commenting about disabled warnings 2020-08-12 12:59:48 -05:00
Jeff Epler 32fc8b0676 nrf: reset_pin_number: reset pin clears never-reset, mirroring samd 2020-08-12 07:32:18 -05:00
Jeff Epler 760a171903 nrf: Make port build with -Werror=undef
.. build-tested on particle_xenon
2020-08-12 07:32:18 -05:00
Dan Halbert 06f3b4048a fix #3228 for nrf; still needs to be fixed for HCI; tested 2020-08-11 16:21:16 -04:00
Jeff Epler 807f049dc3
Merge pull request #3244 from xiongyihui/main
add an option to turn off QSPI when sleep
2020-08-10 16:06:57 -05:00
Dan Halbert 0f4b969d62 discovery of Nordic UART service working 2020-08-08 00:29:37 -04:00
Yihui Xiong af1291ec28 dynamically enable or disable QSPI by default 2020-08-07 16:23:42 +08:00
Yihui Xiong d8257380d7 add qspi_disable() 2020-08-06 09:56:05 +08:00
Yihui Xiong 7854625c4e avoid using the RGB LEDs to save energy 2020-08-05 16:08:13 +08:00
Yihui Xiong dbe47a6a2a adjust 2020-08-05 16:07:18 +08:00
Jeff Epler 93b373d617 "pop from empty %q"
Saves 12 bytes code on trinket m0
2020-08-04 18:42:09 -05:00
Jeff Epler c849b781c0 Combine 'index out of range' messages 2020-08-04 14:45:45 -05:00
Jeff Epler dddd25a776 Combine similar strings to reduce size of translations
This is a slight trade-off with code size, in places where a "_varg"
mp_raise variant is now used.  The net savings on trinket_m0 is
just 32 bytes.

It also means that the translation will include the original English
text, and cannot be translated.  These are usually names of Python
types such as int, set, or dict or special values such as "inf" or
"Nan".
2020-08-04 13:34:29 -05:00
Yihui Xiong 6dc0f4f1b6 add an option to turn off QSPI when sleep 2020-08-05 01:10:58 +08:00
Dan Halbert 0a60aee3e4 wip: compiles 2020-08-02 11:36:38 -04:00
Scott Shawcroft debbf1028a
Merge pull request #3196 from IkigaiSense/ikigaisense_vita
add-ikigaisense_vita-nRF52840
2020-07-27 16:10:57 -07:00
root 204cdada7c remove unnecessary mk files parameters 2020-07-24 09:53:40 -05:00
root ce37a442e8 format fix 2020-07-23 19:35:04 -05:00
root c937fa1760 fix formatting 2020-07-23 19:29:57 -05:00
root 778e8bfda9 Changes to optimization option 2020-07-23 19:27:02 -05:00
ikigaisense 1ee8a09da2 add-ikigaisense_vita-nRF52840 2020-07-23 14:39:59 -06:00
root d83a4ac72d Changes to add compiler optimization option 2020-07-22 12:44:41 -05:00
DavePutz 39e01c3938
Merge pull request #14 from adafruit/main
update from main
2020-07-22 11:30:49 -05:00
Glenn Ruben Bakke caaaa2b1f4 nrf: Enable more features for all targets.
Enabling the following features for all targets, except for nrf51
targets compiled to be used with SoftDevice:

- MICROPY_PY_ARRAY_SLICE_ASSIGN
- MICROPY_PY_SYS_STDFILES
- MICROPY_PY_UBINASCII
2020-07-22 12:54:20 +02:00
Glenn Ruben Bakke 0a79e18398 nrf: Split mpconfigport.h into multiple files.
Splitting mpconfigport.h into multiple device specific
files in order to facilitate variations between devices.

Due to the fact that the devices might have variations in
features and also variations in flash size it makes sense
that some devices offers more functionality than others
without being limited by restricted devices.

For example more micropython features can be activated for
nrf52840 with 1MB flash, compared to nrf51 with 256KB.
2020-07-22 12:54:20 +02:00
root 49decf90c9 Add option for higher optimization levels 2020-07-21 10:11:08 -05:00
Scott Shawcroft 610e0171aa
Disable existing native networking.
We're moving towards a co-processor model and a Wiznet library is
already available.

New native APIs will replace these for chips with networking like the
ESP32S2 but they won't be these.
2020-07-17 17:43:02 -07:00
Jeff Epler 9cdf5e148a
Merge pull request #2879 from jepler/background-callback
Use a linked list of background tasks to perform
2020-07-17 15:46:03 -05:00
Dan Halbert 6494bbdc64 snapshot 2020-07-16 23:14:49 -04:00
Scott Shawcroft 7bb508bf43
Merge pull request #3157 from tinkeringtech/tinkeringtech-scoutmakes-azul
Addition of Tinkeringtech ScoutMakes Azul nRF52840 based platform to CircuitPython
2020-07-16 11:03:31 -07:00
Matt Trentini 486cb6dd4a nrf: Add board definition for nRF52840-MDK-USB-Dongle. 2020-07-16 23:47:13 +10:00
Glenn Ruben Bakke 95d0d1c486 nrf/boards: Enable RTCounter machine module for nrf9160 boards.
Resolves dependencies for MICROPY_PY_TIME_TICKS which
requires to link against nrfx_rtc.c functions by setting
MICROPY_PY_MACHINE_RTCOUNTER to 1.
2020-07-16 11:48:52 +02:00
Glenn Ruben Bakke b776fe6969 nrf/nrfx_config: Disable RTC2 for nRF9160 targets.
nRF9160 does not have any RTC2. Disable the configuration in
case of NRF9160_XXAA.
2020-07-16 11:44:44 +02:00
TinkeringTech 49fcfd14d2 Added the TinkeringTech ScoutMakes Azul platform to CircuitPython 2020-07-15 21:49:34 -04:00
Jeff Epler 1df48176ce supervisor: factor supervisor_background_tasks from sundry ports 2020-07-15 11:49:44 -05:00
Jeff Epler 6160d11c5a supervisor: factor out, Handle USB via background callback 2020-07-15 11:49:44 -05:00
Jeff Epler dc74ae83da nRF: Always use sd_nvic_critical_region calls
The motivation for doing this is so that we can allow
common_hal_mcu_disable_interrupts in IRQ context, something that works
on other ports, but not on nRF with SD enabled.  This is because
when SD is enabled, calling sd_softdevice_is_enabled in the context
of an interrupt with priority 2 or 3 causes a HardFault.  We have chosen
to give the USB interrupt priority 2 on nRF, the highest priority that
is compatible with SD.

Since at least SoftDevice s130 v2.0.1, sd_nvic_critical_region_enter/exit
have been implemented as inline functions and are safe to call even if
softdevice is not enabled.  Reference kindly provided by danh:
 https://devzone.nordicsemi.com/f/nordic-q-a/29553/sd_nvic_critical_region_enter-exit-missing-in-s130-v2

Switching to these as the default/only way to enable/disable interrupts
simplifies things, and fixes several problems and potential problems:
 * Interrupts at priority 2 or 3 could not call common_hal_mcu_disable_interrupts
   because the call to sd_softdevice_is_enabled would HardFault
 * Hypothetically, the state of sd_softdevice_is_enabled
   could change from the disable to the enable call, meaning the calls
   would not match (__disable_irq() could be balanced with
   sd_nvic_critical_region_exit).

This also fixes a problem I believe would exist if disable() were called
twice when SD is enabled.  There is a single "is_nested_critical_region"
flag, and the second call would set it to 1.  Both of the enable()
calls that followed would call critical_region_exit(1), and interrupts
would not properly be reenabled.  In the new version of the code,
we use our own nesting_count value to track the intended state, so
now nested disable()s only call critical_region_enter() once, only
updating is_nested_critical_region once; and only the second enable()
call will call critical_region_exit, with the right value of i_n_c_r.

Finally, in port_sleep_until_interrupt, if !sd_enabled, we really do
need to __disable_irq, rather than using the common_hal_mcu routines;
the reason why is documented in a comment.
2020-07-15 09:26:47 -05:00
Scott Shawcroft 90ad9beff5
Merge pull request #3136 from xiongyihui/master
Add 2 boards nRF52840 M.2 devkit and M60 Keyboard
2020-07-13 17:14:18 -07:00
Scott Shawcroft 51c888d4be
Merge pull request #3003 from Flameeyes/master
License tagging according to REUSE specifications.
2020-07-13 16:28:49 -07:00
Scott Shawcroft d712d1281c
Merge branch 'main' into master 2020-07-13 15:53:44 -07:00
Dan Halbert f6869c69c5 wip: advertising; not tested 2020-07-12 19:45:23 -04:00
Yihui Xiong c8752ff93e use RGB LEDs as status indicators 2020-07-11 21:25:32 +08:00
Yihui Xiong 8e26fdc0e9 add LED status, remove unused macros 2020-07-11 10:51:31 +08:00
Yihui Xiong 7ff499046b use VID & PIDs granted by Seeed 2020-07-11 00:37:45 +08:00
Alex Tsamakos f743bd3d25
nrf/boards: Add initial support for Actinius Icarus.
Example make command:

make BOARD=actinius_icarus
2020-07-10 03:48:30 +02:00
Scott Shawcroft 0068c76fa6
Merge pull request #3135 from arms22/bless_dev_board_multi_sensor
Add new board BLE-SS dev board Multi Sensor
2020-07-09 10:29:57 -07:00
Yihui Xiong 678f266394 fix pre-commit check 2020-07-09 10:25:46 +00:00
Yihui Xiong 96f6ce222c add makerdiary m60 keyboard
Signed-off-by: Yihui Xiong <yihui.xiong@hotmail.com>
2020-07-09 10:02:27 +00:00
Yihui Xiong e81d22cd67 add makerdiary nrf52840 m.2 devkit
Signed-off-by: Yihui Xiong <yihui.xiong@hotmail.com>
2020-07-09 10:01:04 +00:00
arms22 bb5cdcf954 Add new board BLE-SS dev board Multi Sensor 2020-07-09 11:26:45 +09:00
Arudinne 768149fb01 modified: ports/nrf/boards/raytac_mdbt50q-db-40/pins.c 2020-07-08 10:36:41 -05:00
Martin Fischer 59ed3bdd9f nrf: Enable nrf tick support on all boards by default.
Having time.ticks_ms/us/add/diff is very useful and used by many drivers,
libraries and components.
2020-07-08 23:47:08 +10:00
Martin Fischer 15574cd665 nrf: Add support for time.ticks_xxx functions using RTC1.
This commit adds time.ticks_ms/us support using RTC1 as the timebase.  It
also adds the time.ticks_add/diff helper functions.  This feature can be
enabled using MICROPY_PY_TIME_TICKS.  If disabled the system uses the
legacy sleep methods and does not have any ticks functions.

In addition support for MICROPY_EVENT_POLL_HOOK was added to the
time.sleep_ms(x) function, making this function more power efficient and
allows support for select.poll/asyncio.  To support this, the RTC's CCR0
was used to schedule a ~1msec event to wakeup the CPU.

Some important notes about the RTC timebase:

- Since the granularity of RTC1's ticks are approx 30usec, time.ticks_us is
not perfect, does not have 1us resolution, but is otherwise quite usable.
For tighter measurments the ticker's 1MHz counter should be used.

- time.ticks_ms(x) should *not* be called in an IRQ with higher prio than
the RTC overflow irq (3).  If so it introduces a race condition and
possibly leads to wrong tick calculations.

See #6171 and #6202.
2020-07-08 23:47:02 +10:00
Arudinne 5a9aac472a modified: ports/nrf/boards/raytac_mdbt50q-db-40/pins.c 2020-07-07 14:37:59 -05:00
Arudinne dc2f729d19 modified: ports/nrf/boards/raytac_mdbt50q-db-40/mpconfigboard.mk
modified:   ports/nrf/boards/raytac_mdbt50q-db-40/pins.c
2020-07-07 14:37:08 -05:00
Arudinne b5af05cd31 new file: ports/nrf/boards/raytac_mdbt50q-db-40/board.c
new file:   ports/nrf/boards/raytac_mdbt50q-db-40/bootloader/6.0.0/pca10056_bootloader_6.0.0_s140.zip
	new file:   ports/nrf/boards/raytac_mdbt50q-db-40/mpconfigboard.h
	new file:   ports/nrf/boards/raytac_mdbt50q-db-40/mpconfigboard.mk
	new file:   ports/nrf/boards/raytac_mdbt50q-db-40/pins.c
2020-07-07 12:27:23 -05:00
Diego Elio Pettenò 34b4993d63 Add license to some obvious files. 2020-07-06 19:16:25 +01:00
Jeff Epler fcddfd0f39
Merge pull request #3083 from tannewt/esp32s2_busio
Add busio support for the ESP32-S2
2020-07-01 21:02:08 -05:00
Glenn Ruben Bakke c2317a3a8d nrf/Makefile: Disable ROM text compression when compiling for debug.
When compiling for debug (-O0) the .text segment cannot fit the flash
region when MICROPY_ROM_TEXT_COMPRESSION=1, because the compiler does not
optimise away the large if-else chain used to select the correct compressed
string.

This commit enforces MICROPY_ROM_TEXT_COMPRESSION=0 when compiling for
debug (DEBUG=1).
2020-07-01 22:54:52 +10:00
Glenn Ruben Bakke f22f7b285e nrf/bluetooth/ble_uart: Swap end character on cooked strings.
Changing line ending character of cooked strings makes rshell/pyboard.py
work correctly over Bluetooth socat/pts devices.
2020-07-01 22:51:30 +10:00
Glenn Ruben Bakke 5996bf72f1 nrf/bluetooth/ble_uart: Fix random advertisement name.
The storage space of the advertisement name is not declared static, leading
to a random advertisement name.  This commit fixes the issue by declaring
it static.
2020-07-01 22:50:56 +10:00
Glenn Ruben Bakke ab0c14dba0 nrf/bluetooth/ble_uart: Add mp_hal_stdio_poll function.
This adds support for enabling MICROPY_PY_SYS_STDFILES when running UART
over Bluetooth (NUS).
2020-07-01 22:50:41 +10:00
Glenn Ruben Bakke fc1f22a097 nrf/bluetooth: Handle data length update request.
The Bluetooth link gets disconnected when connecting from a PC after 30-40
seconds.  This commit adds handling of the data length update request.  The
data length parameter pointer is set to NULL in the reply,  letting the
SoftDevice automatically set values and use them in the data length update
procedure.
2020-07-01 22:49:04 +10:00
Glenn Ruben Bakke 9dfb4ae6aa nrf/bluetooth/ble_uart: Fix implicit declaration of function.
mp_keyboard_interrupt() triggers a compiler error because the function is
implicitly declared.  This commit adds "py/runtime.h" to the includes.

Fixes issue #5732.
2020-07-01 22:48:25 +10:00
Jeff Epler 57fde2e07b sdcardio: implement new library for SD card I/O
Testing performed: That a card is successfully mounted on Pygamer with
the built in SD card slot

This module is enabled for most FULL_BUILD boards, but is disabled for
samd21 ("M0"), litex, and pca10100 for various reasons.
2020-06-26 11:50:23 -05:00
Dan Halbert 759929c24a hci early wip; refactor supervisor bluetooth.c for nrf: tested 2020-06-25 20:57:17 -04:00
Jeff Epler 1d2cc0b968 I2CPeripheral: Rename class and its module
This is an incompatible change.
2020-06-25 11:44:19 -05:00
Scott Shawcroft c5fa9730a8
Compiles! 2020-06-24 12:47:59 -07:00
Scott Shawcroft a26102607e
Add UART support 2020-06-24 12:47:58 -07:00
Glenn Ruben Bakke 8d71cc2e7d nrf/bluetooth: Use MP_ERROR_TEXT for all error messages.
This follows up on commit def76fe4d9.

Fixes issue #6152.
2020-06-17 11:33:22 +10:00
Nick 33496e9c68 Add nice!nano board support 2020-06-05 19:58:54 -05:00
Diego Elio Pettenò dd5d7c86d2 Fix up end of file and trailing whitespace.
This can be enforced by pre-commit, but correct it separately to make it easier to review.
2020-06-03 10:56:35 +01:00
Scott Shawcroft 959f7297da
Merge remote-tracking branch 'adafruit/master' into wdt-nrf 2020-06-01 17:01:16 -07:00
Scott Shawcroft 4146d6f872
Merge pull request #2890 from jepler/nrf-audio-tick
nrf: put supervisor enable/disable tick in place
2020-06-01 15:51:22 -07:00
Scott Shawcroft 323cca8910
Merge remote-tracking branch 'adafruit/master' into wdt-nrf 2020-06-01 15:18:12 -07:00
Scott Shawcroft 2fd7a43f2f
Merge remote-tracking branch 'adafruit/master' into wdt-nrf 2020-05-29 10:16:24 -07:00
Dan Halbert 0d2fee95e2 enable aesio on all nRF52840 boards 2020-05-29 11:06:30 -04:00
Scott Shawcroft 796373b8be
A number of small ESP32S2 fixes:
* Fix flash writes that don't end on a sector boundary. Fixes #2944
* Fix enum incompatibility with IDF.
* Fix printf output so it goes out debug UART.
* Increase stack size to 8k.
* Fix sleep of less than a tick so it doesn't crash.
2020-05-28 15:43:55 -07:00
Scott Shawcroft 9380c34cf7
Merge remote-tracking branch 'adafruit/master' into wdt-nrf 2020-05-27 10:47:08 -07:00
Dan Halbert d06a7c4671
Correct HiiBot BlueFi USB_PID
Donated a PID set for HiiBot BlueFi.
2020-05-27 11:47:15 -04:00
Sean Cross aac5a4f178 watchdog: use common_hal_watchdog_* pattern
This pulls all common functionality into `shared-bindings` and keeps
platform-specific code inside `nrf`. Additionally, this performs most
validation in the `shared-bindings` site.

The only validation that occurs inside platform-specific `common-hal`
code is related to timeout limits that are platform-specific.

Additionally, all documentation is now inside the `shared-bindings`
directory.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:38:29 +08:00
Sean Cross e470376c12 nrf: add ticks (not subticks) to overflow count during reset
Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:50 +08:00
Sean Cross 296ba101ec nrf: set WDT priority to 2
The previous setting of `1` meant that the bluetooth system couldn't be
used when the watchdog timer was enabled.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:50 +08:00
Sean Cross d0f1b59be5 nrf: pca10100: disable some unused features to shrink image
This removes some features that are largely unused in order to get the
image to fit.

Recommended in
https://github.com/adafruit/circuitpython/pull/2933#issuecomment-632859678

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:50 +08:00
Sean Cross 33001f4e19 nrf: simmel: shrink filesystem to fit watchdog timer
The watchdog timer has increased the amount of code and text that's
required.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:50 +08:00
Sean Cross daf7c2857d nrf: port: save rtc value across reboots
As part of the reset process, save the current tick count to an
uninitialized memory location.  That way, the current tick value will be
preserved across reboots.

A reboot will cause us to lose a certain number of ticks, depending on
how long a reboot takes, however if reboots are infrequent then this
will not be a large amount of time lost.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 5edc29c6a5 nrf: microcontroller: use port reset path
For `microcontroller.reset()`, don't manually call NVIC_SystemReset().
Instead, call the `port_reset()` in case the port wants to do any
cleanup.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross c7efc94a33 watchdog: move timeout exception to shared-bindings
Make this exception globally available to all platforms that have
enabled the watchdog timer.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross c5c13a8ba1 nrf: reset watchdog as part of port_reset()
Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 108409c6cd nrf: common-hal: finish reworking exceptions
This finishes the rework of the exception handler, which is once
again stored inside the watchdog timer module.

This also implements a `watchdog_reset()` that is used to disable the
RAISE watchdog, if one is enabled.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross bd086a102e Revert "add WatchDogTimeout exception"
This reverts commit 561e7e619095869f58fc728d428f3ff20e8bfc40.
2020-05-27 11:28:49 +08:00
Sean Cross 589cb1af6d nrf: watchdog: use nrfx_wdt driver
Instead of directly poking registers, use `nrfx_wdt`.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross e738f5eaa1 nrf: boot into safe mode sometimes for watchdog reset
If the watchdog resets the system and we're plugged into USB, boot into
safe mode.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 08362c9cab watchdogtimer: refactor to new api
This refactors the WatchDogTimer API to use the format proposed in
https://github.com/adafruit/circuitpython/pull/2933#issuecomment-632268227

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross ae950bc050 add WatchDogTimeout exception
This adds an exception to be raised when the WatchDogTimer times out.

Note that this currently causes a HardFault, and it's not clear why it's
not behaving properly.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 0169ea5155 nrf: discard arm exception sections
Since these exceptions are unused, don't include them in the output
binary.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 8f46133917 nrf: watchdog: implement software watchdogtimer
This adds a software WatchDogTimer implementation that can be used for
testing.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 595f6387c2 watchdog: rename module from `wdt` and move to `microcontroller`
This also places it under the `microcontroller` object.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross c23f151b6b nrf: enable wdt for all platforms
Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:48 +08:00
Sean Cross fbe1c05832 nrf: simmel: enable wdt support
This enables WDT support for Simmel. Other platforms cannot yet use
WDT because it overflows their flash storage.

Enable CIRCUITPY_WDT support for the nrf target.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:48 +08:00
Sean Cross abd01c5fbb nrf: add watchdog module
Add common-hal bindings to allow the watchdog module to be used
on nrf platforms.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:48 +08:00
Sean Cross 17ef2df2ca nrf: ld: add ARM.exidx to output image
With the WDT changes, building Circuit Python results in the following error:

/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: section .ARM.exidx LMA [00000000000621c8,00000000000621cf] overlaps section .data LMA [00000000000621c8,0000000000062383]

This is because unwinding data is getting generated, but has nowhere to go.
Re-enable this data in the linker script so it is saved.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:48 +08:00
Scott Shawcroft 2ffd70417d
Merge remote-tracking branch 'adafruit/master' into esp32s2_digitalio 2020-05-26 13:09:57 -07:00
Dan Halbert 19f0d82048
Merge pull request #2955 from BradChan/master
Add hiibot_bluefi board definitions
2020-05-26 15:37:35 -04:00
Scott Shawcroft 3bb6a32a20
Merge branch 'master' into esp32s2_digitalio 2020-05-21 08:52:39 -07:00
Sean Cross 67cf005ee5 nrf: nvm: assume sd is not enabled if interrupts are off
If interrupts are disabled, then calling sd_* functions will hardfault.
Instead, assume that it's safe to write if interrupts are disabled.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-21 22:04:20 +08:00
Sean Cross fd4ef233c6 nrf: port: add memory barrier before wfi
ARM recommends issuing a DSB instruction propr to issuing WFI, as it is
required on many parts suchas Cortex-M7. This is effectively a no-op on
the Cortex-M4 used in most NRF parts, however it ensures that we won't
be surprised when new parts come out.

See
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/BIHICBGB.html
for more information.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-21 21:46:37 +08:00
Sean Cross 77cf4dce8f nrf: disable interrupts before running wfi
In order to ensure we don't have any outstanding requests, disable
interrupts prior to issuing `WFI`.

As part of this process, check to see if there are any pending USB
requests, and only execute the `WFI` if there is no pending data.

This fixes #2855 on NRF.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-21 21:43:52 +08:00
Scott Shawcroft c32214ccc7
Merge pull request #2932 from simmel-project/nrf-rtc-reset
nrf: reset rtc as part of port_reset()
2020-05-20 11:39:16 -07:00
Scott Shawcroft ba724fffb4
Merge remote-tracking branch 'adafruit/master' into esp32s2_digitalio 2020-05-20 10:48:27 -07:00
Scott Shawcroft fd0420d432
Update digitalio api for other ports 2020-05-20 09:23:42 -07:00
Sean Cross 4cca455c9b nrf: reset rtc as part of port_reset()
On NRF, the `rtc_reset()` function is never called.  As a result,
calls to `time.time()` return a cryptic error>

```
>>> import time
>>> time.time()
'' object has no attribute 'datetime'
>>>
```

This is because `MP_STATE_VM(rtc_time_source)` is not initialized
due to `rtc_reset()` never being called.

If `CIRCUITPY_RTC` is enabled, call `rtc_reset()` as part of the
`reset_port()` call. This ensures that `time.time()` works as expected.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-20 16:44:18 +08:00
Scott Shawcroft 916ca9f8a6
Merge pull request #2910 from tannewt/esp32s2
Add initial ESP32S2 support
2020-05-19 12:53:23 -07:00
Sean Cross c1bcc25b88 nrf: _bleio: clean up timeout calculation
The timeout value is calculated by the common-hal layer now, so we don't
need to be quite so clever about calculating it here.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-19 21:56:39 +08:00
Sean Cross 34f91f01c6 bleio: adapter: add advertising timeout and status
Add a field to allow specifying a timeout when initiating advertising.
As part of this, add a new property to determine if the device is still
advertising.

Additionally, have the `anonymous` property require a timeout, and set
the timeout to the maximum possible value if no timeout is specified.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-19 15:01:19 +08:00
Sean Cross cfe65742a3 _bleio: support anonymous advertising
Add a new parameter to the `start_advertising()` function to enable
anonymous advertising.  This forces a call to `sd_ble_gap_privacy_set()`
with `privacy_mode` set to `BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY` and
`private_addr_type` set to
`BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE`.

With this, addresses will cycle at a predefined rate (currently once
every 15 minutes).

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-19 15:01:18 +08:00
Scott Shawcroft 2c2b53303d
Merge pull request #2837 from k0d/serial-debug
Add support for a debug console, such as ST-Link VCP.
2020-05-18 18:13:31 -07:00
Mark Olsson 007c92ee6a Enable showing the console on a debug uart 2020-05-19 02:02:52 +02:00
Scott Shawcroft cf690bd390
Merge remote-tracking branch 'adafruit/master' into esp32s2 2020-05-18 16:46:41 -07:00
Sean Cross 9f7c26c60d nrf: port: call common_hal_rtc_init() during init
Call the new function to set the RTC, or reset it if the offset is not
valid.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-18 11:52:30 +08:00
Sean Cross 83680c41db nrf: rtc: persist rtc offset across reboots
Store the RTC value in the .uninitialized section, but make sure to
flank it with some known values.  That way we can determine if the RTC
value has been initialized, or if it's random uninitialized garbage.

As part of this, add a `common_hal_rtc_init()` routine to determine if
the value is correct, or reset it to 0 if it is not valid.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-18 11:52:27 +08:00
Sean Cross 3b5f5ddaa6 nrf: port: move saved word into .uninitialized section
Circuit Python supports saving a single word of data across reboots.
Previously, this data was placed immediately following the .bss.

However, this appeared to not work, as Circuit Python zeroes out the
heap when it starts up, and the heap begins immediately after the .bss.

Switch to using the new .uninitialized section in order to store this
word across resets.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-18 11:52:25 +08:00
Sean Cross 192bb155fa nrf: port: move the heap after .uninitialized
Previously, it was placed following .bss.  However, now that there is a
new section after .bss, the heap must be moved forward.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-18 11:52:20 +08:00
Sean Cross f002c784c0 nrf: linker: add a new .uninitialized section
This section immediately follows the .bss section, and is designed to
contain uninitialized variables that should persist across reboots.

The section is placed directly after .bss, under the theory that the
size of Circuit Python's .bss + .data is bigger than the bootloader's
.bss + .data, so there is less likely to be a conflict.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-18 11:52:17 +08:00
cyz 4f7b4241a2 add hiibot_bluefi 2020-05-18 09:42:37 +08:00
Scott Shawcroft 3c1469b0a5
Add port_fixed_stack for more builds 2020-05-15 16:22:33 -07:00
Jim Mussared cd9a8c1742 nrf: Add openocd as a supported flasher.
Tested with the Particle Debugger on a Xenon.
2020-05-15 15:06:02 +10:00
Jim Mussared e7f8c7d9a3 nrf: Update to work with nrfx v2.0.0, to match TinyUSB.
Commit 6cea369b89 updated the TinyUSB
submodule to a version based on nrfx v2.0.0.  This commit updates the nrf
port to work with the latest TinyUSB and nrfx v2.0.0.
2020-05-15 15:06:02 +10:00
Damien George 8f348778e1 nrf/mphalport: Remove need for "syntax unified" in mp_hal_delay_us.
Because it can confuse older versions of gcc.  Instead use the correct
instruction for Thumb vs Thumb-2 (sub vs subs) so the assembler emits the
2-byte instruction.

Related to commit 1aa9ff9141.
2020-05-15 15:04:49 +10:00
Damien George eb5e9c00f8 nrf/Makefile: Don't use -fno-builtin for Cortex-M0 builds.
So that error string compression is optimised correctly (it needs strcmp to
be optimised away by the compiler).
2020-05-15 13:39:12 +10:00
Jeff Epler eb876e21c3 nrf: code style 2020-05-13 10:40:41 -05:00
Jeff Epler 011acf41c0 nrf: Ensure ticks enabled while playing audio 2020-05-13 10:40:36 -05:00
Scott Shawcroft bc40034a08
Merge branch 'master' into Optical-Encoder-Module 2020-05-12 12:12:51 -07:00
Daniel Pollard ee2cb703c8 merged master 2020-05-12 14:41:28 +10:00
Sean Cross ffaeeda749 nrf: simmel: decrease flash filesystem size
The flash filesystem must be reduced in order to allow the current
build to fit.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-12 09:31:51 +08:00
Sean Cross f7fcd43516 nrf: simmel: disable SPIM3
Disable the SPIM3 controller to avoid needing to dedicate 8 kB to
the SPIM3 block.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-12 09:31:51 +08:00
Sean Cross 370fc7293a nrf: support disabling SPIM3
SPIM3 is faster than all other SPI blocks, and is capable of generating
a 32 MHz clock.  However, it cannot be used at the same time as the BLE
radio without dedicating an additional 8 kB of RAM to it.

Therefore, some boards may want to disable this.  Support pre-defining
NRFX_SPIM3_ENABLED on the command line to disable it on some bords.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-12 09:31:51 +08:00
Sean Cross 79c055f958 nrf: simmel: enable aesio
This adds AES support to simmel.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-12 09:31:51 +08:00
Sean Cross 235098efb8 nrf: simmel: correct CSn pin
The CSn pin is pin 6 on bank 1, not bank 0.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-12 09:31:51 +08:00
Scott Shawcroft 62b835ad76
Merge pull request #2833 from xiongyihui/pitaya-go
add nRF52840 based Makerdiary Pitaya Go
2020-05-11 16:34:27 -07:00
Daniel Pollard bfa5cd9c13 refactor countio based on feedback 2020-05-05 15:23:38 +10:00
Dan Halbert b7836aeac6 address review comments 2020-05-04 19:51:08 -04:00
Dan Halbert bae7a5e433 make translate again 2020-05-04 17:26:59 -04:00
Dan Halbert d6c6f9f4f0 add PacketBuffer .incoming_ and .outgoing_packet_length 2020-05-04 15:59:45 -04:00
Dan Halbert 4d7e341e44
Merge pull request #2844 from xobs/add-nrf-pca10100
nrf: add pca10100
2020-05-04 10:51:01 -04:00
Sean Cross b128399d1e nrf: simmel: enable CIRCUITPY_USB_HID
Simmel had USB HID disabled in order to save space.  However, the board
configuration did not set USB_DEVICES, causing it to inherit the default
device bouquet of MSC,CDC,MIDI,HID.  This in turn caused HID to be included
in the USB Configuration Descriptor.

For some reason, this was not a problem in an earlier version of tinyusb or
circuitpython.  However, in the most recent version this has rightfully
caused asserts to appear during configuration.

Re-enable USB_HID for now, as it doesn't add too much in terms of space.
We may disable it again later on if we become pressed for space.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-04 15:37:53 +08:00
Sean Cross cb4fc894d7 nrf: add pca10100
This is the nRF52833-DK board.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-04 15:07:49 +08:00
Yihui Xiong 7dd3ddc06b use Nordic's VID which seems to be allowed
https://devzone.nordicsemi.com/f/nordic-q-a/50638/usb-pid-for-nrf52840
2020-05-01 06:10:43 +00:00
Scott Shawcroft 1ca90572f1
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-30 13:25:31 -07:00
Scott Shawcroft 74a2d0944a
Merge pull request #2834 from Teknikio/fix/bluebird_pinout
Update teknikio bluebird pin assignments
2020-04-30 11:50:02 -07:00
JoeBakalor 36a71560c2 update teknikio bluebird pin assignments 2020-04-30 09:58:27 -04:00
Yihui Xiong 4393a88fb6 add nRF52840 based Makerdiary Pitaya Go 2020-04-30 07:38:20 +00:00
Dan Halbert 241d7e2ae6 change many ifndefs to ?= 2020-04-29 23:31:34 -04:00
Dan Halbert f3078511a6 further cleanup and bug fixing 2020-04-29 23:18:08 -04:00
Sean Cross 6aac9233db nrf: bluetooth: add s147 v7.0.1 softdevice hexfile
This was not added as part of the initial v7.0.1 patchset because
.hex files are in this project's .gitignore, and so git ignored it.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-30 10:43:46 +08:00
Dan Halbert 180f5c6a94 Merge remote-tracking branch 'adafruit/master' into ringbuf-fixes 2020-04-29 22:11:22 -04:00
Dan Halbert 3d62f87e29 back to '.packet_size' for compatiblity 2020-04-29 22:10:56 -04:00
Dan Halbert 84cee1ab8d rename and improve PacketBuffer packet length property 2020-04-29 17:49:31 -04:00
Scott Shawcroft a30ff70b4e
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-29 10:51:21 -07:00
Sean Cross 1d0781bf12 nrf: add simmel board
This adds support for Simmel, an nRF52833-based bluetooth tracking
board designed to aid in pandemic tracing.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-29 11:40:00 +08:00
TG-Techie b9e494b85a add submodule to TG-Watch02A 2020-04-28 00:03:02 -04:00
TG-Techie 76b466a38a add submodule to TG-Watch02A 2020-04-27 22:49:30 -04:00
Scott Shawcroft 755d404edf
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-27 16:45:10 -07:00
Scott Shawcroft 9e4b94f466
Merge pull request #2805 from tannewt/update_tinyusb
Update tinyusb
2020-04-26 20:55:36 -07:00
Scott Shawcroft 5c7f6e6211
Remove empty #if and add missing includes. 2020-04-24 11:48:55 -07:00
Dan Halbert 982a755eae
Merge pull request #2801 from simmel-project/nrf-s140-7.0.1
Add NRF S140 7.0.1
2020-04-23 21:59:51 -04:00
stijn 84fa3312cf all: Format code to add space after C++-style comment start.
Note: the uncrustify configuration is explicitly set to 'add' instead of
'force' in order not to alter the comments which use extra spaces after //
as a means of indenting text for clarity.
2020-04-23 11:24:25 +10:00
stijn d6243568a0 all: Remove commented-out include statements. 2020-04-23 11:24:15 +10:00
Sean Cross 689dd61379 nrf: nrf52833: use s140 v7.0.1
Previously, we were using v6.1.1 which worked, but was unsupported.
v7.0.1 is the first version of s140 that supports the nRF52833.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-22 13:34:11 +08:00
Sean Cross 09bef7b0e1 nrf: bluetooth: add s140 v7.0.1
This is the first version with official support for nRF52833.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-22 13:33:39 +08:00
Dan Halbert 2f86e31501 fix calculation of nrf firmware size 2020-04-22 00:52:54 -04:00
Dan Halbert fbc8719fad ringbuf tested 2020-04-21 22:40:12 -04:00
Dan Halbert 77cd93ac2d merge from adafruit 2020-04-21 17:47:51 -04:00
Dan Halbert 38ec3bc574 further ringbuf cleanup 2020-04-21 17:38:20 -04:00
Sean Cross c04e6d6f52 nrf: bleio: parameterize softradio configuration
Allow for setting various softradio memory settings as part of a
board in order to support lower-memory configurations.  If a
parameter is unspecified then the previously-defined value is used.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-21 12:29:59 +08:00
Sean Cross 3537ad4059 nrf: mpconfigport: support configuration of various sizes
Conditionally set variables such as the softdevice RAM size, bootloader
size, and the spi m3 buffer size.  This allows ports to adjust these
values to suit their needs.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-21 12:29:58 +08:00
Sean Cross 33720af0c6 nrf: mpconfigport: subtract config size from firmware size
The BLE Config area needs to be subtracted from the size of the firmware.
THis is because the firmware is counted by walking backwards from the end
of memory, and the BLE config area is placed lower in memory than the
firmware.  Subtracting the BLE config size ensures the internal flash
filesystem doesn't try to use the firmware as storage.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-21 12:29:57 +08:00
Sean Cross 3ed5b87b8f nrf: add support for nrf52833
This adds preliminary support for the nRF52833, which is a variant of
the nRF52840 with half the RAM, half the flash, and fewer peripherals.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-21 12:29:56 +08:00
Sean Cross 4ad1cbeea3 nrf: make rgbmatrix and framebufferio optional
Ports can set CIRCUITPY_RGBMATRIX and CIRCUITPY_FRAMEBUFFERIO to 0
in their .mk file in order to prevent these from being built.  This
is necessary for resource-constrained devices.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-21 10:44:21 +08:00
Sean Cross 066f486b28 nrf: supervisor: support building without BUSIO
Only initialize i2c, spi, and uart if building with BUSIO.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-21 10:44:20 +08:00
Sean Cross ac9d336f40 nrf: make neopixel support optional
Add a conditional around the call to neopixel_write(), allowing us
to build for nrf without neopixel support.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-21 09:56:27 +08:00
Scott Shawcroft bebf27e733
Merge remote-tracking branch 'adafruit/master' into lower_power
This isn't perfect and needs a bit more testing.
2020-04-20 18:25:13 -07:00
Jeff Epler 5fcc6d6286 RGBMatrix: finish renaming from Protomatter
This gets all the purely internal references.  Some uses of
protomatter/Protomatter/PROTOMATTER remain, as they are references
to symbols in the Protomatter C library itself.
2020-04-17 18:44:07 -05:00
Jeff Epler 3d6258f63d Rename Protomatter -> RGBMatrix
This is a quick rename, it changes the user-facing names but not the
internal names of things.
2020-04-17 18:43:57 -05:00
Jeff Epler a32337718d Rename _protomatter -> protomatter
I originally believed that there would be a wrapper library around it,
like with _pixelbuf; but this proves not to be the case, as there's
too little for the library to do.
2020-04-17 18:43:57 -05:00
Scott Shawcroft 7e3d4c61b5
Update TinyUSB and add interrupt hooks. 2020-04-17 14:16:49 -07:00
Scott Shawcroft b580b34cbf
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-14 17:14:44 -07:00
Jeff Epler 1d8a073c05 nrf: protomatter port 2020-04-14 18:24:58 -05:00
Jeff Epler 09dc46a984 Add Protomatter and FramebufferDisplay 2020-04-14 18:24:54 -05:00
Damien George 8e048d2548 all: Clean up error strings to use lowercase and change cannot to can't.
Now that error string compression is supported it's more important to have
consistent error string formatting (eg all lowercase English words,
consistent contractions).  This commit cleans up some of the strings to
make them more consistent.
2020-04-13 22:19:37 +10:00
Jim Mussared 073b9a5eb8 ports: Enable error text compression for various ports, but not all.
Enabled on: bare-arm, minimal, unix coverage/dev/minimal, stm32, esp32,
esp8266, cc3200, teensy, qemu-arm, nrf.  Not enabled on others to be able
to test the code when the feature is disabled (the default case).

Code size change for this commit:

   bare-arm:  -600 -0.906%
minimal x86:  -308 -0.208%
   unix x64:    +0 +0.000%
unix nanbox:    +0 +0.000%
      stm32: -3368 -0.869% PYBV10
     cc3200: -1024 -0.558%
    esp8266: -2512 -0.368% GENERIC
      esp32: -2876 -0.205% GENERIC[incl -3168(data)]
        nrf: -1708 -1.173% pca10040
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
2020-04-05 15:02:06 +10:00
Jim Mussared def76fe4d9 all: Use MP_ERROR_TEXT for all error messages. 2020-04-05 15:02:06 +10:00
Scott Shawcroft 7e69d30c02
Fix nRF PulseIn 2020-04-03 14:22:56 -07:00
Scott Shawcroft 8fe512c7e9
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-03-31 15:13:58 -07:00
Scott Shawcroft cbe9512691
Merge pull request #2741 from tannewt/fix_packetbuffer_server
Fix PacketBuffer server support
2020-03-31 13:39:34 -07:00
Jeff Epler 54e8c63b4f
Merge pull request #2730 from tannewt/fix_fourwire_phase_polarity
Add polarity and phase to FourWire.
2020-03-28 07:28:37 -05:00
Scott Shawcroft 798118b74f
Update board.c's to remove remaining tick.h 2020-03-27 14:52:35 -07:00
Scott Shawcroft b043384949
Update built in display init 2020-03-27 14:35:29 -07:00
siddacious 9e0c00dfd4 adding a backlight polarity flag to Display 2020-03-25 22:51:20 -07:00
siddacious 7bba79363a allowing backlight change 2020-03-25 22:41:23 -07:00
Scott Shawcroft 8a5d3cd6c4
Add exception on small buffer and fix Connecion WRITE handling 2020-03-25 17:41:47 -07:00
Scott Shawcroft 3551b769a2
Fix connection handle tracking in PacketBuffer when a server. 2020-03-25 13:31:18 -07:00
William Moser c961ed9025 Added 31250 and 56000 to baudrate_map in UART.c, to parallel definitions in nrfx/mdk/nrf*_bitfields.h files 2020-03-24 13:25:02 -04:00
Zoltán Vörös c5cc64175b ports: Add lib/libm/roundf.c to bare-metal Makefile's.
This function is not used by the core but having it as part of the build
allows it to be used by user C modules, or board extensions.  The linker
won't include it in the final firmware if it remains unused.
2020-03-25 01:22:00 +11:00
Damien George feb2577585 all: Remove spaces between nested paren and inside function arg paren.
Using new options enabled in the uncrustify configuration.
2020-03-25 00:39:46 +11:00
Damien George ad9a0ec8ab all: Convert exceptions to use mp_raise_XXX helpers in remaining places. 2020-03-18 17:26:19 +11:00
Jeff Epler d6342af980 ulab: rename enable macro so it appears in the support matrix 2020-03-17 09:33:03 -05:00
Scott Shawcroft 76ca13b6ed
Fix SAMD51 pulsein 2020-03-13 17:21:15 -07:00
Scott Shawcroft 48b5f2a384
Initial work on SAMD 2020-03-13 11:16:41 -07:00
Scott Shawcroft affd3fcc2a
Clear the pending IRQ in the NVIC as well. 2020-03-13 11:16:38 -07:00
Scott Shawcroft 00d5f63e7c
Hopefully fix PulseIn 2020-03-13 11:12:31 -07:00
Scott Shawcroft ed5cdd7e09
Hopefully fix flash flush and hopefully audio as well. 2020-03-13 11:12:31 -07:00
Scott Shawcroft 418333979a
Fix autoreload, neopixel, monotonic_ns and sleep w/o SD 2020-03-13 11:12:31 -07:00
Scott Shawcroft 6f60afe8c5
First try at lowering the power consumption 2020-03-13 11:12:30 -07:00
Scott Shawcroft 85f44e20cb
Merge pull request #2695 from TG-Techie/master
Add new TG-Watch02A to the nrf boards directory
2020-03-13 10:46:48 -07:00
TG-Techie 197dc344af fix requested changes 2020-03-12 02:31:13 -04:00
TG-Techie b967a2071f changed TG-Watch02A HW_BOARD_NAME 2020-03-10 23:07:25 -04:00
TG-Techie 50b451ae0c add TG-Watch02A board def 2020-03-10 22:40:55 -04:00
TG-Techie fec84054d9 ah 2020-03-06 15:03:37 -05:00
TG-Techie 7198056bc3
Merge pull request #2 from adafruit/5.0.x
5.0.x
2020-03-06 13:57:31 -05:00
Dan Halbert 210c3274e5 Merge remote-tracking branch 'adafruit/master' into assert_pin-and-mp_const_none-cleanup 2020-03-05 17:47:01 -05:00
Jeff Epler da31acfcc4 Merge remote-tracking branch 'origin/master' into ulab 2020-03-03 20:13:53 -06:00
Dan Halbert 8435935429 update uses of assert_pin_free; remove redundant checks 2020-02-29 15:37:32 -05:00
Dan Halbert b6206406de new pin validation routines; don't use mp_const_none if NULL will do 2020-02-28 23:43:04 -05:00
Jeff Epler eef742bf45 oofatfs: Remove _FS_DISK_READ_ALIGNED
This workaround is no longer needed, so it can be removed.

Closes: #2332
2020-02-28 10:04:28 -06:00
Jeff Epler 1e6c08fc30 nrf: sqpi_flash: Handle unaligned reads 2020-02-28 10:03:37 -06:00
TG-Techie 527eb2444c added TG-Watch02A pins 2020-02-28 04:11:54 -05:00
TG-Techie 6d4ffc69fd add TG-Watch02A 2020-02-28 02:52:46 -05:00
Damien George 69661f3343 all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-28 10:33:03 +11:00
Damien George 3f39d18c2b all: Add *FORMAT-OFF* in various places.
This string is recognised by uncrustify, to disable formatting in the
region marked by these comments.  This is necessary in the qstrdef*.h files
to prevent modification of the strings within the Q(...).  In other places
it is used to prevent excessive reformatting that would make the code less
readable.
2020-02-28 10:31:07 +11:00
Jeff Epler fa3b9eba92 ulab: Incorporate it 2020-02-27 11:03:03 -06:00
ladyada 86e9fd170a move red LED to D13 and make D3 lsm6ds IRQ 2020-02-25 18:00:23 -05:00
Scott Shawcroft 28c7a1e9c3
Fix crash after empty REPL session
We were trying to reset bluetooth when it was off and then trying
to raise an exception without the heap.
2020-02-24 16:11:17 -08:00
Dan Halbert f63b2c0d0c use realloc instead 2020-02-21 17:36:15 -05:00
Dan Halbert 9cf46ec947 put neopixel_write buffer in root pointers 2020-02-21 08:44:25 -05:00
Dan Halbert 23d6a3dc1f merge from upstream 2020-02-20 22:27:16 -05:00
Dan Halbert 634d246910 relicense nrf SPI.c to MIT 2020-02-20 16:00:21 -05:00
Dave Marples 24405cabaf Edits as a result of review 2020-02-19 00:07:01 +00:00
Dave Marples 490a808bf6 Addition of stubs for rs485/CTS/RTS handling on non-implemented chips 2020-02-18 23:16:40 +00:00
Damien George ac8383a95d nrf: Use MICROPY_HW_ENABLE_RNG instead of MICROPY_PY_RANDOM_HW_RNG.
The "random" module no longer uses the hardware RNG (the extmod version of
this module has a pseudo-random number generator), so the config option
MICROPY_PY_RANDOM_HW_RNG is no longer meaningful.  This commit replaces it
with MICROPY_HW_ENABLE_RNG, which controls whether the hardware RNG is
included in the build.
2020-02-18 12:43:16 +11:00
Damien George 6ad3bb1e12 nrf: Remove custom "random" module and use extmod version instead.
Hardware RNG code is moved to drivers/rng.[ch].
2020-02-18 12:43:16 +11:00
cccc 4f3e5ea934 nrf/drivers/bluetooth: Fix variable initialisation error with older gcc.
Without this change, arm-none-eabi-gcc version 4.9.3 (at least) would give
a "missing braces around initializer" error.
2020-02-16 23:46:27 +11:00
Dan Halbert dc97b0d844 correct chec^Cfor flash erase boundaries 2020-02-13 17:41:05 -05:00
Scott Shawcroft e97b0cfc61
Merge pull request #2581 from jamesbowman/master
First draft of eveL, the low-level module of the Gameduino bindings
2020-02-13 11:21:32 -08:00
Damien George ad7213d3c3 py: Add mp_raise_msg_varg helper and use it where appropriate.
This commit adds mp_raise_msg_varg(type, fmt, ...) as a helper for
nlr_raise(mp_obj_new_exception_msg_varg(type, fmt, ...)).  It makes the
C-level API for raising exceptions more consistent, and reduces code size
on most ports:

   bare-arm:   +28 +0.042%
minimal x86:  +100 +0.067%
   unix x64:   -56 -0.011%
unix nanbox:  -300 -0.068%
      stm32:  -204 -0.054% PYBV10
     cc3200:    +0 +0.000%
    esp8266:   -64 -0.010% GENERIC
      esp32:  -104 -0.007% GENERIC
        nrf:  -136 -0.094% pca10040
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
2020-02-13 11:52:40 +11:00
Damien George 97eca38c4f py: Add mp_raise_type helper macro and use it where appropriate.
This provides a more consistent C-level API to raise exceptions, ie moving
away from nlr_raise towards mp_raise_XXX.  It also reduces code size by a
small amount on some ports.
2020-02-13 11:03:37 +11:00
Dan Halbert e00b3269fe use properly-sized SPI transactions 2020-02-12 15:04:19 -05:00
Dan Halbert 2e029d55fc nrf: add SPIM3 support 2020-02-11 19:22:14 -05:00
Damien George 580fd636c0 nrf/drivers: Use mp_raise_msg where appropriate, and shorten exc msgs.
If the exception doesn't need printf-style formatting then calling
mp_raise_msg is more efficient.  Also shorten exception messages to match
style in core and other ports.
2020-02-11 11:45:14 +11:00
Drew Fustini 3bf4b42e2e change OH20 badge pin defs to use SWn for buttons
Rather than use A, B, C and D

Use the buttons according to silkscreen references:
SW1
SW2
SW3
SW4
2020-02-10 00:49:13 +01:00
Drew Fustini 0a54f88751 add pin defs for buttons on the OHS2020 badge 2020-02-10 00:32:16 +01:00
Dan Halbert 005c4caf8c fix function defs for compiler 2020-02-07 10:32:37 -05:00
Dan Halbert 857d8ab40a improve time.monotonic_ns() accuracy from ms to us 2020-02-07 10:02:50 -05:00
Dan Halbert a63f49cb83
Merge pull request #2592 from tannewt/add_extra_ble_error
Add another error message to BLE
2020-02-05 23:39:17 -05:00
James Bowman acef93a253 Rename eveL to _eve, EVEL to _EVE 2020-02-05 18:17:58 -08:00
Scott Shawcroft 72a1bdab30
Add another error message for extended advertisements at the same
time as scan response. The SD can't do it.
2020-02-05 15:56:17 -08:00
Dan Halbert b6da2fa173 nrf: fix i2c frequency setting 2020-02-05 11:25:31 -05:00
James Bowman 7fd30e7d20 First draft of eveL, the low-level module of the Gameduino (and BridgeTek EVE) bindings.
[adafruit/circuitpython#2578]
2020-02-03 16:46:14 -08:00
Lady Ada 5a29b222eb add bluefruit sense - tested 2020-02-03 13:52:30 -05:00
Michael Welling 64cafe82bc Adjust OHS2020 madctl for default rotation
Make to go faster I guess.

Signed-off-by: Michael Welling <mwelling@ieee.org>
2020-02-02 22:14:10 -08:00
Michael Welling 6804b2a7fd Add I2C pin definitions for interoperability with Adafruit libraries
Signed-off-by: Michael Welling <mwelling@ieee.org>
2020-02-02 22:13:39 -08:00
Michael Welling 33dcdd7c03 Updates to enable working SPI TFT
The backlight enable is active low on our board so the driver doesn't like it.
Toggling to GPIO manually for now.

As fixed the improper SPI bus pins definitions and it works!

Signed-off-by: Michael Welling <mwelling@ieee.org>
2020-02-02 22:13:03 -08:00
Michael Welling d99c2ffe4f QSPI flash fixes
We had the pin names swapped on the schematic and a different flash was populated.

Signed-off-by: Michael Welling <mwelling@ieee.org>
2020-02-02 22:11:12 -08:00
Lady Ada dc964b346c adjust CLUE madctl so rotation 0 is 'right' 2020-01-31 20:17:39 -05:00
Dan Halbert be4e681d07 fix UICR check; do not use NULL for no MISO 2020-01-31 18:57:41 -05:00
Dan Halbert 4abd5f1f7b increase max connections from 2 to 5 2020-01-31 14:58:23 -05:00
caochaowu 61f64c78a6 nrf/boards/common.ld: Add ENTRY(Reset_Handler) in linker script.
It's not strictly needed but can be helpful when using a debugger.
2020-02-01 00:09:44 +11:00
Dan Halbert b6358182d3 Update CLUE to Rev C 2020-01-30 15:22:26 -05:00
Scott Shawcroft 298bca3fdd
Merge pull request #2562 from dhalbert/ble-fixes
nrf: track vm_used_ble better
2020-01-30 10:33:19 -08:00
Dan Halbert 87f73e2729 track vm_used_ble better 2020-01-30 09:52:06 -05:00
hierophect 898f4e1f72
Merge branch 'master' into stm32-meowbit 2020-01-29 16:32:08 -05:00
Lucian Copeland 100409961a Move board_init to main.c 2020-01-29 16:29:43 -05:00
Wojtek Siudzinski df5e58fc6e Add support for the Particle Ethernet FeatherWing 2020-01-28 10:53:50 +01:00
Scott Shawcroft b36b2493bc
Merge pull request #2532 from tannewt/teensy4-dev
Refine iMX RT memory layout and add three boards
2020-01-27 14:11:08 -08:00
Lady Ada f2dfcee042 add missing displayref 2020-01-26 20:10:20 -05:00
Dan Halbert 68f9aee992 reset NeoPixels on CPB on soft reload 2020-01-23 20:16:31 -05:00
Scott Shawcroft 1c39606345
Fix other builds missing new heap bounds functions 2020-01-18 18:06:56 -08:00
Michael Welling cc77e86408 Update the VID and USB company string
Signed-off-by: Michael Welling <mwelling@ieee.org>
2020-01-16 15:43:49 -08:00
Michael Welling cc03d68984 Fix backlight pin registration
Signed-off-by: Michael Welling <mwelling@ieee.org>
2020-01-16 14:53:07 -08:00
Michael Welling 86d454adf3 Initial board support for OHS2020 Badge
Not tested but builds.

Signed-off-by: Michael Welling <mwelling@ieee.org>
2020-01-16 13:46:56 -08:00
Scott Shawcroft 8b61333937
Merge pull request #2510 from dhalbert/bonding-nvm
nrf: Add bonding to BLE pairing support
2020-01-15 16:11:09 -08:00
Benny Meisels 4bf10a75c7 Add board definition files for AramCon Badge 2019 2020-01-16 00:44:18 +02:00
Dan Halbert 85dc4089b9 address review comments 2020-01-14 17:23:16 -05:00
Memiks 4ab4bf3ec6 ports: Modify mp_hal_pin_write macro so it can be used as a function.
Even though it doesn't return anything it could still be used like a
function.  Addresses issue #5501.
2020-01-14 23:48:42 +11:00
Dan Halbert 0367ba7495 fix some typos and leftovers 2020-01-13 18:29:34 -05:00
Dan Halbert 2a75196aa3 merge from adafruit/circuitpython 2020-01-13 18:15:32 -05:00
Dan Halbert 4ad004f24e put bonding to-do flags into Connection objects instead of using a heap-allocated queue 2020-01-13 17:52:32 -05:00
Dan Halbert 9e7f8743c2 fix CCCD bonding store; avoid excessive bonding writes 2020-01-12 23:32:51 -05:00
Dan Halbert 346ce3b73b wip: HID bonding works! 2020-01-10 23:55:45 -05:00
Scott Shawcroft 6ea8d8a6c2
Merge pull request #2498 from dhalbert/optional-i2c-pullup-checking
Make requiring I2C pullups be optional
2020-01-10 11:42:44 -08:00
Scott Shawcroft 8708d3dc45
Merge pull request #2461 from jepler/urandom-hardfaults
Urandom hardfaults
2020-01-10 11:37:59 -08:00
Dan Halbert 9c167af17a wip; redid flash writing to be compatible with SD 2020-01-09 17:40:02 -05:00
Dan Halbert 189f2d5f07 Make requiring I2C pullups be optional 2020-01-09 17:31:50 -05:00
Jeff Epler 1c6efb9e66 os.urandom: remove unneeded sleep 2020-01-08 16:48:17 -06:00
Roy Hooper 1caf6bd8d3 add missing .h file 2020-01-08 15:23:38 -05:00
Roy Hooper e1c1e32ceb address code review 2020-01-08 15:17:54 -05:00
Roy Hooper 4e040b0152 add reset of heap to board reset for nrf port 2020-01-08 15:15:27 -05:00
Roy Hooper 34c9e00f08 try (re)using the buffer in neopixel_write 2020-01-08 15:14:53 -05:00
Scott Shawcroft 7a94940c89
Replace magic number and add comment. 2020-01-08 11:01:43 -08:00
Scott Shawcroft d4492aaed0
Merge remote-tracking branch 'adafruit/master' into packet_buffer 2020-01-08 10:44:37 -08:00
Jeff Epler b3fb024301 nrf: Call into sd as many times as necessary to fill urandom request
Generating 51200 bytes in one go takes 4.966s, so that's a rate of about
10KiB/s.
2020-01-08 10:06:55 -06:00
Dan Halbert 8d629a957d
Merge pull request #2367 from iot49/mtime
fix mtime on file creation
2020-01-07 17:19:40 -05:00
Dan Halbert 390337b9a5 wip; compiles 2020-01-05 23:33:42 -05:00
Scott Shawcroft 82fb761c0f
Add PacketBuffer and MTU negotiation support.
PacketBuffer facilitates packet oriented BLE protocols such as BLE
MIDI and the Apple Media Service.

This also adds PHY, MTU and connection event extension negotiation
to speed up data transfer when possible.
2020-01-03 17:29:54 -08:00
Scott Shawcroft 776c9b011c
Merge pull request #2432 from tannewt/fix_nrf_uart
Fix nRF UART reset
2020-01-03 16:57:59 -08:00
Scott Shawcroft f6ec1ea172
Throw an error when we cannot allocate PWM pixel buffer 2020-01-03 15:15:36 -08:00
Scott Shawcroft 6afb8dadbc
Change SPI and I2C in the same way. 2020-01-03 15:14:37 -08:00
Dan Halbert 242d572470 wip 2020-01-03 10:24:07 -05:00
Dan Halbert f0d34da556 add display support; rotation 270 2019-12-30 17:39:39 -05:00
Dan Halbert 3f9ebd2fed initial CLUE board defn 2019-12-30 17:10:42 -05:00
Scott Shawcroft cfd71d9023
Fix nRF UART reset
disable only turns off ENABLE but doesn't set the init tracking that
nrfx uses. uninit hangs if ENABLE is off and is called because it
waits forever for TX to stop.
2019-12-27 20:18:07 -08:00
Tim Gates 007a704d82 nrf/examples: Fix typo in mountsd.py, wireing -> wiring. 2019-12-28 12:07:30 +11:00
Yonatan Goldschmidt b2e4a57289 nrf/main: Remove unnecessary repl_info(0) call.
It's statically initialized to 0.
2019-12-28 00:08:31 +11:00
Yonatan Goldschmidt 61d2b40ad5 lib/utils/pyexec: Introduce MICROPY_REPL_INFO, wrap debug prints in it.
For the 3 ports that already make use of this feature (stm32, nrf and
teensy) this doesn't make any difference, it just allows to disable it from
now on.

For other ports that use pyexec, this decreases code size because the debug
printing code is dead (it can't be enabled) but the compiler can't deduce
that, so code is still emitted.
2019-12-28 00:05:39 +11:00
David Lechner e79424d672 ports: Allow overriding CROSS_COMPILE in a custom makefile.
Many ports already allow overriding CROSS_COMPILE.  This modifies the
remaining ports to allow it as well.
2019-12-27 23:53:16 +11:00
Jeff Epler 51af8aadb7 nrf: PWMAudioOut: 62500Hz limitation is not needed
.. and it gets in the way of some example programs, due to the way
circuitplayground library generates different frequency sine waves
2019-12-19 10:34:56 -06:00
Ha Thach 25df6e613a
Merge pull request #2395 from hathach/nrfx-v2
upgrade nrfx API to v2
2019-12-18 16:14:25 +07:00
hathach dad2663337 update nrfx submodule to v2 2019-12-18 15:39:11 +07:00
Jeff Epler 8137ac4c49 nRF: PWMAudioOut: handle non-looping rawsamples 2019-12-17 08:59:08 -06:00
hathach 894cad2e17 upgrade nrfx API to v2 2019-12-17 21:39:52 +07:00
JoeBakalor 2abccc1745 update vid and pid for teknikio_bluebird 2019-12-16 08:58:56 -05:00
JoeBakalor 32744a04e1 update bluebird make file 2019-12-13 09:08:21 -05:00
Joe Bakalor 3992a870e5
Merge branch 'master' into teknikio/bluebird 2019-12-13 08:55:15 -05:00
JoeBakalor 4bee6536c9 updates to bluebird 2019-12-13 08:52:03 -05:00
Joe Bakalor b484c89b73
Merge pull request #4 from adafruit/master
Pull master
2019-12-13 08:51:06 -05:00
Dan Halbert ef2ef7a6b8 merge from master 2019-12-12 15:51:13 -05:00
Dan Halbert e11fabd5e0 moved nrf internal filesystem to just below bootloader 2019-12-12 14:57:23 -05:00
Dan Halbert 7889b999cc Fix flash write error handling; clean up safe mode message printing 2019-12-12 14:41:49 -05:00
JoeBakalor dde7c5e145 Merge branch 'master' of https://github.com/Teknikio/circuitpython 2019-12-12 08:59:37 -05:00
Joe Bakalor bf4138b0e4
Merge pull request #3 from adafruit/master
Pull master
2019-12-12 08:59:22 -05:00
Dan Halbert fd03fd5e4f sd_flash_operation_status should be volatile 2019-12-12 00:19:03 -05:00
Dan Halbert ae64a669dd address review comments 2019-12-11 15:43:06 -05:00
JoeBakalor 0da5dceccf update bluebird makefile 2019-12-11 15:25:16 -05:00
JoeBakalor a273a7c55e add remaining peripheral pin maps and digital/analog pin definitions 2019-12-11 15:23:16 -05:00
JoeBakalor 006d85d5c2 add make file and board configuration, add accelerometer pin mappings 2019-12-11 14:49:59 -05:00
Dan Halbert 1e11f2708b remove debugging leftovers 2019-12-11 09:34:56 -05:00
iot49 73b6e5d8e6 added correct include files 2019-12-10 19:44:11 -08:00
Dan Halbert d9ca4c9a60 fix build failures 2019-12-10 22:39:44 -05:00
Dan Halbert c6221c5956 Remove no-longer-used nrf and atmel-samd .ld files 2019-12-10 21:22:17 -05:00
Dan Halbert 68ae47907c merge from upstream 2019-12-10 21:04:46 -05:00
Dan Halbert 013c840862 working on all ports 2019-12-10 20:27:30 -05:00
Jeff Epler a484a93b29 nRF: disk_read must be 4-byte aligned
.. a requirement that oofatfs needs to be taught to respect.

This problem can be demonstrated with the following snippet, except
that the related file ("test.bin") must also be contiguous on the
filesystem.  You can ensure this by reformatting your device's filesystem
before testing, then copying any single file bigger than 4kB to test.bin.

    f = open("test.bin", "rb")
    f.seek(2048)
    b = bytearray(2048)
    v = memoryview(b)
    f.readinto(v[909:])

Closes: #2332
2019-12-10 14:03:06 -06:00
Joe Bakalor dbc28e35c5
Merge pull request #2 from adafruit/master
Pull master
2019-12-10 11:50:49 -05:00
iot49 0712c95225 fix mtime on file creation 2019-12-09 23:14:26 -08:00
Dan Halbert 60f399395a Add POWER_SWITCH pin to CPB 2019-12-09 18:30:24 -05:00
Jeff Epler 13620cc4db nRF: PWMAudioOut: fix half-speed playback of stereo samples
The "spacing" of "buffer structure" is confusing, use the "channel count"
instead.

Testing performed on nrf52840 feather:

Play stereo and mono, 8- and 16-bit, 8kHz RawSamples representing 333.33Hz
square waves.

Use both mono and stereo PWMAudioOut instances.

Scope the RC-filtered signal and use the scope's frequency
measurement function, verify the frequency is 333 or 334Hz in all tested
cases.

In the "stereo output" cases, verify both the L and R channels.  Verify
the output amplitude is the same in both channels.

In the "stereo output" cases, run a second test where the L channel's
amplitude is attenuated 50%. Verify the output amplitude is correct
in each channel.
2019-12-09 10:57:55 -06:00
Daniel Mizyrycki 2df6a0436d nrf/boards/particle_xenon: Enable USB CDC on Particle Xenon board. 2019-12-09 14:10:24 +11:00
Dan Halbert f5e913101c
Merge pull request #2301 from tannewt/support_extended_advertising
Add support for extended (>31 byte) BLE advertisements.
2019-12-06 23:51:05 -05:00
Scott Shawcroft da0ea979ff
Check connection validity after service discovery.
Fixes #2347
2019-12-06 16:03:14 -08:00
Dan Halbert 40434d6919 wip 2019-12-05 22:45:53 -05:00
Andrej Krejcir 210d053286 nrf/main: Execute boot.py/main.py frozen modules without a file system.
When the file system is not enabled, the boot.py and main.py modules will
still be executed, if they are frozen.
2019-12-05 23:11:12 +11:00
Scott Shawcroft 17c8356b8c
Add connection interval and debugging
This also sets TinyUSB to master and to not include its submodules.

It also fixes an old displayio example comment and retries gattc
reads.
2019-12-04 14:39:02 -08:00
Jeff Epler 95d9c49e43 Merge remote-tracking branch 'origin/master' into tick-refactor 2019-11-29 11:27:09 -06:00
Dan Halbert b32a9192df make UART.write be blocking on SAMD; add timeout property 2019-11-27 13:05:29 -05:00
Scott Shawcroft 3fc58cee38
Merge remote-tracking branch 'adafruit/master' into support_extended_advertising 2019-11-26 13:12:43 -08:00
Scott Shawcroft e5dd78d393
Merge pull request #2324 from jepler/nrf-i2s-channels-widths
nrf: assign channel width and count correctly
2019-11-25 16:59:08 -08:00
Scott Shawcroft 2653455ded
Merge pull request #2321 from jepler/nrf-i2s-buglets
Nrf i2s buglets
2019-11-25 16:11:43 -08:00
Jeff Epler 1ee35fd6fd nrf: i2sout: move register settings closer together
.. just for consistency's sake
2019-11-25 11:43:51 -06:00
Jeff Epler 47a6eaa297 nrf: i2sout: Assign SWIDTH
The sample width register was never set, so all samples were played
as though they were 16 bit.

After this change, 8-bit samples no longer produce audio on the MAX 98357A
BOB, because only 16-, 24-, and 32-bit samples are supported by the
hardware.  This will be addressed by a future change to pad samples to
16 bits; see #2323 and the 98357A datasheet page 6.
2019-11-25 11:43:29 -06:00
Jeff Epler 8f4bab2d24 i2sout: Correctly retrieve channel_count
The meaning of the "single channel" parameter is not well-documented,
but in fact it seems that "true" must be passed or else the returned
channel_count is always 1.  This caused stereo samples to be played
incorrectly.
2019-11-25 10:59:59 -06:00
Dan Halbert d154d11911
Merge pull request #2320 from jepler/nrf-unsigned-audio-crash
nrf: i2sout: Fix double-increment when copying samples
2019-11-25 11:42:16 -05:00
Jeff Epler c9946dfd63 nrf: i2sout: Use <, not !=, for loop condition
This is good C style, h/t @danh
2019-11-25 09:35:57 -06:00
Jeff Epler 19d122e546 nrf: i2sout: Fix double-increment when copying samples
This caused two problems when playing unsigned samples:
 * When an even number of samples were present, it "worked" but only
   every other sample was copied into the output, changing the waveform
 * When an odd number of samples were present, the copy continued beyond
   the end of the buffers and caused a hard fault
2019-11-25 09:07:20 -06:00
Dan Halbert 1ccb7b4c5e cosmetic commit, mostly to re-run 2019-11-22 16:30:10 -05:00
Dan Halbert 13375d16f1 change mpconfigport.mk files so they can be overriden by mpconfigboard.mk 2019-11-22 15:44:51 -05:00
Jeff Epler 77b78d7fb9 Merge remote-tracking branch 'origin/master' into tick-refactor 2019-11-22 14:28:51 -06:00
Jeff Epler 1c6c9a3e1f nrf: i2sout: Ensure hardware I2S is stopped at deinit
.. otherwise, it may be possible under some scenario, for the background
task to continue and overwrite unrelated memory.
2019-11-22 14:15:07 -06:00
Jeff Epler aabb56c840 nrf: i2sout: Only update hold_value when appropriate
If we put no samples into the buffer, then there is no last
sample to fill out hold_value with.  (and, in fact, the expression such
as *(uint32_t*)(buffer-4) is outside an allocated region)

Detect this condition, and leave the prior value in place.

This improves clicks heard when pausing and resuming a waveform.
2019-11-22 13:54:37 -06:00
Scott Shawcroft 743bc829ab
Clean up debug changes 2019-11-21 16:39:57 -08:00
Scott Shawcroft e63796c7bc
Special exception message for when pairing prompt is ignored. 2019-11-21 16:32:42 -08:00
Scott Shawcroft 39f4046f70
Fix pairing when peripheral. Central untested. 2019-11-21 16:32:42 -08:00
Scott Shawcroft 5e857fdb67
Use BluetoothError in _bleio
This better differentiates errors than using OSError everywhere.
2019-11-20 14:02:15 -08:00
Scott Shawcroft 11c2c3443f
Add support for extended (>31 byte) BLE advertisements. 2019-11-19 13:55:58 -08:00
Jeff Epler 7f744a2369 Supervisor: move most of systick to the supervisor
This code is shared by most parts, except where not all the #ifdefs
inside the tick function were present in all ports.  This mostly would
have broken gamepad tick support on non-samd ports.

The "ms32" and "ms64" variants of the tick functions are introduced
because there is no 64-bit atomic read.  Disabling interrupts avoids
a low probability bug where milliseconds could be off by ~49.5 days
once every ~49.5 days (2^32 ms).

Avoiding disabling interrupts when only the low 32 bits are needed is a minor
optimization.

Testing performed: on metro m4 express, USB still works and
time.monotonic_ns() still counts up
2019-11-18 11:01:23 -06:00
Hierophect 81223c76bd revert error 2019-11-15 13:04:25 -05:00
Hierophect 2c6781f74d move neopixel_in_use flag to shared-bindings 2019-11-15 12:59:52 -05:00
Hierophect de5691acf5 Add never_reset and reset to pin common hal, adjust files 2019-11-15 12:47:00 -05:00
Damien George 799b6d1e0c extmod: Consolidate FAT FS config to MICROPY_VFS_FAT across all ports.
This commit removes the Makefile-level MICROPY_FATFS config and moves the
MICROPY_VFS_FAT config to the Makefile level to replace it.  It also moves
the include of the oofatfs source files in the build from each port to a
central place in extmod/extmod.mk.

For a port to enabled VFS FAT support it should now set MICROPY_VFS_FAT=1
at the level of the Makefile.  This will include the relevant oofatfs files
in the build and set MICROPY_VFS_FAT=1 at the C (preprocessor) level.
2019-11-11 11:37:38 +11:00