Skip to content

Commit

Permalink
Skeleton.
Browse files Browse the repository at this point in the history
  • Loading branch information
thejpster committed Nov 10, 2018
0 parents commit 653f501
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/target
**/*.rs.bk
Cargo.lock
9 changes: 9 additions & 0 deletions Cargo.toml
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"


52 changes: 52 additions & 0 deletions src/lib.rs
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);
}
}

0 comments on commit 653f501

Please sign in to comment.