Skip to content

Commit ec33697

Browse files
committed
Implement heartbeat function in sys crate
1 parent 83573d8 commit ec33697

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ledger_secure_sdk_sys/src/seph.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ pub fn send_general_status() {
3434
}
3535
}
3636

37+
/// Function to ensure a I/O channel is not timeouting waiting
38+
/// for operations after a long time without SEPH packet exchanges
39+
pub fn heartbeat() {
40+
send_general_status();
41+
let mut spi_buffer = [0u8; 128];
42+
seph_recv(&mut spi_buffer, 0);
43+
while is_status_sent() {
44+
seph_recv(&mut spi_buffer, 0);
45+
}
46+
}
47+
3748
#[repr(u8)]
3849
pub enum SephTags {
3950
ScreenDisplayStatus = SEPROXYHAL_TAG_SCREEN_DISPLAY_STATUS as u8,

0 commit comments

Comments
 (0)