@@ -135,8 +135,8 @@ where
135135 self . send_end_cmd ( ) ;
136136
137137 // Pad byte stream to multiple of 4
138- self . read_byte ( ) . ok ( ) . unwrap ( ) ;
139- self . read_byte ( ) . ok ( ) . unwrap ( ) ;
138+ self . get_byte ( ) . ok ( ) . unwrap ( ) ;
139+ self . get_byte ( ) . ok ( ) . unwrap ( ) ;
140140
141141 self . control_pins . esp_deselect ( ) ;
142142 self . control_pins . wait_for_esp_select ( ) ;
@@ -200,7 +200,7 @@ where
200200 //return Err(SPIError::Misc);
201201 }
202202
203- let num_params_to_read = self . get_param ( ) ? as usize ;
203+ let num_params_to_read = self . get_byte ( ) ? as usize ;
204204
205205 if num_params_to_read > 8 {
206206 return Ok ( [ 0x31 , 0x2e , 0x37 , 0x2e , 0x34 , 0x0 , 0x0 , 0x0 ] ) ;
@@ -209,7 +209,7 @@ where
209209
210210 let mut params: [ u8 ; ARRAY_LENGTH_PLACEHOLDER ] = [ 0 ; 8 ] ;
211211 for i in 0 ..num_params_to_read {
212- params[ i] = self . get_param ( ) . ok ( ) . unwrap ( )
212+ params[ i] = self . get_byte ( ) . ok ( ) . unwrap ( )
213213 }
214214
215215 self . read_and_check_byte ( ControlByte :: End as u8 ) ?;
@@ -223,7 +223,7 @@ where
223223 Ok ( ( ) )
224224 }
225225
226- fn get_param ( & mut self ) -> Result < u8 , self :: Error > {
226+ fn get_byte ( & mut self ) -> Result < u8 , self :: Error > {
227227 // Blocking read, don't return until we've read a byte successfully
228228 loop {
229229 let word_out = & mut [ ControlByte :: Dummy as u8 ] ;
@@ -239,22 +239,11 @@ where
239239 }
240240 }
241241
242- fn read_byte ( & mut self ) -> Result < u8 , self :: Error > {
243- match self . get_param ( ) {
244- Ok ( byte_out) => {
245- return Ok ( byte_out) ;
246- }
247- Err ( e) => {
248- return Err ( e) ;
249- }
250- }
251- }
252-
253242 fn wait_for_byte ( & mut self , wait_byte : u8 ) -> Result < bool , self :: Error > {
254243 let mut timeout: u16 = 1000u16 ;
255244
256245 loop {
257- match self . get_param ( ) {
246+ match self . get_byte ( ) {
258247 Ok ( byte_read) => {
259248 if byte_read == ControlByte :: Error as u8 {
260249 return Ok ( false ) ;
@@ -279,7 +268,7 @@ where
279268 }
280269
281270 fn read_and_check_byte ( & mut self , check_byte : u8 ) -> Result < bool , self :: Error > {
282- match self . get_param ( ) {
271+ match self . get_byte ( ) {
283272 Ok ( byte_out) => {
284273 return Ok ( byte_out == check_byte) ;
285274 }
@@ -307,7 +296,7 @@ where
307296
308297 fn pad_to_multiple_of_4 ( & mut self , mut command_size : u16 ) {
309298 while command_size % 4 == 0 {
310- self . get_param ( ) . ok ( ) . unwrap ( ) ;
299+ self . get_byte ( ) . ok ( ) . unwrap ( ) ;
311300 command_size += 1 ;
312301 }
313302 }
0 commit comments