For the STM32 based boards, there's a module "stm", that allows direct access to processor registers.
Is there something like this also for the nrf port?
If not, where should I start to write one?
[nrf52] Module for register definitions like "stm"
Re: [nrf52] Module for register definitions like "stm"
You can easily develop such support for any processor using uctypes module (http://docs.micropython.org/en/latest/l ... types.html). Here's updated docs with some examples: https://pycopy.readthedocs.io/en/latest ... types.html
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Re: [nrf52] Module for register definitions like "stm"
You can also add support for machine_mem.
You'd need to add these 3 lines:
https://github.com/micropython/micropyt ... #L485-L487
to this file:
https://github.com/micropython/micropyt ... ine.c#L190
and then you'd have the mem8, mem16, and mem32 accessors available. You'll still need to define constants for all of the registers you want to access, but that would be needed whether you use this approach or the uctypes approach that @pfalcon mentioned.
You'd need to add these 3 lines:
https://github.com/micropython/micropyt ... #L485-L487
to this file:
https://github.com/micropython/micropyt ... ine.c#L190
and then you'd have the mem8, mem16, and mem32 accessors available. You'll still need to define constants for all of the registers you want to access, but that would be needed whether you use this approach or the uctypes approach that @pfalcon mentioned.
Re: [nrf52] Module for register definitions like "stm"
Would you like to add that officially?
Re: [nrf52] Module for register definitions like "stm"
Regarding the OP, machine.mem32[...] works great and is definitely the way to go: viewtopic.php?f=12&t=5377