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
  How-To: Remote Control Your Phone from Desktop via VNC biketool 2 411 10-12-2024, 11:47 AM
Last Post: biketool
  Office applications for the Pinephone Peter Gamma 2 516 09-05-2024, 09:22 AM
Last Post: Peter Gamma
  Struggle to install LibreOffice on the PinePhone Peter Gamma 50 34,827 07-26-2024, 10:35 PM
Last Post: Peter Gamma
  Why does Pine64 sabotage office on the Pinephone? Peter Gamma 5 968 07-04-2024, 07:34 AM
Last Post: Kevin Kofler
  Which word processor to choose for the Pinephone? Peter Gamma 16 5,215 06-22-2024, 07:28 AM
Last Post: Peter Gamma
  Samba share on the Pinephone? Peter Gamma 0 631 06-16-2024, 10:26 PM
Last Post: Peter Gamma
  Possible Free Backup Carrier for PinePhone PineFone 0 438 06-13-2024, 03:45 PM
Last Post: PineFone
  Using Signal on PinePhone in mid-2023? dante404 47 22,153 05-03-2024, 02:19 AM
Last Post: dragonhospital
  Slarm64 on PinePhone [Unofficial Slackware ARM - 64 bit] acid andy 38 32,402 04-23-2024, 10:29 AM
Last Post: donchurch
Wink PINEPHONE not booting Touchwood 2 1,188 02-23-2024, 07:27 AM
Last Post: Touchwood

Forum Jump:


Users browsing this thread: 1 Guest(s)