Struan Clark 2 лет назад
Родитель
Сommit
81b9e2035f
41 измененных файлов с 661 добавлено и 661 удалено
  1. 3 3
      application.fam
  2. 110 0
      flipbip.c
  3. 61 0
      flipbip.h
  4. 0 110
      flipbip39.c
  5. 0 61
      flipbip39.h
  6. 0 0
      flipbip_10px.png
  7. 0 22
      helpers/flipbip39_custom_event.h
  8. 0 8
      helpers/flipbip39_haptic.h
  9. 0 6
      helpers/flipbip39_led.h
  10. 0 4
      helpers/flipbip39_speaker.h
  11. 0 2
      helpers/flipbip39_string.h
  12. 22 0
      helpers/flipbip_custom_event.h
  13. 8 8
      helpers/flipbip_haptic.c
  14. 8 0
      helpers/flipbip_haptic.h
  15. 6 6
      helpers/flipbip_led.c
  16. 6 0
      helpers/flipbip_led.h
  17. 6 6
      helpers/flipbip_speaker.c
  18. 4 0
      helpers/flipbip_speaker.h
  19. 4 4
      helpers/flipbip_string.c
  20. 2 0
      helpers/flipbip_string.h
  21. 0 30
      scenes/flipbip39_scene.c
  22. 0 5
      scenes/flipbip39_scene_config.h
  23. 0 53
      scenes/flipbip39_scene_scene_2.c
  24. 0 54
      scenes/flipbip39_scene_startscreen.c
  25. 30 0
      scenes/flipbip_scene.c
  26. 8 8
      scenes/flipbip_scene.h
  27. 5 0
      scenes/flipbip_scene_config.h
  28. 20 20
      scenes/flipbip_scene_menu.c
  29. 19 19
      scenes/flipbip_scene_scene_1.c
  30. 53 0
      scenes/flipbip_scene_scene_2.c
  31. 31 31
      scenes/flipbip_scene_settings.c
  32. 54 0
      scenes/flipbip_scene_startscreen.c
  33. 0 19
      views/flipbip39_scene_1.h
  34. 0 19
      views/flipbip39_scene_2.h
  35. 0 19
      views/flipbip39_startscreen.h
  36. 43 43
      views/flipbip_scene_1.c
  37. 19 0
      views/flipbip_scene_1.h
  38. 69 69
      views/flipbip_scene_2.c
  39. 19 0
      views/flipbip_scene_2.h
  40. 32 32
      views/flipbip_startscreen.c
  41. 19 0
      views/flipbip_startscreen.h

+ 3 - 3
application.fam

@@ -1,15 +1,15 @@
 App(
     appid="FlipBIP",
-    name="BIP39 Tool",
+    name="BIP32/39/44 Tool",
     apptype=FlipperAppType.EXTERNAL,
-    entry_point="flipbip39_app",
+    entry_point="flipbip_app",
     cdefines=["APP_FLIPBIP"],
     requires=[
         "gui",
     ],
     stack_size=2 * 1024,
     order=10,
-    fap_icon="flipbip39_10px.png",
+    fap_icon="flipbip_10px.png",
     fap_icon_assets="icons",
     fap_category="Misc",
 )

+ 110 - 0
flipbip.c

@@ -0,0 +1,110 @@
+#include "flipbip.h"
+
+bool flipbip_custom_event_callback(void* context, uint32_t event) {
+    furi_assert(context);
+    FlipBip* app = context;
+    return scene_manager_handle_custom_event(app->scene_manager, event);
+}
+
+void flipbip_tick_event_callback(void* context) {
+    furi_assert(context);
+    FlipBip* app = context;
+    scene_manager_handle_tick_event(app->scene_manager);
+}
+
+//leave app if back button pressed
+bool flipbip_navigation_event_callback(void* context) {
+    furi_assert(context);
+    FlipBip* app = context;
+    return scene_manager_handle_back_event(app->scene_manager);
+}
+
+FlipBip* flipbip_app_alloc() {
+    FlipBip* app = malloc(sizeof(FlipBip));
+    app->gui = furi_record_open(RECORD_GUI);
+    app->notification = furi_record_open(RECORD_NOTIFICATION);
+    
+    //Turn backlight on, believe me this makes testing your app easier
+    notification_message(app->notification, &sequence_display_backlight_on);
+
+    //Scene additions
+    app->view_dispatcher = view_dispatcher_alloc();
+    view_dispatcher_enable_queue(app->view_dispatcher);
+
+    app->scene_manager = scene_manager_alloc(&flipbip_scene_handlers, app);
+    view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
+    view_dispatcher_set_navigation_event_callback(app->view_dispatcher, flipbip_navigation_event_callback);
+    view_dispatcher_set_tick_event_callback(app->view_dispatcher, flipbip_tick_event_callback, 100);
+    view_dispatcher_set_custom_event_callback(app->view_dispatcher, flipbip_custom_event_callback);
+    app->submenu = submenu_alloc();
+
+    app->haptic = 1;
+    app->speaker = 1;
+    app->led = 1;
+    app->bip39_strength = 2; // 256 bits (24 words)
+
+    view_dispatcher_add_view(app->view_dispatcher, FlipBipViewIdMenu, submenu_get_view(app->submenu));
+    app->flipbip_startscreen = flipbip_startscreen_alloc();
+    view_dispatcher_add_view(app->view_dispatcher, FlipBipViewIdStartscreen, flipbip_startscreen_get_view(app->flipbip_startscreen));
+    app->flipbip_scene_1 = flipbip_scene_1_alloc();
+    view_dispatcher_add_view(app->view_dispatcher, FlipBipViewIdScene1, flipbip_scene_1_get_view(app->flipbip_scene_1));
+    app->flipbip_scene_2 = flipbip_scene_2_alloc();
+    view_dispatcher_add_view(app->view_dispatcher, FlipBipViewIdScene2, flipbip_scene_2_get_view(app->flipbip_scene_2));
+    app->variable_item_list = variable_item_list_alloc();
+    view_dispatcher_add_view(app->view_dispatcher, FlipBipViewIdSettings, variable_item_list_get_view(app->variable_item_list));
+
+    //End Scene Additions
+
+    return app;
+}
+
+void flipbip_app_free(FlipBip* app) {
+    furi_assert(app);
+    
+    // Scene manager
+    scene_manager_free(app->scene_manager);
+
+    // View Dispatcher
+    view_dispatcher_remove_view(app->view_dispatcher, FlipBipViewIdMenu);
+    view_dispatcher_remove_view(app->view_dispatcher, FlipBipViewIdScene1);
+    view_dispatcher_remove_view(app->view_dispatcher, FlipBipViewIdScene2);
+    view_dispatcher_remove_view(app->view_dispatcher, FlipBipViewIdSettings);
+    submenu_free(app->submenu);
+
+    view_dispatcher_free(app->view_dispatcher);
+    furi_record_close(RECORD_GUI);
+    
+    app->gui = NULL;
+    app->notification = NULL;
+
+    //Remove whatever is left
+    free(app);
+}
+
+int32_t flipbip_app(void* p) {
+    UNUSED(p);
+    FlipBip* app = flipbip_app_alloc();
+    
+    // Disabled because causes exit on customer firmwares such as RM
+    /*if(!furi_hal_region_is_provisioned()) {
+        flipbip_app_free(app);
+        return 1;
+    }*/
+    
+    view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
+    
+    scene_manager_next_scene(app->scene_manager, FlipBipSceneStartscreen); //Start with start screen
+    //scene_manager_next_scene(app->scene_manager, FlipBipSceneMenu); //if you want to directly start with Menu
+
+    furi_hal_power_suppress_charge_enter();
+
+    view_dispatcher_run(app->view_dispatcher);
+    
+    furi_hal_power_suppress_charge_exit();
+    flipbip_app_free(app);
+
+    return 0;
+}
+
+
+

+ 61 - 0
flipbip.h

@@ -0,0 +1,61 @@
+#pragma once
+
+#include <furi.h>
+#include <furi_hal.h>
+#include <gui/gui.h>
+#include <input/input.h>
+#include <stdlib.h>
+#include <notification/notification_messages.h>
+#include <gui/view_dispatcher.h>
+#include <gui/modules/submenu.h>
+#include <gui/scene_manager.h>
+#include <gui/modules/variable_item_list.h>
+#include "scenes/flipbip_scene.h"
+#include "views/flipbip_startscreen.h"
+#include "views/flipbip_scene_1.h"
+#include "views/flipbip_scene_2.h"
+
+typedef struct {
+    Gui* gui;
+    NotificationApp* notification;
+    ViewDispatcher* view_dispatcher;
+    Submenu* submenu;
+    SceneManager* scene_manager;
+    VariableItemList* variable_item_list;
+    FlipBipStartscreen* flipbip_startscreen;
+    FlipBipScene1* flipbip_scene_1;
+    FlipBipScene2* flipbip_scene_2;
+    int haptic; 
+    int speaker;
+    int led;
+    int bip39_strength;
+} FlipBip;
+
+typedef enum {
+    FlipBipViewIdStartscreen,
+    FlipBipViewIdMenu,
+    FlipBipViewIdScene1,
+    FlipBipViewIdScene2,
+    FlipBipViewIdSettings,
+} FlipBipViewId;
+
+typedef enum {
+    FlipBipHapticOff,
+    FlipBipHapticOn,
+} FlipBipHapticState;
+
+typedef enum {
+    FlipBipSpeakerOff,
+    FlipBipSpeakerOn,
+} FlipBipSpeakerState;
+
+typedef enum {
+    FlipBipLedOff,
+    FlipBipLedOn,
+} FlipBipLedState;
+
+typedef enum {
+    FlipBipStrength128,
+    FlipBipStrength192,
+    FlipBipStrength256,
+} FlipBipStrengthState;

+ 0 - 110
flipbip39.c

