Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "Apache-2.0 OR MIT"
repository = "https://github.com/solokeys/ctaphid-dispatch"

[workspace.dependencies]
heapless = "0.7"
heapless-bytes = "0.3"
trussed-core = "0.1"

[patch.crates-io]
Expand Down
2 changes: 1 addition & 1 deletion app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ license.workspace = true
repository.workspace = true

[dependencies]
heapless.workspace = true
heapless-bytes.workspace = true
trussed-core.workspace = true
4 changes: 2 additions & 2 deletions app/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![no_std]

use heapless::Vec;
use heapless_bytes::Bytes;
use trussed_core::InterruptFlag;

mod command;
Expand All @@ -27,7 +27,7 @@ pub trait App<'interrupt, const N: usize> {
&mut self,
command: Command,
request: &[u8],
response: &mut Vec<u8, N>,
response: &mut Bytes<N>,
) -> Result<(), Error>;
}

Expand Down
2 changes: 2 additions & 0 deletions dispatch/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
- Optimize stack usage of `Dispatch::poll`
- Replace `trussed` dependency with `trussed-core`.
- Replace `heapless` dependency with `heapless-bytes`.
- Move the `app` and `command` modules into a separate crate, `ctaphid-app`, and re-export it.
- Make `App` trait generic over the response size.
- Remove unused `ShortMessage` type.

## [0.1.1] - 2022-08-22
- adjust to `interchange` API change
Expand Down
3 changes: 1 addition & 2 deletions dispatch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ repository.workspace = true
[dependencies]
ctaphid-app = "0.1"
delog = "0.1"
heapless.workspace = true
heapless-bytes = "0.3"
heapless-bytes.workspace = true
interchange = "0.3.0"
ref-swap = "0.1.2"
trussed-core.workspace = true
Expand Down
5 changes: 3 additions & 2 deletions dispatch/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use heapless_bytes::Bytes;

pub use ctaphid_app::Error;

// // 7609 bytes is max message size for ctaphid
Expand All @@ -10,9 +12,8 @@ pub use ctaphid_app::Error;
// pub type Message = heapless::Vec<u8, 3072>;
pub const MESSAGE_SIZE: usize = 7609;

pub type Message = heapless::Vec<u8, MESSAGE_SIZE>;
pub type Message = Bytes<MESSAGE_SIZE>;
pub type AppResult = core::result::Result<(), Error>;
pub type ShortMessage = heapless::Vec<u8, 1024>;

/// Wrapper struct that implements [`Default`][] to be able to use [`response_mut`](interchange::Responder::response_mut)
pub struct InterchangeResponse(pub Result<Message, Error>);
Expand Down
Loading