@@ -47,37 +47,37 @@ mod embedded_hal_impl {
4747 use std:: io:: Write as _;
4848
4949 impl Transfer < u8 > for Spidev {
50- type Error = IoError ;
50+ type Error = SPIError ;
5151
5252 fn transfer < ' b > ( & mut self , read : & ' b mut [ u8 ] , write : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
5353 self . 0
5454 . transfer ( & mut SpidevTransfer :: read_write ( & write, read) )
55- . map_err ( |err| IoError { err } )
55+ . map_err ( |err| SPIError { err } )
5656 }
5757 }
5858
5959 impl TransferInplace < u8 > for Spidev {
60- type Error = IoError ;
60+ type Error = SPIError ;
6161
6262 fn transfer_inplace < ' b > ( & mut self , buffer : & ' b mut [ u8 ] ) -> Result < ( ) , Self :: Error > {
6363 let tx = buffer. to_owned ( ) ;
6464 self . 0
6565 . transfer ( & mut SpidevTransfer :: read_write ( & tx, buffer) )
66- . map_err ( |err| IoError { err } )
66+ . map_err ( |err| SPIError { err } )
6767 }
6868 }
6969
7070 impl Write < u8 > for Spidev {
71- type Error = IoError ;
71+ type Error = SPIError ;
7272
7373 fn write ( & mut self , buffer : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
74- self . 0 . write_all ( buffer) . map_err ( |err| IoError { err } )
74+ self . 0 . write_all ( buffer) . map_err ( |err| SPIError { err } )
7575 }
7676 }
7777
7878 /// Transactional implementation batches SPI operations into a single transaction
7979 impl Transactional < u8 > for Spidev {
80- type Error = IoError ;
80+ type Error = SPIError ;
8181
8282 fn exec < ' a > ( & mut self , operations : & mut [ SpiOperation < ' a , u8 > ] ) -> Result < ( ) , Self :: Error > {
8383 // Map types from generic to linux objects
@@ -105,23 +105,24 @@ mod embedded_hal_impl {
105105 // Execute transfer
106106 self . 0
107107 . transfer_multiple ( & mut messages)
108- . map_err ( |err| IoError { err } )
108+ . map_err ( |err| SPIError { err } )
109109 }
110110 }
111111}
112112
113+ /// Error type wrapping [io::Error](io::Error) to implement [embedded_hal::spi::ErrorKind]
113114#[ derive( Debug ) ]
114- pub struct IoError {
115+ pub struct SPIError {
115116 err : io:: Error ,
116117}
117118
118- impl From < io:: Error > for IoError {
119+ impl From < io:: Error > for SPIError {
119120 fn from ( err : io:: Error ) -> Self {
120121 Self { err }
121122 }
122123}
123124
124- impl embedded_hal:: spi:: Error for IoError {
125+ impl embedded_hal:: spi:: Error for SPIError {
125126 fn kind ( & self ) -> embedded_hal:: spi:: ErrorKind {
126127 use embedded_hal:: spi:: ErrorKind :: * ;
127128 match self . err . kind ( ) {
0 commit comments