@@ -1,110 +0,0 @@
-#include "flipbip39.h"
-
-bool flipbip39_custom_event_callback(void* context, uint32_t event) {
-    furi_assert(context);
-    FlipBip39* app = context;
-    return scene_manager_handle_custom_event(app->scene_manager, event);
-}
-
-void flipbip39_tick_event_callback(void* context) {
-    furi_assert(context);
-    FlipBip39* app = context;
-    scene_manager_handle_tick_event(app->scene_manager);
-}
-
-//leave app if back button pressed
-bool flipbip39_navigation_event_callback(void* context) {
-    furi_assert(context);
-    FlipBip39* app = context;
-    return scene_manager_handle_back_event(app->scene_manager);
-}
-
-FlipBip39* flipbip39_app_alloc() {
-    FlipBip39* app = malloc(sizeof(FlipBip39));
-    app->gui = furi_record_open(RECORD_GUI);
-    app->notification = furi_record_open(RECORD_NOTIFICATION);
-    
-    //Turn backlight on, believe me this makes testing your app easier
-    notification_message(app->notification, &sequence_display_backlight_on);
-
-    //Scene additions
-    app->view_dispatcher = view_dispatcher_alloc();
-    view_dispatcher_enable_queue(app->view_dispatcher);
-
-    app->scene_manager = scene_manager_alloc(&flipbip39_scene_handlers, app);
-    view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
-    view_dispatcher_set_navigation_event_callback(app->view_dispatcher, flipbip39_navigation_event_callback);
-    view_dispatcher_set_tick_event_callback(app->view_dispatcher, flipbip39_tick_event_callback, 100);
-    view_dispatcher_set_custom_event_callback(app->view_dispatcher, flipbip39_custom_event_callback);
-    app->submenu = submenu_alloc();
-
-    app->haptic = 1;
-    app->speaker = 1;
-    app->led = 1;
-    app->bip39_strength = 2; // 256 bits (24 words)
-
-    view_dispatcher_add_view(app->view_dispatcher, FlipBip39ViewIdMenu, submenu_get_view(app->submenu));
-    app->flipbip39_startscreen = flipbip39_startscreen_alloc();
-    view_dispatcher_add_view(app->view_dispatcher, FlipBip39ViewIdStartscreen, flipbip39_startscreen_get_view(app->flipbip39_startscreen));
-    app->flipbip39_scene_1 = flipbip39_scene_1_alloc();
-    view_dispatcher_add_view(app->view_dispatcher, FlipBip39ViewIdScene1, flipbip39_scene_1_get_view(app->flipbip39_scene_1));
-    app->flipbip39_scene_2 = flipbip39_scene_2_alloc();
-    view_dispatcher_add_view(app->view_dispatcher, FlipBip39ViewIdScene2, flipbip39_scene_2_get_view(app->flipbip39_scene_2));
-    app->variable_item_list = variable_item_list_alloc();
-    view_dispatcher_add_view(app->view_dispatcher, FlipBip39ViewIdSettings, variable_item_list_get_view(app->variable_item_list));
-
-    //End Scene Additions
-
-    return app;
-}
-
-void flipbip39_app_free(FlipBip39* app) {
-    furi_assert(app);
-    
-    // Scene manager
-    scene_manager_free(app->scene_manager);
-
-    // View Dispatcher
-    view_dispatcher_remove_view(app->view_dispatcher, FlipBip39ViewIdMenu);
-    view_dispatcher_remove_view(app->view_dispatcher, FlipBip39ViewIdScene1);
-    view_dispatcher_remove_view(app->view_dispatcher, FlipBip39ViewIdScene2);
-    view_dispatcher_remove_view(app->view_dispatcher, FlipBip39ViewIdSettings);
-    submenu_free(app->submenu);
-
-    view_dispatcher_free(app->view_dispatcher);
-    furi_record_close(RECORD_GUI);
-    
-    app->gui = NULL;
-    app->notification = NULL;
-
-    //Remove whatever is left
-    free(app);
-}
-
-int32_t flipbip39_app(void* p) {
-    UNUSED(p);
-    FlipBip39* app = flipbip39_app_alloc();
-    
-    // Disabled because causes exit on customer firmwares such as RM
-    /*if(!furi_hal_region_is_provisioned()) {
-        flipbip39_app_free(app);
-        return 1;
-    }*/
-    
-    view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
-    
-    scene_manager_next_scene(app->scene_manager, FlipBip39SceneStartscreen); //Start with start screen
-    //scene_manager_next_scene(app->scene_manager, FlipBip39SceneMenu); //if you want to directly start with Menu
-
-    furi_hal_power_suppress_charge_enter();
-
-    view_dispatcher_run(app->view_dispatcher);
-    
-    furi_hal_power_suppress_charge_exit();
-    flipbip39_app_free(app);
-
-    return 0;
-}
-
-
-

+ 0 - 61
flipbip39.h

@@ -1,61 +0,0 @@
-#pragma once
-
-#include <furi.h>
-#include <furi_hal.h>
-#include <gui/gui.h>
-#include <input/input.h>
-#include <stdlib.h>
-#include <notification/notification_messages.h>
-#include <gui/view_dispatcher.h>
-#include <gui/modules/submenu.h>
-#include <gui/scene_manager.h>
-#include <gui/modules/variable_item_list.h>
-#include "scenes/flipbip39_scene.h"
-#include "views/flipbip39_startscreen.h"
-#include "views/flipbip39_scene_1.h"
-#include "views/flipbip39_scene_2.h"
-
-typedef struct {
-    Gui* gui;
-    NotificationApp* notification;
-    ViewDispatcher* view_dispatcher;
-    Submenu* submenu;
-    SceneManager* scene_manager;
-    VariableItemList* variable_item_list;
-    FlipBip39Startscreen* flipbip39_startscreen;
-    FlipBip39Scene1* flipbip39_scene_1;
-    FlipBip39Scene2* flipbip39_scene_2;
-    int haptic; 
-    int speaker;
-    int led;
-    int bip39_strength;
-} FlipBip39;
-
-typedef enum {
-    FlipBip39ViewIdStartscreen,
-    FlipBip39ViewIdMenu,
-    FlipBip39ViewIdScene1,
-    FlipBip39ViewIdScene2,
-    FlipBip39ViewIdSettings,
-} FlipBip39ViewId;
-
-typedef enum {
-    FlipBip39HapticOff,
-    FlipBip39HapticOn,
-} FlipBip39HapticState;
-
-typedef enum {
-    FlipBip39SpeakerOff,
-    FlipBip39SpeakerOn,
-} FlipBip39SpeakerState;
-
-typedef enum {
-    FlipBip39LedOff,
-    FlipBip39LedOn,
-} FlipBip39LedState;
-
-typedef enum {
-    FlipBip39Strength128,
-    FlipBip39Strength192,
-    FlipBip39Strength256,
-} FlipBip39StrengthState;

+ 0 - 0
flipbip39_10px.png → flipbip_10px.png


+ 0 - 22
helpers/flipbip39_custom_event.h

@@ -1,22 +0,0 @@
-#pragma once
-
-typedef enum {
-    FlipBip39CustomEventStartscreenUp,
-    FlipBip39CustomEventStartscreenDown,
-    FlipBip39CustomEventStartscreenLeft,
-    FlipBip39CustomEventStartscreenRight,
-    FlipBip39CustomEventStartscreenOk,
-    FlipBip39CustomEventStartscreenBack,
-    FlipBip39CustomEventScene1Up,
-    FlipBip39CustomEventScene1Down,
-    FlipBip39CustomEventScene1Left,
-    FlipBip39CustomEventScene1Right,
-    FlipBip39CustomEventScene1Ok,
-    FlipBip39CustomEventScene1Back,
-    FlipBip39CustomEventScene2Up,
-    FlipBip39CustomEventScene2Down,
-    FlipBip39CustomEventScene2Left,
-    FlipBip39CustomEventScene2Right,
-    FlipBip39CustomEventScene2Ok,
-    FlipBip39CustomEventScene2Back,
-} FlipBip39CustomEvent;

+ 0 - 8
helpers/flipbip39_haptic.h

@@ -1,8 +0,0 @@
-#include <notification/notification_messages.h>
-
-void flipbip39_play_happy_bump(void* context);
-
-void flipbip39_play_bad_bump(void* context);
-
-void flipbip39_play_long_bump(void* context);
-

+ 0 - 6
helpers/flipbip39_led.h

@@ -1,6 +0,0 @@
-
-
-void flipbip39_led_set_rgb(void* context, int red, int green, int blue);
-
-void flipbip39_led_reset(void* context);
-

+ 0 - 4
helpers/flipbip39_speaker.h

@@ -1,4 +0,0 @@
-#define NOTE_INPUT 587.33f
-
-void flipbip39_play_input_sound(void* context);
-void flipbip39_stop_all_sound(void* context);

+ 0 - 2
helpers/flipbip39_string.h

@@ -1,2 +0,0 @@
-char * flipbip39_strtok(char *s, const char *delim);
-char * flipbip39_strtok_r(char *s, const char *delim, char **last);

+ 22 - 0
helpers/flipbip_custom_event.h

@@ -0,0 +1,22 @@
+#pragma once
+
+typedef enum {
+    FlipBipCustomEventStartscreenUp,
+    FlipBipCustomEventStartscreenDown,
+    FlipBipCustomEventStartscreenLeft,
+    FlipBipCustomEventStartscreenRight,
+    FlipBipCustomEventStartscreenOk,
+    FlipBipCustomEventStartscreenBack,
+    FlipBipCustomEventScene1Up,
+    FlipBipCustomEventScene1Down,
+    FlipBipCustomEventScene1Left,
+    FlipBipCustomEventScene1Right,
+    FlipBipCustomEventScene1Ok,
+    FlipBipCustomEventScene1Back,
+    FlipBipCustomEventScene2Up,
+    FlipBipCustomEventScene2Down,
+    FlipBipCustomEventScene2Left,
+    FlipBipCustomEventScene2Right,
+    FlipBipCustomEventScene2Ok,
+    FlipBipCustomEventScene2Back,
+} FlipBipCustomEvent;

+ 8 - 8
helpers/flipbip39_haptic.c → helpers/flipbip_haptic.c

