Skip to content

Commit ee6d95c

Browse files
author
Jonathan Pallant
authored
Merge pull request #118 from 42-technology-ltd/run_cargo_fmt
Ran cargo fmt with default options.
2 parents 72f2b85 + 697d87b commit ee6d95c

File tree

33 files changed

+601
-650
lines changed

33 files changed

+601
-650
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ rust:
55
- nightly
66
install:
77
- rustup target add thumbv7em-none-eabi thumbv7em-none-eabihf thumbv8m.main-none-eabi
8+
- rustup component add rustfmt
89
script:
910
- scripts/build.sh

boards/actinius-icarus/examples/blinky.rs

100755100644
File mode changed.

boards/actinius-icarus/src/lib.rs

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use hal::{
2121
uarte::{self, Baudrate as UartBaudrate, Parity as UartParity, Uarte},
2222
};
2323

24-
use hal::prelude::{OutputPin, InputPin};
24+
use hal::prelude::{InputPin, OutputPin};
2525

2626
pub use hal::pac;
2727

boards/adafruit-nrf52-bluefruit-le/examples/blinky.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
#![no_main]
22
#![no_std]
33

4-
54
extern crate panic_halt;
65

7-
86
use adafruit_nrf52_bluefruit_le::{prelude::*, Board};
97
use core::fmt::Write;
108
use cortex_m_rt::{entry, exception, ExceptionFrame};
119
use nb::block;
1210
use nrf52832_hal::timer::{self, Timer};
1311

