Project template for hardware wallet workshop

Dependencies:   mbed QSPI_DISCO_F469NI BSP_DISCO_F469NI

Revision:
2:8b42ea8491ae
Parent:
1:6fea6c7dce1c
Child:
3:f9462bf83c56
--- a/main.cpp	Tue Jul 30 19:29:37 2019 +0000
+++ b/main.cpp	Wed Jul 31 12:22:15 2019 +0000
@@ -191,9 +191,11 @@
 
 static lv_res_t newMnemonicCallback(lv_obj_t * btn){
     string mnemonic = generateNewMnemonic();
-    saveMnemonic(mnemonic);
-    showMessage("Write down your recovery phrase:", mnemonic);
-    initKeys(mnemonic);
+    if(mnemonic.length() > 0){
+        saveMnemonic(mnemonic);
+        showMessage("Write down your recovery phrase:", mnemonic);
+        initKeys(mnemonic);
+    }
     return LV_RES_OK;
 }
 
@@ -397,6 +399,11 @@
     return LV_RES_OK;
 }
 
+static lv_res_t showInitScreenCallback(lv_obj_t * btn){
+    showInitScreen();
+    return LV_RES_OK;
+}
+
 static lv_res_t enterMnemonicCallback(lv_obj_t * btn){
     gui.clear();
     mnemonic = "";
@@ -415,7 +422,11 @@
     kb.position(0, gui.height()*2/3-150);
 
     Button btnx(checkMnemonicCallback, "Continue");
-    btnx.size(gui.width()-100, 80);
-    btnx.position(50, gui.height()-100);
+    btnx.size(gui.width()/2-45, 80);
+    btnx.position(30+gui.width()/2, gui.height()-100);
+
+    Button btny(showInitScreenCallback, "Back");
+    btny.size(gui.width()/2-45, 80);
+    btny.position(30, gui.height()-100);
     return LV_RES_OK;
 }