[usb] Leave DFU mode on Back key press.

Change-Id: Icd031097f678a19729f12453db18cac2e08c6f05
This commit is contained in:
Léa Saviot
2018-03-21 17:15:16 +01:00
parent 15001c37da
commit c96ef84139
2 changed files with 6 additions and 1 deletions

View File

@@ -33,6 +33,8 @@ usb_objs += liba/src/memset.o
usb_objs += liba/src/memcpy.o
usb_objs += libaxx/src/cxxabi/pure_virtual.o
usb_objs += ion/src/device/usb/boot.o
usb_objs += ion/src/device/keyboard.o
usb_objs += ion/src/device/device.o
ion/src/device/usb/dfu.elf: LDFLAGS = --gc-sections -T ion/src/device/boot/dfu.ld
ion/src/device/usb/dfu.elf: $(usb_objs)

View File

@@ -1,5 +1,6 @@
#include "calculator.h"
#include "../regs/regs.h"
#include <ion/keyboard.h>
namespace Ion {
namespace USB {
@@ -11,7 +12,9 @@ void Calculator::Poll() {
}
Calculator c;
while (true) {
// Leave DFU mode when pressing the Back key.
// TODO also leave on detach or when unplugging
while (!Ion::Keyboard::scan().keyDown(Ion::Keyboard::Key::A6)) {
c.poll();
}
}