14-
1512
#[entry]
1613
fn main() -> ! {
1714
let mut b = Board::take().unwrap();

boards/adafruit_nrf52pro/examples/blinky.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ use nb::block;
88
use panic_semihosting;
99

1010
use adafruit_nrf52pro_bsc::hal::{
11-
prelude::*,
1211
gpio::{p0, Level},
12+
prelude::*,
1313
timer::{self, Timer},
1414
};
15-
use adafruit_nrf52pro_bsc::nrf52832_pac::{Peripherals};
15+
use adafruit_nrf52pro_bsc::nrf52832_pac::Peripherals;
1616
use adafruit_nrf52pro_bsc::Pins;
1717

1818
#[entry]

boards/adafruit_nrf52pro/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![no_std]
2-
pub use nrf52832_hal as hal;
32
use crate::hal::gpio::{p0, Floating, Input};
43
pub use crate::hal::nrf52832_pac;
4+
pub use nrf52832_hal as hal;
55

66
/// Maps the pins to the names printed on the device
77
pub struct Pins {

boards/nRF52-DK/examples/blinky.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
#![no_main]
33

44
extern crate cortex_m_rt as rt;
5-
extern crate panic_semihosting;
6-
extern crate nrf52_dk_bsp as dk;
75
extern crate nb;
6+
extern crate nrf52_dk_bsp as dk;
7+
extern crate panic_semihosting;
88

9-
use dk::{ Board, prelude::*, nrf52832_hal::Timer };
10-
use rt::entry;
9+
use dk::{nrf52832_hal::Timer, prelude::*, Board};
1110
use nb::block;
11+
use rt::entry;
1212

1313
#[entry]
1414
fn main() -> ! {

boards/nRF52-DK/src/lib.rs

Lines changed: 87 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,9 @@ pub mod prelude {
1414
}
1515

1616
use nrf52832_hal::{
17-
gpio::{
18-
p0,
19-
Pin,
20-
Floating,
21-
Input,
22-
Output,
23-
PushPull,
24-
PullUp,
25-
Level,
26-
},
27-
nrf52832_pac::{
28-
self as nrf52,
29-
CorePeripherals,
30-
Peripherals,
31-
},
32-
uarte::{
33-
self,
34-
Uarte,
35-
Parity as UartParity,
36-
Baudrate as UartBaudrate,
37-
},
17+
gpio::{p0, Floating, Input, Level, Output, Pin, PullUp, PushPull},
18+
nrf52832_pac::{self as nrf52, CorePeripherals, Peripherals},
19+
uarte::{self, Baudrate as UartBaudrate, Parity as UartParity, Uarte},
3820
};
3921

4022
use nrf52832_hal::prelude::OutputPin;
@@ -270,10 +252,7 @@ impl Board {
270252
/// This method will return an instance of `nRF52DK` the first time it is
271253
/// called. It will return only `None` on subsequent calls.
272254
pub fn take() -> Option<Self> {
273-
Some(Self::new(
274-
CorePeripherals::take()?,
275-
Peripherals::take()?,
276-
))
255+
Some(Self::new(CorePeripherals::take()?, Peripherals::take()?))
277256
}
278257

279258
/// Steal the peripherals
@@ -289,10 +268,7 @@ impl Board {
289268
///
290269
/// Always use `nRF52DK::take`, unless you really know what you're doing.
291270
pub unsafe fn steal() -> Self {
292-
Self::new(
293-
CorePeripherals::steal(),
294-
Peripherals::steal(),
295-
)
271+
Self::new(CorePeripherals::steal(), Peripherals::steal())
296272
}
297273

298274
fn new(cp: CorePeripherals, p: Peripherals) -> Self {
@@ -302,38 +278,38 @@ impl Board {
302278
// It features HWFC but does not have to use it.
303279
// It can transmit a flexible baudrate of up to 1Mbps.
304280
let cdc_uart = Uarte::new(
305-
p.UARTE0,
306-
uarte::Pins {
281+
p.UARTE0,
282+
uarte::Pins {
307283
txd: pins0.p0_06.into_push_pull_output(Level::High).degrade(),
308284
rxd: pins0.p0_08.into_floating_input().degrade(),
309285
cts: Some(pins0.p0_07.into_floating_input().degrade()),
310286
rts: Some(pins0.p0_05.into_push_pull_output(Level::High).degrade()),
311287
},
312288
UartParity::EXCLUDED,
313-
UartBaudrate::BAUD115200
289+
UartBaudrate::BAUD115200,
314290
);
315291

316292
Board {
317293
cdc: cdc_uart,
318294

319295
pins: Pins {
320296
_RESET: pins0.p0_21,
321-
P0_02 : pins0.p0_02,
322-
P0_03 : pins0.p0_03,
323-
P0_04 : pins0.p0_04,
324-
P0_11 : pins0.p0_11,
325-
P0_12 : pins0.p0_12,
326-
P0_24 : pins0.p0_24,
327-
P0_25 : pins0.p0_25,
328-
P0_28 : pins0.p0_28,
329-
P0_29 : pins0.p0_29,
330-
P0_30 : pins0.p0_30,
331-
P0_31 : pins0.p0_31,
332-
333-
P0_22 : pins0.p0_22,
334-
P0_23 : pins0.p0_23,
335-
P0_26 : pins0.p0_26,
336-
P0_27 : pins0.p0_27,
297+
P0_02: pins0.p0_02,
298+
P0_03: pins0.p0_03,
299+
P0_04: pins0.p0_04,
300+
P0_11: pins0.p0_11,
301+
P0_12: pins0.p0_12,
302+
P0_24: pins0.p0_24,
303+
P0_25: pins0.p0_25,
304+
P0_28: pins0.p0_28,
305+
P0_29: pins0.p0_29,
306+
P0_30: pins0.p0_30,
307+
P0_31: pins0.p0_31,
308+
309+
P0_22: pins0.p0_22,
310+
P0_23: pins0.p0_23,
311+
P0_26: pins0.p0_26,
312+
P0_27: pins0.p0_27,
337313
},
338314

339315
leds: Leds {
@@ -356,87 +332,86 @@ impl Board {
356332
},
357333

358334
// Core peripherals
359-
CBP : cp.CBP,
335+
CBP: cp.CBP,
360336
CPUID: cp.CPUID,
361-
DCB : cp.DCB,
362-
DWT : cp.DWT,
363-
FPB : cp.FPB,
364-
FPU : cp.FPU,
365-
ITM : cp.ITM,
366-
MPU : cp.MPU,
367-
NVIC : cp.NVIC,
368-
SCB : cp.SCB,
369-
SYST : cp.SYST,
370-
TPIU : cp.TPIU,
337+
DCB: cp.DCB,
338+
DWT: cp.DWT,
339+
FPB: cp.FPB,
340+
FPU: cp.FPU,
341+
ITM: cp.ITM,
342+
MPU: cp.MPU,
343+
NVIC: cp.NVIC,
344+
SCB: cp.SCB,
345+
SYST: cp.SYST,
346+
TPIU: cp.TPIU,
371347

372348
// nRF52 peripherals
373-
FICR : p.FICR,
374-
UICR : p.UICR,
375-
POWER : p.POWER,
376-
CLOCK : p.CLOCK,
377-
RADIO : p.RADIO,
378-
379-
UART0 : p.UART0,
380-
SPIM0 : p.SPIM0,
381-
SPIS0 : p.SPIS0,
382-
TWIM0 : p.TWIM0,
383-
TWIS0 : p.TWIS0,
384-
SPI0 : p.SPI0,
385-
TWI0 : p.TWI0,
386-
SPIM1 : p.SPIM1,
387-
SPIS1 : p.SPIS1,
388-
TWIS1 : p.TWIS1,
389-
SPI1 : p.SPI1,
390-
TWI1 : p.TWI1,
391-
NFCT : p.NFCT,
349+
FICR: p.FICR,
350+
UICR: p.UICR,
351+
POWER: p.POWER,
352+
CLOCK: p.CLOCK,
353+
RADIO: p.RADIO,
354+
355+
UART0: p.UART0,
356+
SPIM0: p.SPIM0,
357+
SPIS0: p.SPIS0,
358+
TWIM0: p.TWIM0,
359+
TWIS0: p.TWIS0,
360+
SPI0: p.SPI0,
361+
TWI0: p.TWI0,
362+
SPIM1: p.SPIM1,
363+
SPIS1: p.SPIS1,
364+
TWIS1: p.TWIS1,
365+
SPI1: p.SPI1,
366+
TWI1: p.TWI1,
367+
NFCT: p.NFCT,
392368
GPIOTE: p.GPIOTE,
393-
SAADC : p.SAADC,
369+
SAADC: p.SAADC,
394370
TIMER0: p.TIMER0,
395371
TIMER1: p.TIMER1,
396372
TIMER2: p.TIMER2,
397-
RTC0 : p.RTC0,
398-
TEMP : p.TEMP,
399-
RNG : p.RNG,
400-
ECB : p.ECB,
401-
CCM : p.CCM,
402-
AAR : p.AAR,
403-
WDT : p.WDT,
404-
RTC1 : p.RTC1,
405-
QDEC : p.QDEC,
406-
COMP : p.COMP,
373+
RTC0: p.RTC0,
374+
TEMP: p.TEMP,
375+
RNG: p.RNG,
376+
ECB: p.ECB,
377+
CCM: p.CCM,
378+
AAR: p.AAR,
379+
WDT: p.WDT,
380+
RTC1: p.RTC1,
381+
QDEC: p.QDEC,
382+
COMP: p.COMP,
407383
LPCOMP: p.LPCOMP,
408-
SWI0 : p.SWI0,
409-
EGU0 : p.EGU0,
410-
SWI1 : p.SWI1,
411-
EGU1 : p.EGU1,
412-
SWI2 : p.SWI2,
413-
EGU2 : p.EGU2,
414-
SWI3 : p.SWI3,
415-
EGU3 : p.EGU3,
416-
SWI4 : p.SWI4,
417-
EGU4 : p.EGU4,
418-
SWI5 : p.SWI5,
419-
EGU5 : p.EGU5,
384+
SWI0: p.SWI0,
385+
EGU0: p.EGU0,
386+
SWI1: p.SWI1,
387+
EGU1: p.EGU1,
388+
SWI2: p.SWI2,
389+
EGU2: p.EGU2,
390+
SWI3: p.SWI3,
391+
EGU3: p.EGU3,
392+
SWI4: p.SWI4,
393+
EGU4: p.EGU4,
394+
SWI5: p.SWI5,
395+
EGU5: p.EGU5,
420396
TIMER3: p.TIMER3,
421397
TIMER4: p.TIMER4,
422-
PWM0 : p.PWM0,
423-
PDM : p.PDM,
424-
NVMC : p.NVMC,
425-
PPI : p.PPI,
426-
MWU : p.MWU,
427-
PWM1 : p.PWM1,
428-
PWM2 : p.PWM2,
429-
RTC2 : p.RTC2,
430-
I2S : p.I2S,
398+
PWM0: p.PWM0,
399+
PDM: p.PDM,
400+
NVMC: p.NVMC,
401+
PPI: p.PPI,
402+
MWU: p.MWU,
403+
PWM1: p.PWM1,
404+
PWM2: p.PWM2,
405+
RTC2: p.RTC2,
406+
I2S: p.I2S,
431407
}
432408
}
433409
}
434410

435-
436411
/// The nRF52 pins that are available on the nRF52DK
437412
#[allow(non_snake_case)]
438413
pub struct Pins {
439-
_RESET : p0::P0_21<Input<Floating>>,
414+
_RESET: p0::P0_21<Input<Floating>>,
440415

441416
pub P0_03: p0::P0_03<Input<Floating>>,
442417
pub P0_04: p0::P0_04<Input<Floating>>,
@@ -458,7 +433,6 @@ pub struct Pins {
458433
pub P0_27: p0::P0_27<Input<Floating>>,
459434
}
460435

461-
462436
/// The LEDs on the nRF52-DK board
463437
pub struct Leds {
464438
/// nRF52-DK: LED1, nRF52: P0.17

boards/nRF52840-DK/examples/blinky.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use nrf52840_dk_bsp::{
1515
Board,
1616
};
1717

18-
1918
#[entry]
2019
fn main() -> ! {
2120
let mut nrf52 = Board::take().unwrap();

0 commit comments

Comments
 (0)