Commit Graph

1618 Commits

Author SHA1 Message Date
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
Joe Bakalor
ba83a4a2ac
Merge pull request #1 from adafruit/master
Update base
2019-11-05 11:06:18 -05:00
JoeBakalor
8ab3ef44dd add bluebird template files 2019-11-05 10:52:25 -05:00
Dan Halbert
8cd2f87e99
Merge pull request #2236 from tannewt/bleio_tweaks
Refine _bleio
2019-11-04 22:27:54 -05:00
Damien George
c13f9f209d all: Convert nlr_raise(mp_obj_new_exception_msg(x)) to mp_raise_msg(x).
This helper function was added a while ago and these are the remaining
cases to convert, to save a bit of code size.
2019-11-05 11:35:45 +11:00
Dan Halbert
e3638ffaad
Merge pull request #2262 from jepler/cpb-speaker-disable
cpb: Disable the onboard speaker until request
2019-11-03 18:34:29 -05:00
Dan Halbert
85a648224f Check for no pullups on I2C on nrf; give arduino nano 33 ble two I2C devices 2019-11-02 22:47:03 -04:00
jepler
2bdccf03a7 cpb: define the SPEAKER_ENABLE_PIN
This allows the board to disable the onboard speaker until explicitly
enabled in user code.

Testing performed on a CPB:
 * Touching the AUDIO pin with a fingertip no longer generates noise/buzz
 * Generating a waveform with `simpleio.tone` produces no sound by default
 * When the board.SPEAKER_ENABLE is configured as a digital output and
   set True, `simpleio.tone` does produce sound

Note that while guides should include information about SPEAKER_ENABLE, it's
possible that some users who omitted it could view this as a breaking change.
They can fix it by simply adding code similar to

    speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
    speaker_enable.direction = digitalio.Direction.OUTPUT
    speaker_enable.value = True

before using the internal speaker.

Closes: #2258
2019-11-01 16:26:03 -05:00
jepler
fe47eba97f nRF: Handle SPEAKER_ENABLE_PIN
.. the existing code, which was never activated by the preprocessor,
wasn't quite right.
2019-11-01 16:23:35 -05:00
Scott Shawcroft
47e50e5659
Merge remote-tracking branch 'adafruit/master' into bleio_tweaks 2019-11-01 13:20:58 -07:00
Damien George
9aabb6c01b extmod: Factor out block-device struct to make independent of fatfs. 2019-10-29 12:12:37 +11:00
Dan Halbert
e35eb08f1d nrf: allocate two I2C on CPB 2019-10-28 21:08:53 -04:00
Dan Halbert
358920db0e Use MICROPY_PY_SYS_PLATFORM in mpconfigport.h only 2019-10-28 10:40:10 -04:00
Jeff Epler
1103490223
Merge pull request #2244 from dhalbert/itsybitsy_nrf52840_express
Initial Itsy nRF52840 defn
2019-10-27 16:46:28 -05:00
Dan Halbert
76817eaa10 Merge remote-tracking branch 'adafruit/master' into nano-33-ble 2019-10-25 22:41:26 -04:00
Dan Halbert
ab6fd34828 add object types to rgb status objects;mark spi rgb objects as never_reset 2019-10-25 22:32:43 -04:00
Dan Halbert
7d04d9109e use bitbang SPI for DotStar; still need to fix hw SPI for dotstar 2019-10-25 15:37:27 -04:00
Dan Halbert
cdeb0857a9 Initial Itsy nRF52840 defn 2019-10-25 11:15:34 -04:00
Scott Shawcroft
91c9d519ae
Refine comments and switch prefix_len to size_t 2019-10-22 23:09:56 -07:00
Damien George
d2384efa80 py: Automatically provide weak links from "foo" to "ufoo" module name.
This commit implements automatic module weak links for all built-in
modules, by searching for "ufoo" in the built-in module list if "foo"
cannot be found.  This means that all modules named "ufoo" are always
available as "foo".  Also, a port can no longer add any other weak links,
which makes strict the definition of a weak link.

It saves some code size (about 100-200 bytes) on ports that previously had
lots of weak links.

Some changes from the previous behaviour:
- It doesn't intern the non-u module names (eg "foo" is not interned),
  which saves code size, but will mean that "import foo" creates a new qstr
  (namely "foo") in RAM (unless the importing module is frozen).
- help('modules') no longer lists non-u module names, only the u-variants;
  this reduces duplication in the help listing.

Weak links are effectively the same as having a set of symbolic links on
the filesystem that is searched last.  So an "import foo" will search
built-in modules first, then all paths in sys.path, then weak links last,
importing "ufoo" if it exists.  Thus a file called "foo.py" somewhere in
sys.path will still have precedence over the weak link of "foo" to "ufoo".

See issues: #1740, #4449, #5229, #5241.
2019-10-22 15:30:52 +11:00
Scott Shawcroft
ae30a1e5aa
Refine _bleio
This PR refines the _bleio API. It was originally motivated by
the addition of a new CircuitPython service that enables reading
and modifying files on the device. Moving the BLE lifecycle outside
of the VM motivated a number of changes to remove heap allocations
in some APIs.

It also motivated unifying connection initiation to the Adapter class
rather than the Central and Peripheral classes which have been removed.
Adapter now handles the GAP portion of BLE including advertising, which
has moved but is largely unchanged, and scanning, which has been enhanced
to return an iterator of filtered results.

Once a connection is created (either by us (aka Central) or a remote
device (aka Peripheral)) it is represented by a new Connection class.
This class knows the current connection state and can discover and
instantiate remote Services along with their Characteristics and
Descriptors.

Relates to #586
2019-10-21 18:57:03 -07:00
Dan Halbert
7b79ac3739 Parameterize linker script 2019-10-20 23:50:12 -04:00
Kamil Tomaszewski
96756b3945 Add functions to get top and limit stack 2019-10-18 11:04:45 +02:00
Dan Halbert
be8136dc6d Merge remote-tracking branch 'adafruit/master' into bonding1 2019-10-15 15:55:21 -04:00
Dan Halbert
eca73436c9 Merge remote-tracking branch 'adafruit/master' into cpu-voltage 2019-10-15 09:03:24 -04:00
Damien George
d7a9388fe0 ports: Add new make target "submodules" which inits required modules. 2019-10-15 17:14:41 +11:00
Dan Halbert
fdd7ebef2d change calibration from analogin_reset() to analogin_init() 2019-10-14 23:38:41 -04:00
Dan Halbert
c1ab2486f9 return chip vcc value 2019-10-12 15:42:15 -04:00
Jeff Epler
fae6e29546 nrf: PWMAudioOut: deactivate PWM when deinitting self
.. otherwise, when an AudioPWMOut object was deinitted without being
explicitly stop()ped, it would use up a slot in active_audio[]; the
5th iteration would create a non-working audio object which would just
buzz instead of playing the right thing.

Closes: #2203
2019-10-12 14:01:35 +09:00
Jeff Epler
ef459326cb nrf: PWMAudioOut: coding style 2019-10-12 13:57:31 +09:00
Glenn Ruben Bakke
98c2eabaff nrf/boards: Add nrf9160 pca10090 board. 2019-10-10 21:36:20 +02:00
Glenn Ruben Bakke
82fe6b0526 nrf: Add nrf9160 base support.
This patch add basic building blocks for nrf9P60.

It also includes a secure bootloader which forwards all
possible peripherals that are user selectable to become
non-secure. After configuring Flash, RAM and peripherals
the secure bootloader will jump to the non-secure domain
where MicroPython is placed.

The minimum size of a secure boot has to be a flash
block of 32Kb, hence why the linker scripts are
offsetting the main application this much.

The RAM offset is set to 128K, to allow for later
integration of Nordic Semiconductor's BSD socket
library which reserves the range 0x20010000 - 0x2001FFFF.
2019-10-10 21:35:27 +02:00
Glenn Ruben Bakke
01a3110e36 nrf/boards: Add support for pca10059.
Add support for pca10059 with REPL over tinyusb USB CDC.

The board also includes a board specific module that will
recover UICR->REGOUT0 in case this has been erased.

This initial support does not preserve any existing bootloader
on the pca10090 in case this was present, and expects to use all
available flash on the device.
2019-10-10 20:21:07 +02:00
Glenn Ruben Bakke
60b0b69f20 nrf: Add tinyusb support for nrf52840.
Add nrf-port finyusb driver files. USB CDC can be activated
by board configuration files using the MICROPY_HW_USB_CDC.

Updating BLE driver, Makefile, nrfx-glue and main.c to plug
in the tinyusb stack.
2019-10-10 20:21:07 +02:00
Glenn Ruben Bakke
1571120dc2 nrf/device: Correct SPIM3 IRQ handler entry for nrf52840. 2019-10-10 20:21:07 +02:00
Damien George
2863dcdf4f nrf: Add support to activate MICROPY_PY_SYS_STDFILES.
Fixes issue #5162.
2019-10-08 16:38:04 +11:00
Dan Halbert
fc19e03128 WIP: bonding 2019-10-06 21:30:26 -04:00
roland van straten
a069340c1e nrf/main: Update the way the LED is used on startup.
In case of LED1 being present, do a short blink during startup
instead of turning it on and leave it on.
2019-10-02 22:17:54 +02:00
roland van straten
226399bcef nrf/led: Expose public API for LED manipulation.
Aligned implementation with the STM32 port.
Added empty functions to be used when no LED is available.
2019-10-02 22:09:43 +02:00
Glenn Ruben Bakke
cf383412ef nrf/flash: Update flash driver to use nrfx_nvmc driver.
The the nrfx driver is aware of chip specific registers, while
the raw HAL abstraction is not. This driver enables use of NVMC
in non-secure domain for nrf9160.
2019-10-02 21:28:34 +02:00
Glenn Ruben Bakke
c561ae61a1 nrf/uart: Add support for UARTE (EasyDMA). 2019-10-02 21:20:56 +02:00
Glenn Ruben Bakke
02a8c31eef nrf/temp: Move module configuration guard.
This patch moves the check for MICROPY_PY_MACHINE_TEMP to come
before the inclusion of nrf_temp.h. The nrf_temp.h depends on
the NRF_TEMP_Type which might not be defined for all nRF devices.
2019-10-02 21:15:48 +02:00
Glenn Ruben Bakke
d2e730b727 nrf/i2c: Add support for TWIM (EasyDMA). 2019-10-02 20:42:06 +02:00
Dan Halbert
aa1eed3bd3 initial Arduino Nano 33 BLE board definition 2019-09-26 15:28:57 -04:00
Scott Shawcroft
19c6c96929
Merge pull request #2130 from jepler/nrf-debugflags
nrf: Makefile: sensible flags for debugging
2019-09-20 10:18:00 -07:00
Scott Shawcroft
b5a9ed3688
Merge pull request #2161 from jepler/nrf-analog-reference
nRF: Change analog reference voltage
2019-09-17 09:41:52 -07:00
jepler
d39c85e3f5 nRF: Change analog reference to VCC(/4)
@ladyada says:
"having this be adjustable (reference) would be ideal cause you can get
absolute voltages but for now, VCC/4 + 4x matches every other chip :)"

... and indeed doing it this way happens to give a much more steady
reading when using a VCC-referenced resistance, and so many of the simple
things you'd wire up are actually VCC-referenced anyway.
2019-09-16 21:43:07 -05:00
roland van straten
ac112f88d0 nrf/boards: Add board definition for uBlox Nina B1 series BLE modules. 2019-09-17 11:33:48 +10:00
Jeff Epler
c56186da8c nRF: Change analog reference voltage
Datasheet reading explains one reason why readings might have been 10% low.
2019-09-16 18:35:48 -05:00
jepler
df48312ce7 nRF: PWMOut: At deinit, make pin available again
Closes: #2146
2019-09-11 20:09:38 -05:00
jepler
7b9dfc9952 nrf: i2s: tune audio buffering
.. based on some tasks I found that caused stuttering:

 # Test SD and printing
 while True: os.listdir('.')

 # Test bulk I/O
 while True: len(open('somefile.wav', 'rb').read())

Each of these tasks *WAS* worse and I am improving them in a separate
PR by adding RUN_BACKGROUND_TASKS to them.
2019-09-09 20:13:12 -05:00
jepler
c66f5a8536 nrf: i2s: rewrite without 'goto' 2019-09-09 19:26:18 -05:00
jepler
fe9605a6a3 nrf: i2s: Comment this slightly tricksy code 2019-09-09 19:25:52 -05:00
jepler
ccf08aa3df nrf: I2SOut: deal more gracefully with errors from the sample 2019-09-08 21:59:07 -05:00
jepler
e890bc8efe nrf: Makefile: sensible flags for debugging
This enables the highest level of debug symbols, and all optimizations
except lto that do NOT interfere with debugging, in the view of the gcc
maintainers.
2019-09-08 21:07:00 -05:00
jepler
f38ee42874 nrf: Add i2s audio output
Testing performed: I used a Particle Xenon with a HDA1334 I2S DAC.
I played a variety of mono 16-bit samples at 11025 and 22050Hz nominal
bit rates.  With this setup, all the 11025Hz samples sound good.
I tested play, pause,  and loop functionality.

During some runs with 22050Hz samples, there were glitches.  However,
these may have only occurred during runs where I had set breakpoints
and watchpoints in gdb.

I also tested with a MAX98357A I2S amplifier.  On this device, everything
sounded "scratchy".  I was powering it from 5V and the 5V rail seemed
steady, so I don't have an explanation for this.  However, I haven't
tried it with a SAMD board.
2019-09-08 16:46:35 -05:00
Dan Halbert
3c22c690c8 CPB A1 pin mapping wrong; remove A7 2019-09-06 14:17:11 -04:00
Jim Mussared
1f52a6f8e4 nrf/boards: Add Particle Xenon board configuration (an nRF52840). 2019-09-05 22:56:05 +10:00
Jim Mussared
d36fc4682e nrf/Makefile: Add support for flashing with a Black Magic Probe.
Also rename "flash" target to "deploy" to match other ports (but provide
"flash" as an alias for backwards compatibility).
2019-09-05 22:56:05 +10:00
Jim Mussared
353ed7705f nrf/boards/make-pins.py: Fix gen of board pins to use correct index.
It was previously not taking into account that the list of pins was sparse,
so using the wrong index.  The boards/X/pins.csv was generating the wrong
data for machine.Pin.board.

As part of this fix rename the variables to make it more clear what the
list contains (only board pins).
2019-09-05 22:52:24 +10:00
Damien George
9e90e2528b nrf/machine/adc: Fix mapping of ADC channel to pin. 2019-09-05 22:13:04 +10:00
Damien George
c7fb93b844 nrf/machine/adc: Allow to pass a Pin object in to ADC constructor. 2019-09-05 22:13:04 +10:00
Damien George
b766a6971e nrf: Add ADC channel mapping to alt function table. 2019-09-05 22:13:04 +10:00
Damien George
9cad134a2f nrf/machine/adc: Add ADC.read_u16() method. 2019-09-05 22:13:04 +10:00
sommersoft
b1c3d47413 Merge branch 'master' of https://github.com/adafruit/circuitpython into mixer_voice 2019-09-01 21:16:12 -05:00
sommersoft
8120f5cdad Merge branch 'master' of https://github.com/adafruit/circuitpython into mixer_voice 2019-08-29 22:14:53 -05:00
Dan Halbert
7a64af9280 rename bleio module to _bleio 2019-08-29 18:44:27 -04:00
Dan Halbert
b11b7916fd address minor issues: typos, make translate, and sphinx 2019-08-29 17:58:21 -04:00
Dan Halbert
f17059b10b another API rework: less abstraction leakage 2019-08-28 23:15:22 -04:00
Dan Halbert
19c59b41ed bleio: API change to create and connect related objects simulatenously: no orphan bleio objects 2019-08-28 16:15:09 -04:00
Dan Halbert
a72bcab0fd Merge remote-tracking branch 'adafruit/master' into bleio-api-revamp 2019-08-28 16:09:18 -04:00
Damien George
1fe1ff935b nrf: Clean up source by removing tabs, trailing spaces, non-ASCII chars. 2019-08-28 13:34:45 +10:00
Damien George
af20c2ead3 py: Add global default_emit_opt variable to make emit kind persistent.
mp_compile no longer takes an emit_opt argument, rather this setting is now
provided by the global default_emit_opt variable.

Now, when -X emit=native is passed as a command-line option, the emitter
will be set for all compiled modules (included imports), not just the
top-level script.

In the future there could be a way to also set this variable from a script.

Fixes issue #4267.
2019-08-28 12:47:58 +10:00
Dan Halbert
0364f1dc85 remove some debugging prints 2019-08-26 08:17:59 -04:00
Dan Halbert
76446f634b BLE HID WIP: works everywhere except iOS; fixed a bunch of bugs; pretend bonding 2019-08-25 21:38:13 -04:00
sommersoft
2e4b687ba5 enable audiomixer on nrf 2019-08-25 07:32:48 -05:00
Scott Shawcroft
7324b70a7c
Rework based on Dan's review 2019-08-23 15:27:21 -07:00
Scott Shawcroft
2497cbe186
Fix nrf builds 2019-08-22 14:23:33 -07:00
Scott Shawcroft
36a23e0fe3
Rework refresh API and factor common display stuff out
NOT TESTED! Just compiles

Fixes #1691
2019-08-22 14:23:27 -07:00
Scott Shawcroft
c247e7df9c
Begin refresh rework. 2019-08-22 14:08:33 -07:00
Benny Meisels
d37dd4d758
Updated ParallelBus implementation in nrf port 2019-08-22 14:08:33 -07:00
Dan Halbert
7cc15e56c8 make translate 2019-08-22 15:20:23 -04:00
Dan Halbert
0b7291d767 fix default crystal value; fix include order 2019-08-22 09:01:05 -04:00
Dan Halbert
acc6df4959 merge similar fix in 2019-08-22 01:29:34 -04:00
Dan Halbert
d94023e9b3 Fix CPBlue LFCLKSRC; CPB has no status neopixel 2019-08-22 01:04:00 -04:00
Scott Shawcroft
389e7cc35d
Merge pull request #2072 from bmeisels/nrf-no-crystal-support
Add support for nrf boards that don't have an external crystal
2019-08-21 13:01:26 -07:00
Benny Meisels
fe2ec6c887 Add support for nrf boards that don't have an external crystal 2019-08-20 23:30:21 +03:00
Dan Halbert
e00696de7f merge from upstream and make translate 2019-08-20 13:06:23 -04:00
Dan Halbert
44b28d1187 update tinyusb to 00c440cb 2019-08-19 19:42:45 -04:00
Dan Halbert
e3dc5e3a66 Merge remote-tracking branch 'adafruit/master' into run-background-tasks
Restore dependencies indicated by indentation in circuitpy_mpconfig.h.
2019-08-19 12:41:20 -04:00
Jeff Epler
26a05d01dc Merge remote-tracking branch 'origin/master' into nrf-pdm-audioin 2019-08-18 21:30:14 -05:00
Jeff Epler
912fd7759d nrf: PDMIn: Implement
So far, this supports only 16kHz and 16-bit samples with a fixed gain.
This is enough to support the basic functionality of e.g., sensing
ambient audio levels.
2019-08-18 15:58:04 -05:00
Jeff Epler
79f8a85786 nrf: stub out audiobusio.PDMIn, audiobusio.I2SOut 2019-08-18 15:55:57 -05:00
Dan Halbert
3f7321af00
Merge pull request #2031 from jepler/nrf-lto
Enable link-time optimization for nrf targets
2019-08-18 12:35:26 -04:00
Dan Halbert
e2a4c76a37 make nrf touchio be generic: now available for SAMD51 too 2019-08-18 08:44:10 -04:00
Scott Shawcroft
85d7398476
Merge pull request #2066 from dhalbert/ble-pairing
BLE: more features
2019-08-16 14:50:00 -07:00
Dan Halbert
630c92392a address review comments; avoid calling common_hal_bleio_device... routines from shared-bindings 2019-08-16 15:18:53 -04:00
Damien George
497683b315 gitignore: Put build-*/ pattern in top-level gitignore file. 2019-08-16 00:08:08 +10:00
Dan Halbert
5877bd6036 CPblue initial definition 2019-08-13 22:12:36 -04:00
Jeff Epler
11dd3a260e nrf: Use RUN_BACKGROUND_TASKS 2019-08-11 08:53:02 -05:00
Dan Halbert
1570ef2dd4 specifying attribute length; fix up value setting 2019-08-07 23:49:09 -04:00
Dan Halbert
d047b73a9c fix newly-introduced bugs; UART client/server working again 2019-08-07 11:10:21 -04:00
Dan Halbert
d74c8b9425 WIP: more Descriptor work; refactor gattc/gatts read/write 2019-08-06 22:55:25 -04:00
Dan Halbert
243334da75 Merge remote-tracking branch 'adafruit/master' into ble-pairing 2019-08-05 23:06:24 -04:00
Scott Shawcroft
59efce3035
Merge pull request #2039 from dhalbert/metro-52840
Metro nRF52840 rev A defn; remove '#define FEATHER52840' from mpconfigboard.h
2019-08-05 18:48:36 -07:00
Scott Shawcroft
b675a27e16
Merge pull request #2000 from jepler/nrf-pwm-audio
Implement PWM audio out for the nrf port
2019-08-05 17:26:27 -07:00
Dan Halbert
c56566179a Metro nRF52840 rev A defn; also remove '#define FEATHER52840' from mpconfigboard.h files 2019-08-05 18:10:27 -04:00
Dan Halbert
b67d04a5b1 Merge remote-tracking branch 'adafruit/master' into ble-pairing 2019-08-05 16:35:44 -04:00
Jeff Epler
77bc1ba03e nrf: PWMAudioOut: Remove the need to wait in "pause"
The original formulation was because I saw the need to avoid a transition
from playing to stopped exactly when a resume was taking place.  However,
@tannewt was concerned about this pause causing trouble, because it could
be relatively lengthy (several ms even in a typical case).

After reflection, I've convinced myself that updating the registers
in this order in resume avoids a window where a "stopped" event can
be missed as long as the shortcut is updated first.

Testing re-performed: pause/resume testing of looped RawSample and
WaveFile audio sources.
2019-08-03 08:19:25 -05:00
Jeff Epler
4bae29b925 nrf: enable link-time optimization
Testing performed: installed freshly built .uf2 on a Particle Xenon.
Checked that circuitpython still starts.
Checked that the size of all .uf2 files for nrf builds are plausible.

Aside from memory savings, the performance of Python code (pystone)
increased by about +14%.

However, this adds about 12-16 seconds to each nrf build.

Timings & Sizes (build system: i5-3320M, -j5 parallelism on 4 threads):

Before:
$ make -j5 BOARD=particle_xenon
765004 bytes free in flash out of 1048576 bytes ( 1024.0 kb ).
232076 bytes free in ram for stack out of 245760 bytes ( 240.0 kb ).
68.54user 11.83system 0:34.34elapsed 234%CPU
pystones before: 570

After:
$ make -j5 BOARD=particle_xenon
804284 bytes free in flash out of 1048576 bytes ( 1024.0 kb ).
232072 bytes free in ram for stack out of 245760 bytes ( 240.0 kb ).
71.06user 11.77system 0:46.91elapsed 176%CPU
pystones after: 650

Timings on travis:

Before:
Build feather_nrf52840_express for pl took 55.79s and succeeded
Build feather_nrf52840_express for zh_Latn_pinyin took 3.18s and succeeded

After:
Build feather_nrf52840_express for pl took 62.72s and succeeded
Build feather_nrf52840_express for zh_Latn_pinyin took 19.10s

Closes: #1396
2019-08-02 20:59:47 -05:00
Dan Halbert
7ce3776b80 WIP: rework of Characteristic properties; enhance Descriptor; not tested 2019-08-02 17:57:31 -04:00
Jeff Epler
28b7cbfca6 nrf: Mark interrupt vectors as used 2019-08-02 07:53:35 -05:00
jepler
34e2bab96a nrf: Implement RUNMODE_BOOTLOADER and RUNMODE_SAFE_MODE 2019-08-01 18:53:07 -05:00
Jeff Epler
76f65ac694 Implement play/pause
.. and also incidentally fix a problem where a RawSample could only
be looped 131070 times.
2019-07-31 20:02:56 -05:00
Dan Halbert
91d791afd0 cleanup adapter.address; add uniquish suffix to BLE device name 2019-07-31 00:30:24 -04:00
Dan Halbert
83129b8c63 BLE: peripheral client pairing (not yet bonding); fix time doc formatting 2019-07-30 14:26:26 -04:00
Jeff Epler
b72352949b PWM audio: Rename AudioOut -> PWMAudioOut, _audioio_ -> _audiopwmio_ 2019-07-29 18:39:00 -04:00
Dan Halbert
28ca05ccdc allow discovery from central or peripheral 2019-07-27 13:22:15 -04:00
Jeff Epler
a183425e00 ports/nrf: Implement audioio.AudioOut using PWM
This implements AudioOut, with known caveats:
 * pause/resume are not yet implemented (this is just a bug)
 * at best, the sample fidelity is 8 bits (this is a hardware limitation)

Testing performed:

My test system is a Particle Xenon with a PAM8302 op-amp
https://www.adafruit.com/product/2130 and 8-ohm speaker.  There's no
analog filtering between the Xenon's PWM pin and the "A+" input of
the amplifier; the "A-" pin is disconnected.  It is powered from
VUSB.

I used pin D4, which is *NOT* listed as a low-speed-only pin, but
the code does NOT switch the pin to high drive.  This is related to
an open issue for general inability to set drive level for pins
being used by a "special function" on nrf:
https://github.com/adafruit/circuitpython/issues/1270

Nothing about the code I've written should limit the usable pins.

All samples I played were 16-bit, generally monophonic at 11025Hz
and 22050Hz from the Debian LibreOffice package.
2019-07-26 07:57:11 -05:00
Jeff Epler
2bc704fe07 ports/nrf: factor out routines for allocating, freeing pwm channels 2019-07-26 07:52:37 -05:00
Scott Shawcroft
8ec2d6ce49
Merge pull request #2007 from hierophect/F4xx-port-setup
Add STM32 Discovery F412ZG and F411RE support
2019-07-24 18:49:48 -07:00
hathach
c921f6637f update tinyusb lib to 0.5.x 2019-07-24 16:46:31 +07:00
Dan Halbert
82ab998cd5
Merge pull request #1998 from tannewt/monocolor
Add support for grayscale displays
2019-07-22 22:30:28 -04:00
Hierophect
58630a844a Add feature conditionals and clean up 2019-07-22 12:58:28 -04:00
Tavish Naruka
e4d92a3aad
Fix incorrect preprocessor define NRFX_TIMER3/4
Should be NRF_TIMER3 and NRF_TIMER4
2019-07-22 20:07:05 +05:30
Scott Shawcroft
6797ec6ed3
Add support for grayscale displays that are < 8 bit depth.
This also improves Palette so it stores the original RGB888 colors.

