Skip to content

Commit 5b2657b

Browse files
committed
Button animates OK yay!
1 parent 86700c3 commit 5b2657b

File tree

1 file changed

+124
-35
lines changed

1 file changed

+124
-35
lines changed

README.md

Lines changed: 124 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,50 @@ And the LVGL Display renders OK in our HTML Canvas yay!
932932

933933
![Render LVGL Display in Web Browser](https://lupyuen.github.io/images/zig-wasm3.png)
934934

935+
# Handle LVGL Input
936+
937+
TODO
938+
939+
Create LVGL Button...
940+
941+
https://github.com/lupyuen/pinephone-lvgl-zig/blob/86700c3453d91bc7d2fe0a46192fa41b7a24b6df/feature-phone.zig#L185-L196
942+
943+
Handle Button Events...
944+
945+
https://github.com/lupyuen/pinephone-lvgl-zig/blob/86700c3453d91bc7d2fe0a46192fa41b7a24b6df/feature-phone.zig#L198-L208
946+
947+
Register the LVGL Input Device
948+
949+
https://github.com/lupyuen/pinephone-lvgl-zig/blob/86700c3453d91bc7d2fe0a46192fa41b7a24b6df/feature-phone.zig#L69-L74
950+
951+
Define LVGL Input Device Driver (std.mem.zeroes doesn't work)
952+
953+
https://github.com/lupyuen/pinephone-lvgl-zig/blob/86700c3453d91bc7d2fe0a46192fa41b7a24b6df/feature-phone.zig#L255-L270
954+
955+
Handle Timer in JavaScript
956+
957+
https://github.com/lupyuen/pinephone-lvgl-zig/blob/35cc0b7100e313453b451295a33dd2f689758792/feature-phone.js#L106-L122
958+
959+
Handle Timer in Zig
960+
961+
https://github.com/lupyuen/pinephone-lvgl-zig/blob/86700c3453d91bc7d2fe0a46192fa41b7a24b6df/feature-phone.zig#L213-L222
962+
963+
Handle Mouse in JavaScript
964+
965+
https://github.com/lupyuen/pinephone-lvgl-zig/blob/35cc0b7100e313453b451295a33dd2f689758792/feature-phone.js#L77-L95
966+
967+
Handle Mouse in Zig
968+
969+
https://github.com/lupyuen/pinephone-lvgl-zig/blob/86700c3453d91bc7d2fe0a46192fa41b7a24b6df/feature-phone.zig#L224-L235
970+
971+
Read Input Device in Zig
972+
973+
https://github.com/lupyuen/pinephone-lvgl-zig/blob/86700c3453d91bc7d2fe0a46192fa41b7a24b6df/feature-phone.zig#L237-L253
974+
975+
Remember to set Direct Mode!
976+
977+
https://github.com/lupyuen/pinephone-lvgl-zig/blob/86700c3453d91bc7d2fe0a46192fa41b7a24b6df/display.c#L94-L95
978+
935979
# LVGL Fonts
936980

937981
Remember to compile the LVGL Fonts! Or nothing will be rendered...
@@ -1013,38 +1057,49 @@ TODO: Here's the log...
10131057

10141058
```text
10151059
main: start
1016-
loop: start
10171060
lv_demo_widgets: start
10181061
[Info] lv_init: begin (in lv_obj.c line #102)
10191062
[Warn] lv_init: Log level is set to 'Trace' which makes LVGL much slower (in lv_obj.c line #176)
10201063
[Trace] lv_init: finished (in lv_obj.c line #183)
10211064
[Info] lv_obj_create: begin (in lv_obj.c line #206)
1022-
[Trace] lv_obj_class_create_obj: Creating object with 0x174cc class on 0 parent (in lv_obj_class.c line #45)
1065+
[Trace] lv_obj_class_create_obj: Creating object with 0x1774c class on 0 parent (in lv_obj_class.c line #45)
10231066
[Trace] lv_obj_class_create_obj: creating a screen (in lv_obj_class.c line #55)
10241067
[Trace] lv_obj_constructor: begin (in lv_obj.c line #403)
10251068
[Trace] lv_obj_constructor: finished (in lv_obj.c line #428)
10261069
[Info] lv_obj_create: begin (in lv_obj.c line #206)
1027-
[Trace] lv_obj_class_create_obj: Creating object with 0x174cc class on 0 parent (in lv_obj_class.c line #45)
1070+
[Trace] lv_obj_class_create_obj: Creating object with 0x1774c class on 0 parent (in lv_obj_class.c line #45)
10281071
[Trace] lv_obj_class_create_obj: creating a screen (in lv_obj_class.c line #55)
10291072
[Trace] lv_obj_constructor: begin (in lv_obj.c line #403)
10301073
[Trace] lv_obj_constructor: finished (in lv_obj.c line #428)
10311074
[Info] lv_obj_create: begin (in lv_obj.c line #206)
1032-
[Trace] lv_obj_class_create_obj: Creating object with 0x174cc class on 0 parent (in lv_obj_class.c line #45)
1075+
[Trace] lv_obj_class_create_obj: Creating object with 0x1774c class on 0 parent (in lv_obj_class.c line #45)
10331076
[Trace] lv_obj_class_create_obj: creating a screen (in lv_obj_class.c line #55)
10341077
[Trace] lv_obj_constructor: begin (in lv_obj.c line #403)
10351078
[Trace] lv_obj_constructor: finished (in lv_obj.c line #428)
10361079
createWidgetsWrapped: start
10371080
[Info] lv_label_create: begin (in lv_label.c line #75)
1038-
[Trace] lv_obj_class_create_obj: Creating object with 0x174b0 class on 0x39dfd0 parent (in lv_obj_class.c line #45)
1081+
[Trace] lv_obj_class_create_obj: Creating object with 0x17730 class on 0x39e2e0 parent (in lv_obj_class.c line #45)
1082+
[Trace] lv_obj_class_create_obj: creating normal object (in lv_obj_class.c line #82)
1083+
[Trace] lv_obj_constructor: begin (in lv_obj.c line #403)
1084+
[Trace] lv_obj_constructor: finished (in lv_obj.c line #428)
1085+
[Trace] lv_label_constructor: begin (in lv_label.c line #691)
1086+
[Trace] lv_label_constructor: finished (in lv_label.c line #721)
1087+
[Info] lv_btn_create: begin (in lv_btn.c line #51)
1088+
[Trace] lv_obj_class_create_obj: Creating object with 0x17d5c class on 0x39e2e0 parent (in lv_obj_class.c line #45)
1089+
[Trace] lv_obj_class_create_obj: creating normal object (in lv_obj_class.c line #82)
1090+
[Trace] lv_obj_constructor: begin (in lv_obj.c line #403)
1091+
[Trace] lv_obj_constructor: finished (in lv_obj.c line #428)
1092+
[Trace] lv_btn_constructor: begin (in lv_btn.c line #64)
1093+
[Trace] lv_btn_constructor: finished (in lv_btn.c line #69)
1094+
[Info] lv_label_create: begin (in lv_label.c line #75)
1095+
[Trace] lv_obj_class_create_obj: Creating object with 0x17730 class on 0x39e606 parent (in lv_obj_class.c line #45)
10391096
[Trace] lv_obj_class_create_obj: creating normal object (in lv_obj_class.c line #82)
10401097
[Trace] lv_obj_constructor: begin (in lv_obj.c line #403)
10411098
[Trace] lv_obj_constructor: finished (in lv_obj.c line #428)
10421099
[Trace] lv_label_constructor: begin (in lv_label.c line #691)
10431100
[Trace] lv_label_constructor: finished (in lv_label.c line #721)
10441101
createWidgetsWrapped: end
1045-
lv_timer_handler: start
1046-
[Trace] lv_timer_handler: begin (in lv_timer.c line #69)
1047-
[Trace] lv_timer_exec: calling timer callback: 0x19 (in lv_timer.c line #312)
1102+
lv_demo_widgets: end
10481103
[Info] lv_obj_update_layout: Layout update begin (in lv_obj_pos.c line #314)
10491104
[Trace] lv_obj_update_layout: Layout update end (in lv_obj_pos.c line #317)
10501105
[Info] lv_obj_update_layout: Layout update begin (in lv_obj_pos.c line #314)
@@ -1057,35 +1112,69 @@ lv_timer_handler: start
10571112
[Trace] lv_obj_update_layout: Layout update end (in lv_obj_pos.c line #317)
10581113
flushDisplay: start
10591114
render: start
1060-
get_canvas_buffer: 1782 non-empty pixels
1061-
canvas_buffer: 0x17e70
1062-
{bufferOffset: 97904}
1115+
get_canvas_buffer: 13600 non-empty pixels
1116+
canvas_buffer: 0x18180
1117+
{bufferOffset: 98688}
1118+
render: end
1119+
flushDisplay: end
1120+
main: end
1121+
{mousedown: {…}}
1122+
readInput: state=1, x=390, y=695
1123+
[Info] (2.820, +2762) indev_proc_press: pressed at x:390 y:695 (in lv_indev.c line #819)
1124+
flushDisplay: start
1125+
render: start
1126+
get_canvas_buffer: 13600 non-empty pixels
1127+
canvas_buffer: 0x18180
1128+
{bufferOffset: 98688}
1129+
render: end
1130+
flushDisplay: end
1131+
[Info] (2.854, +34) indev_proc_release: released (in lv_indev.c line #969)
1132+
eventHandler: toggled
1133+
eventHandler: clicked
1134+
flushDisplay: start
1135+
render: start
1136+
get_canvas_buffer: 13600 non-empty pixels
1137+
canvas_buffer: 0x18180
1138+
{bufferOffset: 98688}
1139+
render: end
1140+
flushDisplay: end
1141+
{mouseup: {…}}
1142+
readInput: state=0, x=390, y=695
1143+
flushDisplay: start
1144+
render: start
1145+
get_canvas_buffer: 14556 non-empty pixels
1146+
canvas_buffer: 0x18180
1147+
{bufferOffset: 98688}
1148+
render: end
1149+
flushDisplay: end
1150+
flushDisplay: start
1151+
render: start
1152+
get_canvas_buffer: 14074 non-empty pixels
1153+
canvas_buffer: 0x18180
1154+
{bufferOffset: 98688}
1155+
render: end
1156+
flushDisplay: end
1157+
flushDisplay: start
1158+
render: start
1159+
get_canvas_buffer: 14074 non-empty pixels
1160+
canvas_buffer: 0x18180
1161+
{bufferOffset: 98688}
1162+
render: end
1163+
flushDisplay: end
1164+
flushDisplay: start
1165+
render: start
1166+
get_canvas_buffer: 13600 non-empty pixels
1167+
canvas_buffer: 0x18180
1168+
{bufferOffset: 98688}
1169+
render: end
1170+
flushDisplay: end
1171+
flushDisplay: start
1172+
render: start
1173+
get_canvas_buffer: 13600 non-empty pixels
1174+
canvas_buffer: 0x18180
1175+
{bufferOffset: 98688}
10631176
render: end
10641177
flushDisplay: end
1065-
[Trace] lv_timer_exec: timer callback 0x19 finished (in lv_timer.c line #314)
1066-
[Trace] lv_timer_handler: finished (15 ms until the next timer call) (in lv_timer.c line #144)
1067-
lv_timer_handler: end
1068-
lv_timer_handler: start
1069-
[Trace] lv_timer_handler: begin (in lv_timer.c line #69)
1070-
[Trace] lv_timer_handler: finished (8 ms until the next timer call) (in lv_timer.c line #144)
1071-
lv_timer_handler: end
1072-
lv_timer_handler: start
1073-
[Trace] lv_timer_handler: begin (in lv_timer.c line #69)
1074-
[Trace] lv_timer_handler: finished (1 ms until the next timer call) (in lv_timer.c line #144)
1075-
lv_timer_handler: end
1076-
lv_timer_handler: start
1077-
[Trace] lv_timer_handler: begin (in lv_timer.c line #69)
1078-
[Trace] lv_timer_exec: calling timer callback: 0x19 (in lv_timer.c line #312)
1079-
[Trace] lv_timer_exec: timer callback 0x19 finished (in lv_timer.c line #314)
1080-
[Trace] lv_timer_handler: finished (-1 ms until the next timer call) (in lv_timer.c line #144)
1081-
lv_timer_handler: end
1082-
lv_timer_handler: start
1083-
[Trace] lv_timer_handler: begin (in lv_timer.c line #69)
1084-
[Trace] lv_timer_handler: finished (-1 ms until the next timer call) (in lv_timer.c line #144)
1085-
lv_timer_handler: end
1086-
lv_demo_widgets: end
1087-
loop: end
1088-
main: end
10891178
```
10901179

10911180
TODO: How to disassemble Compiled WebAssembly with cross-reference to Source Code? Like `objdump --source`? See [wabt](https://github.com/WebAssembly/wabt) and [binaryen](https://github.com/WebAssembly/binaryen)

0 commit comments

Comments
 (0)