Skip to content

Commit 4d0d81f

Browse files
committed
Change reset delay and allow App0 after TFUc
1 parent f143aac commit 4d0d81f

File tree

4 files changed

+4
-18
lines changed

4 files changed

+4
-18
lines changed

src/asynchronous/embassy/task.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use defmt::error;
1+
use defmt::{error, warn};
22
use embassy_sync::blocking_mutex::raw::RawMutex;
33
use embedded_hal::digital::InputPin;
44
use embedded_hal_async::{digital::Wait, i2c::I2c};
@@ -17,7 +17,7 @@ pub async fn interrupt_task<const N: usize, M: RawMutex, B: I2c, INT: Wait + Inp
1717

1818
for interrupt in &mut interrupts {
1919
if let Err(_) = interrupt.process_interrupt(int).await {
20-
error!("Error processing interrupt");
20+
warn!("Error processing interrupt");
2121
}
2222
}
2323
}

src/asynchronous/internal/command.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl<B: I2c> Tps6699x<B> {
148148

149149
// Confirm we're in the correct mode
150150
let mode = self.get_mode().await?;
151-
if mode != Mode::App1 {
151+
if mode != Mode::App0 && mode != Mode::App1 {
152152
error!("Failed to enter normal mode, mode: {:?}", mode);
153153
return Err(PdError::InvalidMode.into());
154154
}

src/asynchronous/internal/mod.rs

-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! This module implements a low-level TPS6699x driver. The super module provides a high-level API
22
//! that uses standard PD types and provides functions that implement features that may occur over several interrupts
3-
use defmt::debug;
43
use embedded_hal_async::delay::DelayNs;
54
use embedded_hal_async::i2c::I2c;
65
use embedded_usb_pd::{Error, PdError, PortId};
@@ -36,12 +35,6 @@ impl<B: I2c> device_driver::AsyncRegisterInterface for Port<'_, B> {
3635
// Sized to accommodate up to 255 bytes of data
3736
let mut buf = [0u8; 257];
3837

39-
debug!(
40-
"PD write, address: {:#x}, register: {:#x}, length: {}",
41-
self.addr,
42-
address,
43-
data.len()
44-
);
4538
// Buffer length is sent as a byte
4639
if data.len() > 255 {
4740
return Err(PdError::InvalidParams.into());
@@ -68,13 +61,6 @@ impl<B: I2c> device_driver::AsyncRegisterInterface for Port<'_, B> {
6861
let full_len = data.len() + 1;
6962
let reg = [address];
7063

71-
debug!(
72-
"PD read, address: {:#x}, register: {:#x}, length: {}",
73-
self.addr,
74-
address,
75-
data.len()
76-
);
77-
7864
if data.is_empty() {
7965
return Err(PdError::InvalidParams.into());
8066
}

src/command.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub const REG_DATA1_LEN: usize = 64;
88

99
/// Delay after reset before we can assume the controller is ready
1010
// Derived from experimentation
11-
pub const RESET_DELAY_MS: u32 = 1600;
11+
pub const RESET_DELAY_MS: u32 = 2000;
1212
pub const RESET_TIMEOUT_MS: u32 = RESET_DELAY_MS + 100;
1313
pub const TFUS_DELAY_MS: u32 = 500;
1414
pub const TFUS_TIMEOUT_MS: u32 = TFUS_DELAY_MS + 100;

0 commit comments

Comments
 (0)