-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_defines.h
143 lines (126 loc) · 2.69 KB
/
app_defines.h
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#ifndef APP_DEFINES_H
#define APP_DEFINES_H
#define GPIO_PIN_COUNT 8
#define ANIMATE_FRAME_TIME_MS 133
#define FRAME_TIME 66.666666
typedef void (*DrawView)(Canvas* canvas, void* ctx);
typedef void (*HandleInput)(InputEvent* event, void* ctx);
typedef enum {
MAIN_VIEW,
CONFIG_MENU_VIEW
}enum_view;
typedef enum {
GPIO_MODE_INPUT,
GPIO_MODE_INPUT_PULLUP,
GPIO_MODE_OUTPUT,
GPIO_MODE_UNSET
}GpioUserMode;
typedef enum {
GPIO_VALUE_TRUE,
GPIO_VALUE_FALSE,
GPIO_VALUE_INPUT,
GPIO_VALUE_NONE
}GpioUserValue;
typedef enum {
CONFIG_MENU_MODE,
CONFIG_MENU_VALUE,
CONFIG_MENU_INPUT
}ConfigMenuOptions;
typedef struct {
GpioUserMode mode;
GpioUserValue value;
int gp_idx_input;
bool changed;
GpioUserMode prev_mode;
}GPIOPinUserSelection;
typedef struct {
int selected;
enum_view view;
int wiggle_frame;
size_t prev_frame_time;
size_t elapsed_time;
double result;
double freq_var;
double elapsed_var;
ConfigMenuOptions config_menu_selected;
} ViewerState;
// 5V A7 A6 A4 B3 B2 C3 GND SET
//
//
// 3V SWC GND SIO TX RX C1 C0 1W GND
typedef enum {
PIN_5V = 0,
PIN_A7,
PIN_A6,
PIN_A4,
PIN_B3,
PIN_B2,
PIN_C3,
GEARIC,
PIN_3V,
PIN_SWC,
PIN_SIO,
PIN_TX,
PIN_RX,
PIN_C1,
PIN_C0,
PIN_1W,
PIN_GND_08,
PIN_GND_11,
PIN_GND_18,
NONE
}enum_view_element;
typedef struct {
enum_view_element element;
enum_view_element opposite;
bool selectable;
bool editable;
bool top_row;
bool pull_out;
int gp_idx;
uint8_t x_pos;
uint8_t y_pos;
const char* name;
Icon* icon;
Icon* selected_icon;
}ViewElement;
typedef struct {
uint8_t element_idx;
const GpioPin* pin;
GpioMode mode;
GpioPull pull;
GpioSpeed speed;
double value;
const char* name;
bool unset;
bool found;
bool input;
GPIOPinUserSelection user;
}GPIOPin;
// GPIO enums from firmware/targets/f7/furi_hal/furi_hal_gpio.h
// /**
// * Gpio modes
// */
// typedef enum {
// *GpioModeInput,
// *GpioModeOutputPushPull,
// GpioModeOutputOpenDrain,
// GpioModeAltFunctionPushPull,
// GpioModeAltFunctionOpenDrain,
// *GpioModeAnalog,
// GpioModeInterruptRise,
// GpioModeInterruptFall,
// GpioModeInterruptRiseFall,
// GpioModeEventRise,
// GpioModeEventFall,
// GpioModeEventRiseFall,
// } GpioMode;
// /**
// * Gpio pull modes
// */
// typedef enum {
// GpioPullNo,
// GpioPullUp,
// GpioPullDown,
// } GpioPull;
#endif