Lastly, it adds I2CDisplay as a display bus to talk over I2C. Particularly
useful for the SSD1306.

Fixes #1828. Fixes #1956
2019-07-19 16:06:11 -07:00
Scott Shawcroft
a98bfa628e
Merge pull request #2002 from ntavish/blip_improvements
Blip improvements
2019-07-19 10:52:08 -07:00
Tavish Naruka
724ce4acba enable libraries needed by BlipBoy Shield 2019-07-19 18:48:08 +05:30
Hierophect
43e8a4110f Add missing files for DigitalIO 2019-07-17 14:18:01 -04:00
Dan Halbert
364ee62d10 Address review comments. 2019-07-16 19:53:36 -04:00
Dan Halbert
1cf8a3e8d8 Merge remote-tracking branch 'adafruit/master' into ble-scanner 2019-07-11 18:42:16 -04:00
Scott Shawcroft
6fad383367
Merge pull request #1925 from C47D/rgb_status
Initial support for RGB led as Status indicator, fixes #1382
2019-07-09 10:31:34 -07:00
Dan Halbert
6a001786a9 merge from master 2019-07-09 08:58:49 -04:00
Dan Halbert
118b26b335 UARTClient now works both directions 2019-07-09 00:21:46 -04:00
Dan Halbert
09ddff8df1 WIP: Need descriptors for Central CCCD discovery; not done yet 2019-07-07 00:07:47 -04:00
Scott Shawcroft
5610e05b8c
Fix up nrf so that it is initialized properly. Also, do not reset
it's pins.
2019-07-06 12:48:16 -07:00
iot49
6e5d70fa19 changed type of receiver_buffer_size to uint16_t 2019-07-03 12:02:01 -07:00
Dan Halbert
bf8a35b2f8 WIP: CharacteristicBuffer for Central; not working: need to set remote Characteristic Service 2019-07-02 22:34:54 -04:00
Dan Halbert
6ea01ea9b0 Central is connecting; characteristics can be read and written 2019-06-29 00:20:06 -04:00
Hierophect
16ba035ba7 first commit, very crude 2019-06-28 15:36:08 -04:00
Glenn Ruben Bakke
d889def06b nrf/led: Adjust how board LEDs are defined.
Change static LED functions to lowercase names, and trim down source code
lines for variants of MICROPY_HW_LED_COUNT.  Also rename configuration for
MICROPY_HW_LEDx_LEVEL to MICROPY_HW_LEDx_PULLUP to align with global PULLUP
configuration.
2019-06-25 16:02:31 +10:00
Dan Halbert
140904ec84 getting Scanner to work 2019-06-22 22:10:15 -04:00
Dan Halbert
4881e1ff55 WIP: Central compiles; now will test 2019-06-21 18:04:04 -04:00
Dan Halbert
23bd861c9a nrf: fix neopixel_write pwm buf size calc 2019-06-20 18:02:14 -04:00
Dan Halbert
24ac1fdcab WIP: backup only; not compiled 2019-06-19 21:54:28 -04:00
Dan Halbert
a1b5d800f3 Update copyrights; get ready for Central 2019-06-19 10:42:36 -04:00
Dan Halbert
35b9191857 Don't operate directly on bleio objects in shared-bindings: use common_hal
routines instead. Changes made but not yet tested.
2019-06-18 23:46:20 -04:00
Dan Halbert
1356819de1 Handle None for BLE name; fix ScanEntry bug; compile issue 2019-06-17 23:16:40 -04:00
Dan Halbert
bed6d43a76 merge from upstream; WIP redo Address; no more AddressType 2019-06-13 21:55:07 -04:00
Dan Halbert
62de2506e4 Include display objects in gc. 2019-06-06 17:49:32 -04:00
Dan Halbert
1905d90eaa Make advertising data buffers long-lived 2019-06-05 20:08:53 -04:00
Tavish Naruka
4a7122d354 boards: add support for Electronut labs Blip
Signed-off-by: Tavish Naruka <tavishnaruka@gmail.com>
2019-06-05 00:49:29 +05:30
Dan Halbert
613e12f99f Replace Broadcaster with enhanced Peripheral 2019-06-03 20:40:05 -04:00
Dan Halbert
63ac37946d 1. Remove advertising data construction in C: it's all done in Python now
2. Add scan response capability to advertising.
2019-06-02 23:21:30 -04:00
Dan Halbert
12f1d9d30c fix advertisement length check; add Service.secondary attribute 2019-05-31 18:03:05 -04:00
Dan Halbert
6cec81bcb5 Need to enable ble before scanning 2019-05-23 22:05:16 -04:00
Dan Halbert
1639354e5f Scanner working, but not very first time 2019-05-23 16:07:54 -04:00
Damien George
9cf1cbb057 nrf/mphalport: Use wfi to save power while waiting at the UART REPL. 2019-05-22 12:47:48 +10:00
Damien George
456c89f749 nrf/uart: Make UART print output something, and add write method. 2019-05-22 12:47:48 +10:00
Damien George
50d5114fcd nrf/mpconfigport.h: Enable MICROPY_KBD_EXCEPTION by default. 2019-05-22 12:47:48 +10:00
Damien George
302ffdba7f nrf/uart: Change UART driver to be non-blocking and use IRQs.
As part of this, ctrl-C is now able to interrupt a running program.
2019-05-22 12:47:19 +10:00
Glenn Ruben Bakke
d80abd035e nrf/nrfx_glue: Adapt to nrfx v.1.7.1.
Defining NRFX_STATIC_ASSERT macro to be empty, but available
to nrfx.
2019-05-21 23:16:20 +02:00
Damien George
bb29bde102 nrf/machine/i2c: Update to support new C-level I2C API. 2019-05-20 15:04:29 +10:00
Damien George
7e21cf723a nrf: Change types to size_t for all uses of mp_obj_str_get_data. 2019-05-13 12:39:56 +10:00
Scott Shawcroft
9feb844b7e
Fix crash in internal filesystem on nrf
Fixes #1842
2019-05-08 15:43:18 -07:00
Nguyen Hoan Hoang
9a6f6fd68d nrf/boards: Add support for BLYST Nano module based boards.
- IBK-BLYST-NANO: Breakout board
- IDK-BLYST-NANO: DevKit board with builtin IDAP-M CMSIS-DAP Debug JTAG,
  RGB led
- BLUEIO-TAG-EVIM: Sensor tag board (environmental sensor
  (T, H, P, Air quality) + 9 axis motion sensor)

Also, the LED module has been updated to support individual base level
configuration of each LED. If set, this will be used instead of the
common configuration, MICROPY_HW_LED_PULLUP. The new configuration,
MICROPY_HW_LEDX_LEVEL, where X is the LED number can be used to set
the base level of the specific LED.
2019-05-02 22:33:44 +02:00
Damien George
0646e607b5 ports: Convert to use pyexec_file_if_exists() to execute boot/main.py.
The stm32 and nrf ports already had the behaviour that they would first
check if the script exists before executing it, and this patch makes all
other ports work the same way.  This helps when developing apps because
it's hard to tell (when unconditionally trying to execute the scripts) if
the resulting OSError at boot up comes from missing boot.py or main.py, or
from some other error.  And it's not really an error if these scripts don't
exist.
2019-04-26 15:22:14 +10:00
Dan Halbert
15b7946fc4 Off-by-one error for usage of MAX_TX_IN_PROGRESS 2019-04-22 22:07:48 -04:00
Scott Shawcroft
713a38d1a2
Merge pull request #1754 from dmazzella/dmazzella-patch-1
add support for USER_C_MODULES
2019-04-17 09:41:20 -07:00
Dan Halbert
c0ce820974
Merge pull request #1803 from nickzoic/circuitpython-nickzoic-1042-nrf-nvm-bytearray-3
Circuitpython nickzoic 1042 nrf nvm bytearray 3
2019-04-16 15:05:18 -04:00
Tavish Naruka
32a0855d18 Add support for Electronut Labs Papyr.
Signed-off-by: Tavish Naruka <tavishnaruka@gmail.com>
2019-04-16 12:59:42 +05:30
Nick Moore
9c42a72275 Fix up single-byte access to nvm.ByteArray 2019-04-16 14:53:44 +10:00
Nick Moore
83dad37562 Fixups for adafruit/circuitpython#1042 2019-04-16 14:53:44 +10:00
Nick Moore
02dd32da60 Make some space for NVM adafruit/circuitpython#1042 2019-04-16 14:53:44 +10:00
Nick Moore
f22c01a05e Switch supervisor/internal_flash to use new nrf_nvm_safe_flash_page_write
adafruit/circuitpython#1610
2019-04-16 14:53:44 +10:00
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
Glenn Ruben Bakke
1f5d945afa nrf/Makefile: Update to match latest oofatfs version.
See corresponding commit b5f33ac2cb
2019-04-01 19:22:25 +02: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
Glenn Ruben Bakke
e0c6dfe90a nrf/readme: Add section about LTO.
Adding section about on how to disable use of the linker flag
-flto, by setting the LTO=0 argument to Make. Also, added a
note on recommended toolchains to use that works well with
LTO enabled.
2019-03-19 16:59:18 +01:00
Dan Halbert
9cceea0d68 nrf: fix internal flash writes 2019-03-18 09:11:40 -04:00
Glenn Ruben Bakke
696549d2e5 nrf/bluetooth: Deprecate use of SoftDevice s140 v6.0.0.
Removing linker script for nrf52840 s140 v6.0.0 as pca10056
target board now points to the new v6.1.1. Also, removing the
entry from the download_ble_stack.sh script.
2019-03-15 20:50:15 +01:00
Glenn Ruben Bakke
a3a266a9c3 nrf/board: Migrate nrf52840 target to new BLE stack.
This patch moves pca10056/nrf52840 target board to use
the new SoftDevice s140 v6.1.1 instead of the legacy v6.0.0.
2019-03-15 20:50:15 +01:00
Glenn Ruben Bakke
d3c1436e75 nrf/bluetooth: Add support for SoftDevice s140 version 6.1.1.
Updating download script to fetch the new SoftDevice, and
adding corresponding linker script for the BLE stack.
2019-03-15 20:50:15 +01:00
Glenn Ruben Bakke
1e5e3e3d48 nrf/bluetooth: Deprecate use of SoftDevice s132 v6.0.0.
Removing linker script for nrf52832 s132 v6.0.0 as all target
boards now points to the new v6.1.1. Also, removing the entry
from the download_ble_stack.sh script.
2019-03-15 20:50:15 +01:00
Glenn Ruben Bakke
5f26ef1112 nrf/board: Migrate all nrf52832 targets to new BLE stack.
This patch moves all the nrf52832 target boards to use the
new SoftDevice s132 v6.1.1 instead of the legacy v6.0.0.
2019-03-15 20:50:15 +01:00
Nguyen Hoan Hoang
e8ed2dea71 nrf/bluetooth: Add support for SoftDevice s132 version 6.1.1.
Updating download script to fetch the new SoftDevice, and
adding corresponding linker script for the BLE stack.
2019-03-15 20:50:15 +01:00
Dan Halbert
c4586c0531 nrf: Disable SPIM3; add SPIM1; remove TWIM1 2019-03-12 08:31:03 -04:00
Damien George
b5f33ac2cb ports: Update to work with new oofatfs version. 2019-03-05 15:56:39 +11: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
Stig Bjørlykke
c72391c4ce nrf/pwm: Remove superfluous NULL in machine_hard_pwm_instances.
Remove unneeded NULL entry in machine_hard_pwm_instances[] when not
building for NRF52_SERIES.
2019-02-20 22:52:18 +01:00
Stig Bjørlykke
6ca03fe8bd nrf/readme: Update make flash command when defining board.
Update the "make flash" command sample to include BOARD parameter
when building for a specific target board.
2019-02-20 22:34:08 +01:00
Glenn Ruben Bakke
ca2bb66127 nrf/bluetooth: Resolve compilation warning in ble_drv.c.
This patch makes sure that the char_data.props is first
assigned a value before other flags are OR'd in.
Resolves compilation warning on possible unitialized variable.
2019-02-20 07:25:51 +01:00
Glenn Ruben Bakke
0c6f5bc529 nrf/bluetooth: Improve advertisment behavior for nrf52 targets.
This patch makes sure that advertisment data is located in
persistent static RAM memory throughout the advertisment.

Also, setting m_adv_handle to predifined
BLE_GAP_ADV_SET_HANDLE_NOT_SET value to indicate first time
usage of the handle. Upon first advertisment configuration
this will be populated with a handle value returned by the
stack (s132/s140).
2019-02-20 07:25:51 +01:00
Glenn Ruben Bakke
ee3a01f25c nrf/readme: Update link to nrfjprog download.
After new layout of nordicsemi.com the direct links to
command line tools (nrfjprog) has changed to become dynamic.
This patch removes the old direct links to each specific OS
variant and is replaced with one single link to the download
landing page instead.
2019-02-20 07:13:36 +01: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
Damien George
6e30f96b0b ports: Convert legacy uppercase macro names to lowercase. 2019-02-12 14:54:51 +11: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
Stig Bjørlykke
98f790b03a nrf/timer: Fix disabling Timer 1 when using soft PWM.
Don't exclude the Timer instance 1 entry from machine_timer_obj[] when
using soft PWM. The usage is already checked when creating the Timer,
so just create an empty entry.
2019-02-02 11:15:52 +01:00
Scott Shawcroft
ec03887040
Fix hallowing and nrf builds 2019-01-31 11:42:15 -08:00
Stig Bjørlykke
63eae33b7b nrf/ticker: Remove duplicate NRFX_IRQ_PRIORITY_SET. 2019-01-31 17:50:10 +11:00
Ayke van Laethem
e8678cd1c9 nrf/pin: Print pull information in Pin.__str__. 2019-01-31 17:38:13 +11:00
Ayke van Laethem
2d293873a6 nrf/pin: Cleanup Pin.__str__ to print relevant information.
Code size change:
nrf51: -44
nrf52: -52
2019-01-31 17:31:58 +11:00
Ayke van Laethem
4e1c2fc831 nrf: Shrink "<peripheral> does not exist" error messages.
Code size reductions:
nrf51: -132
nrf52: -188
2019-01-31 17:26:26 +11:00
Ayke van Laethem
1ba962ff57 nrf/uart: Remove unused machine.UART() parameters.
If needed these parameters can be added back and made functional one at a
time.  It's better to explicitly not support them than to silently allow
but ignore them.
2019-01-31 17:18:23 +11:00
Ayke van Laethem
a293fa3d6d nrf/uart: Use formula instead of switch for baudrate calculation.
This saves a bit of code:
nrf51: -176
nrf52: -152
2019-01-31 17:06:59 +11: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
Damien George
d5d060ead9 nrf/modmachine: Rename machine.sleep to machine.lightsleep. 2019-01-30 14:15:38 +11: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
Glenn Ruben Bakke
9e5768a6db nrf/bluetooth: Update BLE stack download script.
Due to new webpages at nordicsemi.com, the download links
for Bluetooth LE stacks were broken.

This patch updates the links to new locations for the current
targets.
2018-12-10 20:42:06 +01: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
Scott Shawcroft
df18d22a93
Capture stderr as well and work on nRF build 2018-11-30 12:59:05 -08:00
jimblom
f67814fc97 Adding SparkFun nRF52840 Mini board support. 2018-11-30 13:57:22 -07:00
Scott Shawcroft
cf70dc4f1c
Fix BLE build 2018-11-30 11:53:33 -08:00
Scott Shawcroft
9d07e95351
Add support for adding release info into adafruit/circuitpython-org
This also changes the build script to python with better output.
2018-11-30 00:30:57 -08:00
Scott Shawcroft
60480ff4ed
Merge pull request #1351 from jepler/issue1307-ujson
json: enable on nrf boards and "large flash" M4 samd boards
2018-11-27 11:29:29 -08:00
Scott Shawcroft
d446d328d8
Fix QSPI on Feather nRF52840
We were writing with quad page program including the address (0x38)
which is unsupported by the GD25Q16C but it is supported by the
flash on the DK. So, we use the single address, quad data command
(0x32).
2018-11-27 00:13:24 -08:00
Dan Halbert
3164b16196 WIP: debug; add hash and __eq__ to UUID 2018-11-26 21:09:17 -05:00
Dan Halbert
6fb7590280 Merge remote-tracking branch 'adafruit/master' into bleio-rev 2018-11-26 10:16:29 -05:00
Scott Shawcroft
15eeac5d4b
A few fixes for nRF52840 feather QSPI and neopixel 2018-11-23 14:22:07 -08:00
Scott Shawcroft
324301e3bc
Update tinyusb to include control fixes. 2018-11-23 13:28:10 -08:00
Jeff Epler
52fd151c9c ports/nrf: enable json module on nrf boards generally 2018-11-22 10:35:57 -06:00
Dan Halbert
5fe746f643 Latest Feather nRF52840 pin revisions 2018-11-21 19:46:49 -05:00
Dan Halbert
1763ffe245 More UUID work; use mp_raise for exceptions 2018-11-20 23:04:58 -05:00
Dan Halbert
31cc71f7fb WIP: bleio revisions 2018-11-20 09:36:45 -05:00
Scott Shawcroft
b67c53edfa
Factor out of external flash as well.
Plus some cleanup.

Fixes #1324
2018-11-14 18:30:47 -08:00
Scott Shawcroft
87ddd64481
Factor out fake partition 2018-11-14 17:59:11 -08:00
Scott Shawcroft
47212ee31e
start debug 2018-11-14 17:21:48 -08:00
Scott Shawcroft
355abc835e
Fix output overflow and make help translatable 2018-11-09 16:41:08 -08:00
Scott Shawcroft
9d91111b1b
Move atmel-samd to tinyusb and support nRF flash.
This started while adding USB MIDI support (and descriptor support is
in this change.) When seeing that I'd have to implement the MIDI class
logic twice, once for atmel-samd and once for nrf, I decided to refactor
the USB stack so its shared across ports. This has led to a number of
changes that remove items from the ports folder and move them into
supervisor.

Furthermore, we had external SPI flash support for nrf pending so I
factored out the connection between the usb stack and the flash API as
well. This PR also includes the QSPI support for nRF.
2018-11-08 17:25:30 -08:00
Dan Halbert
64d457dad9 bring bleio PR up to date 2018-11-07 14:12:22 -05:00
Dan Halbert
e203ce9ce5 Use adafruit/nrfx fork of NordicSemiconductor/nrfx 2018-10-31 23:18:59 -04:00
arturo182
4bc24c4f60 bleio: Fix errors after rebase 2018-10-21 17:15:27 +02:00
arturo182
eceb21a017 bleio: Don't register the services until needed
Because of the very specific way nRF requires service registration
(characteristics can be added only to last added service), we would
have to write the Python code in a specific way. With this patch the
user has more freedom.
2018-10-21 16:00:04 +02:00
arturo182
19fab4af5a bleio: Remove deep copy constructor for UUID 2018-10-21 15:59:50 +02:00
arturo182
b5e5805bb4 bleio: Remove redundant struct field 2018-10-21 15:59:46 +02:00
arturo182
c7b42d80b3 bleio: A bit of cleanup 2018-10-21 15:59:42 +02:00
arturo182
cf79316002 nrf: Fix ble uart using the new API 2018-10-21 15:59:36 +02:00
arturo182
d5a71a4b8a nrf: Move bluetooth driver to the 'bluetooth' folder 2018-10-21 15:55:25 +02:00
arturo182
17f13ecc2c nrf: Cleanup of the ble driver
Moved the functions to classes that they belong to.
2018-10-21 15:54:13 +02:00
arturo182
77eeecbfd9 nrf: BLE driver cleanup 2018-10-21 15:52:36 +02:00
arturo182
6545aa99a9 nrf: Remove the ble drv specific characteristic struct 2018-10-21 15:51:04 +02:00
arturo182
98aa8c5923 nrf: Remove the ble drv specific service struct 2018-10-21 15:51:01 +02:00
arturo182
3df7dea2cc nrf: Remove the ble drv specific advertisement data struct 2018-10-21 15:50:59 +02:00
arturo182
4b344812bf nrf: Remove the ble drv specific address struct 2018-10-21 15:50:56 +02:00
arturo182
3bd65fbae5 nrf: Move the Peripheral class to bleio as Device
This was the last class from ubluepy and so that module is now gone.
The Device class offers both Peripheral and Central functionality.
See the inline docs for more info.
2018-10-21 15:50:45 +02:00
arturo182
bda734223e nrf: Move the Service class from ubluepy to the shared bleio module 2018-10-21 15:43:51 +02:00
arturo182
cc78249226 nrf: Move the Characteristic class from ubluepy to the shared bleio module 2018-10-21 15:43:48 +02:00
arturo182
61bf4a16a7 nrf: Remove unused ubluepy classes 2018-10-21 15:43:39 +02:00
arturo182
1c6bf9a150 bleio: Move the Scanner class to a shared module 2018-10-21 15:43:29 +02:00
arturo182
7390dc7dab bleio: Move ScanEntry to shared module and add a new AdvertisementData class 2018-10-21 15:43:24 +02:00
arturo182
345334aaf1 bleio: Add a new Address class
Use the new in the Adapter singleton.
2018-10-21 15:43:21 +02:00
arturo182
d5f942a971 bleio: Add a AddressType enum-like class 2018-10-21 15:43:17 +02:00
arturo182
20b8d5169d nrf: Move the Descriptor class from ubluepy to the shared bleio module 2018-10-21 15:43:13 +02:00
arturo182
f4940c9aec nrf: Move the UUID class from ubluepy to the shared bleio module
Also added a UUIDType enum-like class for determining UUID type.
2018-10-21 15:43:08 +02:00
Josh Klar
aefabc5353
Update docs to reflect proper size of device 2018-10-20 03:29:20 -07:00
Josh Klar
4c75a60bd3
Declobber a DEFINE 2018-10-20 02:57:17 -07:00
Josh Klar
16ca9c8c7c
Makefile fixes and some docs 2018-10-20 02:43:13 -07:00
Josh Klar
3d7b96aeb1
Add board and pin defs for MakerDiary NRF52840 MDK 2018-10-20 02:43:12 -07:00
Dan Halbert
b3c7746a7f fix copyright notice 2018-10-16 11:09:37 -04:00
Dan Halbert
2262efc311 PulseOut working 2018-10-16 11:05:02 -04:00
Glenn Ruben Bakke
11bc38d55f nrf/bluetooth: Set GAP_ADV_MAX_SIZE to 31 (s132/s140).
For s132 and s140, GAP_ADV_MAX_SIZE was currently set to
BLE_GATT_ATT_MTU_DEFAULT, which is 23. The correct value
should have been 31, but there are no define for this in
the s132/s140 header files as for s110.

