Open DaveAtKitronik opened 3 years ago
I suggest to change the pin drive strength by writing directly to nRF GPIO registers, using machine.mem32
.
The equivalent C code to set high drive is:
uint32_t s = PORT->PIN_CNF[PIN] & 0xfffff8ff;
s |= 3 << 8;
PORT->PIN_CNF[PIN] = s;
Here's a function that should be able to set the high drive on a pin (I've not tested it though):
def set_high_drive(port_id, pin_id):
addr = 0x5000_0000 + port_id * 0x300 + 0x700 + pin_id * 4
machine.mem32[addr] = (machine.mem32[addr] & 0xffff_f8ff) | 3 << 8
For P0.00 to P0.31 use port_id=0
, for P1.00 to P1.15 use port_id=1
.
Reported by a customer - the ZIP64 does not function correctly with microPython on a V2 microbit. This is the same as a resolved issue in makecode. (https://github.com/microsoft/pxt-microbit/issues/3825).
We added:
if MICROBIT_CODAL
endif
in a c++ shim to fix it there. Not sure where a fix would be applied in microPython - to the neopixel code (baked in), or to just expose the ability to change the pin drive strength from the python code