Skip to content

Commit 20f464e

Browse files
Moved loopback-fw over to the RTIC version, on the dongle.
Tested on macOS 15, Windows 10 and Debian 12.
1 parent 405380c commit 20f464e

File tree

13 files changed

+558
-1618
lines changed

13 files changed

+558
-1618
lines changed

build.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ pushd loopback-fw
7272
cargo build --target=thumbv7em-none-eabihf --release
7373
cargo fmt --check
7474
popd
75-
pushd loopback-fw-rtic
76-
cargo build --target=thumbv7em-none-eabihf --release
77-
cargo fmt --check
78-
popd
7975
popd
8076

8177
# Only build the templates (they will panic at run-time due to the use of todo!)
@@ -109,6 +105,5 @@ cp -r ./.cargo "${OUTPUT_NAME}/"
109105
cp -r ./tools "${OUTPUT_NAME}/"
110106
cp ./nrf52-code/puzzle-fw/target/thumbv7em-none-eabihf/release/puzzle-fw "${OUTPUT_NAME}/nrf52-code/boards/dongle-fw/puzzle-fw"
111107
cp ./nrf52-code/loopback-fw/target/thumbv7em-none-eabihf/release/loopback-fw "${OUTPUT_NAME}/nrf52-code/boards/dongle-fw/loopback-fw"
112-
cp ./nrf52-code/loopback-fw-rtic/target/thumbv7em-none-eabihf/release/loopback-fw-rtic "${OUTPUT_NAME}/nrf52-code/boards/dongle-fw/loopback-fw-rtic"
113108
find "${OUTPUT_NAME}" -name target -type d -print0 | xargs -0 rm -rf
114109
zip -r "${OUTPUT_NAME}.zip" "${OUTPUT_NAME}"

nrf52-code/boards/dk-solution/src/lib.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ use hal::{
3232
#[cfg(any(feature = "radio", feature = "advanced"))]
3333
use defmt_rtt as _; // global logger
3434

35-
#[cfg(feature = "advanced")]
36-
use crate::{
37-
peripheral::{POWER, USBD},
38-
usbd::Ep0In,
39-
};
40-
4135
#[cfg(feature = "advanced")]
4236
mod errata;
4337
pub mod peripheral;
@@ -69,17 +63,21 @@ pub struct Board {
6963
#[cfg(feature = "radio")]
7064
pub radio: ieee802154::Radio<'static>,
7165
/// USBD (Universal Serial Bus Device) peripheral
72-
#[cfg(feature = "advanced")]
73-
pub usbd: USBD,
66+
#[cfg(any(feature = "advanced", feature = "usbd"))]
67+
pub usbd: hal::pac::USBD,
7468
/// POWER (Power Supply) peripheral
7569
#[cfg(feature = "advanced")]
76-
pub power: POWER,
70+
pub power: hal::pac::POWER,
7771
/// USB control endpoint 0
7872
#[cfg(feature = "advanced")]
79-
pub ep0in: Ep0In,
80-
/// A configured USB Device
81-
#[cfg(feature = "usbd")]
82-
pub usbd: UsbDevice,
73+
pub ep0in: usbd::Ep0In,
74+
/// Represents our current clock setup
75+
#[cfg(any(feature = "radio", feature = "usbd"))]
76+
pub clocks: &'static Clocks<
77+
clocks::ExternalOscillator,
78+
clocks::ExternalOscillator,
79+
clocks::LfOscStarted,
80+
>,
8381
}
8482

8583
/// All LEDs on the board
@@ -434,14 +432,14 @@ pub fn init() -> Result<Board, Error> {
434432
#[cfg(feature = "radio")]
435433
radio,
436434
timer: Timer { inner: timer },
437-
#[cfg(feature = "advanced")]
435+
#[cfg(any(feature = "advanced", feature = "usbd"))]
438436
usbd: periph.USBD,
439437
#[cfg(feature = "advanced")]
440438
power: periph.POWER,
441439
#[cfg(feature = "advanced")]
442-
ep0in: unsafe { Ep0In::new(&EP0IN_BUF) },
443-
#[cfg(feature = "usbd")]
444-
usbd: UsbDevice::new(hal::usbd::UsbPeripheral::new(periph.USBD, clocks)),
440+
ep0in: unsafe { usbd::Ep0In::new(&EP0IN_BUF) },
441+
#[cfg(any(feature = "radio", feature = "usbd"))]
442+
clocks,
445443
})
446444
}
447445

