diff --git a/esp32-wroom-rp/src/gpio.rs b/esp32-wroom-rp/src/gpio.rs index 13aa647..e161baf 100644 --- a/esp32-wroom-rp/src/gpio.rs +++ b/esp32-wroom-rp/src/gpio.rs @@ -154,7 +154,7 @@ impl Default for EspControlPins<(), (), (), ()> { cs: (), gpio0: (), resetn: (), - ack: () + ack: (), } } } diff --git a/esp32-wroom-rp/src/lib.rs b/esp32-wroom-rp/src/lib.rs index caeb448..d57ba68 100644 --- a/esp32-wroom-rp/src/lib.rs +++ b/esp32-wroom-rp/src/lib.rs @@ -91,7 +91,7 @@ pub mod wifi; pub mod protocol; mod spi; -use protocol::{ProtocolInterface, ProtocolError}; +use protocol::{ProtocolError, ProtocolInterface}; use defmt::{write, Format, Formatter}; use embedded_hal::blocking::delay::DelayMs; @@ -111,7 +111,11 @@ impl Format for Error { fn format(&self, fmt: Formatter) { match self { Error::Bus => write!(fmt, "Bus error"), - Error::Protocol(e) => write!(fmt, "Communication protocol error with ESP32 WiFi target: {}", e), + Error::Protocol(e) => write!( + fmt, + "Communication protocol error with ESP32 WiFi target: {}", + e + ), } } } diff --git a/esp32-wroom-rp/src/protocol.rs b/esp32-wroom-rp/src/protocol.rs index 1b540fe..579de4e 100644 --- a/esp32-wroom-rp/src/protocol.rs +++ b/esp32-wroom-rp/src/protocol.rs @@ -245,7 +245,7 @@ pub enum ProtocolError { CommunicationTimeout, InvalidCommand, InvalidNumberOfParameters, - TooManyParameters + TooManyParameters, } impl Format for ProtocolError { diff --git a/host-tests/tests/spi.rs b/host-tests/tests/spi.rs index 6512d3d..1557348 100644 --- a/host-tests/tests/spi.rs +++ b/host-tests/tests/spi.rs @@ -1,11 +1,9 @@ -use embedded_hal_mock::spi; -use embedded_hal_mock::pin::{ - Mock as PinMock, State as PinState, Transaction as PinTransaction, -}; use embedded_hal_mock::delay::MockNoop; +use embedded_hal_mock::pin::{Mock as PinMock, State as PinState, Transaction as PinTransaction}; +use embedded_hal_mock::spi; -use esp32_wroom_rp::wifi::Wifi; use esp32_wroom_rp::gpio::EspControlInterface; +use esp32_wroom_rp::wifi::Wifi; struct EspControlMock {} @@ -18,7 +16,7 @@ impl EspControlInterface for EspControlMock { true } - fn wait_for_esp_select(&mut self) {} + fn wait_for_esp_select(&mut self) {} fn wait_for_esp_ack(&self) {} @@ -41,7 +39,6 @@ fn invalid_command_induces_nina_protocol_version_mismatch_error() { spi::Transaction::transfer(vec![0x37], vec![0x0]), spi::Transaction::transfer(vec![0x0], vec![0x0]), spi::Transaction::transfer(vec![0xee], vec![0x0]), - // wait_response_cmd() spi::Transaction::transfer(vec![0xff], vec![0xef]), ]; @@ -54,7 +51,12 @@ fn invalid_command_induces_nina_protocol_version_mismatch_error() { let mut wifi = Wifi::init(&mut spi, &mut pins, &mut delay).ok().unwrap(); let f = wifi.firmware_version(); - assert_eq!(f.unwrap_err(), esp32_wroom_rp::Error::Protocol(esp32_wroom_rp::protocol::ProtocolError::NinaProtocolVersionMismatch)); + assert_eq!( + f.unwrap_err(), + esp32_wroom_rp::Error::Protocol( + esp32_wroom_rp::protocol::ProtocolError::NinaProtocolVersionMismatch + ) + ); spi.done(); }