@@ -1,9 +1,9 @@
-#include "flipbip39_haptic.h"
-#include "../flipbip39.h"
+#include "flipbip_haptic.h"
+#include "../flipbip.h"
 
 
-void flipbip39_play_happy_bump(void* context) {
-    FlipBip39* app = context;
+void flipbip_play_happy_bump(void* context) {
+    FlipBip* app = context;
     if (app->haptic != 1) {
         return;
     }
@@ -12,8 +12,8 @@ void flipbip39_play_happy_bump(void* context) {
     notification_message(app->notification, &sequence_reset_vibro);
 }
 
-void flipbip39_play_bad_bump(void* context) {
-    FlipBip39* app = context;
+void flipbip_play_bad_bump(void* context) {
+    FlipBip* app = context;
     if (app->haptic != 1) {
         return;
     }
@@ -22,8 +22,8 @@ void flipbip39_play_bad_bump(void* context) {
     notification_message(app->notification, &sequence_reset_vibro);
 }
 
-void flipbip39_play_long_bump(void* context) {
-    FlipBip39* app = context;
+void flipbip_play_long_bump(void* context) {
+    FlipBip* app = context;
     if (app->haptic != 1) {
         return;
     }

+ 8 - 0
helpers/flipbip_haptic.h

@@ -0,0 +1,8 @@
+#include <notification/notification_messages.h>
+
+void flipbip_play_happy_bump(void* context);
+
+void flipbip_play_bad_bump(void* context);
+
+void flipbip_play_long_bump(void* context);
+

+ 6 - 6
helpers/flipbip39_led.c → helpers/flipbip_led.c

@@ -1,10 +1,10 @@
-#include "flipbip39_led.h"
-#include "../flipbip39.h"
+#include "flipbip_led.h"
+#include "../flipbip.h"
 
 
 
-void flipbip39_led_set_rgb(void* context, int red, int green, int blue) {
-    FlipBip39* app = context;
+void flipbip_led_set_rgb(void* context, int red, int green, int blue) {
+    FlipBip* app = context;
     if (app->led != 1) {
         return;
     }
@@ -29,8 +29,8 @@ void flipbip39_led_set_rgb(void* context, int red, int green, int blue) {
     furi_thread_flags_wait(0, FuriFlagWaitAny, 10); //Delay, prevent removal from RAM before LED value set    
 }
 
-void flipbip39_led_reset(void* context) {
-    FlipBip39* app = context;
+void flipbip_led_reset(void* context) {
+    FlipBip* app = context;
     notification_message(app->notification, &sequence_reset_red);
     notification_message(app->notification, &sequence_reset_green);
     notification_message(app->notification, &sequence_reset_blue);

+ 6 - 0
helpers/flipbip_led.h

@@ -0,0 +1,6 @@
+
+
+void flipbip_led_set_rgb(void* context, int red, int green, int blue);
+
+void flipbip_led_reset(void* context);
+

+ 6 - 6
helpers/flipbip39_speaker.c → helpers/flipbip_speaker.c

@@ -1,10 +1,10 @@
-#include "flipbip39_speaker.h"
-#include "../flipbip39.h"
+#include "flipbip_speaker.h"
+#include "../flipbip.h"
 
 #define NOTE_INPUT 587.33f
 
-void flipbip39_play_input_sound(void* context) {
-    FlipBip39* app = context;
+void flipbip_play_input_sound(void* context) {
+    FlipBip* app = context;
     if (app->speaker != 1) {
         return;
     }
@@ -15,8 +15,8 @@ void flipbip39_play_input_sound(void* context) {
     
 }
 
-void flipbip39_stop_all_sound(void* context) {
-    FlipBip39* app = context;
+void flipbip_stop_all_sound(void* context) {
+    FlipBip* app = context;
     if (app->speaker != 1) {
         return;
     }

+ 4 - 0
helpers/flipbip_speaker.h

@@ -0,0 +1,4 @@
+#define NOTE_INPUT 587.33f
+
+void flipbip_play_input_sound(void* context);
+void flipbip_stop_all_sound(void* context);

+ 4 - 4
helpers/flipbip39_string.c → helpers/flipbip_string.c

@@ -26,16 +26,16 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-#include "flipbip39_string.h"
+#include "flipbip_string.h"
 #include <string.h>
 char *
-flipbip39_strtok(char *s, const char *delim)
+flipbip_strtok(char *s, const char *delim)
 {
 	static char *last;
-	return flipbip39_strtok_r(s, delim, &last);
+	return flipbip_strtok_r(s, delim, &last);
 }
 char *
-flipbip39_strtok_r(char *s, const char *delim, char **last)
+flipbip_strtok_r(char *s, const char *delim, char **last)
 {
 	char *spanp;
 	int c, sc;

+ 2 - 0
helpers/flipbip_string.h

@@ -0,0 +1,2 @@
+char * flipbip_strtok(char *s, const char *delim);
+char * flipbip_strtok_r(char *s, const char *delim, char **last);

+ 0 - 30
scenes/flipbip39_scene.c

@@ -1,30 +0,0 @@
-#include "flipbip39_scene.h"
-
-// Generate scene on_enter handlers array
-#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter,
-void (*const flipbip39_on_enter_handlers[])(void*) = {
-#include "flipbip39_scene_config.h"
-};
-#undef ADD_SCENE
-
-// Generate scene on_event handlers array
-#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event,
-bool (*const flipbip39_on_event_handlers[])(void* context, SceneManagerEvent event) = {
-#include "flipbip39_scene_config.h"
-};
-#undef ADD_SCENE
-
-// Generate scene on_exit handlers array
-#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit,
-void (*const flipbip39_on_exit_handlers[])(void* context) = {
-#include "flipbip39_scene_config.h"
-};
-#undef ADD_SCENE
-
-// Initialize scene handlers configuration structure
-const SceneManagerHandlers flipbip39_scene_handlers = {
-    .on_enter_handlers = flipbip39_on_enter_handlers,
-    .on_event_handlers = flipbip39_on_event_handlers,
-    .on_exit_handlers = flipbip39_on_exit_handlers,
-    .scene_num = FlipBip39SceneNum,
-};

+ 0 - 5
scenes/flipbip39_scene_config.h

@@ -1,5 +0,0 @@
-ADD_SCENE(flipbip39, startscreen, Startscreen)
-ADD_SCENE(flipbip39, menu, Menu)
-ADD_SCENE(flipbip39, scene_1, Scene_1)
-ADD_SCENE(flipbip39, scene_2, Scene_2)
-ADD_SCENE(flipbip39, settings, Settings)

+ 0 - 53
scenes/flipbip39_scene_scene_2.c

@@ -1,53 +0,0 @@
-#include "../flipbip39.h"
-#include "../helpers/flipbip39_custom_event.h"
-#include "../helpers/flipbip39_haptic.h"
-#include "../helpers/flipbip39_led.h"
-#include "../views/flipbip39_scene_2.h"
-
-void flipbip39_scene_2_callback(FlipBip39CustomEvent event, void* context) {
-    furi_assert(context);
-    FlipBip39* app = context;
-    view_dispatcher_send_custom_event(app->view_dispatcher, event);
-}
-
-void flipbip39_scene_scene_2_on_enter(void* context) {
-    furi_assert(context);
-    FlipBip39* app = context;
-    flipbip39_scene_2_set_callback(app->flipbip39_scene_2, flipbip39_scene_2_callback, app);
-    view_dispatcher_switch_to_view(app->view_dispatcher, FlipBip39ViewIdScene2);
-}
-
-bool flipbip39_scene_scene_2_on_event(void* context, SceneManagerEvent event) {
-    FlipBip39* app = context;
-    bool consumed = false;
-
-    if(event.type == SceneManagerEventTypeCustom) {
-        switch(event.event) {
-            case FlipBip39CustomEventScene2Left:
-            case FlipBip39CustomEventScene2Right:
-                break;
-            case FlipBip39CustomEventScene2Up:
-            case FlipBip39CustomEventScene2Down:
-                break;
-            case FlipBip39CustomEventScene2Back:
-                notification_message(app->notification, &sequence_reset_red);
-                notification_message(app->notification, &sequence_reset_green);
-                notification_message(app->notification, &sequence_reset_blue);
-                if(!scene_manager_search_and_switch_to_previous_scene(
-                    app->scene_manager, FlipBip39SceneMenu)) {
-                        scene_manager_stop(app->scene_manager);
-                        view_dispatcher_stop(app->view_dispatcher);
-                    }
-                consumed = true;
-                break;
-        }
-    }
-
-    return consumed;
-}
-
-void flipbip39_scene_scene_2_on_exit(void* context) {
-    FlipBip39* app = context;
-    UNUSED(app);
-}
-

+ 0 - 54
scenes/flipbip39_scene_startscreen.c

@@ -1,54 +0,0 @@
-#include "../flipbip39.h"
-#include "../helpers/flipbip39_custom_event.h"
-#include "../views/flipbip39_startscreen.h"
-
-void flipbip39_scene_startscreen_callback(FlipBip39CustomEvent event, void* context) {
-    furi_assert(context);
-    FlipBip39* app = context;
-    view_dispatcher_send_custom_event(app->view_dispatcher, event);
-}
-
-void flipbip39_scene_startscreen_on_enter(void* context) {
-    furi_assert(context);
-    FlipBip39* app = context;
-    flipbip39_startscreen_set_callback(app->flipbip39_startscreen, flipbip39_scene_startscreen_callback, app);
-    view_dispatcher_switch_to_view(app->view_dispatcher, FlipBip39ViewIdStartscreen);
-}
-
-bool flipbip39_scene_startscreen_on_event(void* context, SceneManagerEvent event) {
-    FlipBip39* app = context;
-    bool consumed = false;
-    
-    if(event.type == SceneManagerEventTypeCustom) {
-        switch(event.event) {
-            case FlipBip39CustomEventStartscreenLeft:
-            case FlipBip39CustomEventStartscreenRight:
-                break;
-            case FlipBip39CustomEventStartscreenUp:
-            case FlipBip39CustomEventStartscreenDown:
-                break;
-            case FlipBip39CustomEventStartscreenOk:
-                scene_manager_next_scene(app->scene_manager, FlipBip39SceneMenu);
-                consumed = true;
-                break;
-            case FlipBip39CustomEventStartscreenBack:
-                notification_message(app->notification, &sequence_reset_red);
-                notification_message(app->notification, &sequence_reset_green);
-                notification_message(app->notification, &sequence_reset_blue);
-                if(!scene_manager_search_and_switch_to_previous_scene(
-                    app->scene_manager, FlipBip39SceneStartscreen)) {
-                        scene_manager_stop(app->scene_manager);
-                        view_dispatcher_stop(app->view_dispatcher);
-                    }
-                consumed = true;
-                break;
-        }
-    }
-    
-    return consumed;
-}
-
-void flipbip39_scene_startscreen_on_exit(void* context) {
-    FlipBip39* app = context;
-    UNUSED(app);
-}

+ 30 - 0
scenes/flipbip_scene.c

@@ -0,0 +1,30 @@
+#include "flipbip_scene.h"
+
+// Generate scene on_enter handlers array
+#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter,
+void (*const flipbip_on_enter_handlers[])(void*) = {
+#include "flipbip_scene_config.h"
+};
+#undef ADD_SCENE
+
+// Generate scene on_event handlers array
+#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event,
+bool (*const flipbip_on_event_handlers[])(void* context, SceneManagerEvent event) = {
+#include "flipbip_scene_config.h"
+};
+#undef ADD_SCENE
+
+// Generate scene on_exit handlers array
+#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit,
+void (*const flipbip_on_exit_handlers[])(void* context) = {
+#include "flipbip_scene_config.h"
+};
+#undef ADD_SCENE
+
+// Initialize scene handlers configuration structure
+const SceneManagerHandlers flipbip_scene_handlers = {
+    .on_enter_handlers = flipbip_on_enter_handlers,
+    .on_event_handlers = flipbip_on_event_handlers,
+    .on_exit_handlers = flipbip_on_exit_handlers,
+    .scene_num = FlipBipSceneNum,
+};

+ 8 - 8
scenes/flipbip39_scene.h → scenes/flipbip_scene.h

@@ -3,27 +3,27 @@
 #include <gui/scene_manager.h>
 
 // Generate scene id and total number
-#define ADD_SCENE(prefix, name, id) FlipBip39Scene##id,
+#define ADD_SCENE(prefix, name, id) FlipBipScene##id,
 typedef enum {
-#include "flipbip39_scene_config.h"
-    FlipBip39SceneNum,
-} FlipBip39Scene;
+#include "flipbip_scene_config.h"
+    FlipBipSceneNum,
+} FlipBipScene;
 #undef ADD_SCENE
 
-extern const SceneManagerHandlers flipbip39_scene_handlers;
+extern const SceneManagerHandlers flipbip_scene_handlers;
 
 // Generate scene on_enter handlers declaration
 #define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*);
-#include "flipbip39_scene_config.h"
+#include "flipbip_scene_config.h"
 #undef ADD_SCENE
 
 // Generate scene on_event handlers declaration
 #define ADD_SCENE(prefix, name, id) \
     bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event);
-#include "flipbip39_scene_config.h"
+#include "flipbip_scene_config.h"
 #undef ADD_SCENE
 
 // Generate scene on_exit handlers declaration
 #define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context);
-#include "flipbip39_scene_config.h"
+#include "flipbip_scene_config.h"
 #undef ADD_SCENE

+ 5 - 0
scenes/flipbip_scene_config.h

@@ -0,0 +1,5 @@
+ADD_SCENE(flipbip, startscreen, Startscreen)
+ADD_SCENE(flipbip, menu, Menu)
+ADD_SCENE(flipbip, scene_1, Scene_1)
+ADD_SCENE(flipbip, scene_2, Scene_2)
+ADD_SCENE(flipbip, settings, Settings)

+ 20 - 20
scenes/flipbip39_scene_menu.c → scenes/flipbip_scene_menu.c

@@ -1,4 +1,4 @@
-#include "../flipbip39.h"
+#include "../flipbip.h"
 
 enum SubmenuIndex {
     SubmenuIndexScene1 = 10,
@@ -6,25 +6,25 @@ enum SubmenuIndex {
     SubmenuIndexSettings,
 };
 
-void flipbip39_scene_menu_submenu_callback(void* context, uint32_t index) {
-    FlipBip39* app = context;
+void flipbip_scene_menu_submenu_callback(void* context, uint32_t index) {
+    FlipBip* app = context;
     view_dispatcher_send_custom_event(app->view_dispatcher, index);
 }
 
-void flipbip39_scene_menu_on_enter(void* context) {
-    FlipBip39* app = context;
+void flipbip_scene_menu_on_enter(void* context) {
+    FlipBip* app = context;
 
-    submenu_add_item(app->submenu, "New BIP39 Mnemonic", SubmenuIndexScene1, flipbip39_scene_menu_submenu_callback, app);
-    //submenu_add_item(app->submenu, "Scene 2", SubmenuIndexScene2, flipbip39_scene_menu_submenu_callback, app);
-    submenu_add_item(app->submenu, "Settings", SubmenuIndexSettings, flipbip39_scene_menu_submenu_callback, app);
+    submenu_add_item(app->submenu, "New BIP39 Mnemonic", SubmenuIndexScene1, flipbip_scene_menu_submenu_callback, app);
+    //submenu_add_item(app->submenu, "Scene 2", SubmenuIndexScene2, flipbip_scene_menu_submenu_callback, app);
+    submenu_add_item(app->submenu, "Settings", SubmenuIndexSettings, flipbip_scene_menu_submenu_callback, app);
 
-    submenu_set_selected_item(app->submenu, scene_manager_get_scene_state(app->scene_manager, FlipBip39SceneMenu));
+    submenu_set_selected_item(app->submenu, scene_manager_get_scene_state(app->scene_manager, FlipBipSceneMenu));
 
-    view_dispatcher_switch_to_view(app->view_dispatcher, FlipBip39ViewIdMenu);
+    view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdMenu);
 }
 
-bool flipbip39_scene_menu_on_event(void* context, SceneManagerEvent event) {
-    FlipBip39* app = context;
+bool flipbip_scene_menu_on_event(void* context, SceneManagerEvent event) {
+    FlipBip* app = context;
     UNUSED(app);
     if(event.type == SceneManagerEventTypeBack) {
         //exit app
@@ -34,25 +34,25 @@ bool flipbip39_scene_menu_on_event(void* context, SceneManagerEvent event) {
     } else if(event.type == SceneManagerEventTypeCustom) {
         if(event.event == SubmenuIndexScene1) {
             scene_manager_set_scene_state(
-                app->scene_manager, FlipBip39SceneMenu, SubmenuIndexScene1);
-            scene_manager_next_scene(app->scene_manager, FlipBip39SceneScene_1);
+                app->scene_manager, FlipBipSceneMenu, SubmenuIndexScene1);
+            scene_manager_next_scene(app->scene_manager, FlipBipSceneScene_1);
             return true;
         } else if (event.event == SubmenuIndexScene2) {
             scene_manager_set_scene_state(
-                app->scene_manager, FlipBip39SceneMenu, SubmenuIndexScene2);
-            scene_manager_next_scene(app->scene_manager, FlipBip39SceneScene_2);
+                app->scene_manager, FlipBipSceneMenu, SubmenuIndexScene2);
+            scene_manager_next_scene(app->scene_manager, FlipBipSceneScene_2);
             return true;
         } else if (event.event == SubmenuIndexSettings) {
             scene_manager_set_scene_state(
-                app->scene_manager, FlipBip39SceneMenu, SubmenuIndexSettings);
-            scene_manager_next_scene(app->scene_manager, FlipBip39SceneSettings);
+                app->scene_manager, FlipBipSceneMenu, SubmenuIndexSettings);
+            scene_manager_next_scene(app->scene_manager, FlipBipSceneSettings);
             return true;
         }
     }
     return false;
 }
 
-void flipbip39_scene_menu_on_exit(void* context) {
-    FlipBip39* app = context;
+void flipbip_scene_menu_on_exit(void* context) {
+    FlipBip* app = context;
     submenu_reset(app->submenu);
 }

+ 19 - 19
scenes/flipbip39_scene_scene_1.c → scenes/flipbip_scene_scene_1.c

@@ -1,38 +1,38 @@
-#include "../flipbip39.h"
-#include "../helpers/flipbip39_custom_event.h"
-#include "../views/flipbip39_scene_1.h"
+#include "../flipbip.h"
+#include "../helpers/flipbip_custom_event.h"
+#include "../views/flipbip_scene_1.h"
 
-void flipbip39_scene_1_callback(FlipBip39CustomEvent event, void* context) {
+void flipbip_scene_1_callback(FlipBipCustomEvent event, void* context) {
     furi_assert(context);
-    FlipBip39* app = context;
+    FlipBip* app = context;
     view_dispatcher_send_custom_event(app->view_dispatcher, event);
 }
 
-void flipbip39_scene_scene_1_on_enter(void* context) {
+void flipbip_scene_scene_1_on_enter(void* context) {
     furi_assert(context);
-    FlipBip39* app = context;
-    flipbip39_scene_1_set_callback(app->flipbip39_scene_1, flipbip39_scene_1_callback, app);
-    view_dispatcher_switch_to_view(app->view_dispatcher, FlipBip39ViewIdScene1);
+    FlipBip* app = context;
+    flipbip_scene_1_set_callback(app->flipbip_scene_1, flipbip_scene_1_callback, app);
+    view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdScene1);
 }
 
-bool flipbip39_scene_scene_1_on_event(void* context, SceneManagerEvent event) {
-    FlipBip39* app = context;
+bool flipbip_scene_scene_1_on_event(void* context, SceneManagerEvent event) {
+    FlipBip* app = context;
     bool consumed = false;
     
     if(event.type == SceneManagerEventTypeCustom) {
         switch(event.event) {
-            case FlipBip39CustomEventScene1Left:
-            case FlipBip39CustomEventScene1Right:
+            case FlipBipCustomEventScene1Left:
+            case FlipBipCustomEventScene1Right:
                 break;
-            case FlipBip39CustomEventScene1Up:
-            case FlipBip39CustomEventScene1Down:
+            case FlipBipCustomEventScene1Up:
+            case FlipBipCustomEventScene1Down:
                 break;
-            case FlipBip39CustomEventScene1Back:
+            case FlipBipCustomEventScene1Back:
                 notification_message(app->notification, &sequence_reset_red);
                 notification_message(app->notification, &sequence_reset_green);
                 notification_message(app->notification, &sequence_reset_blue);
                 if(!scene_manager_search_and_switch_to_previous_scene(
-                    app->scene_manager, FlipBip39SceneMenu)) {
+                    app->scene_manager, FlipBipSceneMenu)) {
                         scene_manager_stop(app->scene_manager);
                         view_dispatcher_stop(app->view_dispatcher);
                     }
@@ -44,7 +44,7 @@ bool flipbip39_scene_scene_1_on_event(void* context, SceneManagerEvent event) {
     return consumed;
 }
 
-void flipbip39_scene_scene_1_on_exit(void* context) {
-    FlipBip39* app = context;
+void flipbip_scene_scene_1_on_exit(void* context) {
+    FlipBip* app = context;
     UNUSED(app);
 }

+ 53 - 0
scenes/flipbip_scene_scene_2.c

@@ -0,0 +1,53 @@
+#include "../flipbip.h"
+#include "../helpers/flipbip_custom_event.h"
+#include "../helpers/flipbip_haptic.h"
+#include "../helpers/flipbip_led.h"
+#include "../views/flipbip_scene_2.h"
+
+void flipbip_scene_2_callback(FlipBipCustomEvent event, void* context) {
+    furi_assert(context);
+    FlipBip* app = context;
+    view_dispatcher_send_custom_event(app->view_dispatcher, event);
+}
+
+void flipbip_scene_scene_2_on_enter(void* context) {
+    furi_assert(context);
+    FlipBip* app = context;
+    flipbip_scene_2_set_callback(app->flipbip_scene_2, flipbip_scene_2_callback, app);
+    view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdScene2);
+}
+
+bool flipbip_scene_scene_2_on_event(void* context, SceneManagerEvent event) {
+    FlipBip* app = context;
+    bool consumed = false;
+
+    if(event.type == SceneManagerEventTypeCustom) {
+        switch(event.event) {
+            case FlipBipCustomEventScene2Left:
+            case FlipBipCustomEventScene2Right:
+                break;
+            case FlipBipCustomEventScene2Up:
+            case FlipBipCustomEventScene2Down:
+                break;
+            case FlipBipCustomEventScene2Back:
+                notification_message(app->notification, &sequence_reset_red);
+                notification_message(app->notification, &sequence_reset_green);
+                notification_message(app->notification, &sequence_reset_blue);
+                if(!scene_manager_search_and_switch_to_previous_scene(
+                    app->scene_manager, FlipBipSceneMenu)) {
+                        scene_manager_stop(app->scene_manager);
+                        view_dispatcher_stop(app->view_dispatcher);
+                    }
+                consumed = true;
+                break;
+        }
+    }
+
+    return consumed;
+}
+
+void flipbip_scene_scene_2_on_exit(void* context) {
+    FlipBip* app = context;
+    UNUSED(app);
+}
+

+ 31 - 31
scenes/flipbip39_scene_settings.c → scenes/flipbip_scene_settings.c

@@ -1,4 +1,4 @@
-#include "../flipbip39.h"
+#include "../flipbip.h"
 #include <lib/toolbox/value_index.h>
 
 // enum SettingsIndex {
@@ -13,8 +13,8 @@ const char* const haptic_text[2] = {
     "ON",
 };
 const uint32_t haptic_value[2] = {
-    FlipBip39HapticOff,
-    FlipBip39HapticOn,
+    FlipBipHapticOff,
+    FlipBipHapticOn,
 };
 
 const char* const speaker_text[2] = {
@@ -22,8 +22,8 @@ const char* const speaker_text[2] = {
     "ON",
 };
 const uint32_t speaker_value[2] = {
-    FlipBip39SpeakerOff,
-    FlipBip39SpeakerOn,
+    FlipBipSpeakerOff,
+    FlipBipSpeakerOn,
 };
 
 const char* const led_text[2] = {
@@ -31,8 +31,8 @@ const char* const led_text[2] = {
     "ON",
 };
 const uint32_t led_value[2] = {
-    FlipBip39LedOff,
-    FlipBip39LedOn,
+    FlipBipLedOff,
+    FlipBipLedOn,
 };
 
 const char* const bip39_strength_text[3] = {
@@ -41,46 +41,46 @@ const char* const bip39_strength_text[3] = {
     "24",
 };
 const uint32_t bip39_strength_value[3] = {
-    FlipBip39Strength128,
-    FlipBip39Strength192,
-    FlipBip39Strength256,
+    FlipBipStrength128,
+    FlipBipStrength192,
+    FlipBipStrength256,
 };
 
-static void flipbip39_scene_settings_set_haptic(VariableItem* item) {
-    FlipBip39* app = variable_item_get_context(item);
+static void flipbip_scene_settings_set_haptic(VariableItem* item) {
+    FlipBip* app = variable_item_get_context(item);
     uint8_t index = variable_item_get_current_value_index(item);
     variable_item_set_current_value_text(item, haptic_text[index]);
     app->haptic = haptic_value[index];
 }
 
-static void flipbip39_scene_settings_set_speaker(VariableItem* item) {
-    FlipBip39* app = variable_item_get_context(item);
+static void flipbip_scene_settings_set_speaker(VariableItem* item) {
+    FlipBip* app = variable_item_get_context(item);
     uint8_t index = variable_item_get_current_value_index(item);
     variable_item_set_current_value_text(item, speaker_text[index]);
     app->speaker = speaker_value[index];
 }
 
-static void flipbip39_scene_settings_set_led(VariableItem* item) {
-    FlipBip39* app = variable_item_get_context(item);
+static void flipbip_scene_settings_set_led(VariableItem* item) {
+    FlipBip* app = variable_item_get_context(item);
     uint8_t index = variable_item_get_current_value_index(item);
     variable_item_set_current_value_text(item, led_text[index]);
     app->led = led_value[index];
 }
 
-static void flipbip39_scene_settings_set_bip39_strength(VariableItem* item) {
-    FlipBip39* app = variable_item_get_context(item);
+static void flipbip_scene_settings_set_bip39_strength(VariableItem* item) {
+    FlipBip* app = variable_item_get_context(item);
     uint8_t index = variable_item_get_current_value_index(item);
     variable_item_set_current_value_text(item, bip39_strength_text[index]);
     app->bip39_strength = bip39_strength_value[index];
 }
 
-void flipbip39_scene_settings_submenu_callback(void* context, uint32_t index) {
-    FlipBip39* app = context;
+void flipbip_scene_settings_submenu_callback(void* context, uint32_t index) {
+    FlipBip* app = context;
     view_dispatcher_send_custom_event(app->view_dispatcher, index);
 }
 
-void flipbip39_scene_settings_on_enter(void* context) {
-    FlipBip39* app = context;
+void flipbip_scene_settings_on_enter(void* context) {
+    FlipBip* app = context;
     VariableItem* item;
     uint8_t value_index;
 
@@ -89,7 +89,7 @@ void flipbip39_scene_settings_on_enter(void* context) {
         app->variable_item_list,
         "BIP39 Words:",
         3,
-        flipbip39_scene_settings_set_bip39_strength,
+        flipbip_scene_settings_set_bip39_strength,
         app);
     value_index = value_index_uint32(app->bip39_strength, bip39_strength_value, 3);
     variable_item_set_current_value_index(item, value_index);
@@ -100,7 +100,7 @@ void flipbip39_scene_settings_on_enter(void* context) {
         app->variable_item_list,
         "Vibro/Haptic:",
         2,
-        flipbip39_scene_settings_set_haptic,
+        flipbip_scene_settings_set_haptic,
         app);
     value_index = value_index_uint32(app->haptic, haptic_value, 2);
     variable_item_set_current_value_index(item, value_index);
@@ -111,7 +111,7 @@ void flipbip39_scene_settings_on_enter(void* context) {
         app->variable_item_list,
         "Sound:",
         2,
-        flipbip39_scene_settings_set_speaker,
+        flipbip_scene_settings_set_speaker,
         app);
     value_index = value_index_uint32(app->speaker, speaker_value, 2);
     variable_item_set_current_value_index(item, value_index);
@@ -122,17 +122,17 @@ void flipbip39_scene_settings_on_enter(void* context) {
         app->variable_item_list,
         "LED FX:",
         2,
-        flipbip39_scene_settings_set_led,
+        flipbip_scene_settings_set_led,
         app);
     value_index = value_index_uint32(app->led, led_value, 2);
     variable_item_set_current_value_index(item, value_index);
     variable_item_set_current_value_text(item, led_text[value_index]);
     
-    view_dispatcher_switch_to_view(app->view_dispatcher, FlipBip39ViewIdSettings);
+    view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdSettings);
 }
 
-bool flipbip39_scene_settings_on_event(void* context, SceneManagerEvent event) {
-    FlipBip39* app = context;
+bool flipbip_scene_settings_on_event(void* context, SceneManagerEvent event) {
+    FlipBip* app = context;
     UNUSED(app);
     bool consumed = false;
     if(event.type == SceneManagerEventTypeCustom) {
@@ -141,8 +141,8 @@ bool flipbip39_scene_settings_on_event(void* context, SceneManagerEvent event) {
     return consumed;
 }
 
-void flipbip39_scene_settings_on_exit(void* context) {
-    FlipBip39* app = context;
+void flipbip_scene_settings_on_exit(void* context) {
+    FlipBip* app = context;
     variable_item_list_set_selected_item(app->variable_item_list, 0);
     variable_item_list_reset(app->variable_item_list);
 }

+ 54 - 0
scenes/flipbip_scene_startscreen.c

@@ -0,0 +1,54 @@
+#include "../flipbip.h"
+#include "../helpers/flipbip_custom_event.h"
+#include "../views/flipbip_startscreen.h"
+
+void flipbip_scene_startscreen_callback(FlipBipCustomEvent event, void* context) {
+    furi_assert(context);
+    FlipBip* app = context;
+    view_dispatcher_send_custom_event(app->view_dispatcher, event);
+}
+
+void flipbip_scene_startscreen_on_enter(void* context) {
+    furi_assert(context);
+    FlipBip* app = context;
+    flipbip_startscreen_set_callback(app->flipbip_startscreen, flipbip_scene_startscreen_callback, app);
+    view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdStartscreen);
+}
+
+bool flipbip_scene_startscreen_on_event(void* context, SceneManagerEvent event) {
+    FlipBip* app = context;
+    bool consumed = false;
+    
+    if(event.type == SceneManagerEventTypeCustom) {
+        switch(event.event) {
+            case FlipBipCustomEventStartscreenLeft:
+            case FlipBipCustomEventStartscreenRight:
+                break;
+            case FlipBipCustomEventStartscreenUp:
+            case FlipBipCustomEventStartscreenDown:
+                break;
+            case FlipBipCustomEventStartscreenOk:
+                scene_manager_next_scene(app->scene_manager, FlipBipSceneMenu);
+                consumed = true;
+                break;
+            case FlipBipCustomEventStartscreenBack:
+                notification_message(app->notification, &sequence_reset_red);
+                notification_message(app->notification, &sequence_reset_green);
+                notification_message(app->notification, &sequence_reset_blue);
+                if(!scene_manager_search_and_switch_to_previous_scene(
+                    app->scene_manager, FlipBipSceneStartscreen)) {
+                        scene_manager_stop(app->scene_manager);
+                        view_dispatcher_stop(app->view_dispatcher);
+                    }
+                consumed = true;
+                break;
+        }
+    }
+    
+    return consumed;
+}
+
+void flipbip_scene_startscreen_on_exit(void* context) {
+    FlipBip* app = context;
+    UNUSED(app);
+}

+ 0 - 19
views/flipbip39_scene_1.h

@@ -1,19 +0,0 @@
-#pragma once
-
-#include <gui/view.h>
-#include "../helpers/flipbip39_custom_event.h"
-
-typedef struct FlipBip39Scene1 FlipBip39Scene1;
-
-typedef void (*FlipBip39Scene1Callback)(FlipBip39CustomEvent event, void* context);
-
-void flipbip39_scene_1_set_callback(
-    FlipBip39Scene1* flipbip39_scene_1,
-    FlipBip39Scene1Callback callback,
-    void* context);
-
-View* flipbip39_scene_1_get_view(FlipBip39Scene1* flipbip39_static);
-
-FlipBip39Scene1* flipbip39_scene_1_alloc();
-
-void flipbip39_scene_1_free(FlipBip39Scene1* flipbip39_static);

+ 0 - 19
views/flipbip39_scene_2.h

@@ -1,19 +0,0 @@
-#pragma once
-
-#include <gui/view.h>
-#include "../helpers/flipbip39_custom_event.h"
-
-typedef struct FlipBip39Scene2 FlipBip39Scene2;
-
-typedef void (*FlipBip39Scene2Callback)(FlipBip39CustomEvent event, void* context);
-
-void flipbip39_scene_2_set_callback(
-    FlipBip39Scene2* instance,
-    FlipBip39Scene2Callback callback,
-    void * context);
-
-FlipBip39Scene2* flipbip39_scene_2_alloc();
-
-void flipbip39_scene_2_free(FlipBip39Scene2* flipbip39_static);
-
-View* flipbip39_scene_2_get_view(FlipBip39Scene2* boilerpate_static);

+ 0 - 19
views/flipbip39_startscreen.h

@@ -1,19 +0,0 @@
-#pragma once
-
-#include <gui/view.h>
-#include "../helpers/flipbip39_custom_event.h"
-
-typedef struct FlipBip39Startscreen FlipBip39Startscreen;
-
-typedef void (*FlipBip39StartscreenCallback)(FlipBip39CustomEvent event, void* context);
-
-void flipbip39_startscreen_set_callback(
-    FlipBip39Startscreen* flipbip39_startscreen,
-    FlipBip39StartscreenCallback callback,
-    void* context);
-
-View* flipbip39_startscreen_get_view(FlipBip39Startscreen* flipbip39_static);
-
-FlipBip39Startscreen* flipbip39_startscreen_alloc();
-
-void flipbip39_startscreen_free(FlipBip39Startscreen* flipbip39_static);

+ 43 - 43
views/flipbip39_scene_1.c → views/flipbip_scene_1.c

@@ -1,13 +1,13 @@
-#include "../flipbip39.h"
+#include "../flipbip.h"
 #include <furi.h>
 #include <furi_hal.h>
 #include <input/input.h>
 #include <gui/elements.h>
 #include <dolphin/dolphin.h>
-#include "../helpers/flipbip39_haptic.h"
-#include "../helpers/flipbip39_speaker.h"
-#include "../helpers/flipbip39_led.h"
-#include "../helpers/flipbip39_string.h"
+#include "../helpers/flipbip_haptic.h"
+#include "../helpers/flipbip_speaker.h"
+#include "../helpers/flipbip_led.h"
+#include "../helpers/flipbip_string.h"
 
 #include <string.h>
 #include "../helpers/printf.h"
@@ -17,9 +17,9 @@
 #include "../crypto/curves.h"
 #include "../crypto/memzero.h"
 
-struct FlipBip39Scene1 {
+struct FlipBipScene1 {
     View* view;
-    FlipBip39Scene1Callback callback;
+    FlipBipScene1Callback callback;
     void* context;
 };
 
@@ -39,11 +39,11 @@ typedef struct {
     const char* mnemonic4;
     const char* mnemonic5;
     const char* mnemonic6;
-} FlipBip39Scene1Model;
+} FlipBipScene1Model;
 
-void flipbip39_scene_1_set_callback(
-    FlipBip39Scene1* instance,
-    FlipBip39Scene1Callback callback,
+void flipbip_scene_1_set_callback(
+    FlipBipScene1* instance,
+    FlipBipScene1Callback callback,
     void* context) {
     furi_assert(instance);
     furi_assert(callback);
@@ -51,7 +51,7 @@ void flipbip39_scene_1_set_callback(
     instance->context = context;
 }
 
-void flipbip39_scene_1_draw(Canvas* canvas, FlipBip39Scene1Model* model) {
+void flipbip_scene_1_draw(Canvas* canvas, FlipBipScene1Model* model) {
     //UNUSED(model);
     canvas_clear(canvas);
     canvas_set_color(canvas, ColorBlack);
@@ -84,7 +84,7 @@ void flipbip39_scene_1_draw(Canvas* canvas, FlipBip39Scene1Model* model) {
     
 }
 
-static void flipbip39_scene_1_model_init(FlipBip39Scene1Model* const model, const int strength) {
+static void flipbip_scene_1_model_init(FlipBipScene1Model* const model, const int strength) {
     
     model->page = 0;
 
@@ -106,7 +106,7 @@ static void flipbip39_scene_1_model_init(FlipBip39Scene1Model* const model, cons
     }
 
     // Split the mnemonic into parts
-    char *mnemopart = flipbip39_strtok(mnemo, ",");
+    char *mnemopart = flipbip_strtok(mnemo, ",");
     int partnum = 0;
     while(mnemopart != NULL)
     {
@@ -121,7 +121,7 @@ static void flipbip39_scene_1_model_init(FlipBip39Scene1Model* const model, cons
         if (partnum == 5) model->mnemonic5 = partptr;
         if (partnum == 6) model->mnemonic6 = partptr;
 
-        mnemopart = flipbip39_strtok(NULL, ",");
+        mnemopart = flipbip_strtok(NULL, ",");
     }
 
     // Generate a BIP39 seed from the mnemonic
@@ -246,18 +246,18 @@ static void flipbip39_scene_1_model_init(FlipBip39Scene1Model* const model, cons
     bip39_cache_clear();
 }
 
-bool flipbip39_scene_1_input(InputEvent* event, void* context) {
+bool flipbip_scene_1_input(InputEvent* event, void* context) {
     furi_assert(context); 
-    FlipBip39Scene1* instance = context;
+    FlipBipScene1* instance = context;
     if (event->type == InputTypeRelease) {
         switch(event->key) {
             case InputKeyBack:
                 with_view_model(
                     instance->view,
-                    FlipBip39Scene1Model * model,
+                    FlipBipScene1Model * model,
                     {
                         UNUSED(model);
-                        instance->callback(FlipBip39CustomEventScene1Back, instance->context);
+                        instance->callback(FlipBipCustomEventScene1Back, instance->context);
                     },
                     true);
                 break;
@@ -268,7 +268,7 @@ bool flipbip39_scene_1_input(InputEvent* event, void* context) {
             case InputKeyOk:
                 with_view_model(
                     instance->view,
-                    FlipBip39Scene1Model* model,
+                    FlipBipScene1Model* model,
                     {
                         //UNUSED(model);
                         model->page = (model->page + 1) % 2;
@@ -282,13 +282,13 @@ bool flipbip39_scene_1_input(InputEvent* event, void* context) {
     return true;
 }
 
-void flipbip39_scene_1_exit(void* context) {
+void flipbip_scene_1_exit(void* context) {
     furi_assert(context);
-    FlipBip39Scene1* instance = (FlipBip39Scene1*)context;
+    FlipBipScene1* instance = (FlipBipScene1*)context;
 
     with_view_model(
         instance->view,
-        FlipBip39Scene1Model * model,
+        FlipBipScene1Model * model,
         {
             // Clear the mnemonic from memory
             model->page = 0;
@@ -310,40 +310,40 @@ void flipbip39_scene_1_exit(void* context) {
     );
 }
 
-void flipbip39_scene_1_enter(void* context) {
+void flipbip_scene_1_enter(void* context) {
     furi_assert(context);
-    FlipBip39Scene1* instance = (FlipBip39Scene1*)context;
+    FlipBipScene1* instance = (FlipBipScene1*)context;
 
-    FlipBip39* app = instance->context;
+    FlipBip* app = instance->context;
     int strength_setting = app->bip39_strength;
     int strength = 256;
     if (strength_setting == 0) strength = 128;
     else if (strength_setting == 1) strength = 192;
 
-    flipbip39_play_happy_bump(app);
-    flipbip39_led_set_rgb(app, 255, 0, 0);
+    flipbip_play_happy_bump(app);
+    flipbip_led_set_rgb(app, 255, 0, 0);
 
     with_view_model(
         instance->view,
-        FlipBip39Scene1Model * model,
+        FlipBipScene1Model * model,
         {
-            flipbip39_scene_1_model_init(model, strength);
+            flipbip_scene_1_model_init(model, strength);
         },
         true
     );
 }
 
-FlipBip39Scene1* flipbip39_scene_1_alloc() {
-    FlipBip39Scene1* instance = malloc(sizeof(FlipBip39Scene1));
+FlipBipScene1* flipbip_scene_1_alloc() {
+    FlipBipScene1* instance = malloc(sizeof(FlipBipScene1));
     instance->view = view_alloc();
-    view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(FlipBip39Scene1Model));
+    view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(FlipBipScene1Model));
     view_set_context(instance->view, instance); // furi_assert crashes in events without this
-    view_set_draw_callback(instance->view, (ViewDrawCallback)flipbip39_scene_1_draw);
-    view_set_input_callback(instance->view, flipbip39_scene_1_input);
-    view_set_enter_callback(instance->view, flipbip39_scene_1_enter);
-    view_set_exit_callback(instance->view, flipbip39_scene_1_exit);
+    view_set_draw_callback(instance->view, (ViewDrawCallback)flipbip_scene_1_draw);
+    view_set_input_callback(instance->view, flipbip_scene_1_input);
+    view_set_enter_callback(instance->view, flipbip_scene_1_enter);
+    view_set_exit_callback(instance->view, flipbip_scene_1_exit);
 
-    // FlipBip39* app = instance->context;
+    // FlipBip* app = instance->context;
     // int strength_setting = app->bip39_strength;
     // int strength = 256;
     // if (strength_setting == 0) strength = 128;
@@ -351,9 +351,9 @@ FlipBip39Scene1* flipbip39_scene_1_alloc() {
 
     // with_view_model(
     //     instance->view,
-    //     FlipBip39Scene1Model * model,
+    //     FlipBipScene1Model * model,
     //     {
-    //         flipbip39_scene_1_model_init(model, strength);
+    //         flipbip_scene_1_model_init(model, strength);
     //     },
     //     true
     // );
@@ -361,12 +361,12 @@ FlipBip39Scene1* flipbip39_scene_1_alloc() {
     return instance;
 }
 
-void flipbip39_scene_1_free(FlipBip39Scene1* instance) {
+void flipbip_scene_1_free(FlipBipScene1* instance) {
     furi_assert(instance);
 
     with_view_model(
         instance->view,
-        FlipBip39Scene1Model * model,
+        FlipBipScene1Model * model,
         {
             //UNUSED(model);
             free((void*)model->seed1);
@@ -387,7 +387,7 @@ void flipbip39_scene_1_free(FlipBip39Scene1* instance) {
     free(instance);
 }
 
-View* flipbip39_scene_1_get_view(FlipBip39Scene1* instance) {
+View* flipbip_scene_1_get_view(FlipBipScene1* instance) {
     furi_assert(instance);
     return instance->view;
 }

+ 19 - 0
views/flipbip_scene_1.h

@@ -0,0 +1,19 @@
+#pragma once
+
+#include <gui/view.h>
+#include "../helpers/flipbip_custom_event.h"
+
+typedef struct FlipBipScene1 FlipBipScene1;
+
+typedef void (*FlipBipScene1Callback)(FlipBipCustomEvent event, void* context);
+
+void flipbip_scene_1_set_callback(
+    FlipBipScene1* flipbip_scene_1,
+    FlipBipScene1Callback callback,
+    void* context);
+
+View* flipbip_scene_1_get_view(FlipBipScene1* flipbip_static);
+
+FlipBipScene1* flipbip_scene_1_alloc();
+
+void flipbip_scene_1_free(FlipBipScene1* flipbip_static);

+ 69 - 69
views/flipbip39_scene_2.c → views/flipbip_scene_2.c

@@ -1,22 +1,22 @@
-#include "../flipbip39.h"
+#include "../flipbip.h"
 #include <furi.h>
 #include <furi_hal.h>
 #include <input/input.h>
 #include <gui/elements.h>
 #include <dolphin/dolphin.h>
-#include "../helpers/flipbip39_haptic.h"
-#include "../helpers/flipbip39_speaker.h"
-#include "../helpers/flipbip39_led.h"
+#include "../helpers/flipbip_haptic.h"
+#include "../helpers/flipbip_speaker.h"
+#include "../helpers/flipbip_led.h"
 
-struct FlipBip39Scene2 {
+struct FlipBipScene2 {
     View* view;
-    FlipBip39Scene2Callback callback;
+    FlipBipScene2Callback callback;
     void* context;
 };
 
 typedef struct {
     int screen_text;
-} FlipBip39Scene2Model;
+} FlipBipScene2Model;
 
 char buttonText[11][14] = {
     "",
@@ -32,9 +32,9 @@ char buttonText[11][14] = {
     "Release Ok",
 };
 
-void flipbip39_scene_2_set_callback(
-    FlipBip39Scene2* instance,
-    FlipBip39Scene2Callback callback,
+void flipbip_scene_2_set_callback(
+    FlipBipScene2* instance,
+    FlipBipScene2Callback callback,
     void* context) {
     furi_assert(instance);
     furi_assert(callback);
@@ -42,7 +42,7 @@ void flipbip39_scene_2_set_callback(
     instance->context = context;
 }
 
-void flipbip39_scene_2_draw(Canvas* canvas, FlipBip39Scene2Model* model) {
+void flipbip_scene_2_draw(Canvas* canvas, FlipBipScene2Model* model) {
     canvas_clear(canvas);
     canvas_set_color(canvas, ColorBlack);
     canvas_set_font(canvas, FontPrimary);
@@ -54,84 +54,84 @@ void flipbip39_scene_2_draw(Canvas* canvas, FlipBip39Scene2Model* model) {
     free(strInput);
 }
 
-static void flipbip39_scene_2_model_init(FlipBip39Scene2Model* const model) {
+static void flipbip_scene_2_model_init(FlipBipScene2Model* const model) {
     model->screen_text = 0;
 }
 
-bool flipbip39_scene_2_input(InputEvent* event, void* context) {
+bool flipbip_scene_2_input(InputEvent* event, void* context) {
     furi_assert(context);
-    FlipBip39Scene2* instance = context;
+    FlipBipScene2* instance = context;
     if (event->type == InputTypeRelease) {
         switch(event->key) {
             case InputKeyBack:
                 with_view_model(
                     instance->view,
-                    FlipBip39Scene2Model * model,
+                    FlipBipScene2Model * model,
                     {
                         UNUSED(model);
-                        flipbip39_stop_all_sound(instance->context);
-                        instance->callback(FlipBip39CustomEventScene2Back, instance->context);
-                        flipbip39_play_long_bump(instance->context);
+                        flipbip_stop_all_sound(instance->context);
+                        instance->callback(FlipBipCustomEventScene2Back, instance->context);
+                        flipbip_play_long_bump(instance->context);
                     },
                     true);
                 break;
             case InputKeyUp:
                 with_view_model(
                     instance->view,
-                    FlipBip39Scene2Model * model,
+                    FlipBipScene2Model * model,
                     {
                         model->screen_text = 6;
-                        flipbip39_play_bad_bump(instance->context);
-                        flipbip39_stop_all_sound(instance->context);
-                        flipbip39_led_set_rgb(instance->context, 255, 0, 255);
+                        flipbip_play_bad_bump(instance->context);
+                        flipbip_stop_all_sound(instance->context);
+                        flipbip_led_set_rgb(instance->context, 255, 0, 255);
                     },
                     true);
                 break;
             case InputKeyDown:
                 with_view_model(
                     instance->view,
-                    FlipBip39Scene2Model * model,
+                    FlipBipScene2Model * model,
                     {
                         model->screen_text = 7;
-                        flipbip39_play_bad_bump(instance->context);
-                        flipbip39_stop_all_sound(instance->context);
-                        flipbip39_led_set_rgb(instance->context, 255, 255, 0);
+                        flipbip_play_bad_bump(instance->context);
+                        flipbip_stop_all_sound(instance->context);
+                        flipbip_led_set_rgb(instance->context, 255, 255, 0);
                     },
                     true);
                 break;
             case InputKeyLeft:
                 with_view_model(
                     instance->view,
-                    FlipBip39Scene2Model * model,
+                    FlipBipScene2Model * model,
                     {
                         model->screen_text = 8;
-                        flipbip39_play_bad_bump(instance->context);
-                        flipbip39_stop_all_sound(instance->context);
-                        flipbip39_led_set_rgb(instance->context, 0, 255, 255);
+                        flipbip_play_bad_bump(instance->context);
+                        flipbip_stop_all_sound(instance->context);
+                        flipbip_led_set_rgb(instance->context, 0, 255, 255);
                     },
                     true);
                 break;
             case InputKeyRight:
                 with_view_model(
                     instance->view,
-                    FlipBip39Scene2Model * model,
+                    FlipBipScene2Model * model,
                     {
                         model->screen_text = 9;
-                        flipbip39_play_bad_bump(instance->context);
-                        flipbip39_stop_all_sound(instance->context);
-                        flipbip39_led_set_rgb(instance->context, 255, 0, 0);
+                        flipbip_play_bad_bump(instance->context);
+                        flipbip_stop_all_sound(instance->context);
+                        flipbip_led_set_rgb(instance->context, 255, 0, 0);
                     },
                     true);
                 break;
             case InputKeyOk:
                 with_view_model(
                     instance->view,
-                    FlipBip39Scene2Model * model,
+                    FlipBipScene2Model * model,
                     {
                         model->screen_text = 10;
-                        flipbip39_play_bad_bump(instance->context);
-                        flipbip39_stop_all_sound(instance->context);
-                        flipbip39_led_set_rgb(instance->context, 255, 255, 255);
+                        flipbip_play_bad_bump(instance->context);
+                        flipbip_stop_all_sound(instance->context);
+                        flipbip_led_set_rgb(instance->context, 255, 255, 255);
                     },
                     true);
                 break;
@@ -143,55 +143,55 @@ bool flipbip39_scene_2_input(InputEvent* event, void* context) {
             case InputKeyUp:
                 with_view_model(
                     instance->view,
-                    FlipBip39Scene2Model * model,
+                    FlipBipScene2Model * model,
                     {
                         model->screen_text = 1;
-                        flipbip39_play_happy_bump(instance->context);
-                        flipbip39_play_input_sound(instance->context);
+                        flipbip_play_happy_bump(instance->context);
+                        flipbip_play_input_sound(instance->context);
                     },
                     true);
                 break;
             case InputKeyDown:
                 with_view_model(
                     instance->view,
-                    FlipBip39Scene2Model * model,
+                    FlipBipScene2Model * model,
                     {
                         model->screen_text = 2;
-                        flipbip39_play_happy_bump(instance->context);
-                        flipbip39_play_input_sound(instance->context);
+                        flipbip_play_happy_bump(instance->context);
+                        flipbip_play_input_sound(instance->context);
                     },
                     true);
                 break;
             case InputKeyLeft:
                 with_view_model(
                     instance->view,
-                    FlipBip39Scene2Model * model,
+                    FlipBipScene2Model * model,
                     {
                         model->screen_text = 3;
-                        flipbip39_play_happy_bump(instance->context);
-                        flipbip39_play_input_sound(instance->context);
+                        flipbip_play_happy_bump(instance->context);
+                        flipbip_play_input_sound(instance->context);
                     },
                     true);
                 break;
             case InputKeyRight:
                 with_view_model(
                     instance->view,
-                    FlipBip39Scene2Model * model,
+                    FlipBipScene2Model * model,
                     {
                         model->screen_text = 4;
-                        flipbip39_play_happy_bump(instance->context);
-                        flipbip39_play_input_sound(instance->context);
+                        flipbip_play_happy_bump(instance->context);
+                        flipbip_play_input_sound(instance->context);
                     },
                     true);
                 break;
             case InputKeyOk:
                 with_view_model(
                     instance->view,
-                    FlipBip39Scene2Model * model,
+                    FlipBipScene2Model * model,
                     {
                         model->screen_text = 5;
-                        flipbip39_play_happy_bump(instance->context);
-                        flipbip39_play_input_sound(instance->context);
+                        flipbip_play_happy_bump(instance->context);
+                        flipbip_play_input_sound(instance->context);
                     },
                     true);
                 break;
@@ -204,40 +204,40 @@ bool flipbip39_scene_2_input(InputEvent* event, void* context) {
     return true;
 }
 
-void flipbip39_scene_2_exit(void* context) {
+void flipbip_scene_2_exit(void* context) {
     furi_assert(context);
-    FlipBip39* app = context;
-    flipbip39_stop_all_sound(app);
-    //flipbip39_led_reset(app);
+    FlipBip* app = context;
+    flipbip_stop_all_sound(app);
+    //flipbip_led_reset(app);
 }
 
-void flipbip39_scene_2_enter(void* context) {
+void flipbip_scene_2_enter(void* context) {
     furi_assert(context);
     DOLPHIN_DEED(DolphinDeedPluginStart);
 }
 
-FlipBip39Scene2* flipbip39_scene_2_alloc() {
-    FlipBip39Scene2* instance = malloc(sizeof(FlipBip39Scene2));
+FlipBipScene2* flipbip_scene_2_alloc() {
+    FlipBipScene2* instance = malloc(sizeof(FlipBipScene2));
     instance->view = view_alloc();
-    view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(FlipBip39Scene2Model));
+    view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(FlipBipScene2Model));
     view_set_context(instance->view, instance);
-    view_set_draw_callback(instance->view, (ViewDrawCallback)flipbip39_scene_2_draw);
-    view_set_input_callback(instance->view, flipbip39_scene_2_input);
-    //view_set_enter_callback(instance->view, flipbip39_scene_2_enter);
-    view_set_exit_callback(instance->view, flipbip39_scene_2_exit);
+    view_set_draw_callback(instance->view, (ViewDrawCallback)flipbip_scene_2_draw);
+    view_set_input_callback(instance->view, flipbip_scene_2_input);
+    //view_set_enter_callback(instance->view, flipbip_scene_2_enter);
+    view_set_exit_callback(instance->view, flipbip_scene_2_exit);
 
     with_view_model(
         instance->view,
-        FlipBip39Scene2Model * model,
+        FlipBipScene2Model * model,
         {
-            flipbip39_scene_2_model_init(model);
+            flipbip_scene_2_model_init(model);
         },
         true);
     
     return instance;
 }
 
-void flipbip39_scene_2_free(FlipBip39Scene2* instance) {
+void flipbip_scene_2_free(FlipBipScene2* instance) {
     furi_assert(instance);
 
 
@@ -245,7 +245,7 @@ void flipbip39_scene_2_free(FlipBip39Scene2* instance) {
     free(instance);
 }
 
-View* flipbip39_scene_2_get_view(FlipBip39Scene2* instance) {
+View* flipbip_scene_2_get_view(FlipBipScene2* instance) {
     furi_assert(instance);
 
 

+ 19 - 0
views/flipbip_scene_2.h

@@ -0,0 +1,19 @@
+#pragma once
+
+#include <gui/view.h>
+#include "../helpers/flipbip_custom_event.h"
+
+typedef struct FlipBipScene2 FlipBipScene2;
+
+typedef void (*FlipBipScene2Callback)(FlipBipCustomEvent event, void* context);
+
+void flipbip_scene_2_set_callback(
+    FlipBipScene2* instance,
+    FlipBipScene2Callback callback,
+    void * context);
+
+FlipBipScene2* flipbip_scene_2_alloc();
+
+void flipbip_scene_2_free(FlipBipScene2* flipbip_static);
+
+View* flipbip_scene_2_get_view(FlipBipScene2* boilerpate_static);

+ 32 - 32
views/flipbip39_startscreen.c → views/flipbip_startscreen.c

@@ -1,24 +1,24 @@
-#include "../flipbip39.h"
+#include "../flipbip.h"
 #include <furi.h>
 #include <furi_hal.h>
 #include <input/input.h>
 #include <gui/elements.h>
 #include "FlipBIP_icons.h"
 
-struct FlipBip39Startscreen {
+struct FlipBipStartscreen {
     View* view;
-    FlipBip39StartscreenCallback callback;
+    FlipBipStartscreenCallback callback;
     void* context;
 };
 
 
 typedef struct {
     int some_value;
-} FlipBip39StartscreenModel;
+} FlipBipStartscreenModel;
 
-void flipbip39_startscreen_set_callback(
-    FlipBip39Startscreen* instance,
-    FlipBip39StartscreenCallback callback,
+void flipbip_startscreen_set_callback(
+    FlipBipStartscreen* instance,
+    FlipBipStartscreenCallback callback,
     void* context) {
     furi_assert(instance);
     furi_assert(callback);
@@ -26,7 +26,7 @@ void flipbip39_startscreen_set_callback(
     instance->context = context;
 }
 
-void flipbip39_startscreen_draw(Canvas* canvas, FlipBip39StartscreenModel* model) {
+void flipbip_startscreen_draw(Canvas* canvas, FlipBipStartscreenModel* model) {
     UNUSED(model);
     canvas_clear(canvas);
     canvas_set_color(canvas, ColorBlack);
@@ -46,22 +46,22 @@ void flipbip39_startscreen_draw(Canvas* canvas, FlipBip39StartscreenModel* model
     elements_button_right(canvas, "Start"); 
 }
 
-static void flipbip39_startscreen_model_init(FlipBip39StartscreenModel* const model) {
+static void flipbip_startscreen_model_init(FlipBipStartscreenModel* const model) {
     model->some_value = 1;
 }
 
-bool flipbip39_startscreen_input(InputEvent* event, void* context) {
+bool flipbip_startscreen_input(InputEvent* event, void* context) {
     furi_assert(context); 
-    FlipBip39Startscreen* instance = context;
+    FlipBipStartscreen* instance = context;
     if (event->type == InputTypeRelease) {
         switch(event->key) {
             case InputKeyBack:
                 with_view_model(
                     instance->view,
-                    FlipBip39StartscreenModel * model,
+                    FlipBipStartscreenModel * model,
                     {
                         UNUSED(model);
-                        instance->callback(FlipBip39CustomEventStartscreenBack, instance->context);
+                        instance->callback(FlipBipCustomEventStartscreenBack, instance->context);
                     },
                     true);
                 break;
@@ -72,10 +72,10 @@ bool flipbip39_startscreen_input(InputEvent* event, void* context) {
             case InputKeyOk:
                 with_view_model(
                     instance->view,
-                    FlipBip39StartscreenModel* model,
+                    FlipBipStartscreenModel* model,
                     {
                         UNUSED(model);
-                        instance->callback(FlipBip39CustomEventStartscreenOk, instance->context);
+                        instance->callback(FlipBipCustomEventStartscreenOk, instance->context);
                     },
                     true);
                 break;
@@ -86,38 +86,38 @@ bool flipbip39_startscreen_input(InputEvent* event, void* context) {
     return true;
 }
 
-void flipbip39_startscreen_exit(void* context) {
+void flipbip_startscreen_exit(void* context) {
     furi_assert(context);
 }
 
-void flipbip39_startscreen_enter(void* context) {
+void flipbip_startscreen_enter(void* context) {
     furi_assert(context);
-    FlipBip39Startscreen* instance = (FlipBip39Startscreen*)context;
+    FlipBipStartscreen* instance = (FlipBipStartscreen*)context;
     with_view_model(
         instance->view,
-        FlipBip39StartscreenModel * model,
+        FlipBipStartscreenModel * model,
         {
-            flipbip39_startscreen_model_init(model);
+            flipbip_startscreen_model_init(model);
         },
         true
     );
 }
 
-FlipBip39Startscreen* flipbip39_startscreen_alloc() {
-    FlipBip39Startscreen* instance = malloc(sizeof(FlipBip39Startscreen));
+FlipBipStartscreen* flipbip_startscreen_alloc() {
+    FlipBipStartscreen* instance = malloc(sizeof(FlipBipStartscreen));
     instance->view = view_alloc();
-    view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(FlipBip39StartscreenModel));
+    view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(FlipBipStartscreenModel));
     view_set_context(instance->view, instance); // furi_assert crashes in events without this
-    view_set_draw_callback(instance->view, (ViewDrawCallback)flipbip39_startscreen_draw);
-    view_set_input_callback(instance->view, flipbip39_startscreen_input);
-    //view_set_enter_callback(instance->view, flipbip39_startscreen_enter);
-    //view_set_exit_callback(instance->view, flipbip39_startscreen_exit);
+    view_set_draw_callback(instance->view, (ViewDrawCallback)flipbip_startscreen_draw);
+    view_set_input_callback(instance->view, flipbip_startscreen_input);
+    //view_set_enter_callback(instance->view, flipbip_startscreen_enter);
+    //view_set_exit_callback(instance->view, flipbip_startscreen_exit);
 
     with_view_model(
         instance->view,
-        FlipBip39StartscreenModel * model,
+        FlipBipStartscreenModel * model,
         {
-            flipbip39_startscreen_model_init(model);
+            flipbip_startscreen_model_init(model);
         },
         true
     );
@@ -125,12 +125,12 @@ FlipBip39Startscreen* flipbip39_startscreen_alloc() {
     return instance;
 }
 
-void flipbip39_startscreen_free(FlipBip39Startscreen* instance) {
+void flipbip_startscreen_free(FlipBipStartscreen* instance) {
     furi_assert(instance);
 
     with_view_model(
         instance->view,
-        FlipBip39StartscreenModel * model,
+        FlipBipStartscreenModel * model,
         {
             UNUSED(model);
         },
@@ -139,7 +139,7 @@ void flipbip39_startscreen_free(FlipBip39Startscreen* instance) {
     free(instance);
 }
 
-View* flipbip39_startscreen_get_view(FlipBip39Startscreen* instance) {
+View* flipbip_startscreen_get_view(FlipBipStartscreen* instance) {
     furi_assert(instance);
     return instance->view;
 }

+ 19 - 0
views/flipbip_startscreen.h

@@ -0,0 +1,19 @@
+#pragma once
+
+#include <gui/view.h>
+#include "../helpers/flipbip_custom_event.h"
+
+typedef struct FlipBipStartscreen FlipBipStartscreen;
+
+typedef void (*FlipBipStartscreenCallback)(FlipBipCustomEvent event, void* context);
+
+void flipbip_startscreen_set_callback(
+    FlipBipStartscreen* flipbip_startscreen,
+    FlipBipStartscreenCallback callback,
+    void* context);
+
+View* flipbip_startscreen_get_view(FlipBipStartscreen* flipbip_static);
+
+FlipBipStartscreen* flipbip_startscreen_alloc();
+
+void flipbip_startscreen_free(FlipBipStartscreen* flipbip_static);