Skip to content
Open
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
1 change: 1 addition & 0 deletions embassy-rp/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add reset_to_usb_boot for rp235x ([#4705](https://github.com/embassy-rs/embassy/pull/4705))
- Add fix #4822 in PIO onewire. Change to disable the state machine before setting y register ([#4824](https://github.com/embassy-rs/embassy/pull/4824))
- Add PIO::Ws2812 color order support
- Fix i2c_slave respond_to_read for buffers larger than one chunk

## 0.8.0 - 2025-08-26

Expand Down
9 changes: 5 additions & 4 deletions embassy-rp/src/i2c_slave.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ impl<'d, T: Instance> I2cSlave<'d, T> {
return Err(Error::InvalidResponseBufferLength);
}

let mut chunks = buffer.chunks(FIFO_SIZE as usize);
let mut bytes_written = 0;

self.wait_on(
|me| {
Expand All @@ -319,10 +319,11 @@ impl<'d, T: Instance> I2cSlave<'d, T> {
}
}

if let Some(chunk) = chunks.next() {
for byte in chunk {
if bytes_written < buffer.len() {
for _ in 0..((FIFO_SIZE - p.ic_txflr().read().txflr()) as usize).min(buffer.len() - bytes_written) {
p.ic_clr_rd_req().read();
p.ic_data_cmd().write(|w| w.set_dat(*byte));
p.ic_data_cmd().write(|w| w.set_dat(buffer[bytes_written]));
bytes_written += 1;
}

Poll::Pending
Expand Down