mirror of
https://github.com/PSenfft/mb85rc.git
synced 2025-08-24 13:34:16 +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> {
|
impl<T: I2c> Read for EmbedIODev<T> {
|
||||||
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
|
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
|
||||||
self.dev
|
self.dev
|
||||||
.sequential_read(self.head.memory_address().unwrap(), buf)
|
.sequential_read(&self.head.memory_address().unwrap(), buf)
|
||||||
.map_err(MB85RCErrorType::I2c)
|
.map_err(MB85RCErrorType::I2c)
|
||||||
.inspect(|read_bytes| {
|
.map(|_| {
|
||||||
self.head.advance(*read_bytes);
|
self.head.advance(buf.len());
|
||||||
|
buf.len()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: I2c> Write for EmbedIODev<T> {
|
impl<T: I2c> Write for EmbedIODev<T> {
|
||||||
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> {
|
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() {
|
if buf.is_empty() {
|
||||||
return Ok(0);
|
return Ok(0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user