···9090 &mut watchdog,
9191 ).unwrap();
92929393+ // Read flash unique ID
9494+ cortex_m::interrupt::disable();
9595+ let mut id = [0u8; 8];
9696+ unsafe { rp2040_flash::flash::flash_unique_id(&mut id, true) };
9797+ let mut id = u64::from_be_bytes(id);
9898+ info!("Framework 16 EPD firmware version {}, serial no. {:x}", env!("CARGO_PKG_VERSION"), id);
9999+ let mut serial_no = [0u8; 16];
100100+ for c in serial_no.iter_mut().rev() {
101101+ let nibble = (id & 0x0f) as u8;
102102+ *c = match nibble {
103103+ 0x0..=0x9 => b'0' + nibble,
104104+ 0xa..=0xf => b'A' + nibble - 0xa,
105105+ _ => unreachable!(),
106106+ };
107107+ id >>= 4;
108108+ }
109109+ // Safety: this function never returns, so we should be fine right?
110110+ let serial_no: &'static str = unsafe { &*&raw const *core::str::from_utf8(&serial_no).unwrap() };
111111+ unsafe { cortex_m::interrupt::enable() };
112112+93113 let mut sio = Sio::new(pac.SIO);
94114 let pins = Pins::new(
95115 pac.IO_BANK0,
···139159 GLOBAL_USB_BUS = Some(usb_bus);
140160 }
141161162162+ // Safety: These are only accessed within this interrupt handler, or in main() before the
163163+ // interrupt is enabled.
142164 #[allow(static_mut_refs)]
143165 let bus_ref = unsafe { GLOBAL_USB_BUS.as_ref().unwrap() };
144166···147169 .strings(&[StringDescriptors::default()
148170 .manufacturer("arthomnix")
149171 .product("Touchscreen EPD Input Module for Framework 16")
172172+ .serial_number(serial_no)
150173 ])
151174 .unwrap()
152175 .device_class(usbd_serial::USB_CLASS_CDC)
···267290268291 trace!("USBCTRL_IRQ");
269292293293+ // Safety: These are only accessed within this interrupt handler, or in main() before the
294294+ // interrupt is enabled.
270295 #[allow(static_mut_refs)]
271296 let usb_dev = unsafe { GLOBAL_USB_DEVICE.as_mut().unwrap() };
272297 #[allow(static_mut_refs)]