From 69c047136cbe05958bd4538e66f5243e52e7e38a Mon Sep 17 00:00:00 2001 From: Olivier Date: Mon, 19 Sep 2022 15:27:46 +0200 Subject: [PATCH] added SPI is_busy function --- rp2040-hal/src/spi.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rp2040-hal/src/spi.rs b/rp2040-hal/src/spi.rs index 3e018b4..7ecbbab 100644 --- a/rp2040-hal/src/spi.rs +++ b/rp2040-hal/src/spi.rs @@ -179,6 +179,11 @@ impl Spi { self.device.sspsr.read().rne().bit_is_set() } + /// Check if spi is busy transmitting and/or receiving + pub fn is_busy(&self) -> bool { + self.device.sspsr.read().bsy().bit_is_set() + } + /// Disable the spi to reset its configuration pub fn disable(self) -> Spi { self.device.sspcr1.modify(|_, w| w.sse().clear_bit());