-
Notifications
You must be signed in to change notification settings - Fork 6
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
1 parent
9999491
commit 40c9c63
Showing
3 changed files
with
18 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 |
---|---|---|
|
@@ -7,3 +7,4 @@ edition = "2021" | |
|
||
[dependencies] | ||
clap = { version = "4.1.1", features = ["cargo"] } | ||
enum_dispatch = "0.3.12" |
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,4 +1,18 @@ | ||
use self::{ | ||
board_interface::BoardInterface, jlink::JLinkInterface, openocd::OpenOCDInterface, | ||
serial::SerialInterface, | ||
}; | ||
use crate::errors::TockloaderError; | ||
use enum_dispatch::enum_dispatch; | ||
|
||
pub mod board_interface; | ||
pub mod jlink; | ||
pub mod openocd; | ||
pub mod serial; | ||
|
||
#[enum_dispatch(BoardInterface)] | ||
pub enum Interface { | ||
Serial(SerialInterface), | ||
OpenOCD(OpenOCDInterface), | ||
JLink(JLinkInterface), | ||
} |
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,8 @@ | ||
use crate::errors::TockloaderError; | ||
|
||
use enum_dispatch::enum_dispatch; | ||
|
||
#[enum_dispatch] | ||
pub trait BoardInterface { | ||
fn open(&mut self) -> Result<(), TockloaderError>; | ||
} |