-
Notifications
You must be signed in to change notification settings - Fork 82
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
0 parents
commit 653f501
Showing
3 changed files
with
64 additions
and
0 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,3 @@ | ||
/target | ||
**/*.rs.bk | ||
Cargo.lock |
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,9 @@ | ||
[package] | ||
name = "embedded-sdmmc" | ||
version = "0.1.0" | ||
authors = ["Jonathan 'theJPster' Pallant <github@thejpster.org.uk>"] | ||
|
||
[dependencies] | ||
embedded-hal = "0.2.2" | ||
|
||
|
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,52 @@ | ||
//! embedded-sdmmc: A SD/MMC Library written in Embedded Rust | ||
#![no_std] | ||
|
||
/// Represents a standard 512 byte block/sector. | ||
pub struct Block { | ||
_contents: [u8; 512], | ||
} | ||
|
||
/// Represents a block device which is <= 2 TiB in size. | ||
pub trait BlockDevice { | ||
type Error; | ||
fn read(&mut self, block: &mut Block, block_idx: u32) -> Result<(), Self::Error>; | ||
fn write(&mut self, block: &Block, block_idx: u32) -> Result<(), Self::Error>; | ||
} | ||
|
||
pub struct Controller { | ||
_x: () | ||
} | ||
|
||
pub struct Card { | ||
_x: (), | ||
} | ||
|
||
pub struct Volume { | ||
_name: [u8; 11], | ||
} | ||
|
||
pub struct Directory<'a> { | ||
_parent: &'a Volume, | ||
} | ||
|
||
pub struct DirEntry { | ||
pub name: [u8; 11], | ||
pub mtine: u32, | ||
pub ctime: u32, | ||
pub attributes: u8, | ||
} | ||
|
||
pub struct File<'a> { | ||
_parent: &'a Volume, | ||
_offset: u32, | ||
} | ||
|
||
|
||
#[cfg(test)] | ||
mod tests { | ||
#[test] | ||
fn it_works() { | ||
assert_eq!(2 + 2, 4); | ||
} | ||
} |