Skip to content

Commit baf491f

Browse files
author
m19936
committed
Added software reset to SW1 in sandbox
1 parent d71c25d commit baf491f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

examples/sandbox/sandbox.ino

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ ISR(PORTD_PORT_vect) {
9191
}
9292
}
9393

94+
ISR(PORTF_PORT_vect) {
95+
if (PORTF.INTFLAGS & PIN6_bm) {
96+
asm("jmp 0");
97+
PORTF.INTFLAGS = PIN6_bm;
98+
}
99+
}
100+
94101
void connectedToNetwork(void) { event_flags |= NETWORK_CONN_FLAG; }
95102
void disconnectedFromNetwork(void) { event_flags |= NETWORK_DISCONN_FLAG; }
96103
void connectedToBroker(void) { event_flags |= BROKER_CONN_FLAG; }
@@ -261,6 +268,8 @@ void handleSerialCommand(const char *instruction, uint16_t instructionLen) {
261268
}
262269
} else if (strcmp(cmd, "heartbeat") == 0) {
263270
event_flags |= SEND_HEARTBEAT_FLAG;
271+
} else if (strcmp(cmd, "reset") == 0) {
272+
asm("jmp 0");
264273
} else {
265274
Log.info("\nInvalid command");
266275
printHelp();
@@ -277,6 +286,11 @@ void setup() {
277286
// Set PD2 as input (button)
278287
pinConfigure(PIN_PD2, PIN_DIR_INPUT | PIN_INT_FALL);
279288

289+
// Set PF6 as input (reset button)
290+
pinConfigure(PIN_PF6, PIN_DIR_INPUT | PIN_INT_FALL);
291+
292+
sei();
293+
280294
Log.infof("Starting sandbox / landing page procedure. Version = %s\r\n",
281295
SANDBOX_VERSION);
282296

0 commit comments

Comments
 (0)