nrf: add support for threading
hi Micropython,
could you please add thread to nrf as some cusotmer in china need micropython support multi-thread function. currently, it is not supported on nrf51&52 platform.
my email is george.xiong@nordicsemi.no
thanks.
Best regards
george
ports/nrf: add support for time.ticks_ms()
The nordic port lacks support for a milisecond / microsecond tick
counter (and basically most of the time module functionality..).
The ms tick counter is needed by asyncio and prevents the usage
of this module, which is my primary design goal.
So I had a go and enabled the systick irq with 1msec resolution.
This enables the usage of a 32 bit counter rather than
on relying on the hw's systick timer 24bit width. But it does
add a bit of overhead. 32bit would overflow after 50 days - although
the pyhton return value might be restriceted to only 31 bits (?). 24 bits take app.
5h to overflow, which might be suitable too.
Inreasing the counter's width to 64bit would eliminate any overflow
handling on the python side, but may add some overhead on passing
this value from C to python (but I'm not sure how much).
Another option would have been to grab a separate HW timer unit, which could
probably be used in a better, power optimized manner and possibly
without irq's since they are 32bit width.
However I was reluctant to do this since for some MCU's a timer unit is precious.
So in summary, it was a surpring amount of factors to consider for
such a small change. Looking forward to some inputs/comments.