Skip to content

Commit 69b381e

Browse files
committed
XiaoBLE: Skip boot js when pulling pin D1 high
1 parent 5f4db2b commit 69b381e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

boards/XIAOBLE.py

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
# The board should automatically disconnect after copying is finished, and reboot into Espruino,
2525
# which turns on the red led for a short time after starting up.
2626

27+
# If you accidentally put some stuff in .boot0 that prevents you from interacting with Espruino:
28+
# Pull pin D1 to 3.3 V / high (important: make sure you use 3.3 V; higher voltages may cause damage) and reset the board,
29+
# by either pressing the reset button or cutting the power and powering it up again.
30+
# This behaviour is archived by configuring pin D1 as BTN1.
31+
2732
import pinutils
2833
info = {
2934
"name": "Seeed Xiao BLE",
@@ -87,6 +92,7 @@
8792
"LED1": {"pin": "D11"},
8893
"LED2": {"pin": "D13"},
8994
"LED3": {"pin": "D12"},
95+
"BTN1": {"pin": "D1", "pinstate" : "IN_PULLDOWN"},
9096
"BAT": {
9197
"pin_charging": "D23",
9298
"pin_voltage": "D32",

src/jsflash.c

+7
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,9 @@ bool jsfLoadBootCodeFromFlash(bool isReset) {
13811381
#else
13821382
if (!(jshPinGetValue(BTN1_PININDEX)==BTN1_ONSTATE))
13831383
#endif
1384+
#endif
1385+
#if defined(XIAOBLE)
1386+
if (!(jshPinGetValue(BTN1_PININDEX)==BTN1_ONSTATE))
13841387
#endif
13851388
if (jsiStatus & JSIS_FIRST_BOOT) {
13861389
JsVar *code = jsfReadFile(jsfNameFromString(".bootPowerOn"),0,0);
@@ -1398,6 +1401,10 @@ bool jsfLoadBootCodeFromFlash(bool isReset) {
13981401
if (!(jshPinGetValue(BTN1_PININDEX)==BTN1_ONSTATE &&
13991402
(jsiStatus & JSIS_FIRST_BOOT)))
14001403
#endif
1404+
#endif
1405+
#if defined(XIAOBLE)
1406+
if (!(jshPinGetValue(BTN1_PININDEX)==BTN1_ONSTATE &&
1407+
(jsiStatus & JSIS_FIRST_BOOT)))
14011408
#endif
14021409
{
14031410
char filename[7] = ".bootX";

0 commit comments

Comments
 (0)