-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
248 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Meadow.Units; | ||
|
||
namespace Meadow; | ||
|
||
/// <summary> | ||
/// Information about available storage devices | ||
/// </summary> | ||
public abstract class StorageInformation : IStorageInformation | ||
{ | ||
/// <inheritdoc/> | ||
public string Name { get; protected set; } = default!; | ||
|
||
/// <inheritdoc/> | ||
public DigitalStorage SpaceAvailable { get; protected set; } = default!; | ||
|
||
/// <inheritdoc/> | ||
public DigitalStorage Size { get; protected set; } = default!; | ||
} |
56 changes: 55 additions & 1 deletion
56
source/implementations/f7/Meadow.F7/F7PlatformOS.Storage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,64 @@ | ||
namespace Meadow; | ||
using Meadow.Devices; | ||
using System.IO; | ||
using System.Linq; | ||
|
||
namespace Meadow; | ||
|
||
|
||
public partial class F7PlatformOS : IPlatformOS | ||
{ | ||
/// <summary> | ||
/// Meadow F7-specific storage information | ||
/// </summary> | ||
public class F7StorageInformation : StorageInformation | ||
{ | ||
internal static F7StorageInformation Create(IMeadowDevice device) | ||
{ | ||
long totalFlashAvailable; | ||
if (device is F7FeatherV1) | ||
{ | ||
totalFlashAvailable = 33_554_432 // 32MB | ||
- 3_145_728 // allocation for runtime | ||
- 2_097_152; // OtA | ||
|
||
// 16_510_459_314_176.10 | ||
// 29_686_813_949_952.1MB | ||
} | ||
else | ||
{ | ||
totalFlashAvailable = 67_108_864 // 64MB | ||
- 3_145_728 // allocation for runtime | ||
- 2_097_152; // OtA | ||
|
||
|
||
} | ||
|
||
var spaceConsumed = new DirectoryInfo("/meadow0") | ||
.EnumerateFiles("*", SearchOption.AllDirectories) | ||
.Sum(file => file.Length); | ||
|
||
return new F7StorageInformation | ||
{ | ||
Name = "Internal Flash", | ||
Size = new Units.DigitalStorage(totalFlashAvailable), | ||
SpaceAvailable = new Units.DigitalStorage(totalFlashAvailable - spaceConsumed) | ||
}; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets the file system information for the platform. | ||
/// </summary> | ||
public Meadow.IPlatformOS.FileSystemInfo FileSystem { get; private set; } = default!; | ||
|
||
/// <inheritdoc/> | ||
public IStorageInformation[] GetStorageInformation() | ||
{ | ||
// TODO: support external storage for MMC-enabled CCM devices | ||
|
||
return new IStorageInformation[] | ||
{ | ||
F7StorageInformation.Create(Resolver.Device) | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
source/implementations/f7/Meadow.F7/Interop/Interop.clock_gettime.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
source/implementations/f7/Meadow.F7/Interop/Interop.clock_settime.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Meadow.Core | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.