Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
1142: More rp2040 BufferedUart fixes r=Dirbaio a=timokroeger

* Refactor init code
* Make it possible to drop RX without breaking TX (or vice versa)
* Correctly handle RX buffer full scenario

Co-authored-by: Timo Kröger <timokroeger93@gmail.com>
  • Loading branch information
bors[bot] and timokroeger authored Jan 14, 2023
2 parents b0c8c68 + 539f97d commit b6c8505
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 189 deletions.
4 changes: 4 additions & 0 deletions embassy-hal-common/src/atomic_ring_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ impl RingBuffer {
Writer(self)
}

pub fn len(&self) -> usize {
self.len.load(Ordering::Relaxed)
}

pub fn is_full(&self) -> bool {
let len = self.len.load(Ordering::Relaxed);
let start = self.start.load(Ordering::Relaxed);
Expand Down
Loading

0 comments on commit b6c8505

Please sign in to comment.