diff options
Diffstat (limited to 'embassy-embedded-hal/src/flash/partition')
| -rw-r--r-- | embassy-embedded-hal/src/flash/partition/asynch.rs | 11 | ||||
| -rw-r--r-- | embassy-embedded-hal/src/flash/partition/blocking.rs | 11 |
2 files changed, 20 insertions, 2 deletions
diff --git a/embassy-embedded-hal/src/flash/partition/asynch.rs b/embassy-embedded-hal/src/flash/partition/asynch.rs index 576e7e5b6..1b0c91232 100644 --- a/embassy-embedded-hal/src/flash/partition/asynch.rs +++ b/embassy-embedded-hal/src/flash/partition/asynch.rs | |||
| @@ -12,13 +12,22 @@ use super::Error; | |||
| 12 | /// There is no guarantee that muliple partitions on the same flash | 12 | /// There is no guarantee that muliple partitions on the same flash |
| 13 | /// operate on mutually exclusive ranges - such a separation is up to | 13 | /// operate on mutually exclusive ranges - such a separation is up to |
| 14 | /// the user to guarantee. | 14 | /// the user to guarantee. |
| 15 | #[derive(Clone)] | ||
| 16 | pub struct Partition<'a, M: RawMutex, T: NorFlash> { | 15 | pub struct Partition<'a, M: RawMutex, T: NorFlash> { |
| 17 | flash: &'a Mutex<M, T>, | 16 | flash: &'a Mutex<M, T>, |
| 18 | offset: u32, | 17 | offset: u32, |
| 19 | size: u32, | 18 | size: u32, |
| 20 | } | 19 | } |
| 21 | 20 | ||
| 21 | impl<'a, M: RawMutex, T: NorFlash> Clone for Partition<'a, M, T> { | ||
| 22 | fn clone(&self) -> Self { | ||
| 23 | Self { | ||
| 24 | flash: self.flash, | ||
| 25 | offset: self.offset, | ||
| 26 | size: self.size, | ||
| 27 | } | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 22 | impl<'a, M: RawMutex, T: NorFlash> Partition<'a, M, T> { | 31 | impl<'a, M: RawMutex, T: NorFlash> Partition<'a, M, T> { |
| 23 | /// Create a new partition | 32 | /// Create a new partition |
| 24 | pub const fn new(flash: &'a Mutex<M, T>, offset: u32, size: u32) -> Self { | 33 | pub const fn new(flash: &'a Mutex<M, T>, offset: u32, size: u32) -> Self { |
diff --git a/embassy-embedded-hal/src/flash/partition/blocking.rs b/embassy-embedded-hal/src/flash/partition/blocking.rs index 478f39246..a68df7812 100644 --- a/embassy-embedded-hal/src/flash/partition/blocking.rs +++ b/embassy-embedded-hal/src/flash/partition/blocking.rs | |||
| @@ -13,13 +13,22 @@ use super::Error; | |||
| 13 | /// There is no guarantee that muliple partitions on the same flash | 13 | /// There is no guarantee that muliple partitions on the same flash |
| 14 | /// operate on mutually exclusive ranges - such a separation is up to | 14 | /// operate on mutually exclusive ranges - such a separation is up to |
| 15 | /// the user to guarantee. | 15 | /// the user to guarantee. |
| 16 | #[derive(Clone)] | ||
| 17 | pub struct BlockingPartition<'a, M: RawMutex, T: NorFlash> { | 16 | pub struct BlockingPartition<'a, M: RawMutex, T: NorFlash> { |
| 18 | flash: &'a Mutex<M, RefCell<T>>, | 17 | flash: &'a Mutex<M, RefCell<T>>, |
| 19 | offset: u32, | 18 | offset: u32, |
| 20 | size: u32, | 19 | size: u32, |
| 21 | } | 20 | } |
| 22 | 21 | ||
| 22 | impl<'a, M: RawMutex, T: NorFlash> Clone for BlockingPartition<'a, M, T> { | ||
| 23 | fn clone(&self) -> Self { | ||
| 24 | Self { | ||
| 25 | flash: self.flash, | ||
| 26 | offset: self.offset, | ||
| 27 | size: self.size, | ||
| 28 | } | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 23 | impl<'a, M: RawMutex, T: NorFlash> BlockingPartition<'a, M, T> { | 32 | impl<'a, M: RawMutex, T: NorFlash> BlockingPartition<'a, M, T> { |
| 24 | /// Create a new partition | 33 | /// Create a new partition |
| 25 | pub const fn new(flash: &'a Mutex<M, RefCell<T>>, offset: u32, size: u32) -> Self { | 34 | pub const fn new(flash: &'a Mutex<M, RefCell<T>>, offset: u32, size: u32) -> Self { |
