mirror of
https://github.com/PSenfft/mb85rc.git
synced 2025-08-22 04:44:17 +00:00
fixed changed function interface in embedded_io
This commit is contained in:
parent
11b10b53e8
commit
54d35ebbec
@ -27,17 +27,18 @@ impl<T: I2c> ErrorType for EmbedIODev<T> {
|
||||
impl<T: I2c> Read for EmbedIODev<T> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
|
||||
self.dev
|
||||
.sequential_read(self.head.memory_address().unwrap(), buf)
|
||||
.sequential_read(&self.head.memory_address().unwrap(), buf)
|
||||
.map_err(MB85RCErrorType::I2c)
|
||||
.inspect(|read_bytes| {
|
||||
self.head.advance(*read_bytes);
|
||||
.map(|_| {
|
||||
self.head.advance(buf.len());
|
||||
buf.len()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: I2c> Write for EmbedIODev<T> {
|
||||
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> {
|
||||
// From trait doc: Implementations must not return Ok(0) unless buf is empty.
|
||||
// From trait doc: Implementations must not return Ok(0) unless buf is empty.
|
||||
if buf.is_empty() {
|
||||
return Ok(0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user