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
4 changes: 2 additions & 2 deletions hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ critical-section = "1.2.0"
embedded-hal-02 = {package = "embedded-hal", version = "0.2", features = ["unproven"]}
embedded-hal-1 = {package = "embedded-hal", version = "1.0.0"}
embedded-hal-nb = "1.0.0"
embedded-io = "0.6"
embedded-io = "0.7"
fugit = "0.3"
heapless = "0.8"
modular-bitfield = "0.11"
Expand All @@ -62,7 +62,7 @@ void = {version = "1.0", default-features = false}
defmt = {version = "1.0.1", optional = true}
embassy-sync = {version = "0.6.0", optional = true}
embedded-hal-async = {version = "1.0.0", optional = true}
embedded-io-async = {version = "0.6.1", optional = true}
embedded-io-async = {version = "0.7", optional = true}
embedded-sdmmc = {version = "0.8.1", optional = true}
futures = {version = "0.3.31", default-features = false, features = ["async-await"], optional = true}
jlink_rtt = {version = "0.2", optional = true}
Expand Down
8 changes: 8 additions & 0 deletions hal/src/sercom/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,14 @@ pub enum Error {
Dma(crate::dmac::Error),
}

impl core::fmt::Display for Error {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "SPI Error: {:?}", self)
}
}

impl core::error::Error for Error {}

//=============================================================================
// Operating mode
//=============================================================================
Expand Down
15 changes: 15 additions & 0 deletions hal/src/sercom/uart/async_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,13 @@ where
self.write(buffer).await;
Ok(buffer.len())
}


#[inline]
async fn flush(&mut self) -> Result<(), Self::Error> {
// self.write already calls self.wait_flags(Flags::TXC).await;
Ok(())
}
}

impl<C, D, R, T, S> AsRef<Uart<C, D, R, T>> for UartFuture<C, D, R, T>
Expand Down Expand Up @@ -499,11 +506,19 @@ mod dma {
S: Sercom + 'static,
T: AnyChannel<Status = ReadyFuture>,
{

#[inline]
async fn write(&mut self, words: &[u8]) -> Result<usize, Error> {
self.write(words).await?;
Ok(words.len())
}

#[inline]
async fn flush(&mut self) -> Result<(), Self::Error> {
// self.write already calls self.wait_flags(Flags::TXC).await;
Ok(())
}

}
}

Expand Down
8 changes: 8 additions & 0 deletions hal/src/sercom/uart/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ pub enum Error {
Dma(crate::dmac::Error),
}

impl core::fmt::Display for Error {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "UART Error: {:?}", self)
}
}

impl core::error::Error for Error {}

impl From<Error> for Status {
#[inline]
fn from(err: Error) -> Self {
Expand Down
Loading