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
  What File Manager Options Are There For The Pinephone? pinephoneuser22 3 47 9 hours ago
Last Post: pinephoneuser22
  PinePhone app development WhiteHexagon 14 605 05-17-2023, 10:41 PM
Last Post: Kevin Kofler
  When should new OS's like Genode & NuttX RTOS get their own PinePhone subforum? PineFone 1 246 05-17-2023, 06:38 PM
Last Post: lupyuen
  Article: NuttX RTOS for PinePhone: Phone Calls and Text Messages lupyuen 2 310 05-03-2023, 05:03 PM
Last Post: lupyuen
  Bliss OS on pinephone lcayer1 5 4,813 05-01-2023, 11:33 PM
Last Post: erickonix
  Fedora on Pinephone pasifi808 7 573 04-28-2023, 06:32 PM
Last Post: zetabeta
  Article: NuttX RTOS for PinePhone: 4G LTE Modem lupyuen 2 526 04-10-2023, 10:19 PM
Last Post: lupyuen
  Article: NuttX RTOS for PinePhone: USB with Enhanced Host Controller Interface lupyuen 2 641 04-07-2023, 03:47 AM
Last Post: lupyuen
  Slack on PinePhone Adam Seline 4 3,666 03-23-2023, 12:03 AM
Last Post: hall
  Struggle to install LibreOffice on the PinePhone Peter Gamma 41 11,725 03-16-2023, 11:39 PM
Last Post: Peter Gamma

Forum Jump:


Users browsing this thread: 1 Guest(s)