@@ -27,23 +27,23 @@ enum ControlByte {
2727}
2828
2929/// Fundamental struct for controlling a connected ESP32-WROOM NINA firmware-based Wifi board.
30- #[ derive( Debug , Default ) ]
31- pub struct Wifi < B , C > {
32- common : WifiCommon < NinaProtocolHandler < B , C > > ,
30+ #[ derive( Debug ) ]
31+ pub struct Wifi < ' a , B , C > {
32+ common : WifiCommon < NinaProtocolHandler < ' a , B , C > > ,
3333}
3434
35- impl < S , C > Wifi < S , C >
35+ impl < ' a , S , C > Wifi < ' a , S , C >
3636where
3737 S : Transfer < u8 > ,
3838 C : EspControlInterface ,
3939{
4040 /// Initializes the ESP32-WROOM Wifi device.
4141 /// Calling this function puts the connected ESP32-WROOM device in a known good state to accept commands.
4242 pub fn init < D : DelayMs < u16 > > (
43- spi : S ,
44- control_pins : C ,
43+ spi : & ' a mut S ,
44+ control_pins : & ' a mut C ,
4545 delay : & mut D ,
46- ) -> Result < Wifi < S , C > , Error > {
46+ ) -> Result < Wifi < ' a , S , C > , Error > {
4747 let mut wifi = Wifi {
4848 common : WifiCommon {
4949 protocol_handler : NinaProtocolHandler {
8282}
8383
8484// All SPI-specific aspects of the NinaProtocolHandler go here in this struct impl
85- impl < S , C > ProtocolInterface for NinaProtocolHandler < S , C >
85+ impl < ' a , S , C > ProtocolInterface for NinaProtocolHandler < ' a , S , C >
8686where
8787 S : Transfer < u8 > ,
8888 C : EspControlInterface ,
@@ -142,7 +142,7 @@ where
142142 }
143143}
144144
145- impl < S , C > NinaProtocolHandler < S , C >
145+ impl < ' a , S , C > NinaProtocolHandler < ' a , S , C >
146146where
147147 S : Transfer < u8 > ,
148148 C : EspControlInterface ,
@@ -199,6 +199,8 @@ where
199199
200200 for byte in buf {
201201 let write_buf = & mut [ byte] ;
202+ // FIXME: temporary for test writing debugging
203+ defmt:: debug!( "0x{:02x}, " , write_buf[ 0 ] ) ;
202204 self . bus . transfer ( write_buf) . ok ( ) ;
203205 }
204206
@@ -213,7 +215,7 @@ where
213215 cmd : & NinaCommand ,
214216 num_params : u8 ,
215217 ) -> Result < [ u8 ; ARRAY_LENGTH_PLACEHOLDER ] , ProtocolError > {
216- self . check_start_cmd ( ) . ok ( ) . unwrap ( ) ;
218+ self . check_start_cmd ( ) ? ;
217219 let byte_to_check: u8 = * cmd as u8 | ControlByte :: Reply as u8 ;
218220 let result = self . read_and_check_byte ( & byte_to_check) . ok ( ) . unwrap ( ) ;
219221 // Ensure we see a cmd byte
0 commit comments