Article: Inside a Smartphone Accelerometer: PinePhone with NuttX RTOS
#21
Haha no worries @WhiteHexagon , I'm now working on something really interesting: Simulate PinePhone UI with Zig, LVGL and WebAssembly :-)
  Reply
#22
Nice! @lupyuen  btw when you are missing functions in Zig/WASM it is often easier to make a call into the javascript world, unless you are on a performance critical path.  For my wasm stuff I also keep the render loop on the JS side using requestAnimationFrame but with a custom callback into Zig (once per frame) passing over a frame number, timestamp and canvas2d context.


roughly:

     
Code:
  WebAssembly.instantiateStreaming(fetch('app.wasm'),{env}).then(wa=>{
            zex=wa.instance.exports;
            zmb=zex.memory.buffer;
            zex.run();
            let fn=0;      //frame number
            function frame(ts) {
                zex.drawFrame(ctx,fn,timestamp);
                fn++;
                globalThis.requestAnimationFrame(frame);
            }
            globalThis.requestAnimationFrame(frame);
        })
  Reply
#23
Thanks @WhiteHexagon for the tips, we now have LVGL rendering OK in the Web Browser, compiled with Zig yay! :-)

LVGL renders OK in WebAssembly with Zig Compiler
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Why does Pine64 sabotage office on the Pinephone? Peter Gamma 5 441 07-04-2024, 07:34 AM
Last Post: Kevin Kofler
  Which word processor to choose for the Pinephone? Peter Gamma 16 3,540 06-22-2024, 07:28 AM
Last Post: Peter Gamma
  Samba share on the Pinephone? Peter Gamma 0 445 06-16-2024, 10:26 PM
Last Post: Peter Gamma
  Struggle to install LibreOffice on the PinePhone Peter Gamma 49 29,640 06-13-2024, 05:50 PM
Last Post: Peter Gamma
  Possible Free Backup Carrier for PinePhone PineFone 0 143 06-13-2024, 03:45 PM
Last Post: PineFone
  Using Signal on PinePhone in mid-2023? dante404 47 17,774 05-03-2024, 02:19 AM
Last Post: dragonhospital
  Slarm64 on PinePhone [Unofficial Slackware ARM - 64 bit] acid andy 38 28,068 04-23-2024, 10:29 AM
Last Post: donchurch
  PinePhone app development WhiteHexagon 15 5,391 04-23-2024, 05:19 AM
Last Post: Jonnyc
Wink PINEPHONE not booting Touchwood 2 825 02-23-2024, 07:27 AM
Last Post: Touchwood
  Slack on PinePhone Adam Seline 5 5,903 12-20-2023, 07:20 AM
Last Post: nickolas

Forum Jump:


Users browsing this thread: 1 Guest(s)