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
  Movuan distribution for PinePhone merom 4 710 04-07-2025, 12:32 AM
Last Post: tllim
  How-To: Remote Control Your Phone from Desktop via VNC biketool 6 1,783 03-05-2025, 06:18 AM
Last Post: Kevin Kofler
  Latest firmware for PinePhone modem! Subsentient 105 168,957 02-02-2025, 08:47 PM
Last Post: bacydentir85
  Slarm64 on PinePhone [Unofficial Slackware ARM - 64 bit] acid andy 40 40,790 12-28-2024, 12:19 AM
Last Post: mara
  Office applications for the Pinephone Peter Gamma 2 1,214 09-05-2024, 09:22 AM
Last Post: Peter Gamma
  Struggle to install LibreOffice on the PinePhone Peter Gamma 50 44,148 07-26-2024, 10:35 PM
Last Post: Peter Gamma
  Why does Pine64 sabotage office on the Pinephone? Peter Gamma 5 2,158 07-04-2024, 07:34 AM
Last Post: Kevin Kofler
  Which word processor to choose for the Pinephone? Peter Gamma 16 8,487 06-22-2024, 07:28 AM
Last Post: Peter Gamma
  Samba share on the Pinephone? Peter Gamma 0 1,017 06-16-2024, 10:26 PM
Last Post: Peter Gamma
  Possible Free Backup Carrier for PinePhone PineFone 0 944 06-13-2024, 03:45 PM
Last Post: PineFone

Forum Jump:


Users browsing this thread: 1 Guest(s)