Skip to content

Commit eeff752

Browse files
author
Sandra ter Maat
committed
Resolved feedback.
1 parent 30ef074 commit eeff752

File tree

12 files changed

+62
-56
lines changed

12 files changed

+62
-56
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ target/
33
[._]*.sw[a-p]
44
**/*.rs.bk
55
Cargo.lock
6+
Cargo.toml
67
Cargo.my.toml
78

89
# Created by https://www.gitignore.io/api/intellij+all

nrf-hal-common/src/ccm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ use crate::{
5959

6060
use core::sync::atomic::{compiler_fence, Ordering};
6161

62-
#[cfg(not(any(feature = "51",feature = "5340-net")))]
62+
#[cfg(not(any(feature = "51", feature = "5340-net")))]
6363
use crate::pac::ccm::mode::{DATARATE_A, LENGTH_A};
6464

6565
#[cfg(feature = "5340-net")]
@@ -83,14 +83,14 @@ pub enum DataRate {
8383
#[cfg(feature = "5340-net")]
8484
_125Kbps,
8585
#[cfg(feature = "5340-net")]
86-
_500Kbps
86+
_500Kbps,
8787
}
8888

8989
#[cfg(not(feature = "51"))]
9090
impl From<DataRate> for DATARATE_A {
9191
fn from(data_rate: DataRate) -> Self {
9292
match data_rate {
93-
DataRate::_1Mbit => DATARATE_A::_1MBIT,
93+
DataRate::_1Mbit => DATARATE_A::_1MBIT,
9494
DataRate::_2Mbit => DATARATE_A::_2MBIT,
9595
#[cfg(feature = "5340-net")]
9696
DataRate::_125Kbps => DATARATE_A::_125KBPS,

nrf-hal-common/src/clocks.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,12 @@ impl<H, L> Clocks<H, L, LfOscStopped> {
156156
}
157157

158158
/// Use the internal RC Oscillator for the low frequency clock source.
159-
#[cfg(not(any(feature = "9160", feature = "5340-app", feature = "5340-net", feature = "51")))]
159+
#[cfg(not(any(
160+
feature = "9160",
161+
feature = "5340-app",
162+
feature = "5340-net",
163+
feature = "51"
164+
)))]
160165
pub fn set_lfclk_src_rc(self) -> Clocks<H, Internal, LfOscStopped> {
161166
self.periph
162167
.lfclksrc
@@ -170,7 +175,12 @@ impl<H, L> Clocks<H, L, LfOscStopped> {
170175
}
171176

172177
/// Generate the Low Frequency clock from the high frequency clock source.
173-
#[cfg(not(any(feature = "9160", feature = "5340-app",feature = "5340-net", feature = "51")))]
178+
#[cfg(not(any(
179+
feature = "9160",
180+
feature = "5340-app",
181+
feature = "5340-net",
182+
feature = "51"
183+
)))]
174184
pub fn set_lfclk_src_synth(self) -> Clocks<H, LfOscSynthesized, LfOscStopped> {
175185
self.periph
176186
.lfclksrc
@@ -184,7 +194,12 @@ impl<H, L> Clocks<H, L, LfOscStopped> {
184194
}
185195

186196
/// Use an external crystal to drive the low frequency clock.
187-
#[cfg(not(any(feature = "9160", feature = "5340-app",feature = "5340-net", feature = "51")))]
197+
#[cfg(not(any(
198+
feature = "9160",
199+
feature = "5340-app",
200+
feature = "5340-net",
201+
feature = "51"
202+
)))]
188203
pub fn set_lfclk_src_external(
189204
self,
190205
cfg: LfOscConfiguration,

nrf-hal-common/src/ecb.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//!
33
//! The ECB encryption block supports 128 bit AES encryption (encryption only, not decryption).
44
5-
65
#[cfg(not(feature = "5340-net"))]
76
use crate::pac::ECB;
87
#[cfg(feature = "5340-net")]

nrf-hal-common/src/gpio.rs

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@ use crate::pac::{p0_ns as gpio, P0_NS as P0};
6868
#[cfg(feature = "5340-app")]
6969
use crate::pac::P0_S;
7070

71-
#[cfg(not(any(feature = "9160", feature = "5340-app",feature = "5340-net", feature = "51")))]
71+
#[cfg(not(any(
72+
feature = "9160",
73+
feature = "5340-app",
74+
feature = "5340-net",
75+
feature = "51"
76+
)))]
7277
use crate::pac::{p0 as gpio, P0};
7378

7479
#[cfg(any(feature = "52833", feature = "52840"))]
@@ -104,12 +109,22 @@ impl<MODE> Pin<MODE> {
104109

105110
#[inline]
106111
pub fn pin(&self) -> u8 {
107-
#[cfg(any(feature = "52833", feature = "52840", feature = "5340-app", feature = "5340-net"))]
112+
#[cfg(any(
113+
feature = "52833",
114+
feature = "52840",
115+
feature = "5340-app",
116+
feature = "5340-net"
117+
))]
108118
{
109119
self.pin_port & 0x1f
110120
}
111121

112-
#[cfg(not(any(feature = "52833", feature = "52840", feature = "5340-app", feature = "5340-net")))]
122+
#[cfg(not(any(
123+
feature = "52833",
124+
feature = "52840",
125+
feature = "5340-app",
126+
feature = "5340-net"
127+
)))]
113128
{
114129
self.pin_port
115130
}
@@ -120,7 +135,7 @@ impl<MODE> Pin<MODE> {
120135
#[cfg(any(feature = "52833", feature = "52840", feature = "5340-net"))]
121136
{
122137
if self.pin_port & 0x20 == 0 {
123-
Port::Port0
138+
Port::Port0
124139
} else {
125140
Port::Port1
126141
}
@@ -134,7 +149,12 @@ impl<MODE> Pin<MODE> {
134149
Port::Port0Secure
135150
}
136151
}
137-
#[cfg(not(any(feature = "52833", feature = "52840", feature = "5340-app", feature = "5340-net")))]
152+
#[cfg(not(any(
153+
feature = "52833",
154+
feature = "52840",
155+
feature = "5340-app",
156+
feature = "5340-net"
157+
)))]
138158
{
139159
Port::Port0
140160
}
@@ -343,7 +363,12 @@ use crate::pac::gpio::pin_cnf;
343363
#[cfg(any(feature = "5340-app", feature = "5340-net", feature = "9160"))]
344364
use crate::pac::p0_ns::pin_cnf;
345365

346-
#[cfg(not(any(feature = "9160", feature = "5340-app", feature = "5340-net", feature = "51")))]
366+
#[cfg(not(any(
367+
feature = "9160",
368+
feature = "5340-app",
369+
feature = "5340-net",
370+
feature = "51"
371+
)))]
347372
use crate::pac::p0::pin_cnf;
348373

349374
impl OpenDrainConfig {

nrf-hal-common/src/gpiote.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ use {
2828
crate::pac::GPIOTE,
2929
};
3030

31-
#[cfg(feature = "9160")]
31+
#[cfg(feature = "9160")]
3232
use {
3333
crate::pac::gpiote0_s::{EVENTS_IN, EVENTS_PORT, TASKS_CLR, TASKS_OUT, TASKS_SET},
3434
crate::pac::GPIOTE1_NS as GPIOTE,
3535
};
3636

37-
#[cfg(feature = "5340-net")]
37+
#[cfg(feature = "5340-net")]
3838
use {
39-
crate::pac::gpiote_ns::{EVENTS_IN, EVENTS_PORT, TASKS_OUT, TASKS_CLR, TASKS_SET},
40-
crate::pac::GPIOTE_NS as GPIOTE
39+
crate::pac::gpiote_ns::{EVENTS_IN, EVENTS_PORT, TASKS_CLR, TASKS_OUT, TASKS_SET},
40+
crate::pac::GPIOTE_NS as GPIOTE,
4141
};
4242

4343
#[cfg(not(any(feature = "51", feature = "9160", feature = "5340-net")))]

nrf-hal-common/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ pub mod target_constants {
140140
pub const EASY_DMA_SIZE: usize = (1 << 16) - 1;
141141
#[cfg(feature = "52840")]
142142
pub const EASY_DMA_SIZE: usize = (1 << 16) - 1;
143-
#[cfg(any(feature = "5340-app",feature = "5340-net"))]
143+
#[cfg(any(feature = "5340-app", feature = "5340-net"))]
144144
pub const EASY_DMA_SIZE: usize = (1 << 16) - 1;
145145
#[cfg(feature = "9160")]
146146
pub const EASY_DMA_SIZE: usize = (1 << 12) - 1;

nrf-hal-common/src/twim.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ where
182182
return Err(Error::DataNack);
183183
}
184184
if err.overrun().is_received() {
185-
return Err(Error::DataNack);
185+
return Err(Error::Overrun);
186186
}
187187
Ok(())
188188
}

nrf-hal-common/src/uicr.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
//! - nrf52811: Section 4.5
77
//! - nrf52832: Section 14
88
//! - nrf52840: Section 4.5
9-
//!
109
use crate::pac::{NVMC, UICR};
1110

1211
/// Interface to a UICR instance.
@@ -32,7 +31,6 @@ impl Uicr {
3231
/// UICR registers can only be set to `0` bits, additional overrides back to `1` can only be
3332
/// performed by erasing the UICR registers.
3433
/// - Sets all registers to 0xFFFF_FFFFu32
35-
3634
pub fn erase(&mut self, nvmc: &mut NVMC) {
3735
assert!(!nvmc.config.read().wen().is_wen()); // write + erase is forbidden!
3836

nrf5340-net-hal/README.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)