Article: NuttX RTOS for PinePhone: Feature Phone UI in LVGL, Zig and WebAssembly
#40
I think I got some kind of CPU thermal value, counting backwards Smile just need to work out what value to use for CPU temperature shutdown, not that I am stressing the device too much yet Wink

PS being able to do this in Zig is really nice, I get type safety on the poke() (saved me twice) and errors every time I miscount the bit flags in the registers, which saves me at least 3 times a day Wink




Code:
pub const THS_FILT_CTRL_ADDR = Reg32(THS_FILT_CTRL_REG, THS_BASE_ADDR + THS_FILTER);
pub const THS_FILT_CTRL_REG = packed struct(u32) {
    FILTER_TYPE: Filter = Filter.TYPE4,
    FILTER_EN: bool = false,
    _3: u29 = 0,

    pub const Filter = enum(u2) {
        TYPE2 = 0b00,
        TYPE4 = 0b01,
        TYPE8 = 0b10,
        TYPE16 = 0b11,
    };
};


I am still not sure on the naming scheme still, since the ADDR and REG are pretty much the same thing, but the usage below reads okay I think, and I want to be easily searchable for the register names in the 'User Manual'.  Although probably I change the _ADDR to be _REG, and the _REG to be _VAL or _TYPE, not sure yet, will do some more work on the audio side and see what reads best Smile  It is not very linux like, but I am still trying to get my head around linux abstractions, device trees, file based drivers, etc etc.  Just having some fun for now! Smile  Will also probably break down the CCU chapter into smaller manageable units, it's huge as I am sure you noticed!

Code:
    var fltr = thermals.THS_FILT_CTRL_ADDR.peek();
    fltr.FILTER_TYPE = thermals.THS_FILT_CTRL_REG.Filter.TYPE8;
    fltr.FILTER_EN = true;
    thermals.THS_FILT_CTRL_ADDR.poke(fltr);
  Reply


Messages In This Thread
RE: Article: NuttX RTOS for PinePhone: Feature Phone UI in LVGL, Zig and WebAssembly - by WhiteHexagon - 07-27-2023, 05:10 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  asterisk or FreePBX on pinephone? vanja 0 484 06-16-2026, 09:24 AM
Last Post: vanja
  Jami on Pinephone [ IM and VOIP ] p1trson 15 23,362 06-16-2026, 05:02 AM
Last Post: marlboro1950
  Movuan distribution for PinePhone merom 6 7,062 06-04-2026, 02:10 AM
Last Post: merom
  Latest firmware for PinePhone modem! Subsentient 106 233,962 04-03-2026, 08:37 AM
Last Post: baptx
  Fedora + Phosh for PinePhone njha 77 221,836 01-14-2026, 12:22 AM
Last Post: tllim
  Difficulty with openSUSE Tumbleweed Install PinePhone Beta danm1988 0 1,023 11-17-2025, 07:49 AM
Last Post: danm1988
  How-To: Remote Control Your Phone from Desktop via VNC biketool 16 14,489 10-16-2025, 06:55 AM
Last Post: biketool
  baremetal via Zig on PinePhone - JumpDrive help please WhiteHexagon 1 4,233 07-07-2025, 10:33 AM
Last Post: WhiteHexagon
  Jami on the Pine phone ? bcnaz 8 15,594 06-09-2025, 04:17 PM
Last Post: j_s
  Slarm64 on PinePhone [Unofficial Slackware ARM - 64 bit] acid andy 40 66,742 12-28-2024, 12:19 AM
Last Post: mara

Forum Jump:


Users browsing this thread: 1 Guest(s)