Simplify time handling, Solo 2

This commit is contained in:
Nicolas Stalder
2021-05-02 20:54:06 +02:00
committed by Nicolas Stalder
parent 03de6cb83f
commit 54cf898d64
3 changed files with 6 additions and 6 deletions
+1
View File
@@ -9,6 +9,7 @@ edition = "2018"
[dependencies]
apdu-dispatch = { git = "https://github.com/solokeys/apdu-dispatch", branch = "main" }
delog = "0.1.0"
embedded-time = "0.10.1"
heapless = "0.6"
heapless-bytes = "0.2.0"
interchange = "0.2.0"
+3 -3
View File
@@ -1,6 +1,6 @@
use core::convert::TryFrom;
use core::time::Duration;
use embedded_time::duration::Extensions;
use interchange::Requester;
use apdu_dispatch::interchanges;
@@ -57,7 +57,7 @@ where
pub fn did_start_processing(&mut self) -> Status {
if self.pipe.did_started_processing() {
// We should send a wait extension later
Status::ReceivedData(Duration::from_millis(1000))
Status::ReceivedData(1_000.milliseconds())
} else {
Status::Idle
}
@@ -66,7 +66,7 @@ where
pub fn send_wait_extension (&mut self) -> Status {
if self.pipe.send_wait_extension() {
// We should send another wait extension later
Status::ReceivedData(Duration::from_millis(1000))
Status::ReceivedData(1_000.milliseconds())
} else {
Status::Idle
}
+2 -3
View File
@@ -1,5 +1,4 @@
// use cortex_m_semihosting::hprintln;
use core::time::Duration;
use embedded_time::duration::Milliseconds;
// pub mod apdu;
pub mod packet;
@@ -16,7 +15,7 @@ pub enum ClassRequest {
pub enum Status {
Idle,
ReceivedData(Duration),
ReceivedData(Milliseconds),
}
impl core::convert::TryFrom<u8> for ClassRequest {