Move button state setup to jshResetDevices

This commit is contained in:
Gordon Williams 2016-11-09 12:18:56 +00:00 committed by Rhys.Williams
parent a1eb7febd2
commit 33cfbef6e6
3 changed files with 11 additions and 11 deletions

View File

@ -48,6 +48,7 @@
Fix micro:bit/nRF51 ctrl-c behaviour (fix #905)
Simplified process.env on devices with little memory
nRF5x: fixed serial number reporting
Move button state setup to jshResetDevices
1v87 : Add support for compiling with float-abi=hard (even if it doesn't give us real-world benefits)
Add shortcut for quick execution of common call types

View File

@ -82,10 +82,18 @@ void jshResetDevices() {
for (i=0;i<sizeof(jshSerialDeviceStates) / sizeof(JshSerialDeviceState);i++)
jshSerialDeviceStates[i] = SDS_NONE;
jshSerialDeviceStates[TO_SERIAL_DEVICE_STATE(EV_USBSERIAL)] = SDS_FLOW_CONTROL_XON_XOFF;
// set up callbacks for events
// reset callbacks for events
for (i=EV_EXTI0;i<=EV_EXTI_MAX;i++)
jshEventCallbacks[i-EV_EXTI0] = 0;
// Reset pin state for button
#ifdef BTN1_PININDEX
#ifdef BTN1_PINSTATE
jshSetPinStateIsManual(BTN1_PININDEX, true); // so subsequent reads don't overwrite the state
jshPinSetState(BTN1_PININDEX, BTN1_PINSTATE);
#else
jshPinSetState(BTN1_PININDEX, JSHPINSTATE_GPIO_IN);
#endif
#endif
}
// ----------------------------------------------------------------------------

View File

@ -1039,15 +1039,6 @@ static void jshResetPeripherals() {
#endif
jshUSARTSetup(DEFAULT_CONSOLE_DEVICE, &inf);
}
// initialise button state
#ifdef BTN1_PININDEX
#ifdef BTN1_PINSTATE
jshSetPinStateIsManual(BTN1_PININDEX, true); // so subsequent reads don't overwrite the state
jshPinSetState(BTN1_PININDEX, BTN1_PINSTATE);
#else
jshPinSetState(BTN1_PININDEX, JSHPINSTATE_GPIO_IN);
#endif
#endif
}
void jshInit() {