diff options
| author | Felipe Balbi <[email protected]> | 2025-09-02 15:44:44 -0700 |
|---|---|---|
| committer | Felipe Balbi <[email protected]> | 2025-09-02 15:44:44 -0700 |
| commit | d17f4d71781e016f44b081a981a79fdccddabb33 (patch) | |
| tree | 666ceefdadbf8acee4fae952a336863aa897fd0a /embassy-usb-driver/src/lib.rs | |
| parent | 6dc06d47bf76e32096d5e42914cd0269476f5855 (diff) | |
Fix comments
- rename read_data to read_transfer
- rename write_data to write_transfer
- add needs_zlp argument
Signed-off-by: Felipe Balbi <[email protected]>
Diffstat (limited to 'embassy-usb-driver/src/lib.rs')
| -rw-r--r-- | embassy-usb-driver/src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/embassy-usb-driver/src/lib.rs b/embassy-usb-driver/src/lib.rs index 789d6de93..3ad96c61d 100644 --- a/embassy-usb-driver/src/lib.rs +++ b/embassy-usb-driver/src/lib.rs | |||
| @@ -242,7 +242,7 @@ pub trait EndpointOut: Endpoint { | |||
| 242 | /// | 242 | /// |
| 243 | /// This should also clear any NAK flags and prepare the endpoint to receive the next packet or | 243 | /// This should also clear any NAK flags and prepare the endpoint to receive the next packet or |
| 244 | /// data block. | 244 | /// data block. |
| 245 | async fn read_data(&mut self, buf: &mut [u8]) -> Result<usize, EndpointError> { | 245 | async fn read_transfer(&mut self, buf: &mut [u8]) -> Result<usize, EndpointError> { |
| 246 | let mut n = 0; | 246 | let mut n = 0; |
| 247 | loop { | 247 | loop { |
| 248 | let i = self.read(&mut buf[n..]).await?; | 248 | let i = self.read(&mut buf[n..]).await?; |
| @@ -370,11 +370,11 @@ pub trait EndpointIn: Endpoint { | |||
| 370 | /// | 370 | /// |
| 371 | /// If the buffer size is evenly divisible by wMaxPacketSize, this will also ensure the | 371 | /// If the buffer size is evenly divisible by wMaxPacketSize, this will also ensure the |
| 372 | /// terminating zero-length-packet is transmitted. | 372 | /// terminating zero-length-packet is transmitted. |
| 373 | async fn write_data(&mut self, buf: &[u8]) -> Result<(), EndpointError> { | 373 | async fn write_transfer(&mut self, buf: &[u8], needs_zlp: bool) -> Result<(), EndpointError> { |
| 374 | for chunk in buf.chunks(self.info().max_packet_size as usize) { | 374 | for chunk in buf.chunks(self.info().max_packet_size as usize) { |
| 375 | self.write(chunk).await?; | 375 | self.write(chunk).await?; |
| 376 | } | 376 | } |
| 377 | if buf.len() % self.info().max_packet_size as usize == 0 { | 377 | if needs_zlp && buf.len() % self.info().max_packet_size as usize == 0 { |
| 378 | self.write(&[]).await?; | 378 | self.write(&[]).await?; |
| 379 | } | 379 | } |
| 380 | Ok(()) | 380 | Ok(()) |