Updating define in ble_drv.c to the correct value of 31.
2018-10-11 23:38:11 +02:00
Dan Halbert
8d58093328
Merge pull request #1259 from dhalbert/nrf-pwmout
Allow variable freq PWMOut; use multiple channels if same freq
2018-10-10 12:27:27 -04:00
Scott Shawcroft
df80ad8e6e
Merge pull request #1193 from ATMakersBill/master
Add supervisor.runtime.serial_bytes_available so that input() can be used without blocking.
2018-10-09 23:58:43 -07:00
Dan Halbert
ca737e6f7c Don't disable tempoarily in deinit(). 2018-10-09 21:23:47 -04:00
Dan Halbert
91a88cf568 Allow variable freq PWMOut; use multiple channels if same freq 2018-10-09 20:52:55 -04:00
ATMakersBill
9f94712ad1 replacing change to input() with separate method to check for USB Serial input 2018-10-09 18:37:52 -04:00
Jerry Needell
fd0ea85549 add force_create to nrf filesystem_init() 2018-10-06 08:03:27 -04:00
hathach
21ddb6b9b9 fix tinyusb cdc issue 2018-10-05 21:37:16 +07:00
Dan Halbert
6049776b26
Merge branch 'master' into nrf52_uart_io 2018-10-03 13:31:48 -04:00
Scott Shawcroft
86ae707b08
Merge pull request #1223 from dhalbert/spi-baudrate
nrf: remove error check for SPI baudrate too high; round to nearest baudrate
2018-10-03 10:11:44 -07:00
hathach
b8884ccc8b Merge branch 'master' into nrf52_uart_io 2018-10-03 23:13:56 +07:00
Enrico Paganin
4b9099358f Fix 'advertisement' typo 2018-10-03 09:56:30 +02:00
hathach
08cbb03bdd implement common_hal_busio_uart_clear_rx_buffer 2018-10-03 11:39:01 +07:00
hathach
f543c8415d "busio.UART not yet implemented -> not available 2018-10-03 11:30:31 +07:00
Dan Halbert
21d331c8cc round SPI freq down; check max freq 2018-10-02 21:06:40 -04:00
Dan Halbert
aa95526428 nrf: remove error check for SPI baudrate too high; round to nearest baudrate 2018-10-01 18:54:13 -04:00
Dan Halbert
48a3aafdd2 reset I2C and SPI on ctrl-D 2018-09-25 15:12:10 -04:00
hathach
76d6fb03f0 more clean up 2018-09-26 02:12:06 +07:00
hathach
eba80f7a99 update translate string 2018-09-26 02:10:44 +07:00
hathach
52328c88cd remove space 2018-09-26 02:06:32 +07:00
hathach
74cc55b107 change error type to runtime 2018-09-25 17:31:53 +07:00
hathach
f724647a45 fix feather nrf52840 build error 2018-09-25 17:09:54 +07:00
hathach
dec5c50c45 clean up 2018-09-25 16:22:14 +07:00
hathach
2f0e0bdcaf migrate serial from uart to uarte 2018-09-25 16:14:44 +07:00
hathach
9017c9d29a clean up 2018-09-25 14:29:45 +07:00
hathach
d3e5ba83eb update nrfx to 1.3.0 2018-09-25 13:00:57 +07:00
hathach
d714479924 clean up 2018-09-25 12:48:48 +07:00
hathach
01c1296197 nrf52 uart io rx work reliably 2018-09-25 12:37:31 +07:00
hathach
1782ceab35 uarte malloc if buffer is not in SRAM 2018-09-24 16:18:49 +07:00
hathach
4015023e01 clean up uart io 2018-09-24 16:12:05 +07:00
hathach
7bbd449f06 uarte rx work fine 2018-09-24 15:54:32 +07:00
hathach
fdd3e91753 changing to nrf uarte, tx works fine 2018-09-24 14:56:52 +07:00
hathach
7a1b4ccc9b Merge branch 'master' into nrf52_uart_io 2018-09-24 12:50:48 +07:00
Scott Shawcroft
f2c960e89b
Merge pull request #1205 from hathach/nrf52_autoreload
add autoreload for nrf52
2018-09-21 16:48:21 -04:00
hathach
e1fe7e71a1 add autoreload 2018-09-22 02:08:00 +07:00
Dan Halbert
2c15d12f2f allow multiple I2C and SPI; improve nrfx_config.h 2018-09-20 20:45:30 -04:00
hathach
816ff05253 clean up 2018-09-21 03:53:35 +07:00
hathach
dddc437ea7 got rx working finally 2018-09-21 03:48:13 +07:00
hathach
fe1a297889 still have issue with initial uart rx 2018-09-21 01:27:52 +07:00
Dan Halbert
2309e60c0d WIP; problem with staticly allocated IRQ handlers 2018-09-19 21:59:04 -04:00
hathach
9c25306877 uart rx got some issue with irq 2018-09-20 02:12:21 +07:00
Scott Shawcroft
3f380ded6b
Merge pull request #1197 from dhalbert/3.x-master
3.x master
2018-09-19 09:58:52 -07:00
hathach
c5593ec074 got uart tx work 2018-09-19 17:59:15 +07:00
hathach
1df3bcf392 add board.UART() function 2018-09-19 14:40:37 +07:00
Dan Halbert
56b7f3ba64 fix translate omission; pca10059 fix in .travis.yml 2018-09-18 16:28:27 -04:00
Dan Halbert
bc510e714f merge 3.0.2 to master 2018-09-18 15:38:12 -04:00
hathach
d8c8c5f005 remove CFG_HWUART_FOR_SERIAL 2018-09-18 20:26:50 +07:00
Pierrick C
7e8816ad6f Add VOLTAGE_MONITOR alias to pin D31/A7 2018-09-13 23:46:47 +02:00
Dan Halbert
6a72084198 fix nrf builds; sphinx 1.8.0 crashing: use lower version 2018-09-12 18:37:03 -04:00
Dan Halbert
e335c74ac6 use open-drain capabilities on GPIO; clean up board init; set correct GPIO voltage 2018-09-09 15:01:28 -04:00
Dan Halbert
100603a60b neopixel_write merge; alphabetize stuff in Makefile 2018-09-05 17:38:59 -04:00
Dan Halbert
4c3b4cacfa Merge remote-tracking branch 'adafruit/master' into nrf-pin-claiming 2018-09-05 13:15:22 -04:00
hathach
ccd87a33b6 use nrf_pwm instead of direct registers 2018-09-05 13:18:36 +07:00
Dan Halbert
b5c03a7085 generalize # of ports; remove atmel neopixel code; remove pin name in mc_pin_obj_t 2018-09-04 16:43:21 -04:00
hathach
f4a98e909c fix nrf52832 build 2 2018-09-04 23:25:08 +07:00
hathach
b9e8e3cd1f fix nrf52832 build 2018-09-04 20:54:36 +07:00
hathach
1fe3ed87eb run background job while waiting for neopixel write seqend 2018-09-04 19:24:45 +07:00
hathach
0d92c65829 correct disconnection check to only dtr 2018-09-04 18:36:08 +07:00
hathach
3ae24d9f9a add neopixel_write implementation, work ok 2018-09-04 18:33:08 +07:00
hathach
e17253071e adding neopixel write 2018-09-04 15:51:49 +07:00
Dan Halbert
4382389e6f fix typos, remove incorrect pca10059 example; add default buses for pca10056; improve board names for pca boards 2018-09-01 00:29:36 -04:00
Dan Halbert
9ea809bef7 add pin claiming to devices 2018-08-31 18:38:05 -04:00
Dan Halbert
585597a252 pin files rework; implement pin claiming; add more boards 2018-08-31 18:05:55 -04:00
Dan Halbert
0e8d146184 wip 2018-08-31 18:05:55 -04:00
hathach
87811ec3a0 update readme board name feather_nrf52832 2018-08-28 16:15:20 +07:00
ladyada
ded38d30b6 rename pin.h to nrf_pin.h to avoid conflict with Pin.h 2018-08-26 20:37:12 -04:00
Dan Halbert
4cc33f8de6 Merge remote-tracking branch 'adafruit/master' into nrf_board_rename 2018-08-23 16:25:57 -04:00
Dan Halbert
728622f09d
Merge pull request #1139 from hathach/nrf52_usb_serial
use unique DevicID for usb serial
2018-08-23 09:30:31 -04:00
hathach
4a8cd03de1 use unique DevicID for usb serial 2018-08-23 14:00:54 +07:00
hathach
fed1960424 remove s140 6.0.0 and s132 6.1.0 (not supported yet) 2018-08-23 00:27:39 +07:00
hathach
0c0ac06fc7 add SD 6.1.0 to download all 2018-08-22 23:09:09 +07:00
hathach
7961103ee6 update SD to v6.1.0 2018-08-22 21:51:30 +07:00
Dan Halbert
05ea9fd296 remove stray underscore 2018-08-22 10:26:52 -04:00
Dan Halbert
eaf4d19dbb Merge remote-tracking branch 'adafruit/master' into nrf_board_rename
Merge #1137
2018-08-22 10:24:10 -04:00
hathach
a516d1123f fix typos 2018-08-22 19:42:41 +07:00
hathach
02b1b53153 Merge branch 'master' into nrf52_dfu_touch1200 2018-08-22 15:24:12 +07:00
hathach
fc955b1591 remove bootloader binaries, update readme for using adafruit-nrufitl and flashing bootloader 2018-08-22 15:22:17 +07:00
Dan Halbert
c503cf990b forgot to change .travis.yml 2018-08-21 20:35:58 -04:00
Dan Halbert
85df32907f rename nrf boards to feather_nrf52832 and feather_nrf52840_express 2018-08-21 18:45:37 -04:00
hathach
df4184e478 rename linker file to SD major version only 2018-08-21 16:02:57 +07:00
hathach
1c4accfa39 Merge branch 'nrf52_remove_boot_target' into nrf52_dfu_touch1200 2018-08-21 15:17:03 +07:00
hathach
b7dd33b76e add touch 1200 for dfu-flash 2018-08-21 15:15:44 +07:00
Egor Leonenko
18e9f74738
Fix PWM Support on NRF52840
Replace usage of pin number alone with port+pin combination in NRF port of PWMOut
2018-08-17 19:34:03 +12:00
Scott Shawcroft
76e0373576
Fix nrf and unix 2018-08-16 17:41:38 -07:00
Scott Shawcroft
2cd166b573
Fix esp and samd 2018-08-16 17:41:35 -07:00
hathach
e1ccc07841 remove bootloader & dfu-bootloader target
user should go to bootloader repo to upgrade bootloader
2018-08-14 20:19:28 +07:00
Dan Halbert
498fec64e2 increase new dynamic stack size to a comfortable value for now 2018-08-03 22:35:20 -04:00
Dan Halbert
dfa2581ffd
Merge pull request #1057 from tannewt/flexible_heap
Add basic memory allocation outside Python runtime
2018-08-02 18:43:06 -04:00
Scott Shawcroft
5704bc8c93
Share memory.c and a bit of polish. 2018-08-02 14:35:46 -07:00
Ayke van Laethem
e755bd4932
nrf/uart: Fix UART.writechar() to write just 1 byte. 2018-08-02 22:21:24 +02:00
Ayke van Laethem
60a05485cb
nrf/uart: Remove unused UART.char_width field.
Also, clean up some code.
Code size change:
nrf51: -24
nrf52: -28
2018-08-02 22:18:16 +02:00
Stig Bjørlykke
2cf2ad943e nrf: Use separate config for each PWM instance.
The hard_configs table has entries for each PWM instance. Use them.
2018-08-02 20:36:18 +02:00
Stig Bjørlykke
0c161691b4 nrf: Correct index checking of ADC/PWM/RTCounter instances.
Avoid trying to use ADC, PWM and RTCounter instances which is
one past last available, because this will give a HardFault.
2018-08-01 14:56:07 +02:00
Stig Bjørlykke
7f0c5f2ef9 nrf: Enable all PWM, RTC and Timer instances for nrf52840.
The NRF52 define only covers nrf52832, so update the define checks
to use NRF52_SERIES to cover both nrf52832 and nrf52840.

Fixed machine_hard_pwm_instances table in modules/machine/pwm.c

This enables PWM(0) to PWM(3), RTCounter(2), Timer(3) and Timer(4),
in addition to NFC reset cause, on nrf52840.
2018-08-01 14:36:07 +02:00
Stig Bjørlykke
b6e49da407
nrf/uos: Add mbfs __enter__ and __exit__ handlers.
This will make 'with open('file', 'r') as f:' work by properly close
the file after the suite is finished.
2018-08-01 14:12:34 +02:00
hathach
0bc3432106 Merge branch 'master' into nrf52_sys_module 2018-08-01 11:53:12 +07:00
hathach
592c190069 PR review clean up 2018-08-01 11:31:32 +07:00
hathach
8640d37149 try to address sys module, compile ok 2018-08-01 10:19:20 +07:00
hathach
200669216e more clean up 2018-08-01 08:52:07 +07:00
hathach
bac233e99b clean up 2018-08-01 08:47:41 +07:00
hathach
6ddd8583da clean up 2018-08-01 08:20:20 +07:00
Scott Shawcroft
a88cdaca6a
Remove rogue execute bit. Must a common incorrect shortcut for me. :-) 2018-07-31 12:42:21 -07:00
hathach
1e524f1b98 Merge branch 'master' into nrf52840_usb_hid 2018-08-01 00:58:23 +07:00
hathach
85bd46a4e1 enable MICROPY_PY_ARRAY_SLICE_ASSIGN, MICROPY_PY_BUILTINS_SLICE_ATTRS 2018-07-31 23:09:39 +07:00
hathach
4bece22c92 add hid keyboard LED indicator stub 2018-07-31 23:02:15 +07:00
hathach
05139e2aee all hid devices seems to be ok 2018-07-31 22:54:26 +07:00
hathach
2c85f42330 add usb hid syscontrol 2018-07-31 21:57:00 +07:00
hathach
ef58adacd3 usb hid consumer control works 2018-07-31 21:19:02 +07:00
hathach
fd661c1d57 improve usb hid 2018-07-31 21:06:24 +07:00
Scott Shawcroft
12cf5e51c2
Allow for resizing the stack area. 2018-07-31 05:18:23 -07:00
hathach
27b2a9fe59 add usb_desc, disable tinyusb stack CFG_TUD_DESC_AUTO 2018-07-31 17:50:32 +07:00
hathach
d15caf0dbd hid keyboard and mouse work well 2018-07-31 16:42:04 +07:00
hathach
221d54a595 workaround to use lib/utils/interrupt_char.c 2018-07-31 14:28:34 +07:00
hathach
ae783b0b1a update tinyusb, set scsi sense key for unsupported commands 2018-07-31 13:54:58 +07:00
Dan Halbert
2e260a0eab Merge remote-tracking branch 'adafruit/master' into micropython-25ae98f-merge 2018-07-28 14:13:54 -04:00
Dan Halbert
f48b70050e merge finished 2018-07-28 13:29:47 -04:00
hathach
368d59796f adding usb_hid
compiled with undefined ref
2018-07-27 17:36:41 +07:00
hathach
21339c4155 house keeping 2018-07-27 17:22:21 +07:00
hathach
e86f7d0b88 add usb msc callback description 2018-07-27 00:17:14 +07:00
hathach
5bdf40901f update tusb lib 2018-07-26 17:16:41 +07:00
Dan Halbert
bc760dd341 WIP: complete manual inspection of all significant changes 2018-07-23 21:34:25 -04:00
Ayke van Laethem
7067ac3573 nrf/drivers/flash: Fix incorrect page alignment check. 2018-07-23 16:12:33 +10:00
roland
6a31dcd638 nrf: Update nrfjprog links to allow to download any version.
Instead of downloading "a" version, these links point to history from where
you can download the verson you like.
2018-07-23 16:11:40 +10:00
Damien George
6ac4304284 nrf/boards/microbit: Use MICROPY_PY_BUILTINS_FLOAT to detect FP support.
This works for both single and double precision float.
2018-07-20 14:11:28 +10:00
Damien George
9addc38af4 nrf: Properly use (void) instead of () for function definitions. 2018-07-20 14:11:28 +10:00
Damien George
55632af70a nrf/Makefile: Make sure dependencies for pins_gen.c are correct. 2018-07-20 14:11:28 +10:00
Ayke van Laethem
8df342d330 nrf: Include $(SRC_MOD) in the build.
Also, remove the unused $(SRC_LIB).
2018-07-19 00:35:24 +10:00
Ayke van Laethem
2f0f4fdcd3
nrf: Use mp_raise_ValueError instead of nlr_raise(...)
Saves 60 bytes on the nRF52 with SD disabled. There will be a bigger
saving with SD enabled and/or on the micro:bit board.
2018-07-18 15:25:17 +02:00
Glenn Ruben Bakke
264d80c84e nrf/drivers: Add license text to ticker.h and softpwm.h.
As per the LICENSE and AUTHORS files from the original source of these
header files.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
ea00717a57 nrf: Compile nlr objects with -fno-lto flag
To prevent over-optimizations of nlr and nlrthumb when -flto is used
the flag -fno-lto is set on these modules during compilation.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
14d257c66b nrf: Add explicit make flag for oofatfs
Adding MICROPY_FATFS as makefile flag in order to explicitly
include oofatfs files to be compiled into the build.

The flag is set to 0 by default. Must be set in addition to
MICROPY_VFS and MICROPY_VFS_FAT in mpconfigport.h.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
50ee908896 nrf/bluetooth: Replace BLE REPL (WebBluetooth) URL
Updating URL of the WebBluetooth/PhysicalWeb from
https://glennrub.github.io/webbluetooth/micropython/repl to
https://aykevl.nl/apps/nus/.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
cf58ef27af nrf: Quick-fix on const objects with open array dimension in objtuples.
Temporarly solving the issue of
"differ from the size of original declaration [-Werror=lto-type-mismatch]
until linker is fixed in upcomming release of gcc.

Bug is reported by others, and will be fixed in next version of arm-gcc.
However, this patch makes it possible to use modmusic and modimage
with current compilers.

Alternativly, the code can be compiled with LTO=0, but uses valuable 9K
more on this already squeezed target (microbit).
2018-07-18 17:12:26 +10:00
Ayke van Laethem
0e5f8425ea nrf/boards: Check for stack/heap size using an assert.
The main effect of this is that the .bss is now accurate and doesn't
include the stack and minimum heap size.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
7144e87ced nrf/bluetooth: Add support for s132/s140 v6, remove s132 v2/3/5
Support added for s132/s140 v6 in linker scripts and boards.
Support removed for s132 v2/3/5.

Download script updated to fetch new stacks and removed the
non-supported ones.

ble_drv.c updated to only handle s110 v8, and s132/s140 v6.

ubluepy updated to continue scanning after each individual scan
report reported to the module to keep old behaviour of the
Scanner class.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
db67a5000f nrf: Generalize feather52 target
This patch generalize the feather52 target to be a board without
an in-built Bluetooth stack or bootloader giving all flash memory to
micropython code.

This way the feather52 target can run any supported Bluetooth LE
stack the port supports for other nrf52832 targets. Hence, this
make Makefiles/linker scripts and BLE driver support easier
to maintain in the future.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
b7ce2f1460 nrf: Add support for reading output pin state
Current adoption on top of nrfx only reads the GPIO->IN register.
In order to read back an output state, nrf_gpio_pin_out_read has
to be called.

This patch concatinate the two read functions such that, if
either IN or OUT register has a value 1 it will return this,
else 0.

Updating lib/nrfx submodule to latest version of master to get
the new GPIO API to read pin direction.
(nrfx: d37b16f2b894b0928395f6f56ca741287a31a244)
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
6011441342 nrf: Move pyb module to boards module
Cleaning up use of "pyb" module.
Moving the file to a new folder and updating the
makefile accordingly. New module created called
"board" to take over the functionality of the legacy
"pyb" module.

Updating outdated documentation referring to pyb.Pin,
to now point to machine.Pin.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
4a323f8b80 nrf/nrfx_config: Move back nrf52832 to use non-EasyDMA SPI
As EasyDMA variant of SPI(M) might clock out an additional byte
in single byte transactions this patch moves the nrf52832 to
use SPI and not SPIM to get more stable data transactions.

Ref: nrf52832 rev2 errata v1.1, suggested workaround is:
"Use the SPI module (deprecated but still available) or
use the following workaround with SPIM ..."

Current nrfx SPIM driver does not contain this workaround,
and in the meanwhile moving back to SPI fixes the issue.

Also, tabbing the nrfx_config.h a bit to make it more readable.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
5925004da3 nrf/modules/machine/spi: Move enable-guard to prevent wrong includes
This patch moves the check of SPI configuration before
including any SPI header files. As targets might disable SPI
support, current code ends up in including SPIM if not SPI
is configured. Hence, this is why the check whether the module is
enabled should be done before including headers.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
774638e2a9 nrf/boards/feather52: Move phony targets to main Makefile
dfu-gen .PHONY target is run unconditionally as first build
target when included, and might fail if the hex file is not
yet generated.

To prevent this, the dfu-gen and dfu-flash targets are moved
to the main Makefile and only exposed if feather52 is the
defined BOARD.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
d3311681a9 nrf: Enable micro:bit FS by default
Update configuration define from
MICROPY_HW_HAS_BUILTIN_FLASH to MICROPY_MBFS.

MICROPY_MBFS will enable the builtin flash as
part of enabling the micro:bit FS.
2018-07-18 17:12:26 +10:00
Ayke van Laethem
a4615672d4 nrf/modules/uos/microbitfs: Remove unused uos_mbfs_mount.
It throws an error in GCC 6.3.
2018-07-18 17:12:26 +10:00
Ayke van Laethem
635064c432 nrf/modules/uos/microbitfs: Fix errno defines.
Probably broken after the recent Clang fixes to errno.h.
2018-07-18 17:12:26 +10:00
Ayke van Laethem
1aa9ff9141 nrf/mphalport: Remove divided assembly syntax. 2018-07-18 17:12:26 +10:00
Ayke van Laethem
fb17105183 nrf: Remove useless #include <errno.h>. 2018-07-18 17:12:26 +10:00
Ayke van Laethem
17769452d4 nrf/modules/machine/adc: Don't compare -1 to an unsigned number.
Clang warns about this.
2018-07-18 17:12:26 +10:00
Ayke van Laethem
4111206bd5 nrf/Makefile: Refine dead-code elimination parameters.
Clang warns about useless -Wl,--gc-sections passed in CFLAGS.
2018-07-18 17:12:26 +10:00
Ayke van Laethem
ab72b5b69c nrf/Makefile: Use C11 instead of Gnu99.
Some constructs require C11 which GCC silently allows.
2018-07-18 17:12:26 +10:00
Ayke van Laethem
a6ae950b75 nrf/Makefile: Remove -fstack-usage.
-fstack-usage is not supported by Clang and old GCC versions.
2018-07-18 17:12:26 +10:00
Ayke van Laethem
5fdebe62d3 nrf/Makefile: use "standard" GCC -fshort-enums instead of --short-enums.
Clang understands only -fshort-enums, not --short-enums. As
--short-enums isn't even mentioned in the gcc man page, I think this
alias exists more for backwards compatibility.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
03da4e33fb nrf/bluetooth: Fixes for s132 v5 BLE stack
Removing unused nrf52832_512k_64k_s132_5.0.0.ld.

Adding new linker script s132_5.0.0 following new
linker script scheme.

Updating ble_drv.c to handle de-increment of
outstanding tx packets on hvx for s132 v5.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
58ec23fdf7 nrf/modules/machine/adc: Fix to make adc.c compile for nrf51 targets 2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
24258cf0b9 nrf: Return immediatly from mp_hal_delay_us if 0us is given
After nrfx 1.0.0 a new macro was introduced to do a common
hardware timeout. The macro function triggers a counter of
retries or a timeout in us. However, in many cases, like in
nrfx_adc.c the timeout value is set to 0, leading to a infinite
loop in mp_hal_delay_us. This patch prevents this from happening.

Path of error:
nrfx_adc.c -> NRFX_WAIT_FOR -> NRFX_DELAY_US -> mp_hal_delay_us.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
63c748bfcc nrf/spi: Allow for external use of new and transfer function.
This patch also opens up for all arguments to be set as positional
arguments such that an external user of the make_new function can set
provide all parameters as positional arguments.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
434bd568fe nrf/adc: Allow for external use of new and value read function. 2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
3209a13bf5 nrf/modules: Align method to resolve pin object
machine/i2c already uses mp_hal_get_pin_obj which
points to pin_find function in order to locate correct
pin object to use.

The pin_find function was recently updated to also
being able to locate pins based on an integer value,
such that pin number can be used as argument to object
constructors.

This patch modfies and uniforms pin object lookup for
SPI, music and pwm.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
0f7da42c75 nrf/modules/random: Rename port config for RNG
Renaming config for enabling random module with hw
random number generator from MICROPY_PY_HW_RNG to
MICROPY_PY_RANDOM_HW_RNG to indicate which module it
is configuring.

Also, disabling the config by default in mpconfigport.h.

Adding the enable of RNG in all board configs.

Moving ifdef in modrandom, which test for the config being
set, earlier in the code. This is to prevent un-necessary
includes if not needed.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
f4382a2885 nrf/boards/wt51822_s4at: Fixes after nrfx and Pin IRQ introduction 2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
72aacef02e nrf/boards: Remove unused defines from board config headers 2018-07-18 17:12:26 +10:00
Ayke van Laethem
65f8d9a643 nrf/gccollect: Use the SP register instead of MSP.
Using the current stack pointer directly saves 8 bytes of code.
We need the *current* register anyway for GC (which is always MSP).
2018-07-18 17:12:26 +10:00
Ayke van Laethem
013c23712c nrf/drivers/bluetooth/ble_drv: Increase max transfers in progress.
Increase the maximum number of queued notifications from 1 to 6. This
massively speeds up the NUS console - especially when printing large
amounts of text. The reason is that multiple transfers can be done in a
single connection event, in ideal cases 6 at a time.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
67fd67f549 nrf/modules/machine/spi: SPIM (EasyDMA) backend for nrf52x
This patch moves all nrf52 targets to use SPIM backend
for SPI which features EasyDMA. The main benefit of doing
this is to utilize the SPIM3 on nrf52840 which is
EasyDMA only peripheral.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
6e8a605500 nrf/modules/machine/pin: Add support for IRQ on Pin's
This patch ads irq method to the pin object. Handlers
registered in the irq method will be kept as part of the
ROOT_POINTERS.

In order to resolve which pin object is the root of the
IRQ, the pin_find has been extended to also be able to
search up Pin objects based on mp_int_t pin number.
This also implies that the Pin.new API is now also supporting
creation of Pin objects based on the integer value of the
pin instead of old style mandating string name of the Pin.

All boards have been updated to use real pin number from
0-48 instead of pin_Pxx for UART/SPI and music module pins.

UART/SPI/modmusic has also been updated to use pin number
provided directly or look up the Pin object based on the
integer value of the pin (modmusic).

Pin generation has been updated to create a list of pins, where
the board/cpu dicts are now refering to an index in this list
instead of having one const declaration for each pin. This new
const table makes it possible to iterate through all pins generated
in order to locate the correct Pin object.
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
864f671744 nrf: Remove port member from Pin object
In order to be able to support GPIO1 port on nrf52840
the port has been removed from the Pin object.

All pins on port1 will now be incrementally on top of
the pin numbers for gpio0. Hence, Pin 1.00 will become
P32, and Pin 1.15 will become P47.

The modification is done to address the new gpio HAL
interface in nrfx, which resolves the port to be
configured base on a multiple of 32.

The patch also affects the existing devices which does
not have a second GPIO port in the way that the
port indication A and B is removed from Pin generation.
This means that the port which was earlier addressed
as PA0 is now P0, and PA31 is P31.

Also, this patch removes the gpio member which earlier
pointed to the perihperal GPIO base address. This is not
needed anymore, hence removed.
2018-07-18 17:12:26 +10:00
Ayke van Laethem
2de65dda22 nrf: Make linker scripts more modular.
With all the variation in chips and boards it's tedious to copy and
redefine linker scripts for every option. Making linker scripts more
modular also opens up more possibilities, like enabling/disabling the
flash file system from the Makefile - or even defining it's size from a
Makefile argument (FS_SIZE=12 for a 12kB filesystem if tight on space).
2018-07-18 17:12:26 +10:00
Ayke van Laethem
375bc31f4b nrf: Enable -g flag by default.
This does not affect binary output, but makes debugging a whole lot
easier.
2018-07-18 17:12:26 +10:00
Ayke van Laethem
1949719e1d nrf/Makefile: Fix .PHONY target.
It must be in uppercase.
2018-07-18 17:12:26 +10:00
Ayke van Laethem
57ca1ecf01 nrf: Fix NUS console when using boot.py or main.py. 2018-07-18 17:12:26 +10:00
glennrub
002f7d1ad7 nrf: Replace custom-HAL with nrfx-HAL
Summarized this squashed PR replaces the hal/ folder in the port. This has been replaced the official
HAL layer from Nordic Semiconductor; https://github.com/NordicSemiconductor/nrfx.

A Git submodule has been added under lib/nrfx, for the nrfx dependency.

The drivers / modules has been updated to use this new HAL layer; nrfx at v1.0.0.

Also, header files and system files for nrf51/nrf52x chip variants has been deleted from the device/ folder, only keeping back the startup files written in C. All other files are now fetched from nrfx.

3 new header files in the ports/nrf/ folder has been added to configure nrfx (nrfx_config.h), logging (nrfx_log.h) and glue nrfx together with the drivers and modules from micropython (nrfx_glue.h).

The PR has been a joint effort from @aykevl (Ayke van Laethem) and @glennrub.

For reference, the commit log will be kept to get an overview of the changes done:

* ports/nrf: Initial commit for moving hal to Nordic Semiconductor BSD-3 licensed nrfx-hal.

* ports/nrf: Adding nrfx, Nordic Semiconductor BSD-3 hal layer, as git submodule checked out at lib/nrfx.

* ports/nrf/modules/machine/uart: Fixing bug which set hwfc to parity excluded, always resulting in no flow control, hence corrupted output. Also adding an extra loop on uart_tx_char to prevent any tx when any ongoing tx is in progress.

* ports/nrf/i2c: Moving I2C over to nrfx driver.

* ports/nrf/modules/machine/i2c: Alignment. Renaming print function param 'o' to 'self_in'

* ports/nrf/spi: Updating SPI machine module to use nrfx drivers.

* ports/nrf: Renaming modules/machine/rtc.c/.h to rtcounter.c/.h to not confuse the peripheral with Real-Time Clock:

* ports/nrf: Updating various files after renaming machine module RTC to RTCounter.

* ports/nrf: Renaming RTC to RTCounter in modmachine globals dict table. Also updating object type name to reflect new module name.

* ports/nrf: Fixing leftovers after renaming rtc to rtcounter.

* ports/nrf: Early untested adoption of nrfx_rtc in RTCounter. Untested.

* nrf/modules/machine/i2c: Improve keyword argument handling

