Add offset and size accessors to Partition

This commit is contained in:
Rasmus Melchior Jacobsen 2023-05-30 13:57:40 +02:00
parent 887ecef369
commit c2aca45b8d
2 changed files with 20 additions and 0 deletions

View File

@ -30,6 +30,16 @@ impl<'a, M: RawMutex, T: NorFlash> Partition<'a, M, T> {
} }
Self { flash, offset, size } Self { flash, offset, size }
} }
/// Get the partition offset within the flash
pub const fn offset(&self) -> u32 {
self.offset
}
/// Get the partition size
pub const fn size(&self) -> u32 {
self.size
}
} }
impl<M: RawMutex, T: NorFlash> ErrorType for Partition<'_, M, T> { impl<M: RawMutex, T: NorFlash> ErrorType for Partition<'_, M, T> {

View File

@ -31,6 +31,16 @@ impl<'a, M: RawMutex, T: NorFlash> BlockingPartition<'a, M, T> {
} }
Self { flash, offset, size } Self { flash, offset, size }
} }
/// Get the partition offset within the flash
pub const fn offset(&self) -> u32 {
self.offset
}
/// Get the partition size
pub const fn size(&self) -> u32 {
self.size
}
} }
impl<M: RawMutex, T: NorFlash> ErrorType for BlockingPartition<'_, M, T> { impl<M: RawMutex, T: NorFlash> ErrorType for BlockingPartition<'_, M, T> {