1pub struct DeviceId(u64);
2
3impl ariel_os_embassy_common::identity::DeviceId for DeviceId {
4 #[expect(
5 refining_impl_trait_reachable,
6 reason = "making this fallible would be a breaking API change for Ariel OS"
7 )]
8 fn get() -> Result<Self, core::convert::Infallible> {
9 #[cfg(not(context = "nrf5340"))]
10 let ficr = embassy_nrf::pac::FICR;
11 #[cfg(context = "nrf5340")]
12 let ficr = embassy_nrf::pac::FICR.info();
13
14 let low = ficr.deviceid(0).read();
15 let high = ficr.deviceid(1).read();
16 Ok(Self((u64::from(high) << u32::BITS) | u64::from(low)))
17 }
18
19 type Bytes = [u8; 8];
20
21 fn bytes(&self) -> Self::Bytes {
22 self.0.to_le_bytes()
23 }
24}