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
jshPinSetState(pin, JSHPINSTATE_UNDEFINED);
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.
disconnected
pinMode
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
@Gordon started
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.
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#L699But 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 thepinMode
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