Skip to content

Commit

Permalink
Add method to finalize config into initialization mode
Browse files Browse the repository at this point in the history
It is useful for applications to be able to decide when to bring MCAN
into operational mode. Therefore, add the option for user to finalize
the configuration into initialization mode rather than operational mode
directly.
  • Loading branch information
epontan committed Mar 4, 2024
1 parent a4c8e75 commit 053c64c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions mcan/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Tagging in git follows a pattern: `mcan/<version>`.
## [Unreleased]
- *Breaking* Update the register mappings with svd2rust 0.30.2 and form 0.10.0 (#46)
- Add safe way to shutdown the bus when actively transmitting/receiving (#45)
- Add method to finalize configuration into initialization mode (#ChangeMe)

## [0.4.0] - 2023-10-24

Expand Down
10 changes: 10 additions & 0 deletions mcan/src/bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,16 @@ impl<'a, Id: mcan_core::CanId, D: mcan_core::Dependencies<Id>, C: Capacities>
Ok(can)
}

/// Locks the configuration and enters initialization mode.
pub fn finalize_initialized(mut self) -> Result<Can<'a, Id, D, C>, ConfigurationError> {
self.apply_configuration()?;

let can = self.0;
can.aux.initialization_mode();

Ok(can)
}

/// Locks the configuration and enters normal operation.
pub fn finalize(mut self) -> Result<Can<'a, Id, D, C>, ConfigurationError> {
self.apply_configuration()?;
Expand Down

0 comments on commit 053c64c

Please sign in to comment.