Skip to content

Commit

Permalink
Rename new_custom_max -> new_with_limits
Browse files Browse the repository at this point in the history
  • Loading branch information
jannic authored and eldruin committed Jan 18, 2023
1 parent 51f29bd commit 26ae3be
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changes
- Add `MAX_DIRS` and `MAX_FILES` generics to `Controller` to allow an arbitrary numbers of concurrent open directories and files.
- Add new constructor method `Controller::new_custom_max(block_device: D, timesource: T) -> Controller<D, T, MAX_DIRS, MAX_FILES>`
- Add new constructor method `Controller::new_with_limits(block_device: D, timesource: T) -> Controller<D, T, MAX_DIRS, MAX_FILES>`
to create a `Controller` with custom limits.

## [Version 0.4.0](https://github.com/rust-embedded-community/embedded-sdmmc-rs/releases/tag/v0.4.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let mut cont: Controller<
DummyTimeSource,
6,
12,
> = Controller::new_custom_max(block, time_source);
> = Controller::new_with_limits(block, time_source);
```

## Supported features
Expand Down
9 changes: 6 additions & 3 deletions src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ where
/// files.
///
/// This creates a Controller with default values
/// MAX_DIRS = 4, MAX_FILES = 4. Call `Controller::new_custom_max(block_device, timesource)`
/// MAX_DIRS = 4, MAX_FILES = 4. Call `Controller::new_with_limits(block_device, timesource)`
/// if you need different limits.
pub fn new(block_device: D, timesource: T) -> Controller<D, T, 4, 4> {
Self::new_custom_max(block_device, timesource)
Self::new_with_limits(block_device, timesource)
}
}

Expand All @@ -56,7 +56,10 @@ where
/// Create a new Disk Controller using a generic `BlockDevice`. From this
/// controller we can open volumes (partitions) and with those we can open
/// files.
pub fn new_custom_max(block_device: D, timesource: T) -> Controller<D, T, MAX_DIRS, MAX_FILES> {
pub fn new_with_limits(
block_device: D,
timesource: T,
) -> Controller<D, T, MAX_DIRS, MAX_FILES> {
debug!("Creating new embedded-sdmmc::Controller");
Controller {
block_device,
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ mod tests {
#[test]
fn partition0() {
let mut c: Controller<DummyBlockDevice, Clock, 2, 2> =
Controller::new_custom_max(DummyBlockDevice, Clock);
Controller::new_with_limits(DummyBlockDevice, Clock);

let v = c.get_volume(VolumeIdx(0)).unwrap();
assert_eq!(
Expand Down

0 comments on commit 26ae3be

Please sign in to comment.