The implication here is that it's not just the clock output pin, but all of them. Generally to set a pin to unused, you set all the bits in the register to 1, so it's probably no coincidence that the 31 from D31 is binary 11111.
I've just had a go at setting the outputs to other things, but with no success so far. So I'm afraid, at the moment, you'll just have to assume that pin D31 can't be used when you're using Neopixels.
I'll file an issue for this though and will see if anything can be done about it.
Just to confirm - if I e.g. set watch to LED and then try to lit it, it does not lit. That's probably because a watch blocks output pinMode, right?
Yes, that's right - you can probably change it by manually calling pinMode, but by default setWatch would change the pin state to an input.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi! Thanks for this - I can confirm it's the same for me too.
HOWEVER if you're using the latest 2v09 firmware, it doesn't crash unless you short D31 to something (but you do get pin state change events).
You can't use pin D22 since that has to be used as a clock output (it can't be disabled).
However, it seems that the hardware issue of not being able to disable pins is much wider spread than I thought: https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52832_Rev2%2FERR%2FnRF52832%2FRev2%2Flatest%2Ferr_832.html
The implication here is that it's not just the clock output pin, but all of them. Generally to set a pin to unused, you set all the bits in the register to 1, so it's probably no coincidence that the 31 from D31 is binary 11111.
I've just had a go at setting the outputs to other things, but with no success so far. So I'm afraid, at the moment, you'll just have to assume that pin D31 can't be used when you're using Neopixels.
I'll file an issue for this though and will see if anything can be done about it.
Yes, that's right - you can probably change it by manually calling
pinMode
, but by default setWatch would change the pin state to an input.