mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Move button state setup to jshResetDevices
This commit is contained in:
parent
a1eb7febd2
commit
33cfbef6e6
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user