firmware for my Touchscreen E-Paper Input Module for Framework Laptop 16
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

eepy-sys: add header::find_program_by_name

arthomnix 416a7fae b1f64dc5

+15
+15
eepy-sys/src/header.rs
··· 25 25 slot_ptr(id).cast() 26 26 }} 27 27 28 + pub fn slot_of_addr<T>(addr: *const T) -> u8 { 29 + ((addr as usize - XIP_BASE as usize) / SLOT_SIZE) as u8 30 + } 31 + 28 32 29 33 pub struct Programs { 30 34 id: u8, ··· 208 212 self.bss_vma.write_bytes(0, self.bss_len); 209 213 } 210 214 }} 215 + } 216 + 217 + /// Get the slot number of the (first) program with the specified name, if it exists. 218 + pub fn find_program_by_name(name: &str) -> Option<u8> { 219 + Programs::new() 220 + .find(|psh| { 221 + // SAFETY: a header returned by Programs must be valid 222 + let prog_name = unsafe { (**psh).name() }; 223 + prog_name == Ok(name) 224 + }) 225 + .map(slot_of_addr) 211 226 }