forked from zinongli/KeyCopier
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkey_copier.h
More file actions
89 lines (80 loc) · 2.25 KB
/
key_copier.h
File metadata and controls
89 lines (80 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include "key_copier_icons.h"
#include "key_formats.h"
#include <applications/services/dialogs/dialogs.h>
#include <applications/services/storage/storage.h>
#include <flipper_format.h>
#include <furi.h>
#include <furi_hal.h>
#include <gui/gui.h>
#include <gui/modules/submenu.h>
#include <gui/modules/text_input.h>
#include <gui/modules/variable_item_list.h>
#include <gui/modules/widget.h>
#include <gui/view.h>
#include <gui/view_dispatcher.h>
#include <math.h>
#include <notification/notification.h>
#include <notification/notification_messages.h>
#include <stdbool.h>
#define TAG "KeyCopier"
#define BACKLIGHT_ON 1
#define KEY_COPIER_FILE_EXTENSION ".keycopy"
#define INCHES_PER_PX 0.00978
typedef enum {
KeyCopierSubmenuIndexMeasure,
KeyCopierSubmenuIndexConfigure,
KeyCopierSubmenuIndexSave,
KeyCopierSubmenuIndexLoad,
KeyCopierSubmenuIndexAbout,
KeyCopierSubmenuIndexQRCode,
} KeyCopierSubmenuIndex;
typedef enum {
KeyCopierViewSubmenu,
KeyCopierViewTextInput,
KeyCopierViewConfigure_i,
KeyCopierViewConfigure_e,
KeyCopierViewSave,
KeyCopierViewLoad,
KeyCopierViewMeasure,
KeyCopierViewAbout,
KeyCopierViewQRCode,
KeyCopierViewManufacturerList,
KeyCopierViewFormatList,
} KeyCopierView;
typedef struct {
ViewDispatcher* view_dispatcher;
NotificationApp* notifications;
Submenu* submenu;
TextInput* text_input;
VariableItemList* variable_item_list_config;
View* view_measure;
View* view_config_e;
View* view_save;
View* view_load;
Widget* widget_about;
Widget* widget_qr_code;
VariableItem* key_name_item;
VariableItem* format_item;
VariableItem* format_name_item;
char* temp_buffer;
uint32_t temp_buffer_size;
DialogsApp* dialogs;
FuriString* file_path;
Submenu* manufacturer_list;
Submenu* format_list;
char* selected_manufacturer;
} KeyCopierApp;
typedef struct {
uint32_t format_index;
FuriString* key_name_str;
uint8_t pin_slc; // The pin that is being adjusted
uint8_t* depth; // The cutting depth
bool data_loaded;
KeyFormat format;
} KeyCopierModel;
static inline int min(int a, int b) {
return (a < b) ? a : b;
}
static inline int max(int a, int b) {
return (a > b) ? a : b;
}