* ports/nrf/modules/temp: Updating Temp machine module to use nrfx defined hal nrf_temp.h. Moving logic of BLE stack awareness to machine module.

* ports/nrf/boards/pca10040: Enable machine Temp module.

* nrf/modules/machine/rtcounter: Remove magic constants.

* ports/nrf: Adding base support for nrfx module logging. Adding option to disable logging of UART as it might log its own setup over UART while the peripheral is not yet set up. Logging of UART could make sense if other transport of log is used.

* ports/nrf: updating nrfx_log.h with more correct parenthisis on macro grouping.

* ports/nrf: Updating nrfx logging with configuration to disable logging of UART module. The pattern can be used to turn off other modules as well. However, for now UART is the only module locking itself by logging before the peripheral is configured. Logging is turned off by default, can be enabled in nrfx_config.h by setting NRFX_LOG_ENABLED=1.

* ports/nrf/modules/random: Updating modrandom to use nrfx hal for rng. Not using nrfx-driver for this peripheral as its blocking mode would do the trick on RNG. Moving softdevice aware code from legacy hal to modrandom.c.

* nrf: Enable Peripheral Resource Sharing.

This enables TWI and SPI to be enabled at the same time.

* nrf/Makefile: Define MCU sub variant (e.g. NRF51822/NRF51422)

* nrf: Port TIMER peripheral to nrfx HAL.

* nrf/modules/machine/uart: Optimize UART module

For a nRF51, this results in a size reduction of:
.text: -68 bytes
.data: -56 bytes

* nrf/modules/machine/uart: Don't use magic index numbers.

* nrf/modules/machine/uart: Fix off-by-one error.

For nrf51:
.text: -40 bytes

* nrf/modules/machine/rtcounter: Update for nrfx HAL.

* nrf/modules/machine/i2c: Reduce RAM consumption.

Reductions for the nrf51:
flash: -108 bytes
RAM:   -72 bytes

* nrf/mpconfigport: Avoid unnecessary root pointers.

This saves 92 bytes of RAM.

* nrf: Support SoftDevice with nrfx HAL.

* nrf: Add NVMC peripheral (microbitfs) support.

There is no support yet for a SoftDevice.

It also fixes a potentially serious bug in start_index generation.

* nrf/modules/machine/spi: Optimize SPI peripheral.

nrf51:
text: -340 bytes
data: -72  bytes

nrf52:
text: -352 bytes
data: -108 bytes

* nrf/modules/random: Forgot to commit header file.

* nrf: Make nrfx_config.h universal for all boards.

* nrf: Use SoftDevice API for flash access when built for SD

* nrf/drivers/bluetooth: Remove legacy HAL driver includes.

These were not used anymore so can be removed.

* ports/nrf/microbit: Port microbit targets to nrfx HAL

Initial port of microbit modules to use nrfx HAL layer.
Tested display/image and modmusic on micro:bit to verify that
softpwm and ticker for nrf51 is working as expected.

Changing IRQ priority on timer to priority 2, as 1 might collide if
used side by side of SD110 BLE stack.

The patch reserves Timer1 peripheral compile time. This is not ideal
and should be resolved in seperate task.

* nrf/boards/microbit: Remove custom nrfx_config.h from microbit target, adding disablement of timer1 if softpwm is enabled.

* nrf/adc: Update ADC module to use nrfx

* nrf/modules/machine/pwm: Updating machine PWM module to use nrfx HAL driver.

examples/nrf52_pwm.py and examples/nrf52_servo.py tested on pca10040.

* nrf: Removing hal folder and boards nrf5x_hal_conf.h headers.

* nrf/nrfx_glue: Adding direct NVIC access for S110 BLE stack

If SoftDevice s110 has not yet been initialized, the IRQ will not be forwarded to
the application using the sd_nvic* function calls. Hence, direct access to cmsi
nvic functions are used instead if SoftDevice is not enabled.

* nrf/drivers/ticker: Setting IRQ priority 3 on Timer1

SoftDevice fails to initilize if Timer1 has been configured to priority
level 2 before enabling the SD. The timer is set to priority 1, higher than BLE
stack in order to provide better quality of music rendering when used with the
music module. This might be too high, time will show.

* nrf/examples: Updating ubluepy_temp after moving RTCounter to nrfx.

* nrf: delete duplicate files from device folder which can be located in nrfx/mdk.

* nrf/Makefile: Fetch system files from nrfx.

Testing on each device sub-variant to figure out which system file to
use. Reason for this is that nrf52.c is actually defining nrf52832.

Removing NRF_DEFINES parameter setting the device in use into the
same sub-variant test, as NRF52 is unique to nrf52832 when using nrfx.
Without this exclusion of -DNRF52 in compilation for nrf52840, the
device will be interpreted as a nrf52, hence nrf52832.

Also, changing name on variable SRC_NRF_HAL to SRC_NRFX_HAL to
explicitly tell the origin of the file.

* nrf: Updating device #ifdefs to be more open to non-nrf51 targets.

* nrf/modules/machine/uart: Removing second instance of UART for nrf52840 as it only has one non-DMA variant.

* nrf/device: Removing system files as these are now used from nrfx/mdk

* nrf: Moving startup files in device one level up as there is no need for deep hierarchy.

* nrf: Use NRF52_SERIES defined in nrfx/mdk/nrf.h as define value when testing for both nrf52(832) and nrf52840 variants.

* nrf/modules/machine/uart: Enable UART RX by default

Enable rx by default after intiialization of the peripheral.
Else, the nrfx driver will re-enable rx for each byte read
on uart REPL, clearing the EVENT_RXDRDY before second byte,
which again will make second byte get lost and read will get stuck.

This happens if the bytes are transmitted nrf(51) while still
processing the previous byte. Not seen on nrf52, but should
also become an issue at higher speeds.

This patch sets rx to always be enabled. Hence, not clearing the event
between read bytes, and it will be able to detect next byte recieved
upon finishing the first.

* nrf/modules/machine/timer: Fixing defines excluding Timer1 if ticker/softpwm is used.

* nrf: Switching import form mpconfigboard.h to mpconfigport.h in nrfx_config.h as mpconfigboard.h might define default values for defines not set by board specific header.

* nrf/modules/machine/i2c: nrfx integration fixes

Increasing speed to 400K.

Returning Address NACK's as MP error code; MP_ENODEV.

Returning MP_ETIMEOUT on all other error codes from TWI nrfx driver
except the ANACK.

Enabling and disabling the TWI peripheral before and after each transaction.

* nrf/examples: Updating ssd1306_mod.py to split framebuffer transfer into multiple chunks

* nrf/modules/machine/i2c: Return MP_EIO error if Data NACK occurs.

* nrf: Addressing review comments.

* nrf: Updating git submodule and users to nrfx v1.0.0.

* nrf/modules/machine/adc: Update adc module to follow v1.0.0 nrfx API.

* nrf/modules/machine/spi: Implement init and deinit functions

Extending SPI objects with a config member such that
configuration can be kept between new() and init().

Moving initialization done in new() to common init
function shared between the module functions.

If SPI is already configured, the SPI peripheral will
be uninitialized before initalized again.

Adding logic to handle initialization of polarity and
phase. As well, updating default speed to 1M from 500K.

* nrf/modules/machine: Removing unused nrfx includes in machine module header files
2018-07-18 17:12:26 +10:00
Glenn Ruben Bakke
62931398d7 nrf/boards/microbit/modules: Initialize variable in microbit_sleep.
When compiling for microbit with LTO=0, a compiler error occurs due to
'ms' variable in the microbit_sleep function has not been initialized.

This patch initialize the variable to 0.
2018-07-18 17:12:25 +10:00
Ayke van Laethem
3cdecf90e6 nrf: Make LTO configurable via Makefile flag.
LTO messes up debuggability and may cause some other issues.
Additionally, it does not always result in reduced code size.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
c486127378 nrf: Improve include of boardmodules.mk
Removing shell commands for checking if boardmodules.mk exists
under boards/<BOARD>/modules folder before including it.

This patch does the equivalent to previous test without using
shell commands. Hence, including the .mk if it exists.

Reference:
https://stackoverflow.com/questions/8346118/check-if-a-makefile-exists-before-including-it
2018-07-18 17:12:25 +10:00
Ayke van Laethem
4231d4311f nrf: Fix stack size in ld script and enable MICROPY_STACK_CHECK.
The nrf51x22_256k_16k_s110_8.0.0.ld had a stack size of only 1kB, which
is way too low. Additionally, the indicated _minimum_stack_size (set at
2kB for that chip) isn't respected.

This commit sets the heap end based on the stack size (heap end = RAM
end - stack size) making it much easier to configure.

Additionally, the stack/heap size of nrf52 chips has been set to a more
sane value of 8kB.
2018-07-18 17:12:25 +10:00
Ayke van Laethem
987381dfa0 nrf: Make machine.UART optional.
Leave it enabled by default on all targets.

This is only possible when using UART-over-BLE (NUS) instead of the
default hardware peripheral. The flash area saved is quite substantial
(about 2.2KB) so this is useful for custom builds that do not need UART.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
f679ee2092 nrf/drivers/ble_drv: Fixing sd_ble_enable bug for SD s132 v.2.0.1
Feather52 target which is using SD s132 v.2.0.1 cannot compile
due to variable containing RAM start address is not used.

This patch enables the correct sd_ble_enable variant for this SD.
2018-07-18 17:12:25 +10:00
Ayke van Laethem
f907139fab nrf/boards/common.ld: Avoid overflowing the .text region.
Similar commit to this one:
6e56e6269f

When .text + .data oveflow available flash, the linker may not show an
error. This change makes sure .data is included in the size calculation.
2018-07-18 17:12:25 +10:00
Ayke van Laethem
4c011e66b4 nrf/modules/machine/pin: Disable pin debug by default.
Saves for the nrf51:
flash: 336 bytes
RAM:     4 bytes
2018-07-18 17:12:25 +10:00
Ayke van Laethem
1b988f1e7d nrf/mpconfigport: Reduce GC stack size for nrf51.
This frees 128 bytes of .bss RAM on the nRF51, at the cost of possibly
more expensive GC cycles. Leave it as-is on the nRF52 as that chip has a
lot more RAM.

