Skip to content

Commit 44ecdac

Browse files
committed
Limits module and struct visibility to crate-level for those things that shouldn't be exported outside of the crate's symbol scope.
1 parent 7ef74ee commit 44ecdac

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

esp32-wroom-rp/src/protocol.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pub mod operation;
22

33
use super::*;
4+
use spi::*;
45

56
use embedded_hal::blocking::delay::DelayMs;
67

@@ -10,14 +11,14 @@ pub const MAX_NINA_PARAM_LENGTH: usize = 255;
1011

1112
#[repr(u8)]
1213
#[derive(Copy, Clone, Debug)]
13-
pub enum NinaCommand {
14+
pub(crate) enum NinaCommand {
1415
GetFwVersion = 0x37u8,
1516
SetPassphrase = 0x11u8,
1617
GetConnStatus = 0x20u8,
1718
Disconnect = 0x30u8,
1819
}
1920

20-
pub trait NinaParam {
21+
pub(crate) trait NinaParam {
2122
// Length of parameter in bytes
2223
type LengthAsBytes: IntoIterator<Item = u8>;
2324

@@ -33,7 +34,7 @@ pub trait NinaParam {
3334
}
3435

3536
// Used for Nina protocol commands with no parameters
36-
pub struct NinaNoParams {
37+
pub(crate) struct NinaNoParams {
3738
_placeholder: u8,
3839
}
3940

@@ -62,25 +63,25 @@ impl NinaParam for NinaNoParams {
6263
}
6364

6465
// Used for single byte params
65-
pub struct NinaByteParam {
66+
pub(crate) struct NinaByteParam {
6667
length: u8,
6768
data: Vec<u8, 1>,
6869
}
6970

7071
// Used for 2-byte params
71-
pub struct NinaWordParam {
72+
pub(crate) struct NinaWordParam {
7273
length: u8,
7374
data: Vec<u8, 2>,
7475
}
7576

7677
// Used for params that are smaller than 255 bytes
77-
pub struct NinaSmallArrayParam {
78+
pub(crate) struct NinaSmallArrayParam {
7879
length: u8,
7980
data: Vec<u8, MAX_NINA_PARAM_LENGTH>,
8081
}
8182

8283
// Used for params that can be larger than 255 bytes up to MAX_NINA_PARAM_LENGTH
83-
pub struct NinaLargeArrayParam {
84+
pub(crate) struct NinaLargeArrayParam {
8485
length: u16,
8586
data: Vec<u8, MAX_NINA_PARAM_LENGTH>,
8687
}
@@ -220,7 +221,7 @@ impl NinaParam for NinaLargeArrayParam {
220221
}
221222
}
222223

223-
pub trait ProtocolInterface {
224+
pub(crate) trait ProtocolInterface {
224225
fn init(&mut self);
225226
fn reset<D: DelayMs<u16>>(&mut self, delay: &mut D);
226227
fn get_fw_version(&mut self) -> Result<FirmwareVersion, self::Error>;
@@ -230,7 +231,7 @@ pub trait ProtocolInterface {
230231
}
231232

232233
#[derive(Debug, Default)]
233-
pub struct NinaProtocolHandler<B, C> {
234+
pub(crate) struct NinaProtocolHandler<B, C> {
234235
/// A Spi or I2c instance
235236
pub bus: B,
236237
/// An EspControlPins instance

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const MAX_NUMBER_OF_PARAMS: usize = 4;
66
// Encapsulates all information needed to execute commands against Nina Firmware.
77
// along with user supplied data. Ex. SSID, passphrase, etc.
88

9-
pub struct Operation<P> {
9+
pub(crate) struct Operation<P> {
1010
pub params: Vec<P, MAX_NUMBER_OF_PARAMS>,
1111
pub command: NinaCommand,
1212
pub has_params: bool,

0 commit comments

Comments
 (0)