Skip to content

Commit

Permalink
Add check functions to CircBuffer.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed May 15, 2022
1 parent beb1e56 commit 48d4f93
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,35 @@ where
}
}

impl<BUFFER, PAYLOAD, CHANNEL> CircBuffer<BUFFER, RxDma<PAYLOAD, CHANNEL>>
where
PAYLOAD: CharacterMatch,
{
/// Checks to see if the peripheral has detected a character match and
/// clears the flag
pub fn check_character_match(&mut self, clear: bool) -> bool {
self.payload.payload.check_character_match(clear)
}
}

impl<BUFFER, PAYLOAD, CHANNEL> CircBuffer<BUFFER, RxDma<PAYLOAD, CHANNEL>>
where
PAYLOAD: ReceiverTimeout,
{
pub fn check_receiver_timeout(&mut self, clear: bool) -> bool {
self.payload.payload.check_receiver_timeout(clear)
}
}

impl<BUFFER, PAYLOAD, CHANNEL> CircBuffer<BUFFER, RxDma<PAYLOAD, CHANNEL>> {
pub fn check_operation_error<O, E>(&mut self) -> Result<O, E>
where
PAYLOAD: OperationError<O, E>,
{
self.payload.payload.check_operation_error()
}
}

pub trait DmaExt {
type Channels;

Expand Down

0 comments on commit 48d4f93

Please sign in to comment.