nrf52-code/boards/dk/src/lib.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ use hal::{
3232
#[cfg(any(feature = "radio", feature = "advanced"))]
3333
use defmt_rtt as _; // global logger
3434

35-
#[cfg(feature = "advanced")]
36-
use crate::{
37-
peripheral::{POWER, USBD},
38-
usbd::Ep0In,
39-
};
40-
4135
#[cfg(feature = "advanced")]
4236
mod errata;
4337
pub mod peripheral;
@@ -67,17 +61,21 @@ pub struct Board {
6761
#[cfg(feature = "radio")]
6862
pub radio: ieee802154::Radio<'static>,
6963
/// USBD (Universal Serial Bus Device) peripheral
70-
#[cfg(feature = "advanced")]
71-
pub usbd: USBD,
64+
#[cfg(any(feature = "advanced", feature = "usbd"))]
65+
pub usbd: hal::pac::USBD,
7266
/// POWER (Power Supply) peripheral
7367
#[cfg(feature = "advanced")]
74-
pub power: POWER,
68+
pub power: hal::pac::POWER,
7569
/// USB control endpoint 0
7670
#[cfg(feature = "advanced")]
77-
pub ep0in: Ep0In,
78-
/// A configured USB Device
79-
#[cfg(feature = "usbd")]
80-
pub usbd: UsbDevice,
71+
pub ep0in: usbd::Ep0In,
72+
/// Represents our current clock setup
73+
#[cfg(any(feature = "radio", feature = "usbd"))]
74+
pub clocks: &'static Clocks<
75+
clocks::ExternalOscillator,
76+
clocks::ExternalOscillator,
77+
clocks::LfOscStarted,
78+
>,
8179
}
8280

8381
/// All LEDs on the board
@@ -396,14 +394,14 @@ pub fn init() -> Result<Board, Error> {
396394
#[cfg(feature = "radio")]
397395
radio,
398396
timer: Timer { inner: timer },
399-
#[cfg(feature = "advanced")]
397+
#[cfg(any(feature = "advanced", feature = "usbd"))]
400398
usbd: periph.USBD,
401399
#[cfg(feature = "advanced")]
402400
power: periph.POWER,
403401
#[cfg(feature = "advanced")]
404-
ep0in: unsafe { Ep0In::new(&EP0IN_BUF) },
405-
#[cfg(feature = "usbd")]
406-
usbd: UsbDevice::new(hal::usbd::UsbPeripheral::new(periph.USBD, clocks)),
402+
ep0in: unsafe { usbd::Ep0In::new(&EP0IN_BUF) },
403+
#[cfg(any(feature = "radio", feature = "usbd"))]
404+
clocks,
407405
})
408406
}
409407

nrf52-code/boards/dongle/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ use cortex_m_semihosting::debug;
1717
use embedded_hal::digital::{OutputPin, StatefulOutputPin};
1818
use grounded::uninit::GroundedCell;
1919

20-
use hal::pac::interrupt;
21-
pub use hal::{self, ieee802154};
2220
use hal::{
2321
clocks::{self, Clocks},
2422
gpio::{p0, p1, Level, Output, Pin, Port, PushPull},
@@ -29,6 +27,9 @@ use hal::{
2927

3028
use defmt_rtt as _; // global logger
3129

30+
pub use hal::pac::{interrupt, Interrupt, NVIC_PRIO_BITS, RTC0};
31+
pub use hal::{self, ieee802154};
32+
3233
/// Exports PAC peripherals
3334
pub mod peripheral {
3435
pub use hal::pac::{interrupt, Interrupt, POWER, USBD};

nrf52-code/loopback-fw-rtic/.cargo/config.toml

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

nrf52-code/loopback-fw-rtic/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)