You can turn SPI/I2C/Serial off just by setting the pins to other things - then it'll happen automatically.
Internally you can do jshPinSetState(pin, JSHPINSTATE_UNDEFINED); to disconnect the pin: https://github.com/espruino/Espruino/blob/master/targets/nrf5x/jshardware.c#L699
But I don't think that behaviour is exposed: https://github.com/espruino/Espruino/blob/master/src/jswrap_io.c#L389
So potentially a disconnected pin Mode could be added to the pinMode function pretty easily.
or perhaps the ADC input mode should instead not configure the pin as a digital input, but should configure it more like the 'undefined' state does? https://github.com/espruino/Espruino/blob/master/targets/nrf5x/jshardware.c#L731
© Espruino, powered by microcosm.
Report a problem