implement MAC auth for felica

This commit is contained in:
2026-08-28 21:56:37 +08:00
parent f523b7d394
commit 494f4b92eb
20 changed files with 562 additions and 233 deletions
+4 -7
View File
@@ -15,15 +15,12 @@ pub struct Uid {
impl core::fmt::Display for Uid {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
#[cfg(feature = "alloc")]
return write!(f, "{}", hex::encode(&self.bytes));
{
write!(f, "{}", hex::encode(&self.bytes))
}
#[cfg(not(feature = "alloc"))]
{
let mut buf: heapless::Vec<u8, 14> = heapless::Vec::new();
hex::encode_to_slice(&self.bytes, &mut buf)
.map_err(|_| core::fmt::Error)?;
let s = heapless::String::from_utf8(buf)
.map_err(|_| core::fmt::Error)?;
write!(f, "{}", s)
write!(f, "{:?}", self)
}
}
}