This is also done in the micro:bit:
a7544718a7/inc/microbit/mpconfigport.h (L6)
2018-07-18 17:12:25 +10:00
kaasasolut
c1cd7e5155 nrf: Only search for frozen files if FROZEN_MPY_DIR is set 2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
725267df09 nrf: Change PYB prefix to MPY 2018-07-18 17:12:25 +10:00
glennrub
f8f14bf0c7 nrf: Add support for s132 v5.0.0 bluetooth stack (#139)
* ports/nrf/boards: Adding linker script for nrf52832 using BLE stack s132 v.5.0.0.

* ports/nrf/drivers/bluetooth: Updating makefile to add BLE_API_VERSION=4 if s132 v5.0.0 is used.

* ports/nrf/drivers/bluetooth: Updating BLE stack download script to also download S132 v5.0.0.

* ports/nrf/drivers/bluetooth: Updating ble_drv.c to handle BLE_API_VERSION=4 (s132 v5.0.0).

* ports/nrf/boards: Updating linker script for nrf52832 with s132 v.5.0.0 bluetooth stack.

* ports/nrf/drivers/bluetooth: Removing commented out code in ble_drv.c

* ports/nrf/drivers/bluetooth: Updating define of GATT_MTU_SIZE_DEFAULT for SD132v5 to be defined using the new name defined in the SD headers in a more generic way.

* ports/nrf/drivers/bluetooth: Cleaning up use of BLE_API_VERSION in the ble_drv.c. Also considering s140v6 API, so not all has been changed to >= if API version 3 and 4 in combo is used. New s140v6 will differ on these, and add a new API not compatible with the API for 3 and 4.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
95bd20522a nrf/drivers/bluetooth: Reset evt_len to size of static buffer each iter.
For each iteration of polling BLE events from the Bluetooth LE stack.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
c8fd71612b nrf/boards/microbit: Enable music, display, image, microbit module.
Enabled by default on microbit targets, with or without BLE stack.  Also
enable softpwm to make display and music module compile.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
f5ed40116f nrf: Add if-def around inclusion of nrf_sdm.h in main.
Not all targets are using bluetooth le.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
6062d46170 nrf: Change board module header from board_modules.h to boardmodules.h.
Applicable for targets with board specific modules.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
0d7976deb2 nrf/boards/microbit: Update docs on top level tick low pri callback. 2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
1128aacb69 nrf/boards/microbit: Add temperature back to microbit module.
Increases size by 68 bytes.  Should be considered to be removed as temp
module is already providing this functionality.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
b6d01a7dd1 nrf/boards/microbit/modules: Fix tabbing in modmicrobit.c. 2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
5601fc9397 nrf/boards/microbit: Move microbit target to custom linker script.
To use if BLE stack is enabled.  The custom linker script also set off
space enough to compile in microbitfs+hal_nvmc.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
67b57bebec nrf: Update main.c to init relevant board drivers, if enabled.
If the board has these drivers then they will be initialized:
- softpwm (implicit ticker)
- music module
- board specific module
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
f8ae6b7bfc nrf/modules/music: Remove init of softpwm/ticker upon music module load.
Also update microbit_music_init0 to register low priority ticker callback
for the music module.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
789f8f1c4b nrf/boards/microbit: Update to work with new ticker code.
- Rename microbit_module_init to board_module_init0 which is the generic
  board module init function.
- Add low priority callback registration of display tick handler in the
  module init function.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
91fcde73d2 nrf/drivers/ticker: Rework ticker functions for microbit display/music.
- Rename init function to ticker_init0.
- Implement ticker_register_low_pri_callback (recycle of unused
  set_low_priority_callback function which was unimplemented).
- Add support for registering 2 low pri callbacks.  For now, one intended
  for microbit display, and one for modmusic.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
7c74b7da48 nrf/drivers/softpwm: Rename init function to softpwm_init0. 2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
d76982e382 nrf/boards/microbit: Include modmicrobit.h in board_modules.h.
So that users of the board module can find the init function of the module
implicitly.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
0b504575e2 nrf/boards/microbit: Add modmicrobit.h to expose module init function. 2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
1b241be310 nrf/boards/microbit: Attempt to get working display/images without FP.
And update the API to align with new unary/binary function callback
structures.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
9e090a8783 nrf/boards/microbit: Add framework updates to build micro:bit modules.
Makefile and mpconfigport.h update is generic, and could be used by other
boards to give extra modules which are only for a selected board.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
fbc45bd3f3 nrf/boards/microbit: Update board modules from C++ to C-code.
This aligns implementation with new style structures.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
f3386cfc50 nrf/boards/microbit: Rename display/image files from .cpp to .c ext.
Also rename modmicrobit.h to microbitconstimage.h.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
98ad4107ef nrf/boards/microbit: Add copy of microbit font type from microbit-dal.
Source: https://github.com/lancaster-university/microbit-dal.git
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
7a2e136049 nrf/boards/microbit: Add copy of microbit display and image files.
From micro:bit port repository, https://github.com/bbcmicrobit/micropython
2018-07-18 17:12:25 +10:00
Ayke van Laethem
a248db6916 nrf: Option to enable Ctrl-C in NUS console.
Costs 136 bytes on a nRF51822.
2018-07-18 17:12:25 +10:00
Ayke van Laethem
03b8429c0c nrf: Remove default FROZEN_MPY_DIR.
Saves 448 bytes of flash. Can still be enabled using:

    make FROZEN_MPY_DIR=freeze BOARD=foo
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
b493de75f3 nrf: Update usage of mp_obj_new_str by removing last parameter. 2018-07-18 17:12:25 +10:00
Ayke van Laethem
fc5d89e29d nrf/drivers/bluetooth: Start advertising after disconnect.
Disconnecting after a connect would not restart advertising, so
reconnecting may get harder.
2018-07-18 17:12:25 +10:00
Ayke van Laethem
2561bcf0c0 nrf/main: Add ampy support.
The ampy tool expects a "soft reboot" line when it does a soft reset.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
2b32333f90 nrf: Use micropython libm to save flash
Using libm from micropython free up about 5.5kb flash on nrf52
targets which have floating point enabled.
2018-07-18 17:12:25 +10:00
Ayke van Laethem
d9fb8c2585 nrf/main: Run boot.py and main.py on startup. 2018-07-18 17:12:25 +10:00
Ayke van Laethem
66e39d6a4e nrf/modules/uos/microbitfs: Make OSError numeric.
This saves about 80 bytes of code size.
2018-07-18 17:12:25 +10:00
Ayke van Laethem
8482daced2 nrf/drivers/bluetooth/ble_drv: Don't handle non-events.
When there is a non-BLE event (sd_evt_get), the ble_evt_handler is
invoked anyway even if it returns NRF_ERROR_NOT_FOUND.
2018-07-18 17:12:25 +10:00
Ayke
f7facf73f1 nrf: Add micro:bit filesystem.
* ports/nrf: Add micro:bit filesystem.

This filesystem has been copied from BBC micro:bit sources [1] and
modified to work with the nRF5x port.

[1]: https://github.com/bbcmicrobit/micropython/blob/master/source/microbit/filesystem.c

* ports/nrf/modules/uos: Make listdir() and ilistdir() consistent.

This removes the optional direcotry paramter from ilistdir(). This is
not consistent with VFS, but makes more sense when using only the
microbit filesystem.

Saves about 100 bytes.

* ports/nrf/modules/uos: Add code size comment.
2018-07-18 17:12:25 +10:00
Ayke van Laethem
fcc1568546 nrf/boards: Update linker scripts.
* Remove FLASH_ISR and merge .isr_vector into FLASH_TEXT. This saves
    some code space, especially on nRF52 devices.
  * Reserve space for nonvolatile storage of data. This is the place for
    a filesystem (to be added).
2018-07-18 17:12:25 +10:00
Ayke van Laethem
83f38a99a9 nrf/hal/hal_nvmc: Fix non-SD code.
The code wasn't tested yet without a SoftDevice.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
a2b4c93e85 nrf/hal/nvmc: Remove pre-compiler error thrown in nvmc.h, if on nrf52.
This has been tested and works.
2018-07-18 17:12:25 +10:00
Ayke van Laethem
7418795fdf nrf: Disable FAT/VFS by default.
Most boards don't have an SD card so it makes no sense to have it
enabled. It can be enabled per board (mpconfigboard.h).
2018-07-18 17:12:25 +10:00
Ayke van Laethem
cc158f98fe nrf: Implement NVMC HAL.
This is only a library for flash access. Actual file system support will
be added later.
2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
0487e23842 nrf/boards/arduino_primo: Add missing hal_rng config used by random mod. 2018-07-18 17:12:25 +10:00
Ayke van Laethem
4838b398af nrf: Enable Link-time optimizations 2018-07-18 17:12:25 +10:00
Ayke van Laethem
4e083819f3 nrf: Add compile switch to disable VFS.
This saves about 17kB.
2018-07-18 17:12:25 +10:00
Ayke van Laethem
38afc6553c nrf: Use --gc-sections to reduce code size
This saves about 6-7kB.
2018-07-18 17:12:25 +10:00
Ayke van Laethem
a1116771b0 nrf: Add WT51822-S4AT board. 2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
51a679752a nrf: Update Makefile and README.md after moving port to new directory 2018-07-18 17:12:25 +10:00
Glenn Ruben Bakke
9e7cda8890 nrf: Align help.c builtin help text to use correct type. 2018-07-18 17:12:25 +10:00
Daniel Tralamazza
e22b943508 nrf: Add new port to Nordic nRF5x MCUs.
This commit is a combination of about 802 commits from the initial stages
of development of this port, up to and including the point where the code
was moved to the ports/nrf directory.  The following is a digest of the
original commits in their original order (most recent listed first),
grouped where possible by author.  The list is here to give credit for the
work and provide some level of traceability and accountability.  For the
full history of development please consult the following repository:

    https://github.com/tralamazza/micropython

Unless otherwise explicitly state in a sub-directory or file, all code is
MIT licensed and the relevant copyright holders are listed in the
comment-header of each file.

Glenn Ruben Bakke <glennbakke@gmail.com>
    ports/nrf: Moving nrf51/52 port to new ports directory
    nrf: Aligning with upstream the use of nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, ...)

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf/modules/random: Backport of microbit random number generator module

    Backport of micro:bit random module.
    Plugged into the port as a general random module for all nrf51/nrf52 targets. Works both with and without Bluetooth LE stack enabled.

    Behavioral change: seed() method has been removed, as the use of RNG peripheral generates true random sequences and not pseudo-random sequences.

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf/hal/rng: Adding HAL driver for accessing RNG peripheral

    The driver also takes care of calling the Bluetooth LE stack for random values if the stack is enabled. The reason for this is that the Bluetooth LE stack take ownership of the NRF_RNG when enabled. Tolerate to enable/disable on the fly, and will choose to use direct access to the peripheral if Bluetooth LE stack is disabled or not compiled in at all.

    Driver has been included in the top Makefile, and will not be compiled in unless nrf51_hal_conf.h/nrf52_hal_conf.h defines HAL_RNG_MODULE_ENABLED (1).

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf/boards: Adding Arduino Primo board support (#88)

    * nrf: Adding Arduino Primo board support
    * nrf: Adding arduino_primo to target boards table in readme.md
    * nrf/boards: Activating pyb.LED module for arduino_primo board.
    * nrf/boards: Removing define not needed for arduino_primo

    Updating arduino_primo board mpconfigboard.h. Removing a define
    that was wrongly named. Instead of renaming it, it was removed as
    it was never used.

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf: Add support for floating point on nrf52 targets.

    Duplicating pattern for detecting location of libm, libc and libgcc
    from teensy port. Activating MICROPY_FLOAT_IMPL (FLOAT) for nrf52 targets
    and adding libs into the compile. For nrf51 targets it is still set to
    NONE as code grows to much (about 30k).

    Some numbers on flash use if MICROPY_FLOAT_IMPL is set to
    MICROPY_FLOAT_IMPL_FLOAT and math libraries are enabled (lgcc, lc, lm).

    nrf51:
    ======

    without float support:
       text    data     bss     dec     hex filename
     144088     260   30020  174368   2a920 build-pca10028/firmware.elf

    with float support:
       text    data     bss     dec     hex filename
     176228    1336   30020  207584   32ae0 build-pca10028/firmware.elf

    nrf52:
    ======

    without float support:
       text    data     bss     dec     hex filename
     142040     356   36236  178632   2b9c8 build-pca10040/firmware.elf

    with float support:
       text    data     bss     dec     hex filename
     165068    1436   36236  202740   317f4 build-pca10040/firmware.elf

Daniel Tralamazza <daniel@tralamazza.com>
    nrf: add a note for running the nrfjprog tool on Linux, and touch up the make sd comment
    nrf: clean compiler warnings

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf/drivers/bluetooth: Speedup Bluetooth LE REPL.

    Updating mp_hal_stdout_tx_strn_cooked to pass on the whole string
    to mp_hal_stdout_tx_strn instead of passing byte by byte.

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf: Use the name MicroPython consistently in comments
    nrf5: Updating readme with BLE REPL

Ben Whitten <ben.whitten@lairdtech.com>
    nrf/boards: Add DVK BL652 from Laird

    To build run 'make BOARD=dvk_bl652 SD=s132'
    To flash with jlink run 'make sd BOARD=dvk_bl652 SD=s132'
    This will remove the existing licences in the bl652

Ben Whitten <ben.whitten@lairdtech.com>
    nrf/drivers/bluetooth: Allow s132 to use LFCLK
    nrf: Add nordic sd folders to the .gitignore

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf/boards: Updating microbit pin mapping for SPI and I2C.
    nrf/boards: Correcting feather52 I2C SDA pin assigned to the board.
    nrf/examples: Update ssd1306 modification example to import correct class.
    nrf/boards: Activate RTC and Timer module and HAL on pca10056. Also swapping out UART with UART DMA variant on this target board.
    nrf/boards: Activate RTC, Timer, I2C, ADC and HW_SPI module and HAL on pca10031.
    nrf/boards: Activate RTC, Timer, I2C and ADC module and HAL on pca10001.
    nrf/boards: Adding RTC and Timer module and HAL to pca10000.
    nrf: Updating README.
    nrf: Removing unused font header.

Daniel Tralamazza <daniel@tralamazza.com>
    rename temperature example

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5/examples: Adding ubluepy peripheral example that works across nrf51 and nrf52. The example uses Environmenting Sensing Service to provide the temperature characteristic. The temperature is fetched from the machine.Temp module. One note is that the example uses 1 LED which is not present on all boards.
    nrf5/modules/ubluepy: Adding new event constant for gatts write (80) events from bluetooth stacks.
    nrf5/hal/timer: Add support for fetching temperature if bluetooth stack is enabled.
    nrf5/drivers/bluetooth: Make printf in 'ble_drv_service_add' function part of debug log.

Daniel Tralamazza <daniel@tralamazza.com>
    implement #50

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5/examples: Updating mountsd example with comment from deleted sdcard.py on how to wire SD directly to SPI.
    nrf5/examples: Removing copy of sdcard.py also found in drivers/sdcard.
    nrf5/examples: Removing copy of ssd1306 driver, creating a new class that overrides the needed function for i2c. Also adding some example usage in the comment in top of the file for both SPI and I2C variant.
    nrf5/hal/gpio: Updating toggle inline function to work correctly, currently only used by LED module.
    nrf5/examples: Renaming servo.py to nrf52_servo.py as it is only implemented machine.PWM for nrf52.
    nrf5/freeze: Adding generic example to freeze. Hello world with board name as parameter.
    nrf5/examples: Moving nrf52 specific HW example from freeze to examples to replace test.py with a more generic example.
    nrf5: Update pyb module, and led module to only be compiled in if MICROPY_HW_HAS_LED is set to 1.
    nrf5/boards: Updating boards with correct LED count. Also adding new flag, MICROPY_HW_HAS_LED, to select whether the board has LED's at all. If not, this will unselect LED module from being compiled in.
    nrf5/boards: Updating pca10040 board header to set the LED count.
    nrf5: Generalize script setting LED(1) on to be applied only when there are leds present on the board.
    nrf5: Updating mpconfigport.h to set default values for MICROPY_HW_LED_COUNT (0) and MICROPY_HW_LED_PULLUP (0).
    nrf5/boards/feather52: Update s132 target makefile with dfu-gen and dfu-flash. This enables feather52 with Bluetooth LE. Features to be configured in bluetooth_conf.h.
    nrf5/boards/feather52: Add SERIAL makeflag if dfu-flash target is used.
    nrf5: Updating readme.md file based on review comments.
    nrf5: Update help.c with documentation of CTRL-A and CTRL-B to enter and exit raw REPL mode.
    nrf5: Updating main.c to support RAW REPL.
    Update README.md
    nrf5/modules/music: Updating pitch method to also use configured pin from mpconfigboard.h if set, in the case of lacking kwarg for pin. Also removing some commented out arguments to remove some confusion in the argument list. Done for both play() and pitch().
    nrf5/modules/music: Correct parameter checking of pin argument to deside whether to use MUSIC_PIN define or throw an error. If MUSIC_PIN define is configured the pin argument to music module play() can be elided.
    nrf5/modules/machine: Update timer init to set default IRQ priority before initializing Timer instance.
    nrf5/hal/timer: Update timer hal to use value provided in init to configure the irq_priority.
    nrf5/modules/machine: Reserving timer0 instance for bluetooth if compiled in. Leaving timer1 and timer2 for application. Note that music module soft-pwm will also occupy timer1 if enabled.
    nrf5/modules/machine: Updating timer module to use new hal. Adding new parameters to the init to set period, mode and callback.
    nrf5/hal/timer: Implementing hal_timer to 1us prescaler. Multiplier inside to get to millisecond resolution. Callback must be registered before starting a timer.
    nrf5: Makefile cleanup. Removing duplicate include and unused netutils.c used by BLE 6lowpan network which has been removed for now.
    nrf5/modules/machine: Indention fix in uart module.
    nrf5/modules/machine: Removing unused code from uart module.
    nrf5/hal/rtc: Updating hal driver to calculate prescaler a bit more verbose. Using 1 second interval ticks.
    nrf5/modules/machine: Fixing type in RTC.
    nrf5/modules/machine: Update rtc init to set default IRQ priority before initializing RTC instance.
    nrf5/hal/rtc: Aligning RTC (real-time counter) HAL driver with Timer HAL driver. To make api's symetric. Also updating modules/rtc to get aligned with new HAL api.
    nrf5/drivers/bluetooth: Moving stop condition initialization before call to bluetooth stack write function is done, to make sure that its not overwritten after reception of the write event in case of with_response writes.
    nrf5/drivers/bluetooth: Removing duplicate static variable declaration.
    nrf5/modules/ubluepy: Updating characteristic write method to take in an additional keyword, 'with_response'. Default value is False. Only activated in central role.
    nrf5/drivers/bluetooth: Updating ble_drv_attr_c_write with possibility to do client write with response. Blocking call.
    nrf5/examples: Adding some notes on which pin layout that has been used in the seeed_tft.py ILI9341 driver for driving the display.
    nrf5/examples: Shorten name on seeedstudio_tft_shield_v2.py to seeed_tft.py.
    nrf5/examples: Updating ili9341 example to use new Frambuffer object instead of legacy Framebuffer1.
    nrf5/examples: Removing seeed.py which used a lcd mono framebuffer has been removed.

Matt Trentini <matt.trentini@gmail.com>
    Adding a README for the nRF5 port

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5/examples: Updating documentation in SDCard module example. Correcting typo and adding SD card wireing documentation for direct SPI connection.
    nrf5/modules/pin: Adding on() and off() methods to Pin object to be forward compatible with upstream master. Legacy high() and low() methods are kept.
    nrf5/modules/spi: Remove pyb abstraction from SPI module, as there was a bug in transfer of bytes due to casting errors. The update removes the pyb_spi_obj_t wrapper going directly on the machine_hard_spi_obj_t as base for machine SPI objects. SDCard mounting is also tested.
    nrf5/drivers/bluetooth: Enable ubluepy central by default if running nrf52/s132 bluetooth stack. Maturity of the module is pretty OK now.
    nrf5/boards/feather52: Updating pins.csv for the feather52 board.
    nrf5/boards/feather52: Updating LED pull to low.
    nrf5/boards/feather52: Update SPI pinout.
    nrf5/main: Move initializaton of modmusic to the module itself. Upon init of the module, the hardware, pwm and ticker will be started. Could be moved back to main if pwm or ticker should be shared among more modules and have to be initialized more global.
    nrf5/modules/machine/timer: If timer is used in combination with SOFT_PWM (implicitly use of ticker.c) guard the Timer1 instance from being instantiated trough python timer module. Also disable implementation of the HAL IRQ handler which is for now explicitly implemented in ticker.c for Timer1.
    nrf5/modules/music: Update ticker and modmusic to share global ticks counter as a volatile variable. Use Timer1 hardware peripheral instead of instance 0. Timer0 is not free if used in combination with a bluetooth stack. Update IRQ priority to levels that are compatible in use with a bluetooth stack for both nrf51 and nrf52. Apply nrf51 PAN fixes for Timer1 instead of original Timer0.
    nrf5/drivers/bluetooth: Updating bluetooth driver to initialize nrf_nvic_state_t struct during declaration of the global variable instead of explicit memset.
    nrf5/hal/irq: Adding wrappers for handling nvic calls when Bluetooth LE stack is enabled.
    nrf5/modules/machine: Updating IRQ levels in SPI with IRQ priorities compatible with Bluetooth stacks.
    nrf5/device: Remove old startup files in asm, which has now been replaced with c-implementation.
    nrf5: Update Makefile to add c-implementation of startup scripts instead of the .s files.
    nrf5/device: Adding startup files in .c to replace current asm versions.
    nrf5/examples: Tuning Bluetooth LE example controller python script after testing out the example live. Motor speed of 100 was not enought to lift the airplane. Also turning was hard without setting higher angle values. The new values are just guessed values. However, the flying experience was good.
    nrf5/hal/irq: Adding include of nrf_nvic.h if s132 bluetooth stack is used to resolve IRQ function wrappers on newer bluetooth stacks.
    nrf5/drivers/ticker: Removing unused code.
    nrf5/examples: Adding music example. Only working if bluetooth stack is not enabled.
    nrf5/boards/microbit: Disable music and softPWM as there are some issues with the ticker.
    nrf5: Adding -fstack-usage flag to gcc CFLAGS to be able to trace stack usage on modules.
    nrf5/drivers/ticker: Removing LowPriority callback from nrf51 as there is only one SoftwareIRQ free if bluetooth stack is enabled. Also setting new IRQ priority on SlowTicker to 3 instead of 2, to interleave with bluetooth stack if needed. Updating all NVIC calls to use hal_irq.h defined static inlines instead of direct access.
    nrf5/hal/irq: Adding IRQ wrappers if Bluetooth Stack is present.
    nrf5: Facilitate option to configure away the modble if needed. Enabled if MICROPY_PY_BLE config is enabled in bluetooth_conf.h.
    nrf5/boards/microbit: Enable music module by default. However, timer and rtc module has to be disabled. Bluetooth support broken. Optimization needed.
    nrf5/modules/machine: Quickfix. Update timer object to not allow instanciation of Timer(0) if SOFT_PWM is enabled by board.
    nrf5/hal/timer: Quickfix. Disable IRQ handler if SOFT_PWM is configured to be enabled. Ticker driver has in current driver a seperate IRQ handler for this timer instance.
    nrf5/drivers/ticker: Add compile config guard in ticker.c to only include the driver if SOFT_PWM is configured in by board.
    nrf5/drivers/softpwm: Renaming pwm_init to softpwm_init to not collide on symbol name with pwm_init in nrf52 machine PWM object.
    nrf5: Add modmusic QSTR definition of notes to qstrdefsport.h.
    nrf5: Update Makefile to include ticker.c and renamed softpwm. Updating also include paths to include modules/music and drivers/.
    nrf5: Adding include of modmusic.h in main.c.
    nrf5: Call microbit_music_init0() if enabled in main.c.
    nrf5/modules/music: Expose public init function for music module.
    nrf5/modules/music: Update modmusic to use updated includes. Add extern ticks. Add function which implements initialization of pwm and ticker, register ticker callback, and start the pwm and ticker. This corresponds to microbit port main.cpp init.
    nrf5/drivers/softpwm: Enable use of ticker in softpwm driver.
    nrf5/drivers/ticker: Adding ticker.c/.h from microbit port.
    nrf5/drivers/pwm: Renaming pwm.c/.h to softpwm.c/.h
    nrf5/drivers/pwm: Expose pwm_init() as public function.
    nrf5/modules/ubluepy: Making peripheral conn_handle volatile. Upon connection event, the variable is accessed in thread mode. However, the main-loop is blocking on conn_handle != 0xFFFF. If this is not volatile, optimized code will not exit the loop.
    nrf5/drivers/bluetooth: As callback functions are in most usecases are set to NULL upon last event to get public API function out of blocking mode, these function pointers has to be set as volatile, as they are updated to NULL in interrupt context, but read in blocking main-thread.
    nrf5/examples: Fixing overlapping function names and variable names inside the object. Also removing some print statements. Tuning max angle from -7/7 to -25/25.

Glenn Ruben Bakke <glennbakke@gmail.com>
    Powerup (#26)

    * nrf5/examples: Adding python example template for PowerUp 3.0 Bluetooth LE controlled Paper Airplane.
    * nrf5: Enable bluetooth le central while developing powerup 3.0 example.
    * nrf5/examples: Backing up powerup 3.0 progress.
    * nrf5/examples: Adding working example on how to control PowerUp 3.0 paper airplane using bluetooth le.
    * nrf5/bluetooth: Disable central role.

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5/modules/ubluepy: Correcting alignment of enum values in modubluepy.h.
    nrf5/drivers/bluetooth: Add implementation of client attribute write without response.
    nrf5/modules/ubluepy: Pass on buffer to write in characteristic write central mode.
    nrf5/modules/ubluepy: Updating characteristic object write function to be role aware. Either peripheral or central (gatts or gattc). Adding dummy call to attr_c_write if central is compiled in. Still in progress to be implemented.
    nrf5/drivers/bluetooth: Adding template function for attr_c_write.
    nrf5/drivers/bluetooth: Renaming attr_write and attr_notify to attr_s_write and attr_s_notify to prepare for introduction of attribute write for gatt client.
    nrf5/modules/ubluepy: Fixing type in ubluepy_peripheral.c.
    nrf5/modules/ubluepy: Setting peripheral role upon advertise() or connect().
    nrf5/drivers/bluetooth: Adding role member to peripheral object to indicate whether Peripheral object is Peripheral or Central role.
    nrf5/modules/ubluepy: Continue characteristic discovery until nothing more is found during connect proceedure.
    nrf5/drivers/bluetooth: Refactoring code to group statics for s130 and s132 into the same ifdef. Also adding two empty lines in discovery functions to make it more easy to read.
    nrf5/drivers/bluetooth: Updating characteristic discovery to signal whether anything was found or not.
    nrf5/modules/ubluepy: Continue primary service discovery until nothing more is found in connect proceedure.
    nrf5/drivers/bluetooth: Updating primary service discovery api to take in start handle from where to start the service discovery. Also adjusting return parameter to signal whether anything was found or not.
    nrf5/modules/ubluepy: Remove duplication GAP event handler registration in peripheral.connect().

Glenn Ruben Bakke <glennbakke@gmail.com>
    Support address types (#18)

    * nrf5/modules/ubluepy: Adding new enumeration of address types.
    * nrf5/modules/ubluepy: Adding constants that can be used from micropython for public and random static address types.
    * nrf5/modules/ubluepy: Adding support for optionally setting address type in Peripheral.connect(). Public address is used as default. Address types can be retrieved from 'constants'. Either constants.ADDR_TYPE_PUBLIC or constants.ADDR_TYPE_RANDOM_STATIC.
    * nrf5/modules/ubluepy: Register central GAP event handler before issuing connect to a peripheral. Has to be done before connect() function as a connected event will be propergated upon successfull connection. The handler will set the connection handle which gets connect function out of the busy loop waiting for connection to succeed.
    * nrf5/modules/ubluepy: Removing duplicate setting of GAP event handler in connect().

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5/modules/ubluepy: Register central GAP event handler before issuing connect to a peripheral. Has to be done before connect() function as a connected event will be propergated upon successfull connection. The handler will set the connection handle which gets connect function out of the busy loop waiting for connection to succeed.
    nrf5/modules/ubluepy: Fixing compilation bug of wrong variable name when registering gattc event handler in ublupy peripheral connect function (central mode).
    nrf5/bluetooth: Updating makefiles with updated paths to bluetooth le components after moving files.
    nrf5/bluetooth: Moving stack download script to drivers/bluetooth folder.
    nrf5/bluetooth: Move bluetooth driver files to drivers/bluetooth. Move bluetooth stack download script to root folder.
    nrf5/bluetooth: Guarding implementation against being linked in by surrounding it with BLUETOOTH_SD flag. Flag is only set if SD=<sdname> parameter is provided during make.
    nrf5/bluetooth: Moving makefile include folder and source files of bluetooth driver, ble uart and ble module to main Makefile.
    nrf5/bluetooth: Moving help_sd.h and modble.c to modules/ble.
    nrf5/modules/machine: bugfix after changing to MP_ROM_PTR in machine module local dict.
    nrf5: Syncing code with upstream master and converting all module and method tables to use MP_ROM macros. Also adding explicit casting of local dicts to (mp_obj_dict_t*).
    nrf5/modules/timer: Fixing bug in timer_find(). Function allowed to locate index out of range and started to look up in config pointer (index == size of array).
    nrf5/modules/timer: Remove test which is covered by timer_find() function in the line below.
    nrf5/modules/timer: Adding locals dict table and adding start/stop template functions. Also adding constants for oneshot and periodic to locals dict.
    nrf5/modules/timer: Adding timer module to modmachine.
    nrf5/boards: Adding micro:bit default music pin definition. Also adding config flag for enabling pwm machine module.
    nrf5/hal/timer: Adding start/stop template functions to hal_timer.h/.c
    nrf5/Makefile: Adding drivers/pwm.c and modules/music files to the source file list.
    nrf5/modules/music: Adding config guard in musictunes.c and adding import of mphal.h.
    nrf5/modules/music: Including mphal.h before config guard in modmusic.c. Also changed name on config guard to MICROPY_PY_MUSIC. Missing PWM functions during linkage will show up if PWM module has not not configured.
    nrf5/drivers/pwm: Including mphal.h before config guard in pwm.c.
    nrf5: Updating mpconfigport.h to include music module as builtin. Adding new configuration for enabling music module. Activating MODULE_BUILTIN_INIT in order to run music module init function on import.
    nrf5/modules/music: Backing up progress in music module.
    nrf5/drivers/pwm: Updating soft PWM driver to only be included if SOFT_PWM config is set.
    nrf5/hal/gpio: Add function to clear output register using a pin mask.
    nrf5: Adding new configuration called MICROPY_PY_MACHINE_SOFT_PWM to mpconfigport.h. This config will enable software defined PWM using timer instead of using dedicated PWM hardware. Aimed to be used in nrf51 targets.
    nrf5/boards: Removing PWM config set to 0 from pca10001 board. Config will later be re-introduced as SOFT_PWM variant.
    nrf5/pwm: Updating config name of PWM to hardware PWM to prepare for introduction of soft variant.
    nrf5/modules/music: Backing up progress in modmusic.
    nrf5/modules/music: backing up porting progress in modmusic.c.
    nrf5/modules/music: Commenting out backend function calls in modmusic.c to make module compile for now.
    nrf5/modules/music: Updating music module to use pin_obj_t instad of microbit_pin_obj_t. Update include to drivers/pwm.h to resolve some undefined functions.
    nrf5/modules/music: Removing c++ extern definition. Updating include list in modmusic.c. Removing module name from module struct.
    nrf5/modules/music: Removing include of modmicrobit.h in musictunes.c.
    nrf5/modules/music: Adding header to expose extern structs defined in musictunes.c
    nrf5/drivers: Adding copy of microbit soft pwm.
    nrf5/modules/music: Renaming microbitmusic files to modmusic/music.
    nrf5/modules/music: Renaming microbit module to music.
    nrf5/modules/microbit: Copying microbit music module to the port.
    nrf5/modules/timer: Adding timer3 and timer4 to timer object in case of nrf52 target.
    nrf5/modules/timer: Optimizing timer object structure and updating the module to use new hal_timer_init structures and parameters.
    nrf5/hal/timer: Adding empty IRQ handlers for all timers.
    nrf5/hal/timer: Changing hardcoded hal timer instance base to a lookup, so that IRQ num can be detected automatically without the need of using struct param on it. Size of binary does not increase when using Os.
    nrf5: Updating example in main.c on how to execute string before REPL is set up, to allow for boards with two leds. Todo for later is to update this code such that it will skip this LED toggle when there are no leds defined. Or use an example not depending on LEDs.
    nrf5/bluetooth: Updating Bluetooth LE stack download script to allow to be invoked from any parent folder. No need to change directory to bluetooth/ in order to get the correct download target folder position. Using the script location to determine the target folder.
    nrf5/boards: Adding board target for feather52 using s132 v.2.0.1 application offset even if the device is not using softdevice. To be worked on later.
    nrf5/boards: decrease size of ISR region from 4k to 1k in custom feather52 linker script to get some more flash space.
    nrf5/boards: Updating feather52 mpconfigboard.h to use correct uart pins, flow control disabled. Also adjusting leds down to two leds.
    nrf5/boards: Updating path to custom linker script for feather52 board.
    nrf5/boards: Renaming bluefruit_nrf52_feather to feather52 to shorten down the name quite drastically.
    nrf5/boards: Updating path to custom bluefruit feather linker script after renaming board folder.
    nrf5/boards: Renaming bluefruit_feather to bluefruit_nrf52_feather as it also exist a m0 variant of the board name.
    nrf5/boards: Updating mpconfigboard.h for bluefruit nrf52 feather with correct board, mcu and platform name.
    nrf5/boards: Updating adafruit bluefruit nrf52 feather linker script to use 0x1c000 application offset.
    nrf5/boards: Renaming custom linker script for bluefruit feather to reflect that the purpose of the custom linker script is DFU. The script is diverging from the generic s132 v2 linker script in the offset of the application.
    nrf5/boards: Adding custom linker script for adafruit nrf52 bluefruit feather to be able to detect application upper boundry in flash. Pointing s132 mk file to use this new custom linker script instead of the generic s132 v2 linker script.
    nrf5/boards: Adding linker script for nrf52832 s132 v.2.0.1.
    nrf5/boards: Adding template board makefiles and configs for bluefruit nrf52 feather. Copied from pca10040 target board. Linker script reference updated to use s132 v2.0.1. Non-BLE enable build disabled for now. Board configuration for leds, uart etc has not been updated yet from pca10040 layout.
    nrf5/bluetooth: Correcting typo in test where s132 API version is settled.
    nrf5/bluetooth: Updating bluetooth le driver to compile with s132 v.2.0.1 stack.
    nrf5/bluetooth: Add new compiler flag to signal API variants of the s132 bluetooth le stack. The version is derived from the major number of the stack name.
    nrf5/bluetooth: Remove hardcoded softdevice version as this now comes as parameter from board makefile.
    nrf5/boards: Updating makefiles using bluetooth stack to use updated linker script file names.
    nrf5/boards: Renaming bluetooth stack linker scripts to reflect version of the stack.
    nrf5/boards: adding some spaces in s132 makefile for pca10040.
    nrf5/boards: Renaming linker script for nrf52832 using bluetooth stack such that it also holds the version number of the stack. Updating linkerscript using the target linker script.
    nrf5/bluetooth: Add support for downloading s132_2.0.1 bluetooth stack.
    nrf5/bluetooth: Switch over to downloaded bluetooth stacks from nordicsemi.com instead of getting them through the SDK's. This will facilitate download of s132 v2.0.0 later.
    nrf5/bluetooth: Fixing bug found when testing microbit. Newly introduced advertisment data pointer was not cleared on nrf51 targets. Explicit set to NULL as no additional advertisment data is set. Raises a question on why the nrf51 static variable was not zero initialized. To be checked up.
    nrf5: Removing SDK_ROOT parameter to Makefile. Bluetooth stacks should be downloaded using the download_ble_stack.sh. The script should be run inside the bluetooth folder to work properly.
    nrf5/bluetooth: Adding back SOFTDEV_HEX as flash tools in main Makefile uses this to locate hex file.
    nrf5/bluetooth: Including bluetooth stack version in folder name after download to be able to detect if stack has been updated.
    nrf5/bluetooth: Updating Bluetooth LE stack download script.
    nrf5/bluetooth: Adding bash script to automate download of bluetooth le stacks
    nrf5/examples: Adding example to show how to use current PWM module to control servo motors.
    nrf5/modules/machine: Updating PWM module with two new kwargs parameters. One for setting pulse with more fine grained. This value should not exceed the period value. Also, adding support for setting PWM mode, whether it is LOW duty cycle or HIGH duty cycle. By default, high to low is set (this could be changed).
    nrf5/hal/pwm: Updating PWM implementation to support manually set duty cycle period. Pulse width has precidence over duty cycle percentage. Also adding support for the two configurable modes, high to low, and low to high, duty cycles.
    nrf5/hal/pwm: Adding more configuration options to the PWM peripheral wrapper. Possibility to set pulse with manually, and also mode. The mode indicates whether duty cycle is low and then goes high, or if it is high and then go low. Added new type to describe the two modes.
    nrf5: Adding hal_gpio.c to Makefile's source list.
    nrf5/modules/machine: Updating Pin module to register a IRQ callback upon GPIO polarity change events.
    nrf5/hal/gpio: Adding initial gpiote implementation to handle IRQ on polarity change on a gpio.
    nrf5: Moving initialization of pin til after uart has been initialized for debugging purposes. This will make it possible to use uart to print out debug data when adding gpio irq handlers.
    nrf5/hal/gpio: Adding some new structures and functions to register irq channels to gpio's using GPIOTE peripheral
    nrf5/hal/gpio: Adding missing include.
    nrf5/modules/machine: Style fix in pin object, indention.
    nrf5/modules/machine: Adding placeholder for irq method to pin object class.
    nrf5/modules/machine: Adding pin irq type and basic functions and structures.
    nrf5/hal/gpio: Reintroducing gpio polarity toggle event to be able to reference the short form of adding high_to_low and low_to_high together.
    nrf5/hal/gpio: Updating hal_gpio.h with some tab-fixes in order to make the file a bit consistent in style.
    nrf5/hal/gpio: Removing toggle event from the enumeration as that will be a combination of the rising and falling together.
    nrf5/modules/machine: Removing toggle event trigger as that will be a combination of the rising and falling together.
    nrf5/modules/machine: Adding new constants to pin object for polarity change triggers using the enumerated values in hal_gpio.h.
    nrf5/hal/gpio: Adding new enumeration for input polarity change events.
    nrf5/hal: Moving hal_gpio functions, types and defines from mphalport.h to a new hal_gpio.h.
    Revert "lib/netutils: Adding some basic parsing and formating of ipv6 address strings. Only working with full length ipv6 strings. Short forms not supported at the moment (for example FE80::1, needs to be expressed as FE80:0000:0000:0000:0000:0000:0000:0001)."
    nrf5: Removing leftover reference to deleted display module.
    nrf5/usocket: Removing network modules related to Bluetooth 6lowpan implementation as it depends on SDK libraries for now. Will be moved to seperate working branch.
    nrf5: Removing custom display, framebuffer and graphics module to make branch contain core components instead of playground modules.
    nrf5/modules/usocket: Updating import of netutils.h after upmerge with upstream master.
    nrf5/bluetooth: Add some comment on the destination of the eddystone short-url.
    nrf5/bluetooth: Updating Eddystone URL to point to https://goo.gl/x46FES which hosts the MicroPython WebBluetooth application which will be able to connect to the Bluetooth LE UART service of the device and create the REPL.
    nrf5/bluetooth: Adding webbluetooth REPL template. Alternating advertisment of eddystone URL and UART BLE service every 500 ms. Adding new config parameter to bluetooth_conf.h to enable webbluetooth repl. Has to be configured in combination with BLE_NUS. Eddystone URL not pointing to a valid WebBluetooth application at the moment, but rather to micropython.org as a placeholder for now.
    nrf5/modules/ubluepy: Adding method Peripheral object to stop any ongoing advertisment. Adding compile guard to only include advertise and advertise_stop if peripheral role is compiled in.
    nrf5/bluetooth: Adding function to stop advertisment if onging
    nrf5/modules/ubluepy: Adding support for starting advertisment from BLE UART REPL, by delaying registration of gatt/gatts and gattc handlers until needed in advertise or connect. If non connectable advertisment is selected, handlers in peripheral new is not anymore overriding the other peripheral instances which has set the callbacks.
    nrf5/bluetooth: Adding possibility to configure whether advertisment should be connectable or not.
    nrf5/bluetooth: Removing legacy advertise function in the bluetooth driver, which only did a hardcoded eddystone beacone advertisment.
    nrf5/help: Updating ble module help description to also include the address method.
    nrf5/bluetooth: Renaming the ble module method address_print() to address(), as it will now return a string of the resolved local address. Updating the function to create a string out the local address and return this.
    nrf5/bluetooth: Update ble_drv_address_get to new api which pass in a address struct to fill by reference. Updating implementation to copy the address data. Also ensuring that the bluetooth stack has been enabled before fetching the address from the bluetooth stack.
    nrf5/bluetooth: Adding new structure which can hold local address. Updating api prototype for ble_drv_address_get with a address structure by reference.
    nrf5/bluetooth: Updating help text for ble module to also list up enabled() function which queries the bluetooth stack on whether it is enabled or not.
    nrf5/bluetooth: Removing advertise from ble module. Removing help text as well.
    nrf5/examples: Adding python eddystone example using ubluepy api.
    nrf5/modules/ubluepy: Open up Peripheral advertise method to pass custom data to the bluetooth driver. Allowing method to allow kwargs only if no args is set. To support setting data kwarg only.
    nrf5/modules/ubluepy: Adding new members to the ublupy advertisment parameters, to hold custom data payload if set.
    nrf5/bluetooth: Cleaning up stack enable function, to not set device name twice. Also, adding support for setting custom advertisment data.
    nrf5/modules/ubluepy: Adding compile guard for UBLUEPY_CENTRAL around the char_read() call to ble_drv_attr_c_read().
    nrf5/bluetooth: Moving central code inside central bluetooth stack defines to make peripheral only code compile again.
    nrf5/examples: Updating ubluepy scan example to use constant value from ubluepy instead of hardcoded value.
    nrf5/examples: Adding example on how to use the ubluepy Scanner object in order to scan for a device name and find the address of the device. This can subsequently be used to perform a Central role connect() using the Peripheral object.
    nrf5/modules/ubluepy: Turn all attributes (addr, addr_type and rssi) to method calls instead of using common .attr callback. Adding getScanData implementation, which parses the advertisment data and returns a list of tuples containing (ad_type, desc, value). Description is generated by peeking into the ad_types local dicts map table, and do a reverse lookup on the value to find the QSTR.
    nrf5/modules/ubluepy: Adding ad_types constants in new object. Linking in ad_types object into the ubluepy.constants local dict.
    nrf5/modules/ubluepy: Expose ubluepy constant objects as externs in modubluepy.h to be able to get access to the local dict tables in order to do a reverse lookup on value to resolve QSTR from external modules in c.
    nrf5/modules/ubluepy: Upon advertisment event, also store the advertisment data.
    nrf5/modules/ubluepy: Adding callback function to handle read response if gatt client has issued a read request. Also adding method for returning the uuid instance from the object.
    nrf5/modules/ubluepy: Adding value data member to the characteristic object. This can hold the value data when gatt client perform a read and value has to be transferred between interrupt and main thread.
    nrf5/bluetooth: Updating bluetooth driver to support GATT client read of a characteristic value. Data passed to caller in interrupt context, and copy has to be performed. The function call is itself blocking.
    nrf5/modules/ubluepy: Adding uuid() function to service object to return UUID instance of the service.
    nrf5/modules/ubluepy: Adding binVal() function to the ubluepy UUID object. For now returning the uint16_t value of the UUID as a small integer.
    nrf5/modules/ubluepy: Adding dummy function call to ble_drv_attr_c_read.
    nrf5/bluetooth: Adding new api for reading attribute as gatt client. Renaming old ble_drv_attr_read function to ble_drv_attr_s_read to indicate the server role.
    nrf5/bluetooth: Adding event handling cases for gatt client read, write and hvx events.
    nrf5/modules/ubluepy: Tab-fix
    nrf5/modules/ubluepy: Updating peripheral object to handle characteristic discovery (central mode).
    nrf5/modules/ubluepy: Adding start and end handle to service object.
    nrf5/bluetooth: Adding support for central characteristic service discovery. Updating primary service discovery to block until all services has been created in the peripheral object before returning from the bluetooth driver. This pattern is also applied to the characteristic discovery.
    nrf5/modules/ubluepy: Updating ubluepy peripheral object to new bluetooth driver API. Starting to populate service objects and uuid objects. Also adding the service to the peripheral object throught the regular static function for adding services. Handle value for the primary service is assuming that it is the first element in the handle range; start_handle reported by the service discovery.
    nrf5/bluetooth: Updating bluetooth driver to do service discovery, doing callbacks to ubluepy upon each individual primary service discovered. Using intermediate structure defined by the driver, to abstract bluetooth stack specific data in ubluepy.
    nrf5/modules/ubluepy: Adding some work in progress on service discovery.
    nrf5/bluetooth: Adding implementation to the discover service function. Adding handler for gatt client primary service discovery response events, and passing this to the ubluepy upon reception.
    nrf5/bluetooth: Adding function parameters and return type to service and characteristic discovery template functions.
    nrf5/bluetooth: Adding template functions for service discovery in bluetooth driver.
    nrf5/bluetooth: Adding function to register gattc event handler (central).
    nrf5/bluetooth: Adding intermediate gattc callback function type in bluetooth driver.
    nrf5/bluetooth: Turning off debug logging in bluetooth driver, which does not work well with bluetooth REPL mode.
    nrf5/bluetooth: Fixing some smaller tab errors in the bluetooth driver.
    nrf5/bluetooth: Updating bluetooth le driver to handle GAP conn param update request. Also updating minor syntax in previous switch case.
    nrf5/boards: Inrease heap size in the nrf52832 w/s132 bluetooth stack linker script.
    nrf5/modules/ubluepy: Update connect method to parse dev_addr parameter and pass it to the bluetooth driver, going through a allocated heap buffer. Adding call to the bluetooth driver to issue a connect. Hardcoding address type for now.
    nrf5/bluetooth: Updating connect function in the bluetooth driver to do a successful connect to a peripheral device.
    nrf5/modules/ubluepy: Adding template function for central connect() in peripheral object.
    nrf5/modules/ubluepy: Adding locals dict to Scan Entry introducing function to retreive Scan Data. Not working as expected together with .attr. It looks like locals dict functions are treated to be attributes and cannot be resolved.
    nrf5/bluetooth: Adding function for connecting to a device (in central role). Not yet tested.
    nrf5/modules/ubluepy: Return BLE peer address as string instead of bytearray. Updated struct in modubluepy.h to use a mp_obj_t to hold a string instead of a fixed 6-byte array. Stripped down ScanEntry print out to only contain class name, peer address available through addr attribute.
    nrf5/bluetooth: capture address type in addition to advertisment type in bluetooth advertisment reports.
    nrf5/modules/ubluepy: Correcting rssi member in scan_entry object to be int instead of uint.
    nrf5/modules/ubluepy: Adding attribute to ScanEntry object for getting address (returning bytearray), type (returning int) and rssi (returning int).
    nrf5/modules/ubluepy: Copy address type and rssi to the ScanEntry object upon reception of an advertisment report callback.
    nrf5/bluetooth: Adding address type to bluetooth stack driver advertisment structure, and fill the member when advertisment report is received.
    nrf5/modules/ubluepy: Swapping address bytes when copying bluetooth address over to ScanEntry object during advertisment scan report event.
    nrf5/modules/ubluepy: Extending print of ScanEntry object to also include the bluetooth le address.
    nrf5/modules/ubluepy: Create new adv report list for each individual scan. Create a new ScanEntry object instance on each advertisment event recieved and append this to the current adv_report list.
    nrf5/modules/ubluepy: Adding print function to scan_entry object.
    nrf5/modules/ubluepy: Populating ubluepy_scan_entry_obj_t with members that are interesting to keep for the ScanEntry object.
    nrf5/bluetooth: Moving callback definitions to bluetooth driver header. Refactoring bluetooth driver, setting new names on callback functions and updating api to use new callback function name prefix.
    nrf5/modules/ubluepy: Extracting advertisment reports and adding some data to list before returning it in scan() method.
    nrf5/bluetooth: Adding handling of advertisment reports in bluetooth driver and issue callback to ubluepy. A bit ugly implmentation and has to be re-worked.
    nrf5/bluetooth: adding adv report data structure to pass to ubluepy upon adv report event. Adding new api for setting callack where to handle advertisment events in ubluepy.
    nrf5/modules/ubluepy: Adding adv_reports member to scanner object, to hold the result of scan.
    nrf5/modules/machine: Cleaning up uart a bit more. Removing unused any() method, and aligning print and local dict names to use machine_uart prefix.
    nrf5/bluetooth: Turn off bluetooth printf logging.
    nrf5: Add back ublupy scanner and scan entry source files in Makefile.
    nrf5/bluetooth: Enable implementation in scan start function in the bluetooth stack driver.
    nrf5/boards: Adjust heap end after increased .data usage in nrf52832 s132 linker script.
    nrf5/bluetooth: Adding more implementation in scan start function. However, commented out for time beeing, as there is some memory issues when activating central.
    nrf5: Removing ubluepy scanner and scan entry from Makefile source list until nrf52 central issues has been resolved.
    nrf5/bluetooth: Correcting indention.
    nrf5/bluetooth: Adding some implementation to scan_start function.
    nrf5/modules/ubluepy: Adding scan method to the Scanner object. Adding locals dict table.
    nrf5/bluetooth: Adding empty scan_start and scan_stop function to the bluetooth driver.
    nrf5/modules/ubluepy: Adding constructor function to scanner object.
    nrf5/modules/ubluepy: Adding print function to Scanner object.
    nrf5/modules/ubluepy: Disable all functions central related functions in the Peripheral object for now, even if MICROPY_PY_UBLUEPY_CENTRAL is enabled.
    nrf5/modules/ubluepy: Activate Scanner and ScanEntry objects if MICROPY_PY_UBLUPY_CENTRAL is set.
    nrf5/bluetooth: Adding new configuration flag for s132 bluetooth stack, to enable/disable ubluepy central. Disabled by default.
    nrf5: Adding ubluepy_scanner.c and ubluepy_scan_entry.c to Makefile source list.
    nrf5/modules/ubluepy: Adding template object typedefs for scanner and scan entry, and extern definition for scanner and scan_entry object type in modubluepy.h
    nrf5/modules/ubluepy: Adding templates for central role Scanner and ScanEntry objects.
    nrf5/uart: Moving UART from pyb to machine module.

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5/uart: Refactoring UART module and HAL driver

    Facilitating for adding second HW uart. Moving pyb_uart into
    machine_uart. Adding return error codes from hal_uart functions,
    if the hardware detects an error.

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5/modules: Updating uart object to allow baudrate configuration.
    nrf5/bluetooth: Moving bluetooth_conf.h to port root folder to make it more exposed.
    nrf5/boards: Remove define of machine PWM module configuration in nrf51 targets, as the device does not have a HW PWM peripheral.
    nrf5: Disable machine PWM module by default if board does not define it.
    nrf5/boards: Disable all display modules in pca10028 board config.
    nrf5: Updated after merge with master. Updating nlr_jump_fail to call __fatal_error in order to provide a non-returning function call.
    nrf5/boards: Adding more heap memory to the nrf51 256k/32k s110 linker script. Leaving 2k for stack.
    nrf5/modules/machine: Adding __WFI() on machine.deepsleep()
    nrf5/modules/machine: Adding __WFE() on machine.sleep()
    nrf5/modules/machine: Adding enable_irq() and disable_irq() method to the machine module. No implementation yet for the case where bluetooth stack is used.
    nrf5/modules/rtc: Adding support for stopping and restarting rtc (if periodic) for all the instances of RTC.
    nrf5/modules: Updating RTC kwarg from type to mode to set ONESHOT or PERIODIC mode.
    nrf5/modules: Adding support for periodic RTC callback.
    nrf5/hal: hal_rtc update. Adding current counter value to period value before setting it in the compare register.
    nrf5/modules: Updating rtc module with non-const machine object list in order to allow setting callback function in constructor.
    nrf5/hal: Adding initialization of LFCLK if not already enabled in hal_rtc.
    nrf5/modules: Moving irq priority settings in RTC object to rtc_init0 when initializing the hardware instances. Also modifying comments a bit. Adding simple example in comment above make_new function on how the object is intended to work.
    nrf5: Updating main.c to initialize the rtc module if enabled.
    nrf5/modules: Added RTC into the machine module globals dict.
    nrf5/modules: Updating rtc module. Not working yet.  Updated to align with new hal_rtc interface. Added start and stop methods. Allowing callback function set from init. This should be moved to start function, not set in main.
    nrf5/hal: Updating hal RTC implementation.
    nrf5/hal: Adding hal_irq.h which defines a set of static inline functions to do nvic irq operations.
    nrf5/modules: Updating machine uart module to use new hal uart interface name.
    nrf5/hal: Renaming uart hal function to use hal_uart prefix.
    nrf5/modules: Updating readfrom function in machine i2c module to use the new hal function which has been implemented.
    nrf5/hal: Adding untested implementation of twi read. Lacking sensors to test with :)
    nrf5/boards: Renaming linker script for all nrf51 and nrf52 into more logical names. Updating all boards with new names.
    nrf5/bluetooth: Updating header guard in bluetooth_conf.h to reflect new filename.
    nrf5/bluetooth: Updating old references to 'sdk' to use the new folder name 'bluetooth' in makefiles.
    nrf5: Renaming sdk folder to bluetooth.
    nrf5: Merging sdk makefiles into bluetooth_common.mk. s1xx_iot is still left out of this refactoring.
    nrf5: Renaming nrf5_sdk_conf.h to bluetooth_conf.h
    nrf5: Starting process of renaming files in sdk folder to facilitate renaming of the folder and make it more logical. Transition will be from sdk to bluetooth.
    nrf5/boards: Adding support for SPI, I2C, ADC, and Temp in machine modules in micro:bit target. Also activating hal drivers for the peripherals.
    nrf5/sdk: Updating low frequency clock calibration from 4 seconds to 250 ms for stack enable when BLUETOOTH_LFCLK_RC is enabled.
    nrf5/boards: Updating nrf51822_aa_s110.ld to be more generic, leaving all RAM not used for stack, .bss and .data to the heap.
    nrf51: Removing stack section from startup file as it got added to the final hex file. Thanks dhylands for helping out.
    nrf5/boards: Adding BLUETOOTH_LFCLK_RC to CFLAGS in microbit s110 makefile.
    nrf5/sdk: Adding support for initializing the bluetooth stack using RC oscillator instead of crystal. If BLUETOOTH_LFCLK_RC is set in CFLAGS, this variant of softdevice enable will be activated.
    nrf5: Initialize repl_display_debugging_info in pyexec.c for cortex-m0 targets.

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5/sdk: Updating ringbuffer.h to use volatile variables for start and end.
    nrf5/sdk: Rename cccd_enable variable to m_cccd_enable in bluetooth le UART driver. Also made the variable volatile.
    nrf5/modules: Updating example in ubluepy header to use handle instead of data length upon reception of an event.
    nrf5/modules: Updating ubluepy peripheral to pass handle value to python event handler instead of data length. Data length can be derived from the bytearray structure.
    nrf5/sdk: Updating bluetooth le driver to handle SEC PARAM REQUEST by replying that pairing is not supported. Moving initialization of adv and tx in progress state variables to stack enable function.
    nrf5/modules: Enable ubluepy constants for CONNECT and DISCONNECT for other bluetooth stacks than s132.
    nrf5/sdk: Fixing unaligned access issues for nrf51 (cortex-m0) in bluetooth le driver

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5/sdk: Removing SDK dependant BLE UART Service implementation

    The sdk_12.1.0 nrf52_ble.c implementation was dependent on SDK components.
    This has been replaced with the ble_uart.c implementation using a standalone
    bluetooth driver implementation without need of SDK components.

    Also, sdk.mk has been updated to not use a special linker script.

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf52: Removing folder to not confuse which folder is in development

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5/sdk: Removing ble_repl_linux.py

    Script does not really work very well with blocking char read and
    async ble notifications printing data when terminal stdout is blocked
    by readchar. Bluetooth UART profile implemented in ble_uart.c is
    now working with tralamazza's nus_console nodejs script.

    Ref: https://github.com/tralamazza/nus_console

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5: Add default config for MICROPY_PY_BLE_NUS (0)

    Disable Bluetooth UART to be used for REPL by default. Can be overridden
    in nrf5_sdk_conf.h. It is defined in  mpconfigport.h as it is connected to
    mphalport.c, where the config is used to determine whether default print
    functions should be using HW UART or Bluetooth UART.

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5/sdk: Add ble_uart.c to source list

    ble_uart.c implements UART Bluetooth service on top of the
    bluetooth stack driver api calls. Can be enabled to be compiled
    in by defining MICROPY_PY_BLE_NUS = 1 in nrf5_sdk_conf.h.

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5/sdk: Removing include of sdk_12.1.0's build.mk

    As no sources are needed from the SDK this build makefile
    can be deleted.

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5: Force implementation of tx_str_cooked function if BLE NUS enabled.

    If BLE UART service has been enabled, the mp_hal_stdout_tx_strn_cooked
    is not defined by default anymore, and has to be implemented by the
    UART driver (in this case BLE).

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5/sdk: Adding compiler guard around exchange MTU request event.

    As s110 is not having this event or function call to answer on a MTU
    exchange request, this is excluded for all other version than s132
    for now.

Bander Ajba <banderajba@macwan.local>
    minor documentation and extra tabs removal fixes

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5/sdk: Updating BLE UART implementation by swapping TX and RX uuid and characterisitic handling. Removed dummy write delay of 10 ms.
    nrf5/sdk: Backing up progress in bluetooth le driver. Adding new gap and gatts handlers. Added handling of tx complete events when using notification, responding to MTU request, and setting of default connection parameters.

Bander Ajba <banderajba@macwan.local>
    fixed temp module to allow for instance support
    did required modification to merge the temperature sensore module

Dave Hylands <dhylands@gmail.com>
    Fix up Makefile dependencies

    I also didn't see any real reason for mkrules.mk to exist,
    so I merged the contents into Makefile.

    Now you can do:
    ```
    make BOARD=pca10028 clean
    make BOARD=pca10028 flash
    ```
    and it will work properly.

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5: Updating Makefile to use correct variable for setting directory of file to freeze as mpy.
    nrf5: Setting stack top in main.c. Thanks dhylands for pointing this out.
    nrf5/sdk: Backing up progress in BLE UART driver. Adding ringbuffer in order to poll bytes from recieved data in REPL main loop.
    nrf5/modules: Updating ubluepy example to print out gatts write events with data.
    nrf5/boards: Updating pca10028 bluetooth stack targets to have a MCU_SUB_VARIANT.

Bander Ajba <banderajba@macwan.local>
    added support for hardware temperature sensor

Glenn Ruben Bakke <glennbakke@gmail.com>
    nrf5/sdk: Adding macro based ringbuffer written by Philip Thrasher. source: https://github.com/pthrasher/c-generic-ring-buffer/blob/master/ringbuffer.h. Copyright noticed copied into the file, and file reviewed by Philip.
    nrf5/sdk: Updating bluetooth le driver to extract data length and pointer from the event structure upon gatts write operation.
    nrf5/modules: Expose ubluepy characteristic and peripheral types as external declaration in ublupy header.
    nrf5: Updating main to initialize bluetooth le uart module right before bluetooth REPL is started.
    nrf5/sdk: Updating bluetooth le uart implemenatation to block until cccd is written.
    nrf5/sdk: Backing up ubluepy version of ble uart service for Bluetooth LE REPL.
    nrf5/modules: Updating ubluepy example in header to align with bluetooth uart service characteristic's.
    nrf5/modules: Implementing characteristic write method. Possible to use write for both write and notifications.
    nrf5/sdk: Remaning bluetooth driver function ble_drv_attr_notif to *_notify.
    nrf5/modules: Adding props and attrs parameter to ubluepy characteristic constructor to override default values. Adding method for reading characteristic properties. Adding values to the local dict table that gives possibility to OR together a configuration of properties and attributes in the keyword argument during construction.
    nrf5/sdk: Adding parsing of characteristic properties and attributes (extra descriptions for the characteristic, for now cccd).
    nrf5/modules: Adding new members to ubluepy characteristic object, props and attrs. Adding enum typedefs for various properties and attributes.
    nrf5/modules: Syncing uart module code after upmerge with upstream master.
    nrf5/boards: Releasing more RAM for heap use in the nrf51 s110 linker script.
    nrf5/modules: Adding new gatts handler and registration of it during creation of a peripheral object. Also, added forwarding to python callback function (for now the same as for GAP).
    nrf5/modules: Adding new callback type in modubluepy for gatts events.
    nrf5/sdk: Adding support for setting gatts handler in the bluetooth le driver.
    nrf5/modules: Adding constant for CCCD uuid in ubluepy constants dict.
    nrf5: Adding ubluepy_descriptor.c into source list to compile.
    nrf5/modules: Adding template for ubluepy descriptor class implementation.
    nrf5/modules: Adding object structure for ubluepy descriptor.
    nrf5/sdk: Adding template functions for attribute read/write/notify in bluetooth le driver.
    nrf5/modules: Adding getCharacteristic method in ublupy service class. This function returns the characteristic with the given UUID if found, else None. The UUID parameter has to be of UUID class type, any other value, like strings will throw an exception.
    nrf5/modules: Updating method documentation in ubluepy peripheral and service.
    nrf5/modules: Adding new method, getCharacteristics(), in the ubluepy service class. The method returns the list of characteristics which has been added to the service instance.
    nrf5/modules: Updating method documentation in ubluepy peripheral class.
    nrf5/modules: Updating ubluepy service. Creating empty characteristic list in constructor. Appending characteristic to the list when added.
    nrf5/modules: Changed return in ubluepy addService() function to return mp_const_none instead of boolean.
    nrf5/modules: Correcting tabbing in ubluepy periheral impl.
    nrf5/modules: Updating ubluepy peripheral. Creating empty service list in constructor. Appending services to the list when added. Added new function for retreiving the service list; getServices().
    nrf5/modules: Adding new members in ubluepy peripheral and service object to keep track of child elements. Peripheral will have a list of services, and service will have a list of charactaristics.
    nrf5/modules: Removing connection handle from python gap event handler callback function.
    nrf5/modules: Updating ubluepy example in the header file with new function call to add service to a peripheral instance.
    nrf5/modules: Updating peripheral class to assign periopheral parent pointer to service's thats added. Also added a hook in the bluetooth le event handler to store the connection handle value, to prevent any services or characteristics to handle this value themselves.
    nrf5/modules: Updating service object to clear pointer to parent peripheral instance. Also assinging pointer to the service when adding a new characteristic.
    nrf5/modules: Updating print to also include peripheral's connection handle. Setting pointer to service parent instance to NULL.
    nrf5/modules: Correcting event id numbers for connect and disconnect event in ubluepy_constants.py
    nrf5/modules: Shuffle order of typedef in ubluepy header. Adding service pointer in characteristic object. Adding peripheral pointer to the service structure. When populated, the characteristic would get access to conn_handle and service handle through pointers. Also service would get access to peripheral instance.
    nrf5/modules: adding template functions for characteristic read and write.
    nrf5/modules: Adding constants class to ubluepy which will contain easy access to common bluetooth le numbers and definitions for the bluetooth stack.
    nrf5/modules: Updating example in ubluepy header with 16-bit uuid's commented out, to show usage.
    nrf5/sdk: Adding support for adding 16-bit uuid's in advertisment packet. The services in paramter list can mix 16-bit and 128-bit.
    nrf5/sdk: Updating sdk_common.mk with new filename of bluetooth le driver.
    nrf5: Updating all includes of softdevice.h to ble_drv.h
    nrf5/sdk: renaming softdevice.* to ble_drv.*
    nrf5/sdk: Renaming bluetooth driver functions to have ble_drv* prefix. Updating modules using it.
    nrf5/sdk: Enable ubluepy module if s110 bluetooth stack is enabled.
    nrf5/sdk: Updating bluetooth driver to only set periph and central count if s132 bluetooth stack. These parameters does not exist in older stacks.
    nrf5/modules: Updating bluetooth driver and ubluepy to use explicit gap event handler. Adding connection handle parameter to the gap handler from ubluepy. Resetting advertisment flag if connection event is recieved, in order to allow for subsequent advertisment if disconnected again. Example in ublupy header updated.
    nrf5: Adding target to flash bluetooth stack when using pyocd-flashtool.
    nrf5/modules: Guarding callback to python event handler before issue the call in case it is not set.
    nrf5/modules: Updating ubluepy example to turn led2 on and off when receiving connected and disconnect bluetooth event.
    nrf5/sdk: Updating bluetooth driver to have configurable logs.
    nrf5/modules: updating ubluepy and bluetooth driver to support python created event handler. Added registration of callback from ubluepy against the bluetooth driver and dispatching of events to the user supplied python function.
    nrf5/modules: Splitting includes to be inside or outside of the compile guard in ubluepy. This way, all micropython specific includes will be outside, and internal will be inside. This way, there will not be any dependency towards ubluepy headers if not compiled in.
    nrf5/modules: Adding two new functions to ubluepy peripheral class to set specific handlers for notificaitons and connection related events.
    nrf5: Set ubluepy to disabled by default in mpconfigport.h if not configured.
    nrf5/modules: Moving includes inside config defines to make non-ubluepy targets compile again.
    nrf5/modules: Adding 'withDelegate' function to peripheral class.
    nrf5/modules: Adding ubluepy delegate type to modubluepy globals table.
    nrf5: Adding ubluepy_delegate.c to list of source files to compile.
    nrf5/modules: Adding new object struct for delegate class and adding a delegate struct member to Peripheral class to bookeep callback object when event occurs.
    nrf5/modules: Adding template for ubluepy delegate class.
    nrf5/sdk: Fixing debug print in bluetooth driver to not use >>> prefix. Adding one more print for connection parameter update.
    nrf5/sdk: Correcting advertisment packet in bluetooth driver in order to make the device connectable.
    nrf5/sdk: Implementing simple event handler for bluetooth stack driver.
    nrf5/sdk: Disable all sdk components from being included in the build while implementing ubluepy, overlap in IRQ handler symbol.
    nrf5/modules: Shortening down the device name to be advertised in the example to make it fit with a 128-bit complete UUID.
    nrf5/modules: Bugfix in ubluepy_uuid_make_new. Used wrong buffer to register vendor specific uuid to the bluetooth stack.
    nrf5/sdk: Updating advertisment function in bluetooth le driver to add 128-bit complete service UUID provided in service list to the advertisment packet.
    nrf5/sdk: Updating advertisment funciton in bluetooth le driver to iterate through services passed in and calculate individiual uuid sizes.
    nrf5/modules: Updating advertisment method in peripheral class to memset advertisment structure. Also applying service list if set to the advertisment structure.
    nrf5/modules: Updating ubluepy module header usage example. Correcting enum for UUID types to start index from 1. Expanding advertisment data structure to also include service list members.
    nrf5/sdk: Adding static boolean for keeping track of whether advertisment is in progress in the bluetooth driver. Now, advertisment can be restarted with new data any time.
    nrf5/modules: Updating ubluepy peripheral class to use mp_const_none instead of MP_OBJ_NULL for unset values in advertisment method parameter list. Adding extraction of the service list in the advertisment method. The list is not yet handled.
    nrf5/modules: Adding a few examples in the modubluepy.h to get easier copy paste when implementing.
    nrf5/sdk: Successful device name advertisment. Added flags to advertisment packet and enable device name byte copy into the advertisment data.
    nrf5/modules: Turning ubluepy peripheral advertisment function into a keyword argument function so that it would be possible to set device name, service uuids, or manually constructed data payload.
    nrf5/sdk: Updating softdevice driver with function to set advertisment data and start advertisment. Does not apply device name yet. Work in progress.
    nrf5/modules: Adding new structure to ubluepy in order to pass advertisment data information to the bluetooth le stack.
    nrf5/modules: Adding function function to add characteristics to the ubluepy service. Enable function in service's local dict table.
    nrf5/modules: Adding function in bluetooth le driver to add characteristic to the bluetooth le stack.
    nrf5/modules: Adding more members to ublue characteristic object structure.
    nrf5/modules: Adding characteristic class to ubluepy globals table.
    nrf5/modules: Updating ubluepy characteristic implementation.
    nrf5/modules: Re-arranging includes in ubluepy_service.c
    nrf5/modules: Adding ubluepy charactaristic type struct.
    nrf5/modules: Updating ubluepy with more implementation in UUID and Service. Adding function in bluetooth le driver which adds services to the bluetooth stack. Making service take UUID object and Service type (primary/secondary) as constructor parameter in Service class.
    nrf5: Adding ubluepy to include path.
    nrf5/modules: Updating ubluepy UUID class constructor with some naive parsing of 128-bit UUIDs, and pass this to the softdevice driver for registration.
    nrf5/sdk: Adding new function to the softdevice handler driver to add vendor specific uuids and return an index to the entry back by reference.
    nrf5/modules: Updating ubluepy UUID class with constructor that can construct an object based on hex value of 16-bit or string of 16-bit prefixed with '0x'.
    nrf5/modules: Adding Peripheral, Service and UUID class to the ubluepy module globals table.
    nrf5/modules: Extending the implementation of Peripheral class in ubluepy.
    nrf5/modules: Extending the implementation of UUID class in ubluepy.
    nrf5/sdk: Adding configuration to enable the ubluepy peripheral class when using softdevice 132 from the SDK.
    nrf5: Adding ubluepy module to builtins if bluetooth stack is selected. Disable NUS profile by default. Adding source for ubluepy module into makefile to be included in build. The source is only linked if MICROPY_PY_UBLUEPY is set.
    nrf5: Aligning code after upmerge with master. Mostly FAT FS related updates. Not tested after merge.
    nrf5/modules: Adding new and print function to ubluepy peripheral class. Template functions only.
    nrf5/modules: Adding ubluepy UUID class template.
    nrf5/modules: Adding ubluepy characteristic class template.
    nrf5/modules: Adding missing #endif. Also adding to property templates to the lolcal dict.
    nrf5/modules: Adding ubluepy service class template.
    nrf5/modules: Updating ubluepy with class function placeholders.
    nrf5/modules: Renaming ble module folder to ubluepy.
    nrf5/modules: Adding new template file for ubluepy Peripheral class.
    nrf5/pyb: Moving pyb module into modules/pyb.
    nrf5/utime: Moving utime module into modules/utime.
    nrf5/uos: Moving uos module into modules/uos.
    nrf5/network: Moving network module into modules/network. Adding include path to network as its needed by the usocket module.
    nrf5/usocket: Moving usocket module into modules/usocket.
    nrf5/led: Moving led module into modules/machine.
    nrf5/led: Moving led module into modules/machine.
    nrf5/pwm: Moving pwm module into modules/machine.
    nrf5/rtc: Moving rtc module into modules/machine.
    nrf5/timer: Moving timer module into modules/machine.
    nrf5/pin: Moving pin module into modules/machine.
    nrf5/adc: Moving adc module into modules/machine.
    nrf5/i2c: Moving i2c module into modules/machine.
    nrf5/spi: Moving spi module into modules/machine.
    nrf5/uart: Moving uart module into modules/machine to start converting it into machine module and not pyb.
    nrf5/machine: Moving modmachine into modules/machine folder. Updating Makefile.
    nrf5/drivers: Renaming folder to modules.
    nrf5: Renaming python modules folder to freeze to give the folder its right meaning. The scripts put into this folder will be frozen.
    nrf5/drivers: Adding template for ubluepy module.
    nrf5/sdk: Adding compilation config whether to include BLE NUS implementation. Config found in sdk/nrf5_sdk_conf.h. NUS enabled for s132 targets by default.
    nrf5: Fallback to HW UART when not Bluetooth LE UART has been enabled.
    nrf5: Updating main.c to use MICROPY_PY_BLE_NUS as switch for regular uart initialization or bluetooth le uart initialization.
    nrf5/sdk: Adding work-in-progress script to connect to bluetooth le REPL using bluepy python module in linux.
    nrf5/boards: Updating board makefiles for s132 and s1xx target for pca10040 (nrf52832) by adding sub variant and device define to the makefiles.
    nrf5/examples: Updating ssd1306.py example with a comment describing proceedure on how to use the I2C variant of the driver.
    nrf5/hal: Line wrapping params in hal_spi.c to make it easier to read.
    nrf5/hal: Updating hal_twi.c tx implementation to a working state. STARTTX only issued once, before looping bytes.
    nrf5/examples: Updating ssd1306.py driver to work with i2c master write implementation.
    nrf5/hal: Updating hal_twi.c with tx function. Gets multiple startup bytes for each clocked byte.
    nrf5/hal: Updating hal_twi.c with tx function which partly works. Bytes are clocked out a bit out of order.
    nrf5/hal: Started implementation of hal_twi.c (non-DMA). Init function started.
    nrf5: Removing hal_twie.c from being compiled in.
    nrf5: Renaming configuration define in board configs using i2c from MICROPY_PY_MACHINE_HW_I2C to MICROPY_PY_MACHINE_I2C as the config is overlapping with the latter.
    nrf5: Renaming configuration define in board configs using i2c from MICROPY_PY_MACHINE_HW_I2C to MICROPY_PY_MACHINE_I2C as the config is overlapping with the latter.
    nrf5: Making i2c configurable from board configuration in case board has to sacrifice the i2c machine module.
    nrf5/boards: Activating all display drivers in pca10056 board.
    nrf5/boards: Updating s110 SD linker script for micro:bit.
    nrf5/i2c: Making use of hal twi tx function in writeto function.
    nrf5/hal: Updating twi driver with template functions.
    nrf5/hal: Updating TWI DMA implementation. Suspend not working on tx. Rx not implemented yet.
    nrf5/hal: Updating twi master tx with stop parameter.
    nrf5/hal: Adding i2c master functions for tx and rx in hal header.
    nrf5/hal: Adding new macros functions to mphalport.h which are used by extmod i2c machine module.
    nrf5/i2c: Adopting use of extmod/machine_i2c module as base for port's machine i2c module.
    nrf5/i2c: Backing up before trying out extmod i2c integration.
    nrf5: Adding i2c class to machine module globals table.
    nrf5: Updating main.c to initialize the i2c machine module if selected.
    nrf5/i2c: Updating i2c machine module with new constructor parameters to set scl and sda pins. Also updating print funciton to debug pin number and port number for the gpio set.
    nrf5/i2c: Updating i2c module to new new hal api, as master is initialized with its own init function.
    nrf5/hal: Adding members to TWI config struct, device address and scl/sda pin. Renaming and adding function such that twi slave and master has seperate init function. Started implementation of master init function for nrf52 using DMA (hal_twie.c).
    nrf5/i2c: Updating module to use new struct layout from hal_twi.h
    nrf5/hal: Updating TWI with frequency enums.
    nrf5/examples: Updating game file to use ssd1305 display driver.
    nrf5/drivers: Updating examples in comment in oled ssd1305 object to use the draw module.
    nrf5/hal: Fixing nrf51 SPI pin configuration to use pin member of struct.
    nrf5/boards: Updating boards to comply to new style of configuring pins for uart and spi.
    nrf5/boards: Updating board configuration for pca10056 (nrf52840) with new pin configuration scheme for SPI and UART.
    nrf5/hal: Updating hal QSPI header with define guard to filter out usage of undefined structures and names when compiling against non-52840 targets.
    nrf5/drivers: Updating display objects to use new SPI pin configuration in print function.
    nrf5/hal: Updating SPI DMA variant with more frequencies, and allowing rx and tx buffers to be NULL.
    nrf5/uart: Updating uart module to use new config hal config structure members for pins. Changing board config provided pins to use const pointers from generated pins instead of pin name.
    nrf5/hal: Updating uart hal to use pointers to Pin objects instead of uint pin and port number.
    nrf5/hal: Updating uart hal to use pointers to Pin objects instead of uint pin and port number.
    nrf5: Updating modmachine to add SPI in globals dict when MICROPY_PY_MACHINE_HW_SPI define is set. This diverge from regular MICROPY_PY_MACHINE_SPI config. Fixes missing SPI in the machine module after renaming port SPI enable define.
    nrf5: Updating main.c to enable SPI if MICROPY_PY_MACHINE_HW_SPI is set. This diverge from regular MICROPY_PY_MACHINE_SPI config. Fixing missing init of SPI after renaming port SPI enable define.
    nrf5/spi: Adding multiple instances of machine SPI depending on which chip is targeted (nrf51/nrf52832/nrf52540). Updating board config requirement to give variable name of const pointer to Pin instead of a Pin name. Adding support of giving keyword set mosi/miso/clk pin through constructor.
    nrf5/hal: Updating SPI hal with full list of SPI interfaces as lookup tables for all devices. Updating init struct to pass Pin instance pointers instead of uint pin number and ports.
    nrf5/drivers: Activate ssd1289 object in the display module.
    nrf5/boards: Adding ssd1289 lcd module in pca10040 (nrf52832) board.
    nrf5: Adding ssd1289 driver and python module into build.
    nrf5/drivers: Adding ssd1289 lcd tft driver and python module.
    nrf5/hal: Fixing compile issues in quad SPI driver.
    nrf5/hal: Updating Quad SPI hal driver.
    nrf5/hal: Aligning assignment in hal_adc.c
    nrf5/hal: Adding more types to quad SPI header.
    nrf5: Syncing code after upmerge with master.
    nrf5/hal: Updating clock frequency enums and lookup table for quad spi.
    nrf5/hal: Adding QSPI base and IRQ num in c-file.
    nrf5/hal: Adding hal template files for 32mhz Quad SPI peripheral.
    nrf5/drivers: Optimizing update_line in ili9341 driver a bit.
    nrf5/drivers: Adding space in macro.
    nrf5/drivers: Adding rgb16.h with macro to convert 5-6-5 rgb values into a 16-bit value.
    nrf5: Adding configuration defines for SSD1289 lcd driver.
    nrf5: Removing old framebuffer implementation.
    nrf5: Remove old framebuffer implementation from being included into the build.
    nrf5/drivers: Enable framebuffer and graphics module to be compiled in by default if display is selected into the compilation.
    nrf5/drivers: Updating epaper driver sld00200p to use new framebuffer.
    nrf5/drivers: Removing debug printf's from epaper display python module.
    nrf5/drivers: Updating python example in comment for ls0xxb7dxx display module.
    nrf5/boards: Enable LS0XXB7DXXX display module in pca10056 board config.
    nrf5/drivers: Adding ls0xxb7dxx to display module.
    nrf5: Adding ssd1305 and ls0xxb7dxxx (sharp memory display) drivers to be included in build.
    nrf5/drivers: Updating sharp memory display driver and python module to a working state.
    nrf5/spi: Adding posibility to configure SPI firstbit mode to LSB or MSB. Default is MSB. Updating python module and hal driver.
    nrf5/drivers: Tuning memory lcd driver a bit. Fixing small mp_printf usage bug.
    nrf5/drivers: Adding sharp memory display driver. For now hardcoded to 2.7 inch variant.
    nrf5: Adding configuration define for sharp memory display series in mpconfigport.h preparing for driver to be included.
    nrf5/boards: Enable ssd1305 oled display to be default for pca10028 for now.
    nrf5/drivers: Adding ssd1305 oled driver. This is very similar to ssd1306, so a merge will happen soon.
    nrf5/drivers: Adding ssd1305 oled driver. This is very similar to ssd1306, so a merge will happen soon.
    nrf5/drivers: Updating ili9341 display object to use new framebuffer.
    nrf5/drivers: Updating ili9341 driver to use new framebuffer, and removing the compressed param from the line update function.
    nrf5: Adding micropython mem_info() to be included in mpconfigport.h.
    nrf5/drivers: Adding example in comment on how to use the ili9341 driver with nrf51/pca10028 board.
    nrf5/examples: Adding a extra global variable to the game which breaks the game execution.
    nrf5/examples: Adding 2048 game using OLED SSD1306 128x64 display and analog joystick.
    nrf52/boards: Increasing the stack and heap in pca10056 (nrf52840) target from 2k/32k to 40k/128k to debug some buffer problems when running large frozen python programs.
    nrf51/boards: Increasing heap and stack size in the pca10028 board.
    nrf51/boards: Enable display driver and oled ssd1306 (also bringing in framebuffer and graphics module) into the pca10028 target.
    nrf5: Enable display/framebuffer.c and graphic/draw.c into the build.
    nrf5/drivers: Adding defines to exclude implementation of draw.c module if not enabled.
    nrf5: Adding configuration defines for the graphics module (draw) and enabling this by default if using oled ssd1306 display which has a compatible python object definition.
    nrf5/drivers: Adding draw module with circle, rectangle and text functions. Can be used by any display object which implements display callback functions.
    nrf5/drivers: Moving oled ssd1306 driver over to new framebuffer layout. Moving some of the draw algorithms into the object in order to optimize the speed on writing data from the framebuffer.
    nrf5/hal: Removing stdio.h include in adce.c which were used for debugging.
    nrf5/boards: Adding ADC pins in pins.csv file for pca10056 (nrf52840).
    nrf52/hal: Adding adce (saadc) implementation for nrf52 to sample values on a channel.
    nrf5/adc: Adding all 8 instances to adc python module. Valid for both nrf51 and nrf52.
    nrf5/drivers: Adding new structures to moddisplay. Adding a display_t structure to cast all other displays into, to retrieve function pointer table of a display object type. Also adding the function table structure which needs to be filled by any display object.
    nrf5/drivers: Adding a new framebuffer implementation to replace the mono_fb.
    nrf5/boards: Updating pca10028 (nrf51) board config. Enable SPI machine module. Enable flow control on UART. Correcting SPI CLK, MISO and MOSI pin assignments.
    nrf5/adc: Updating adc module and hal with a new interface. No need for keeping peripheral base address in structure when there is only one peripheral (nrf51).
    nrf5/rtc: Correcting RTC1 base error in rtc template.
    nrf5: Adding adc module to machine module.
    nrf5/hal: Updating hal_adc* with more api functions.
    nrf5/adc: Adding updated adc module.
    nrf5/boards: Enabling ADCE (SAADC) variant of adc hal to match hardware on nrf52 series.
    nrf5/boards: Adding ADC config to pca10028 pins.csv
    nrf5/boards: Tuning linker script for nrf51822_ac to get some more heap.
    nrf5: Updating nrf51_af.csv to reflect pins having ADC on the chip.
    nrf5/boards: Updating make-pins.py to generate ADC pin settings from board pins.csv.
    nrf5/hal: Updating hal_adc header to use correct Type for ADC on nrf52.
    nrf5/adc: Updating module to compile.
    nrf5/boards: Enable ADC machine module for pca10028, pca10040 and pca10056.
    nrf5: Add add ADC machine module into build.
    nrf5: Adding new config for ADC module in mpconfigport.h.
    nrf5/adc: Adding ADC machine module base files. Implementation missing.
    nrf5: Adding hal_adc* into build.
    nrf5/boards: Enable ADC/SAADC hal for pca10028 (nrf51), pca10040 (nrf52832) and pca10056 (nrf52840) boards.
    nrf5/hal: Removing chip variant guard for hal_adc*, and let this be up to the hal conf file to not mess up at the moment.
    nrf5: Add i2c.c, i2c machine module, and hal_twi into build.
    nrf5/boards: Enable hardware I2C machine module for pca10028 (nrf51), pca10040 (nrf52832) and pca10056 (nrf52840) boards.
    nrf5/boards: Enable TWI hal for pca10028 (nrf51), pca10040 (nrf52832) and pca10056 (nrf52840) boards.
    nrf5/i2c: Adding files for hardware i2c machine module and adding config param in mpconfigport to disable by default.
    nrf5/hal: Adding template files for TWI (i2c) hal.
    nrf5/hal: Adding template files for ADC hal.
    nrf5/drivers: Correcting tabbing in oled ssd1306 c-module.
    nrf5/boards: Enable SSD1306 spi driver for pca10040 (nrf52832) and pca10056 (nrf52840) boards.
    nrf5/drivers: Adding SSD1306 SPI display driver. Not complete, but can do fill screen operation atm.
    nrf5/drivers: Adding epaper display example script in comment for pca10056 / nrf52840 in the display module.
    nrf5/boards: Enable PWM module and epaper display module in pca10056 board config.
    nrf5/drivers: Adding some more delay on bootup to ensure display recovers after reset.
    nrf5/examples: Adding copy of ssd1306.py driver hardcoded with SPI and Pin assignments.
    nrf5/drivers: Updating ili9341 driver to set CS high after cmd or data write.
    nrf5/drivers: Extending print function for ili9341 object to also print out gpio port of the SPI pins.
    nrf5/boards: Giving a bit more heap for nrf52840 linker script.
    nrf5/drivers: bugfix of the sld00200p driver. Stopping the pwm instead of restarting it. Shuffle placement of static function.
    nrf5/drivers: Correcting object print function to also include port number of the SPI pins. Correcting usage script example in comment.
    nrf5/drivers: Adding an initial script as comment for ili9341 on nrf52840/pca10056 in the driver module comment.
    nrf5/examples: Removing tabs from epaper python script usage comment, so that it is easier to copy paste.
    nrf5/hal: Refining if-defs to set up GPIO base pointers in mphalport.h
    nrf5/devices: Removing define which clutters ported modules from nrf.h.
    nrf5/boards: Enabling spi in pca10056 hal config.
    nrf5/boards: Enabling ili9341 display drivers and to be compiled in on pca10056 target board. Updating SPI configuration with gpio port.
    nrf5/boards: Enabling display drivers/spi/pwm to be compiled in on pca10040 target board. Updating SPI configuration with gpio port.
    nrf5/hal: Correcting SPI psel port position define name to the one defined in nrf52840_bitfields.h
    nrf5/led: Hardcoding GPIO port 0 for Led module for now.
    nrf5/hal: Changing import of nrf52 includes in hal_uarte.c to not be explicit. Now only nrf.h is included.
    nrf5: Updating pin, spi and uart to use port configuration for gpio pins. Update pin generation script, macros for PIN generation. Updating macros for setting pin values adding new port parameter to select the correct GPIO peripheral port.
    nrf5/boards: Disable SPI hal from pca10001 board.
    nrf5/boards: Disable SPI/Timer/RTC hal from microbit board.
    nrf5: Exclude import of pwm.h in modmachine.c if MICROPY_PY_MACHINE_PWM is not set, as nrf51 does not yet have this module yet.
    nrf5: Exclude import of pwm.h in main.c if MICROPY_PY_MACHINE_PWM is not set, as nrf51 does not yet have this module yet.
    nrf5/drivers: Block nrf51 from compiling epaper_sld00200p for the moment. There is no soft-pwm present yet, and including pwm would just make compilation fail now.
    nrf5/hal: Making nrf51/2_hal.h go trough nrf.h to find bitfields and other mcu headers instead of explicit include.
    nrf5/boards: Adding more pins to nrf52840 / pca10056 target board.
    nrf5/pin: Adding more pins to nrf52_af.csv file for nrf52840. Port '1' will be prefixed 'B'.
    nrf5/pin: Adding PORT_B to Pin port enum to reflect gpio port 1 on nrf52840.
    nrf5/boards: Updating all board configs with gpio port configuration for uart/spi pins. Leds still not defined by gpio port.
    nrf5/devices: Updating header files for nrf51 and nrf52. Adding headers for nrf52840.
    nrf5: Updating to use new nrfjprog in makefile. Needed for nrf52840 targets. Changed from pinreset to debug reset.
    nrf5/boards: Updating makefiles to use system.c files based on sub-variant of mcu.
    nrf5/devices: Renaming system.c files for nrf51 and nrf52 to be more explicit on which version of chip they are referring to.
    nrf5/drivers: Backing up working epaper display (sld00200p shield) driver before refactoring.
    nrf5/drivers: Fixing parenthesis in ILI9341 __str__ print function.
    nrf5/pwm: Moving out object types to header file so that it can be resused by other modules.
    nrf5/drivers: Updating a working version of ili9341 module and driver. About 10 times faster than python implementation to update a full screen.
    nrf5: Started to split up lcd_mono_fb such that it can be used as a c-library and python module with the same implementaton.
    nrf5/hal: Adding include of stdbool.h in hal_spi.h as it is used by the header.
    nrf5/drivers: Adding preliminary file for ili9341 lcd driver.
    nrf5/hal: Adding support for NULL pointer to be set if no rx buffer is of interest in SPI rx_tx function.
    nrf5: Adding ili9341 class and driver files in Makefile to be included in build.
    nrf5/drivers: Adding template files for upcomming ili9341 driver.
    nrf5/drivers: Adding lcd ili9341 object implementation to make a new instance. print implemented for debugging pins assigned to the display driver. No interaction yet with the hal driver.
    nrf5/drivers: Adding ILI9341 class to the display global dict.
    nrf5/boards: Changing tft lcd display name from SLD10261P to ILI9341 in pca10040 board configuration.
    nrf5: Moving out mp_obj_framebuf_t to the header file to get access to it from other modules. Exposing helper function to make new framebuffer object from c-code.
    nrf5: Trimming down display configurations in mpconfigport.h
    nrf5/spi: Moving *_spi_obj_t out of implementation file to header. Setting hal init structure in the object structure instead of making a temp struct to configure hal. This would enable lookup of the spi settings later.
    nrf5: Removing epaper, lcd and oled modules from Makefile source list as the display modules has been moved to display root folder.
    nrf5/drivers: Removing one level of module hierarchy in display drivers. Removed epaper, lcd and oled modules, making import of classes happen directly from display module.
    nrf5/drivers: Creating python object implementation (locals) to be used for epaper sld00200p.
    nrf5: Moving color defines in lcd_mono_fb from .c to .h so that it can be reused by other modules.
    nrf5: Enable MICROPY_FINALISER and REPL_AUTO_INDENT.
    nrf5/drivers: Adding requirement for nrf52 target on the epaper sld00200p for now. There is no ported PWM module for nrf51 target yet. Hence, soft PWM for nrf51 needs to be added.
    nrf5: Adding suffix to _obj on epaper_sld00200p module.
    nrf5: Correcting define name for epaper sld00200p, missing 0.
    nrf5/drivers: Enable EPAPER_SLD00200P in epaper module globals table.
    nrf5/drivers: Adding missing file for epaper module / driver.
    nrf5/modules: Moving python scripts to examples folder to free up some flash space on constrained targets as modules folder is used as frozen files folder.
    nrf5/boards: Enable display module to be built in. Also adding one epaper display and one tft lcd to test display module when porting the corresponding drivers to micropython.
    nrf5/drivers: Removing external decleration of display module in header.
    nrf5/drivers: Renaming display module to mp_module prefix as it is going to be inbuilt. ifdef'ing all submodules based on type of display configured through mpconfigport.h
    nrf5/drivers: Adding ifdef sourrounding the implementation of module. Configurable with mpconfigport.h.
    nrf5: Adding display module to port builtins.
    nrf5/drivers: Adding driver files to makefile. Implicitly adding display module.
    nrf5/drivers: Adding template for c-implementation of lcd, epaper and oled drivers as a display module.
    nrf5/modules: Updating to correct name of display in epaper driver.
    nrf5/modules: Adding python epaper display driver. Currently colors have been reversed.
    nrf5/hal: Fixing bug in mp_hal_pin_read in mphalport.h which tried to read an OUT register. Corrected to read the IN register.
    nrf5: Adding sleep_us to modutime.c and exposing mp_hal_delay_us in hal/hal_time.h
    nrf5/lcd: Updating framebuffer with double buffer for epaper displays. Moving statics into instance struct. Adding new function to refresh using old buffer, such that epaper can get a cleaner image after update.
    nrf5/boards: Adding initial microbit build files and board configurations.
    nrf5: Makefile option to set FLASHER when doing flash target. If defined in board .mk file, this will be used, else nrfjprog will be used by default (segger). This opens up for using pyocd flashtool and still run 'make flash'.
    nrf5/boards: Updating pca10028 board config to not define RTS/CTS pins when HWFC is set to 0.
    nrf5/uart: Making compile time exclusion of RTS/CTS if not defined to use flow control by board configuration.
    nrf5/spi: Removing automatic chip select (NSS) in hal_spi.c. Also removing configuration of this pin as it is confusing to pass it if not used. User of SPI has to set the NSS/CS itself.
    nrf5/modules: Updating PWM test python script to cope with new api.
    nrf5/hal: Fixing some issues in PWM stop function. Doing a proper stop and disable the peripheral.
    nrf5/pwm: Implementing start and stop call to hal on init and deinit as hal_init does not longer start the PWM automatically.
    nrf5/hal: Exposing two new PWM hal functions start() and stop().
    nrf5/hal: Moving enablement of PWM task from init to a start function. Also activating code in stop function to stop the PWM.
    nrf5/modules: Adding licence text on seeedstudio tft shield python modules.
    nrf52/boards: Tuning linker script for nrf52832 when using iot softdevice. Need more heap for LCD framebuffer.
    nrf5/lcd: Adding lcd_mono_fb.c to source list in the makefile. Adding define in implementation to de-select the file from being included. Adding module to PORT BUILTIN in mpconfigport.h
    nrf52/sdk: Correcting path to iot softdevice if SDK is enabled.
    nrf5: Adding help text for CTRL-D (soft reset) and and CTRL-E (paste mode) in help.c
    nrf5: Adding handling of CTRL+D to reset chip in main.c. Call to NVIC System Reset is issued.
    nrf5/lcd: Correcting indention (tabs with space) in framebuffer module source and header.
    nrf5/lcd: Changing framebuffer to use petme128 8x8 font. This is vertical font. Code modified to flip and mirror the font when rendering a character. Adding copy of the font from stmhal.
    nrf5/modules: Adding new driver for seeedstudio tft shield v2, using new framebuffer module which handles faster update on single lines, callback driven write on each line which is touched in the framebuffer.
    nrf5/lcd: Adding header file for lcd_mono_fb.
    nrf5/lcd: Updating brackets in framebuffer module.
    nrf5/lcd: Renaming variable name from m_ to p_
    nrf5/lcd: Cleaning up a bit in lcd framebuffer.
    nrf5/lcd: Adding work in progress monochrome lcd framebuffer driver which only updates modified (dirty) display lines.
    nrf5/modules: Updating pulse test to set output direction on the LED pin used in the test.
    nrf5/modules: Updating seeedstudio tft lcd driver to render using already existing framebuffer implementation.
    nrf5/boards: Bouncing up heap to 32k  on pca10040 to allow for application to allocate 9600bytes+ framebuffer when using LCD screen (240x320).
    nrf5/modules: Adding a function to get access to the SD card flash drive on the seeedstudio tft shield.
    nrf5/modules: Adding new python script to initialize and clear the display on Seeedstudio 2.8 TFT Touch Shield v2.
    nrf5/modules: Updating documentation on sdcard.py copy to use new params in the example description
    nrf5/modules: Updating mountsd, SD card test script with new params.
    nrf5/pin: Merging input and output pin configuration to one comon function. Adding implementation in Pin class to be able to configure mode and pull. Updating drivers which uses gpio pin configuration to use new function parameters.
    nrf5: Adding rtc.c which implements the machine rtc module to be included in build.
    nrf5/boards: Enable MICROPY_PY_MACHINE_RTC in pca10028 (nrf51) and pca10040 (nrf52) targets.
    nrf5/hal: Adding empty init function in hal_rtc.c
    nrf5/hal: Adding structures and init function prototype to hal_rtc.h.
    nrf5: Setting MICROPY_PY_MACHINE_RTC to disabled by default (during development) in mpconfigport.h. This can be overriden by board config.
    nrf5/rtc: Adding skeleton for machine rtc module for nrf51/52.
    nrf5: Adding timer.c which implements the machine timer module to be included in build.
    nrf5: Setting MICROPY_PY_MACHINE_TIMER to disabled by default (during development) in mpconfigport.h. This can be overriden by board config.
    nrf5/boards: Enable MICROPY_PY_MACHINE_TIMER in pca10028 (nrf51) and pca10040 (nrf52) targets.
    nrf5: Adding initialization of timer module if enabled by MICROPY_PY_MACHINE_TIMER.
    nrf5/timer: Adding initializaton of id field for Timer_HandleTypeDef's. Adding simple print function. Adding make_new function. Enabling the functions in machine_timer_type.
    nrf5/hal: Adding empty init function in hal_timer.c
    nrf5/hal: Adding structures and init function prototype to hal_timer.h.
    nrf5/timer: Adding skeleton for machine timer module for nrf51/52.
    nrf/boards: Adding RTC and TIMER hal to be linked in when implemented. Enable one board for nrf51 and one for nrf52 for ease of debugging when implementing the hal.
    nrf5: Adding rtc and timer hal to Makefile.
    nrf5/hal: Adding skeleton files for rtc and timer driver.
    nrf5/modules: Updating pulse example to work with Pin object instead of hard coded pin number.
    nrf5/pwm: Switching from hardcoded pin number to Pin object type as input to the new() function. Also changing the parameter from kw to arg.
    nrf5/modules: updating test python file with correct PWM frequency type.
    nrf5/modules: Adding a python test file with function to dim a specific led (17).
    nrf5/pwm: Updating pwm module with freq function which re-initilises the PWM instance such that new frequency will be applied.
    nrf5/pwm: Initializing pwm instances in main.c if enabled by MICROPY_PY_MACHINE_PWM.
    nrf5/pwm: Adding api to initialize pwm instances.
    nrf5: Updating mpconfigport.h to set a default for PWM machine module to be enabled by default, if not disabled in a board config. Refactoring order in the file.
    nrf52: Set names to be used on PWM0-2 in board config. For nrf52840, the PWM3 is excluded as repo does not have latest headers to reflect this yet. Bump up to be done soon.
    nrf52: Enable PWM HAL for both pca10040 (nrf52832) and pca10056 (nrf52840).
    nrf51: Disable MICROPY_PY_MACHINE_PWM for now in all nrf51 target boards as sw impl. is not yet included in the repo.
    nrf5: Only enable hal_pwm.c if nrf52 target as nrf51 must have a sw implementation.
    nrf5/pwm: Adding pwm to modmachine.c
    nrf5/hal: Updating PWM header file with init function prototype. Also added PWM_HandleTypeDef structure that can be used in the pwm python module.
    nrf5/pwm: Updating PWM dict table to have freq and duty function. Also added creation of default objects based on PWM name set in board config. Adding ifdef surrounding the import of hal_pwm.h as this module might be used by software implmentation of PWM later.
    nrf5/pwm: Removing include of hal_pwm.h as pwm.c might not use a hal, but sw implementation.
    nrf5: Updating makefile to compile in pwm.c and hal_pwm.c
    nrf5/boards: Adding config flag for HAL_PWM in pca10040 and pca10056.
    nrf5: Adding pwm work in progress machine PWM module.
    nrf5/hal: Starting implementation of PWM hal to be used by PWM python module later.
    nrf5: Adding initial board files for pca10056. The files are not complete (only 32 pins are added for now). UART REPL, leds, and Pins (up to 31) are functional.
    nrf5: Updating comment in linker script for nrf52832 and nrf52840 to distinguish between the two nrf52 variants.
    nrf5: Adding new linker script for nrf52840.
    nrf5: updating flash size comment in nrf52832 linker script.
    lib/netutils: Adding some basic parsing and formating of ipv6 address strings. Only working with full length ipv6 strings. Short forms not supported at the moment (for example FE80::1, needs to be expressed as FE80:0000:0000:0000:0000:0000:0000:0001).
    nrf5: Updating port with new content. SPI, SDcard (trough sdcard.py), Pin, and machine module. Also adding some basic modules depending on SDK and bluetooth stack from nordic semiconductor. NUS is module copied from original port by tralamazza, and new basic module for 6lowpan over BLE which can be used by modnetwork and modusocket. Basic BLE module to enable bluetooth stack and start a eddystone advertisment is kept, and still works without SDK, even if in the SDK folder (its placed there as it needs bluetooth stack from an SDK).
    Renaming softdevice folder to sdk.
    Removing unused 'NRF_SOFTDEVICE' compile variable from all board .mk softdevice targets.
    Fixing main Makefile CFLAGS concatination error when setting softdevice param

Daniel Tralamazza <daniel@tralamazza.com>
    ignore default build folders
    move softdevice (SD) specific code from the main Makefile to their respective board/SD makefiles

Glenn Ruben Bakke <glennbakke@gmail.com>
    Updating Makefile by removing unwanted LDFLAG setting cpu to cortex-m0 in all cases.
    Updating modble.c method doc of address_print() to reflect the actual function name.
    Base support for nrf51 and nrf52 base without depending on SDK. SoftDevice usage optional.

Daniel Tralamazza <daniel@tralamazza.com>
    remove dup declaration mp_builtin_open_obj
    init

Date of "init" commit: Wed Jun 22 22:34:11 2016 +0200
2018-07-18 17:12:25 +10:00
hathach
bb28faf39c arturo182 review 2018-07-17 23:57:49 +07:00
hathach
a0b9871ba9 use seperate interrupt_char.c for nrf
move usb descriptors into usb.c
2018-07-17 21:52:20 +07:00
hathach
d4e84a9bd4 Merge branch 'master' into fix_nrf52840_serial 2018-07-17 21:27:16 +07:00
hathach
3525d65af3 should fix #1021
- update tinyusb for wanted char
- move usb code into usb.c
2018-07-17 21:24:49 +07:00
Dan Halbert
a20ab40ed2 Merge 3.0.0 final bugfixes and changes to master 2018-07-16 09:01:46 -04:00
Dan Halbert
bfe14ff824
Merge pull request #1014 from arturo182/nrf_shared_ble
nrf: Split the ble module into a shared part and the port implementation
2018-07-13 10:23:37 -04:00
Dan Halbert
414267388d
Merge pull request #1023 from arturo182/nrf_pyocd
nrf: Fix flashing with pyocd
2018-07-13 10:02:20 -04:00
arturo182
05c1384b67 nrf: Split the ble module into a shared part and the port implementation
This allows other ports to implement these shared bindings.
2018-07-13 16:01:15 +02:00
arturo182
883ca21321 nrf: Fix flashing with pyocd 2018-07-13 15:22:46 +02:00
arturo182
9729fc3d31 nrf: Fix BLE on nRF52840 after adding the USB functionality 2018-07-13 14:55:02 +02:00
hathach
f98c7f708e merge review 2018-07-12 01:37:23 +07:00
hathach
10846d316b Merge branch 'master' into nrf52840_usbboot 2018-07-11 21:35:44 +07:00
Dan Halbert
4962468fff
Merge pull request #1011 from arturo182/nrf_cleanup
nrf: More cleanup and porting
2018-07-10 15:44:30 -04:00
hathach
a53b1c7cf1 code format 2018-07-10 22:49:51 +07:00
arturo182
eab00ff140 nrf: Remove even more unused files 2018-07-10 14:59:22 +02:00
arturo182
2c63fb2a94 nrf: Remove the random hal and module
Thus getting rid of the whole old hal!
The module is not needed because the common-hal
nRF implementation uses HW RNG anyway.
2018-07-10 14:59:22 +02:00
arturo182
1163462635 nrf: Remove the old time hal and replace with nRFx 2018-07-10 14:59:10 +02:00
Scott Shawcroft
e875f4e52e
Merge pull request #1002 from arturo182/nrfx_gpio
nrf: Rewrite the DigitalInOut hal using nRFx
2018-07-09 17:54:38 -07:00
hathach
0e819599e7 Merge branch 'master' into nrf52840_usbboot 2018-07-10 02:02:52 +07:00
hathach
7715d19efe update bootloader hex 2018-07-10 01:20:37 +07:00
hathach
97a1ae911e add family option for uf2 2018-07-10 01:18:14 +07:00
hathach
f199e87085 add ARRAY_SIZE
which is missing when building with debug mode
2018-07-10 01:06:57 +07:00
hathach
c5089d7274 generate uf2 by default
update tusb
2018-07-10 01:02:33 +07:00
Dan Halbert
64b9ee9c74
Merge pull request #985 from tannewt/heap_tweaks3
A few heap related tweaks
2018-07-08 23:21:38 -04:00
Scott Shawcroft
a45659c59a
Merge pull request #1000 from arturo182/nrfx_uart
nrf: Rewrite the UART HAL using nRFx
2018-07-08 20:17:47 -07:00
Scott Shawcroft
133b99b6f2
Merge pull request #999 from arturo182/nrf_mphalport
nrf: mphalport cleanup
2018-07-08 20:13:21 -07:00
Scott Shawcroft
fd5634e4aa
Merge pull request #992 from arturo182/nrf_i2c_fix
nrf: Fix I2C transfers with data larger than HW allows
2018-07-08 20:12:09 -07:00
arturo182
388f554ff6 nrf: Rewrite the DigitalInOut hal using nRFx 2018-07-08 17:48:32 +02:00
arturo182
25ece8fb3d nrf: Rewrite the UART HAL using nrfx 2018-07-08 16:42:04 +02:00
arturo182
c6a2a55bc9 nrf: Cleanup mpconfigboard files
All the removed defines were used by legacy modules that are now
removed.
2018-07-08 15:18:11 +02:00
arturo182
887486582e nrf: Remove port-specific help
It contains mentions to the pyb module which was removed.
The ble-specific help will be re-added later when the API
is stabilized.
2018-07-08 15:18:11 +02:00
arturo182
1ea633c484 nrf: mphalport cleanup 2018-07-08 14:39:30 +02:00
arturo182
da27253693 nrf: Fix I2C transfers with data larger than HW allows 2018-07-06 21:12:24 +02:00
arturo182
ac74edb4e4 nrf: Fix SPI transfers with data larger than HW allows 2018-07-06 21:10:25 +02:00
hathach
baf68a936e remove hal_time files 2018-07-06 15:59:20 +07:00
hathach
3e319694aa mp_hal_delay_ms() to call background task
remove hal_time.c
2018-07-06 15:48:01 +07:00
hathach
948ddf8463 make SD default to s140 and s132 for nrf52840 and nrf52832
add CFG_HWUART_FOR_SERIAL for using jlink as REPL
2018-07-06 14:39:49 +07:00
hathach
6ef3a0b181 implement filesystem_writable_by_python() 2018-07-06 13:01:07 +07:00
hathach
0806c0a38b update fatfs cached sector when running write10 2018-07-05 17:43:38 +07:00
hathach
4e5d9a029d clean up 2018-07-05 17:26:07 +07:00
hathach
0365912e28 implement msc with internal_flash api
Note: only work with SD is disabled.
2018-07-05 16:19:04 +07:00
hathach
3564e98181 implement msc flash, seems to work 2018-07-05 15:22:23 +07:00
hathach
1745e20391 replace jlink with native usb cdc for serial REPL 2018-07-05 11:30:12 +07:00
hathach
be2ff20e42 enable usb cdc interface
not handle anything yet.
2018-07-04 17:15:49 +07:00
hathach
7fff7f5e70 add usb msc support for nrf52840 2018-07-04 16:40:53 +07:00
Scott Shawcroft
8fb976f0bd
Split out assembly source files. 2018-07-03 07:25:54 -07:00
Scott Shawcroft
dbc977485c
Support gathering register values on nrf. 2018-07-03 06:31:07 -07:00
hathach
46c453cf0a add tinyusb as submodule 2018-07-03 17:46:08 +07:00
hathach
b14b28067e Merge branch 'master' into nrf52840_usbboot 2018-07-03 17:29:28 +07:00
Scott Shawcroft
b91202969a
Merge pull request #982 from arturo182/nrf_makefile
nrf: Save some flash bytes by using extra compile flags
2018-07-02 14:33:47 -07:00
Scott Shawcroft
05a088b369
Merge pull request #972 from arturo182/nrf_i2c
nrf: Rewrite the I2C common-hal using nrfx
2018-07-02 14:33:06 -07:00
arturo182
da491ec961 nrf: Save some flash bytes by using extra compile flags
Both of these are used in the atsamd port as well.
2018-07-02 22:00:04 +02:00
Dan Halbert
7c9a0e2996 remove unnecessary extern in nrf/mphalport.c 2018-06-29 16:06:51 -04:00
Dan Halbert
2a0b857643 implement mp_hal_delay_us() to not need interrupts, and use it 2018-06-29 16:01:46 -04:00
Dan Halbert
b4fd77bb7c fix nrf and esp8266 builds for OneWire fix 2018-06-29 00:00:05 -04:00
Dan Halbert
52a11547cb fix OneWire timing and DigitalInOut.switch_to_input() 2018-06-28 23:32:20 -04:00
Scott Shawcroft
429168d4ac
Merge pull request #970 from arturo182/nrf_softdev
nrf: Remove unsupported softdevice defines
2018-06-28 14:01:19 -07:00
Scott Shawcroft
007155276a
Merge pull request #969 from arturo182/nrf_more_commonhal
nrf: Rewrite more common-hal with nrfx and sync with atsamd port
2018-06-28 14:00:45 -07:00
Scott Shawcroft
039b4dc00a
Merge pull request #968 from arturo182/nrf_qstr
nrf: Remove old qstr defines
2018-06-28 13:57:46 -07:00
Scott Shawcroft
ae82a93b56
Merge pull request #967 from arturo182/nrf_os
nrf: Rewrite the os common-hal using nrfx
2018-06-28 13:55:34 -07:00
arturo182
178c089045 nrf: Rewrite the I2C common-hal using nrfx 2018-06-28 22:45:02 +02:00
arturo182
6e6a500801 nrf: Rewrite the os common-hal using nrfx 2018-06-27 21:01:07 +02:00
arturo182
af5cb9c492 nrf: Remove unneeded hal files 2018-06-27 21:00:34 +02:00
arturo182
b87bba8a28 nrf: Rewrite more common-hal with nrfx and sync with atsamd port 2018-06-27 20:55:29 +02:00
arturo182
1fa8fac5d7 nrf: Remove old qstr defines
These were used by the microbit music module, which was removed.
2018-06-27 20:52:13 +02:00
arturo182
b9f02ca3c5 nrf: Remove unsupported softdevice defines 2018-06-27 20:48:57 +02:00
arturo182
2a12fcd18b nrf: Rewrite the AnalogIn common-hal using nrfx 2018-06-27 20:41:30 +02:00
hathach
c4f11dfd32 flash target update bootloader setting to skip crc checksum 2018-06-27 15:22:44 +07:00
hathach
8fbe1d73e9 clean up makefile 2018-06-27 15:13:20 +07:00
hathach
4920cc47ca move dfu-gen dfu-flash dfu-bootloader bootloader uf2 target to common Makefile since several board use it 2018-06-27 14:31:08 +07:00
hathach
bed7310fd7 update bin files 2018-06-27 14:13:18 +07:00
hathach
ecd3993d43 update pin map for feather52840 2018-06-27 14:06:15 +07:00
Scott Shawcroft
91427b0b23
Merge pull request #959 from arturo182/nrf_spim
nrf: Rewrite the SPI common-hal using nrfx
2018-06-26 11:00:12 -07:00
Scott Shawcroft
d7d132d5a3
Merge pull request #960 from arturo182/nrf_stm_cleanup
nrf: Remove leftovers from stm32 code copy
2018-06-26 10:52:04 -07:00
arturo182
16973d0559 nrf: Remove unused hal files
Makes it easier to keep track of what's left to rewrite.
2018-06-26 00:13:41 +02:00
arturo182
2f1e678d60 nrf: Rewrite the SPI common-hal using nrfx
Use SPIM2 on nRF52832 and SPIM3 on nRF52840. SPIM3 is able to go
up to 32MHz!
2018-06-25 23:46:34 +02:00
arturo182
b14d13e318 nrf: Remove leftovers from stm32 code copy 2018-06-25 23:38:10 +02:00
hathach
8d065fe0e6 update reamde 2018-06-26 00:16:58 +07:00
hathach
54547683f9 add uf2, bootloader target 2018-06-25 23:31:14 +07:00
hathach
4722371be9 update bootloader hex with uf2 2018-06-25 23:27:00 +07:00
hathach
f5be5ed6ee Merge branch 'master' into nrf52840_usbboot 2018-06-25 17:12:24 +07:00
arturo182
596a1d8843 nrf: Rename feather52 to feather52832 in readme files 2018-06-22 10:04:39 +02:00
arturo182
25e71a56d4 nrf: Update the PCA10056 example to use new pin naming 2018-06-20 23:39:36 +02:00
arturo182
deec17e4fe nrf: Remove really old examples
These examples rely on machine and pyb modules, so they have to get.
Leaving 3 BLE examples that also rely on those modules, but can be
fixed to use CP's modules.
2018-06-20 23:38:18 +02:00
arturo182
9c08db55ff nrf: Cleanup machine and microbit leftovers
The music module was useful when this port had support for the
microbit, now that it was removed, it's not so useful.
2018-06-20 23:30:34 +02:00
arturo182
c2d4d0a10b nrf: Simplify pin generation and definition
This commit cleans up the pin generation code, all the pins and their
AF (only ADC, for now) are specified in nrf52_af.csv and board use their
own csv file to specify which pins are available on that board and if
they have any special names.
2018-06-20 23:26:32 +02:00
arturo182
ff918556cd nrf: Simplify the board makefiles
With the only difference between a SD and non-SD build is the linker
file, there's no need to have two separate .mk per board files,
just use a conditional.
2018-06-20 21:21:45 +02:00
arturo182
5509f394dc nrf: Add a nrfx submodule and prepare for using the new drivers 2018-06-20 20:43:59 +02:00
arturo182
7cd34f2a94 nrf: Cleanup Makefile after nrf51 removal 2018-06-20 18:21:18 +02:00
arturo182
97f10241f9 nrf: Fix default board after feather52 rename 2018-06-20 18:21:18 +02:00
arturo182
b47a67d566 nrf: Remove machine, pyb and utime modules
Micropython legacy, keeping it consistent with atsam port.
2018-06-20 18:21:18 +02:00
hathach
61437106e7 update bootloader for feather nrf52840 2018-06-19 15:27:07 +07:00
hathach
6d2702ed98 Merge branch 'master' into nrf52840_usbboot 2018-06-19 14:50:17 +07:00
Scott Shawcroft
4e7eee3553
Merge pull request #946 from arturo182/nrf_sd6
nrf: Use the production version of s140 6.0.0
2018-06-18 16:29:41 -07:00
arturo182
feee808955 nrf: Use the production version of s140 6.0.0 2018-06-18 23:12:28 +02:00
Scott Shawcroft
05547b72ac Switch to Feather52s full name to avoid confusion with the nrf52840 later.
Fixes #940
2018-06-18 10:51:04 -07:00
Limor "Ladyada" Fried
9fc0ec6af8
Merge pull request #934 from microbuilder/usbboot
[WIP] nRF52840 USB Bootloader
2018-06-15 09:35:30 -07:00
hathach
35d38dbfed update nrf52840 bootloader hex 2018-06-13 17:27:55 +07:00
jerryneedell
8150150a24
return "false" for stub call
See #918 for discussion
2018-06-10 07:11:44 -04:00
Scott Shawcroft
8195df1b55 Stub out get_paused in nrf builds. 2018-06-08 14:01:54 -07:00
hathach
418e28c7dc update nrf52840 bootloader hex and target 2018-06-08 16:10:49 +07:00
hathach
2b3436e87c add feather nrf52 uart rts, cts support 2018-06-08 15:59:38 +07:00
hathach
c10899d13f allow to flash feather52 and feather52840 with jlink
add crc bypass magic to bootloader settting
2018-06-08 15:11:17 +07:00
hathach
c854e2dc17 Merge branch 'master' into usbboot 2018-06-07 13:51:21 +07:00
hathach
9bb4ded5fa Merge remote-tracking branch 'upstream/master' 2018-06-07 13:50:04 +07:00
Matt Wozniski
d0e6bb269f Use the system errno's on nrf 2018-06-02 12:55:07 -04:00
Radomir Dopieralski
d02899f822 Add gamepad_singleto to root pointers for the nrf port 2018-05-30 23:11:23 +02:00
hathach
6d4a2f5524 Merge branch 'master' into usbboot 2018-05-17 15:23:45 +07:00
hathach
52ebfd07a5 update nrfutil to 0.5.2d with singlebank option 2018-05-17 15:20:07 +07:00
Kevin Townsend
78f806c891 Added board specific READMEs 2018-05-15 22:42:27 +02:00
hathach
53593d1315 fix #809
define CIRCUITPY_BOOT_OUTPUT_FILE will cause mp_hal_stdout_tx_strn() to
invoke before serial_init() is called. Solution is skipped output to
serial if it is not inited.
2018-05-15 18:40:49 +07:00
hathach
05f36ebeb1 update the bootloader hex for feather52840 2018-05-15 16:06:03 +07:00
hathach
dadf831fe9 Merge branch 'usbboot' of github.com:microbuilder/circuitpython into usbboot 2018-05-15 13:33:53 +07:00
hathach
5365e51e39 Merge branch 'master' into usbboot 2018-05-15 13:29:25 +07:00
Jerry Needell
d6c26942a5 add timeout keyword to I2C - for bitbangio - ignored for busio 2018-05-13 21:54:44 -04:00
Scott Shawcroft
ce5eae1c76
Merge pull request #761 from jepler/nrf-modules
nrf: Enable binascii, hashlib modules
2018-05-11 19:40:45 -07:00
Jeff Epler
471fdae993 nrf: Enable binascii, hashlib modules
These modules would be very handy to have in order to implement a
more robust replacement for ampy.  It costs around 2KiB of text and
no data or bss.

'binascii' has base64 encoding, which can be used to create a fully
8-bit-clean transport above the slightly cooked serial connection of
these boards.

'hashlib' is a bit less critical, but I have found it handy to
be able to robustly checksum remote files.

I see this as only being useful on ports which don't have USB block
device support, so atmel-samd doesn't need it.  These modules are
already on esp8266 so I think nrf52 seems like the only one that
needs it.
2018-05-11 07:41:09 -05:00
Jeff Epler
2acd5d88b6 nrf52: enable framebuf module
Closes: #656
2018-05-10 18:37:08 -05:00
jerryneedell
b617271191
Update mpconfigport.h
comment out define of CIRCUITPYTHON_BOOT_OUTPUT_FILE  for NRF52  --  it does not work properly
2018-05-07 08:59:24 -04:00
Kevin Townsend
d0e00d7fbe
Added built to example 2018-04-23 20:01:53 +02:00
Kevin Townsend
0de8697315
Added note on USB CDC bootloader 2018-04-23 19:58:29 +02:00
hathach
ce9f05f91b add missing files 2018-04-24 00:51:44 +07:00
hathach
50e7a4caa8 add bootloader hex 2018-04-24 00:19:04 +07:00
ladyada
926849d7a8 don't use python nrfutil on windows, it doesnt work :/ tested feather52 makefile on windows/mingw 2018-04-13 14:00:20 -04:00
ladyada
ce6b94f5e2 deal with spaces in directories 2018-04-12 21:43:23 -04:00
Dan Halbert
5f98953ed8 esp8266 and nrf: raise NotImplementedError 2018-04-10 12:08:41 -04:00
sommersoft
6ee573c7c9
Merge branch 'master' into super_status 2018-03-30 14:27:39 -05:00
Jeff Epler
abec199c19 Enable high-quality float hash
This appears to have a relatively small impact on flash usage but
fixes some pathological slow behavior putting floats in dicts or sets.

Closes: #704
2018-03-27 21:56:30 -05:00
Dan Halbert
4190aa2eed
Merge pull request #715 from jepler/array-operation-restrictions-bis
Remove 'O', 'P' support in arrays
2018-03-26 20:01:34 -04:00
Jeff Epler
355bf8b553 Conditionally compile out nonstandard array/struct typecodes
.. defaulting to off for circuitpython-supported boards, on for others.

.. fixing up the tests that fail when it is turned off, so that they skip
instead of failing
2018-03-26 18:13:49 -05:00
Jeff Epler
c0029e1d97 Don't lose half of the processor's serial number
Before this change, `microcontroller.cpu.uid` returned values
where the top 4 bits of each byte were zero, because of
an incorrect bitmask used in this function.
2018-03-25 13:01:04 -05:00
sommersoft
8c9cc6b7c0 nrf: changed Status to Runtime; instituted runtime singleton 2018-03-10 01:07:17 +00:00
Dan Halbert
5f101f3535 Add dummy UART implementation to nrf so it builds with UART turned on. Also add OneWire. 2018-02-21 22:53:17 -05:00
sommersoft
5de8df7997 added Status submodule to ports/nrf/common-hal/supervisor; issue #544 2018-02-19 22:27:16 +00:00
Kevin Townsend
fce0b0858f Removed leftover build option 2018-02-15 21:46:14 +01:00
Kevin Townsend
10497d1db0 Update for style consistency 2018-02-15 21:44:05 +01:00
Kevin Townsend
6544f4cb5c Cleanup minor typos 2018-02-15 21:42:24 +01:00
Kevin Townsend
da15053e0a Fixed pin P0_00 2018-02-15 21:41:21 +01:00
Kevin Townsend
d4356f9416 Added second 'P0_00' 2018-02-15 17:00:58 +01:00
Kevin Townsend
cd7baed14d Added note nrfutil and flashing 2018-02-15 16:00:34 +01:00
Kevin Townsend
70596b6641 Added note on MSDDisable 2018-02-15 15:51:10 +01:00
hathach
f989db25b5 more bootloader feather52840 update 2018-02-15 21:43:27 +07:00
hathach
2e0edd5a63 Merge branch 'nrf52840' of github.com:microbuilder/circuitpython into nrf52840 2018-02-15 15:19:47 +07:00
hathach
2c9cd38547 update bootloader for feather52840 2018-02-15 15:12:30 +07:00
Kevin Townsend
0981c579f0 Fixed pin names 2018-02-13 18:26:28 +01:00
Kevin Townsend
b65e97bdb3 Update pin names 2018-02-13 18:17:31 +01:00
Kevin Townsend
5160dda473 Merge branch 'master' into nrf52840 2018-02-13 18:13:47 +01:00
Kevin Townsend
7b1cc9985b Merge branch 'master' of github.com:adafruit/circuitpython 2018-02-13 18:11:20 +01:00
Kevin Townsend
fac488fbf8
Merge pull request #617 from arturo182/nrf_gpio_cleanup
nrf: Change pin names on DKs to match silkscreen
2018-02-13 17:54:25 +01:00
Kevin Townsend
283be4f58e Added note on installing nrfutil 2018-02-13 11:55:24 +01:00
Kevin Townsend
7b6d1052d9 Improved README 2018-02-13 11:50:51 +01:00
Kevin Townsend
6a8bafc91b Updated FATFS to 256KB 2018-02-13 11:50:29 +01:00
Kevin Townsend
fc28fc4f0b Added notes on flashing bootloader 2018-02-13 11:26:10 +01:00
Kevin Townsend
4745272d6c Added feather52840 readme 2018-02-13 09:34:09 +01:00
Kevin Townsend
76eacad27b
Updated board detection macro 2018-02-13 08:52:17 +01:00
Kevin Townsend
9f1cd41d77
Update to S140 2018-02-13 08:44:35 +01:00
Kevin Townsend
d2b8ae66cb
Update mpconfigboard.h 2018-02-13 08:42:44 +01:00