Skip to content

Commit

Permalink
Moved loopback-fw over to the RTIC version, on the dongle.
Browse files Browse the repository at this point in the history
Tested on macOS 15, Windows 10 and Debian 12.
  • Loading branch information
jonathanpallant committed Dec 12, 2024
1 parent 405380c commit 20f464e
Show file tree
Hide file tree
Showing 13 changed files with 558 additions and 1,618 deletions.
5 changes: 0 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ pushd loopback-fw
cargo build --target=thumbv7em-none-eabihf --release
cargo fmt --check
popd
pushd loopback-fw-rtic
cargo build --target=thumbv7em-none-eabihf --release
cargo fmt --check
popd
popd

# Only build the templates (they will panic at run-time due to the use of todo!)
Expand Down Expand Up @@ -109,6 +105,5 @@ cp -r ./.cargo "${OUTPUT_NAME}/"
cp -r ./tools "${OUTPUT_NAME}/"
cp ./nrf52-code/puzzle-fw/target/thumbv7em-none-eabihf/release/puzzle-fw "${OUTPUT_NAME}/nrf52-code/boards/dongle-fw/puzzle-fw"
cp ./nrf52-code/loopback-fw/target/thumbv7em-none-eabihf/release/loopback-fw "${OUTPUT_NAME}/nrf52-code/boards/dongle-fw/loopback-fw"
cp ./nrf52-code/loopback-fw-rtic/target/thumbv7em-none-eabihf/release/loopback-fw-rtic "${OUTPUT_NAME}/nrf52-code/boards/dongle-fw/loopback-fw-rtic"
find "${OUTPUT_NAME}" -name target -type d -print0 | xargs -0 rm -rf
zip -r "${OUTPUT_NAME}.zip" "${OUTPUT_NAME}"
32 changes: 15 additions & 17 deletions nrf52-code/boards/dk-solution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ use hal::{
#[cfg(any(feature = "radio", feature = "advanced"))]
use defmt_rtt as _; // global logger

#[cfg(feature = "advanced")]
use crate::{
peripheral::{POWER, USBD},
usbd::Ep0In,
};

#[cfg(feature = "advanced")]
mod errata;
pub mod peripheral;
Expand Down Expand Up @@ -69,17 +63,21 @@ pub struct Board {
#[cfg(feature = "radio")]
pub radio: ieee802154::Radio<'static>,
/// USBD (Universal Serial Bus Device) peripheral
#[cfg(feature = "advanced")]
pub usbd: USBD,
#[cfg(any(feature = "advanced", feature = "usbd"))]
pub usbd: hal::pac::USBD,
/// POWER (Power Supply) peripheral
#[cfg(feature = "advanced")]
pub power: POWER,
pub power: hal::pac::POWER,
/// USB control endpoint 0
#[cfg(feature = "advanced")]
pub ep0in: Ep0In,
/// A configured USB Device
#[cfg(feature = "usbd")]
pub usbd: UsbDevice,
pub ep0in: usbd::Ep0In,
/// Represents our current clock setup
#[cfg(any(feature = "radio", feature = "usbd"))]
pub clocks: &'static Clocks<
clocks::ExternalOscillator,
clocks::ExternalOscillator,
clocks::LfOscStarted,
>,
}

/// All LEDs on the board
Expand Down Expand Up @@ -434,14 +432,14 @@ pub fn init() -> Result<Board, Error> {
#[cfg(feature = "radio")]
radio,
timer: Timer { inner: timer },
#[cfg(feature = "advanced")]
#[cfg(any(feature = "advanced", feature = "usbd"))]
usbd: periph.USBD,
#[cfg(feature = "advanced")]
power: periph.POWER,
#[cfg(feature = "advanced")]
ep0in: unsafe { Ep0In::new(&EP0IN_BUF) },
#[cfg(feature = "usbd")]
usbd: UsbDevice::new(hal::usbd::UsbPeripheral::new(periph.USBD, clocks)),
ep0in: unsafe { usbd::Ep0In::new(&EP0IN_BUF) },
#[cfg(any(feature = "radio", feature = "usbd"))]
clocks,
})
}

Expand Down
32 changes: 15 additions & 17 deletions nrf52-code/boards/dk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ use hal::{
#[cfg(any(feature = "radio", feature = "advanced"))]
use defmt_rtt as _; // global logger

#[cfg(feature = "advanced")]
use crate::{
peripheral::{POWER, USBD},
usbd::Ep0In,
};

#[cfg(feature = "advanced")]
mod errata;
pub mod peripheral;
Expand Down Expand Up @@ -67,17 +61,21 @@ pub struct Board {
#[cfg(feature = "radio")]
pub radio: ieee802154::Radio<'static>,
/// USBD (Universal Serial Bus Device) peripheral
#[cfg(feature = "advanced")]
pub usbd: USBD,
#[cfg(any(feature = "advanced", feature = "usbd"))]
pub usbd: hal::pac::USBD,
/// POWER (Power Supply) peripheral
#[cfg(feature = "advanced")]
pub power: POWER,
pub power: hal::pac::POWER,
/// USB control endpoint 0
#[cfg(feature = "advanced")]
pub ep0in: Ep0In,
/// A configured USB Device
#[cfg(feature = "usbd")]
pub usbd: UsbDevice,
pub ep0in: usbd::Ep0In,
/// Represents our current clock setup
#[cfg(any(feature = "radio", feature = "usbd"))]
pub clocks: &'static Clocks<
clocks::ExternalOscillator,
clocks::ExternalOscillator,
clocks::LfOscStarted,
>,
}

/// All LEDs on the board
Expand Down Expand Up @@ -396,14 +394,14 @@ pub fn init() -> Result<Board, Error> {
#[cfg(feature = "radio")]
radio,
timer: Timer { inner: timer },
#[cfg(feature = "advanced")]
#[cfg(any(feature = "advanced", feature = "usbd"))]
usbd: periph.USBD,
#[cfg(feature = "advanced")]
power: periph.POWER,
#[cfg(feature = "advanced")]
ep0in: unsafe { Ep0In::new(&EP0IN_BUF) },
#[cfg(feature = "usbd")]
usbd: UsbDevice::new(hal::usbd::UsbPeripheral::new(periph.USBD, clocks)),
ep0in: unsafe { usbd::Ep0In::new(&EP0IN_BUF) },
#[cfg(any(feature = "radio", feature = "usbd"))]
clocks,
})
}

Expand Down
5 changes: 3 additions & 2 deletions nrf52-code/boards/dongle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ use cortex_m_semihosting::debug;
use embedded_hal::digital::{OutputPin, StatefulOutputPin};
use grounded::uninit::GroundedCell;

use hal::pac::interrupt;
pub use hal::{self, ieee802154};
use hal::{
clocks::{self, Clocks},
gpio::{p0, p1, Level, Output, Pin, Port, PushPull},
Expand All @@ -29,6 +27,9 @@ use hal::{

use defmt_rtt as _; // global logger

pub use hal::pac::{interrupt, Interrupt, NVIC_PRIO_BITS, RTC0};
pub use hal::{self, ieee802154};

/// Exports PAC peripherals
pub mod peripheral {
pub use hal::pac::{interrupt, Interrupt, POWER, USBD};
Expand Down
23 changes: 0 additions & 23 deletions nrf52-code/loopback-fw-rtic/.cargo/config.toml

This file was deleted.

1 change: 0 additions & 1 deletion nrf52-code/loopback-fw-rtic/.gitignore

This file was deleted.

Loading

0 comments on commit 20f464e

Please sign in to comment.