Skip to content

Commit 7ea4736

Browse files
committed
Refactor for NuttX
1 parent f2b768e commit 7ea4736

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

feature-phone.wasm

0 Bytes
Binary file not shown.

feature-phone.zig

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,26 @@ fn createDigitButtons(cont: *c.lv_obj_t) !void {
154154
}
155155
}
156156

157+
/// Labels for Call and Cancel Buttons
158+
const call_labels = [_][]const u8{ "Call", "Cancel" };
159+
160+
/// Labels for Digit Buttons
161+
const digit_labels = [_][]const u8{ "1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "0", "#" };
162+
163+
/// LVGL Display Text (Null-Terminated)
164+
var display_text = std.mem.zeroes([64:0]u8);
165+
166+
/// LVGL Display Label
167+
var display_label: lvgl.Label = undefined;
168+
169+
/// LVGL Styles for Containers (std.mem.zeroes crashes the compiler)
170+
var display_style: c.lv_style_t = undefined;
171+
var call_style: c.lv_style_t = undefined;
172+
var digit_style: c.lv_style_t = undefined;
173+
174+
///////////////////////////////////////////////////////////////////////////////
175+
// Handle Events
176+
157177
/// Handle LVGL Button Event
158178
/// https://docs.lvgl.io/8.3/examples.html#simple-buttons
159179
export fn eventHandler(e: ?*c.lv_event_t) void {
@@ -198,23 +218,6 @@ export fn eventHandler(e: ?*c.lv_event_t) void {
198218
}
199219
}
200220

201-
/// Labels for Call and Cancel Buttons
202-
const call_labels = [_][]const u8{ "Call", "Cancel" };
203-
204-
/// Labels for Digit Buttons
205-
const digit_labels = [_][]const u8{ "1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "0", "#" };
206-
207-
/// LVGL Display Text (Null-Terminated)
208-
var display_text = std.mem.zeroes([64:0]u8);
209-
210-
/// LVGL Display Label
211-
var display_label: lvgl.Label = undefined;
212-
213-
/// LVGL Styles for Containers (std.mem.zeroes crashes the compiler)
214-
var display_style: c.lv_style_t = undefined;
215-
var call_style: c.lv_style_t = undefined;
216-
var digit_style: c.lv_style_t = undefined;
217-
218221
///////////////////////////////////////////////////////////////////////////////
219222
// Imported Functions and Variables
220223

0 commit comments

Comments
 (0)