From 618b79f20744eab9a3d9a7343c5d65206fe2b55b Mon Sep 17 00:00:00 2001 From: Sven Willner Date: Wed, 5 Aug 2020 15:37:55 +0200 Subject: [PATCH] Bypass auto-boot when doing a nerve pinch --- sw/src/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sw/src/main.c b/sw/src/main.c index c264799..932a47c 100644 --- a/sw/src/main.c +++ b/sw/src/main.c @@ -11,6 +11,8 @@ struct ff_spi *spi; +static int nerve_pinch(void); + // ICE40UP5K bitstream images (with SB_MULTIBOOT header) are // 104250 bytes. The SPI flash has 4096-byte erase blocks. // The smallest divisible boundary is 4096*26. @@ -27,7 +29,7 @@ void isr(void) if (irqs & (1 << TIMER0_INTERRUPT)) { timer0_ev_pending_write(timer0_ev_pending_read()); - if (dfu_getstate() == dfuIDLE) { + if (dfu_getstate() == dfuIDLE && !nerve_pinch()) { reboot(); while (1) ;