Skip to content

Commit b59ee22

Browse files
committed
simplify imports
1 parent 1af839e commit b59ee22

File tree

5 files changed

+27
-35
lines changed

5 files changed

+27
-35
lines changed

esp32-wroom-rp/src/lib.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,25 +84,23 @@
8484
#![warn(missing_docs)]
8585
#![cfg_attr(not(test), no_std)]
8686

87-
/// Fundamental interface for creating and send/receiving data to/from a TCP server.
88-
pub mod tcp_client;
89-
9087
pub mod gpio;
91-
/// Fundamental interface for controlling a connected ESP32-WROOM NINA firmware-based Wifi board.
92-
pub mod wifi;
93-
9488
/// Responsible for interactions over a WiFi network and also contains related types.
9589
pub mod network;
9690
/// Responsible for interactions with NINA firmware over a data bus.
9791
pub mod protocol;
92+
/// Fundamental interface for creating and send/receiving data to/from a TCP server.
93+
pub mod tcp_client;
94+
/// Fundamental interface for controlling a connected ESP32-WROOM NINA firmware-based Wifi board.
95+
pub mod wifi;
9896

9997
mod spi;
10098

99+
use defmt::{write, Format, Formatter};
100+
101101
use network::NetworkError;
102102
use protocol::ProtocolError;
103103

104-
use defmt::{write, Format, Formatter};
105-
106104
const ARRAY_LENGTH_PLACEHOLDER: usize = 8;
107105

108106
/// Highest level error types for this crate.

esp32-wroom-rp/src/protocol/operation.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
use heapless::Vec;
2+
13
use crate::protocol::{NinaAbstractParam, NinaCommand};
24

3-
use heapless::Vec;
45
const MAX_NUMBER_OF_PARAMS: usize = 6;
56

67
// Encapsulates all information needed to execute commands against Nina Firmware.

esp32-wroom-rp/src/spi.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
//! Serial Peripheral Interface (SPI) for Wifi
2+
use core::convert::Infallible;
23

3-
use crate::network::ConnectionState;
4+
use embedded_hal::blocking::delay::DelayMs;
5+
use embedded_hal::blocking::spi::Transfer;
46

57
use super::gpio::EspControlInterface;
8+
use super::network::{ConnectionState, IpAddress, NetworkError, Port, Socket, TransportMode};
9+
use super::protocol::operation::Operation;
610
use super::protocol::{
711
NinaByteParam, NinaCommand, NinaConcreteParam, NinaLargeArrayParam, NinaParam,
8-
NinaProtocolHandler, NinaSmallArrayParam, NinaWordParam, ProtocolInterface,
12+
NinaProtocolHandler, NinaSmallArrayParam, NinaWordParam, ProtocolError, ProtocolInterface,
913
};
10-
11-
use super::network::{IpAddress, NetworkError, Port, Socket, TransportMode};
12-
use super::protocol::{operation::Operation, ProtocolError};
1314
use super::wifi::ConnectionStatus;
1415
use super::{Error, FirmwareVersion, ARRAY_LENGTH_PLACEHOLDER};
1516

16-
use embedded_hal::blocking::delay::DelayMs;
17-
use embedded_hal::blocking::spi::Transfer;
18-
19-
use core::convert::Infallible;
20-
2117
// TODO: this should eventually move into NinaCommandHandler
2218
#[repr(u8)]
2319
#[derive(Debug)]

esp32-wroom-rp/src/tcp_client.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
use super::{Error, ARRAY_LENGTH_PLACEHOLDER};
2-
use crate::{network::NetworkError, wifi::Wifi};
3-
4-
use super::protocol::NinaProtocolHandler;
5-
use crate::gpio::EspControlInterface;
6-
use crate::protocol::ProtocolInterface;
7-
8-
use super::network::{ConnectionState, Hostname, IpAddress, Port, Socket, TransportMode};
9-
101
use embedded_hal::blocking::delay::DelayMs;
112
use embedded_hal::blocking::spi::Transfer;
123

134
use heapless::String;
145

6+
use super::gpio::EspControlInterface;
7+
use super::network::{
8+
ConnectionState, Hostname, IpAddress, NetworkError, Port, Socket, TransportMode,
9+
};
10+
use super::protocol::{NinaProtocolHandler, ProtocolInterface};
11+
use super::wifi::Wifi;
12+
use super::{Error, ARRAY_LENGTH_PLACEHOLDER};
13+
1514
const MAX_HOSTNAME_LENGTH: usize = 255;
1615

1716
/// Connect trait that allows for a `TcpClient` instance to connect to a remote

esp32-wroom-rp/src/wifi.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
use embedded_hal::blocking::delay::DelayMs;
2-
use embedded_hal::blocking::spi::Transfer;
1+
use core::cell::RefCell;
32

43
use defmt::{write, Format, Formatter};
54

6-
use super::{Error, FirmwareVersion};
5+
use embedded_hal::blocking::delay::DelayMs;
6+
use embedded_hal::blocking::spi::Transfer;
77

88
use super::gpio::EspControlInterface;
9-
use super::protocol::{NinaProtocolHandler, ProtocolInterface};
10-
11-
use core::cell::RefCell;
12-
139
use super::network::IpAddress;
10+
use super::protocol::{NinaProtocolHandler, ProtocolInterface};
11+
use super::{Error, FirmwareVersion};
1412

1513
/// An enumerated type that represents the current WiFi network connection status.
1614
#[repr(u8)]

0 commit comments

Comments
 (0)