diff --git a/.github/workflows/va108xx.yml b/.github/workflows/va108xx.yml index 222503f..55a4940 100644 --- a/.github/workflows/va108xx.yml +++ b/.github/workflows/va108xx.yml @@ -36,7 +36,7 @@ jobs: - uses: dtolnay/rust-toolchain@stable - name: Install nextest uses: taiki-e/install-action@nextest - - run: cargo nextest run --all-features -p va108xx-hal --no-tests=pass + - run: cargo nextest run -p va108xx-hal --no-tests=pass # I think we can skip those on an embedded crate.. # - run: cargo test --doc -p va108xx-hal @@ -57,7 +57,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly - run: RUSTDOCFLAGS="--cfg docsrs --generate-link-to-definition -Z unstable-options" cargo +nightly doc -p va108xx --all-features - - run: RUSTDOCFLAGS="--cfg docsrs --generate-link-to-definition -Z unstable-options" cargo +nightly doc -p va108xx-hal --all-features --no-deps + - run: RUSTDOCFLAGS="--cfg docsrs --generate-link-to-definition -Z unstable-options" cargo +nightly doc -p va108xx-hal --features "defmt, embassy-oc30-oc31" --no-deps - run: RUSTDOCFLAGS="--cfg docsrs --generate-link-to-definition -Z unstable-options" cargo +nightly doc -p vorago-reb1 --no-deps clippy: diff --git a/justfile b/justfile index 295fc5d..5cae177 100644 --- a/justfile +++ b/justfile @@ -70,7 +70,7 @@ clippy-shared-hal: [working-directory: 'va108xx'] docs-va108xx: RUSTDOCFLAGS="--cfg docsrs --generate-link-to-definition -Z unstable-options" cargo +nightly doc -p va108xx --all-features - RUSTDOCFLAGS="--cfg docsrs --generate-link-to-definition -Z unstable-options" cargo +nightly doc -p va108xx-hal --all-features --no-deps + RUSTDOCFLAGS="--cfg docsrs --generate-link-to-definition -Z unstable-options" cargo +nightly doc -p va108xx-hal --features "defmt, embassy-oc30-oc31" --no-deps RUSTDOCFLAGS="--cfg docsrs --generate-link-to-definition -Z unstable-options" cargo +nightly doc -p vorago-reb1 --no-deps [working-directory: 'va416xx'] diff --git a/va108xx/Cargo.toml b/va108xx/Cargo.toml index 966472f..b0e02e3 100644 --- a/va108xx/Cargo.toml +++ b/va108xx/Cargo.toml @@ -4,7 +4,6 @@ members = [ "vorago-reb1", "va108xx", "va108xx-hal", - "va108xx-embassy", "examples/simple", "examples/rtic", "examples/embassy", diff --git a/va108xx/board-tests/Cargo.toml b/va108xx/board-tests/Cargo.toml index bcfc493..4edd471 100644 --- a/va108xx/board-tests/Cargo.toml +++ b/va108xx/board-tests/Cargo.toml @@ -12,7 +12,7 @@ panic-probe = { version = "1", features = ["print-defmt"] } embedded-hal = "1" [dependencies.va108xx-hal] -version = "0.12" +version = "0.13" features = ["rt"] path = "../va108xx-hal" diff --git a/va108xx/bootloader/Cargo.toml b/va108xx/bootloader/Cargo.toml index 212e8a0..4ac9b61 100644 --- a/va108xx/bootloader/Cargo.toml +++ b/va108xx/bootloader/Cargo.toml @@ -15,7 +15,7 @@ num_enum = { version = "0.7", default-features = false } static_assertions = "1" [dependencies.va108xx-hal] -version = "0.12" +version = "0.13" path = "../va108xx-hal" features = ["defmt"] diff --git a/va108xx/examples/embassy/Cargo.toml b/va108xx/examples/embassy/Cargo.toml index 257761d..6c2b7a7 100644 --- a/va108xx/examples/embassy/Cargo.toml +++ b/va108xx/examples/embassy/Cargo.toml @@ -27,11 +27,10 @@ embassy-executor = { version = "0.10", features = [ "executor-interrupt" ]} -va108xx-hal = { version = "0.12", path = "../../va108xx-hal", features = ["defmt"] } -va108xx-embassy = { version = "0.3", path = "../../va108xx-embassy" } +va108xx-hal = { version = "0.13", path = "../../va108xx-hal", features = ["defmt"] } [features] -default = ["ticks-hz-1_000", "va108xx-embassy/irq-oc30-oc31"] +default = ["ticks-hz-1_000", "va108xx-hal/embassy-oc30-oc31"] custom-irqs = [] ticks-hz-1_000 = ["embassy-time/tick-hz-1_000"] ticks-hz-32_768 = ["embassy-time/tick-hz-32_768"] diff --git a/va108xx/examples/embassy/src/bin/async-gpio.rs b/va108xx/examples/embassy/src/bin/async-gpio.rs index c381cf9..6c60f74 100644 --- a/va108xx/examples/embassy/src/bin/async-gpio.rs +++ b/va108xx/examples/embassy/src/bin/async-gpio.rs @@ -61,7 +61,7 @@ async fn main(spawner: Spawner) { let dp = pac::Peripherals::take().unwrap(); // Safety: Only called once here. - va108xx_embassy::init(dp.tim23, dp.tim22, SYSCLK_FREQ); + va108xx_hal::embassy_time::init(dp.tim23, dp.tim22, SYSCLK_FREQ); unsafe { cortex_m::interrupt::enable(); } diff --git a/va108xx/examples/embassy/src/bin/async-uart-rx.rs b/va108xx/examples/embassy/src/bin/async-uart-rx.rs index 3c9799e..ad04240 100644 --- a/va108xx/examples/embassy/src/bin/async-uart-rx.rs +++ b/va108xx/examples/embassy/src/bin/async-uart-rx.rs @@ -55,7 +55,7 @@ async fn main(spawner: Spawner) { let dp = pac::Peripherals::take().unwrap(); // Safety: Only called once here. - va108xx_embassy::init(dp.tim23, dp.tim22, SYSCLK_FREQ); + va108xx_hal::embassy_time::init(dp.tim23, dp.tim22, SYSCLK_FREQ); let porta = PinsA::new(dp.porta); let mut led0 = Output::new(porta.pa10, PinState::Low); diff --git a/va108xx/examples/embassy/src/bin/async-uart-tx.rs b/va108xx/examples/embassy/src/bin/async-uart-tx.rs index 45f7b70..44db1bd 100644 --- a/va108xx/examples/embassy/src/bin/async-uart-tx.rs +++ b/va108xx/examples/embassy/src/bin/async-uart-tx.rs @@ -41,7 +41,7 @@ async fn main(_spawner: Spawner) { let dp = pac::Peripherals::take().unwrap(); // Safety: Only called once here. - va108xx_embassy::init(dp.tim23, dp.tim22, SYSCLK_FREQ); + va108xx_hal::embassy_time::init(dp.tim23, dp.tim22, SYSCLK_FREQ); let porta = PinsA::new(dp.porta); diff --git a/va108xx/examples/embassy/src/main.rs b/va108xx/examples/embassy/src/main.rs index a0fa571..d02778d 100644 --- a/va108xx/examples/embassy/src/main.rs +++ b/va108xx/examples/embassy/src/main.rs @@ -6,7 +6,7 @@ use embassy_time::{Duration, Instant, Ticker}; cfg_if::cfg_if! { if #[cfg(feature = "custom-irqs")] { - use va108xx_embassy::embassy_time_driver_irqs; + use va108xx_hal::embassy_time_driver_irqs; use va108xx_hal::pac::interrupt; embassy_time_driver_irqs!(timekeeper_irq = OC23, alarm_irq = OC24); } @@ -31,13 +31,13 @@ async fn main(_spawner: Spawner) { // Safety: Only called once here. cfg_if::cfg_if! { if #[cfg(not(feature = "custom-irqs"))] { - va108xx_embassy::init( + va108xx_hal::embassy_time::init( dp.tim23, dp.tim22, SYSCLK_FREQ, ); } else { - va108xx_embassy::init_with_custom_irqs( + va108xx_hal::embassy_time::init_with_custom_irqs( dp.tim23, dp.tim22, SYSCLK_FREQ, diff --git a/va108xx/examples/rtic/Cargo.toml b/va108xx/examples/rtic/Cargo.toml index cfe27ab..85e9bc3 100644 --- a/va108xx/examples/rtic/Cargo.toml +++ b/va108xx/examples/rtic/Cargo.toml @@ -14,5 +14,5 @@ rtic = { version = "2", features = ["thumbv6-backend"] } rtic-monotonics = { version = "2", features = ["cortex-m-systick"] } ringbuf = { version = "0.4.7", default-features = false, features = ["portable-atomic"] } -va108xx-hal = { version = "0.12", path = "../../va108xx-hal" } +va108xx-hal = { version = "0.13", path = "../../va108xx-hal" } vorago-reb1 = { version = "0.9", path = "../../vorago-reb1" } diff --git a/va108xx/examples/simple/Cargo.toml b/va108xx/examples/simple/Cargo.toml index 8369263..e8a661c 100644 --- a/va108xx/examples/simple/Cargo.toml +++ b/va108xx/examples/simple/Cargo.toml @@ -16,6 +16,6 @@ embedded-io = "0.7" portable-atomic = { version = "1", features = ["unsafe-assume-single-core"] } [dependencies.va108xx-hal] -version = "0.12" +version = "0.13" path = "../../va108xx-hal" features = ["defmt"] diff --git a/va108xx/flashloader/Cargo.toml b/va108xx/flashloader/Cargo.toml index b03280b..2c584a8 100644 --- a/va108xx/flashloader/Cargo.toml +++ b/va108xx/flashloader/Cargo.toml @@ -25,7 +25,7 @@ rtic = { version = "2", features = ["thumbv6-backend"] } rtic-monotonics = { version = "2", features = ["cortex-m-systick"] } [dependencies.va108xx-hal] -version = "0.12" +version = "0.13" path = "../va108xx-hal" features = ["defmt"] diff --git a/va108xx/va108xx-embassy/CHANGELOG.md b/va108xx/va108xx-embassy/CHANGELOG.md deleted file mode 100644 index ec06a3e..0000000 --- a/va108xx/va108xx-embassy/CHANGELOG.md +++ /dev/null @@ -1,36 +0,0 @@ -Change Log -======= - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/) -and this project adheres to [Semantic Versioning](http://semver.org/). - -## [unreleased] - -## [v0.3.0] 2025-09-03 - -Bumped allowed va108xx-hal to v0.12 - -## [v0.2.1] 2025-03-07 - -- Bumped allowed va108xx-hal to v0.11 - -## [v0.2.0] 2025-02-17 - -- Bumped va108xx-hal to v0.10.0 -- Remove `embassy` module, expose public functions in library root directly - - -## [v0.1.2] and [v0.1.1] 2025-02-13 - -Docs patch - -## [v0.1.0] 2025-02-13 - -Initial release - -[unreleased]: https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/compare/va108xx-embassy-v0.3.0...HEAD -[v0.3.0]: https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/compare/va108xx-embassy-v0.2.1...va10xx-embassy-v0.3.0 -[v0.2.1]: https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/compare/va108xx-embassy-v0.2.0...va10xx-embassy-v0.2.1 -[v0.2.0]: https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/compare/va108xx-embassy-v0.1.2...va10xx-embassy-v0.2.0 diff --git a/va108xx/va108xx-embassy/Cargo.toml b/va108xx/va108xx-embassy/Cargo.toml deleted file mode 100644 index 915a675..0000000 --- a/va108xx/va108xx-embassy/Cargo.toml +++ /dev/null @@ -1,28 +0,0 @@ -[package] -name = "va108xx-embassy" -version = "0.3.0" -edition = "2021" -authors = ["Robin Mueller "] -description = "Embassy-rs support for the Vorago VA108xx family of microcontrollers" -homepage = "https://egit.irs.uni-stuttgart.de/rust/vorago-rs" -repository = "https://egit.irs.uni-stuttgart.de/rust/vorago-rs" -license = "Apache-2.0" -keywords = ["no-std", "hal", "cortex-m", "vorago", "va108xx"] -categories = ["aerospace", "embedded", "no-std", "hardware-support"] - -[dependencies] -vorago-shared-hal = { version = "0.3", path = "../../vorago-shared-hal", features = ["vor1x"] } -va108xx-hal = { version = "0.12", path = "../va108xx-hal" } - -[features] -default = ["irq-oc30-oc31"] -irqs-in-lib = [] -# This determines the reserved interrupt functions for the embassy time drivers. Only one -# is allowed to be selected! -irq-oc28-oc29 = ["irqs-in-lib"] -irq-oc29-oc30 = ["irqs-in-lib"] -irq-oc30-oc31 = ["irqs-in-lib"] - -[package.metadata.docs.rs] -targets = ["thumbv6m-none-eabi"] -rustdoc-args = ["--generate-link-to-definition"] diff --git a/va108xx/va108xx-embassy/README.md b/va108xx/va108xx-embassy/README.md deleted file mode 100644 index 62a00e8..0000000 --- a/va108xx/va108xx-embassy/README.md +++ /dev/null @@ -1,10 +0,0 @@ -[![Crates.io](https://img.shields.io/crates/v/va108xx-embassy)](https://crates.io/crates/va108xx-embassy) -[![docs.rs](https://img.shields.io/docsrs/va108xx-embassy)](https://docs.rs/va108xx-embassy) - -# Embassy-rs support for the Vorago VA108xx MCU family - -This repository contains the [embassy-rs](https://github.com/embassy-rs/embassy) support for the -VA108xx family. Currently, it contains the time driver to allow using embassy-rs. It uses the TIM -peripherals provided by the VA108xx family for this purpose. - -The documentation contains more information on how to use this crate. diff --git a/va108xx/va108xx-embassy/docs.sh b/va108xx/va108xx-embassy/docs.sh deleted file mode 100755 index c8ddd4e..0000000 --- a/va108xx/va108xx-embassy/docs.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -export RUSTDOCFLAGS="--cfg docsrs --generate-link-to-definition -Z unstable-options" -cargo +nightly doc --open diff --git a/va108xx/va108xx-hal/CHANGELOG.md b/va108xx/va108xx-hal/CHANGELOG.md index 9df8357..93e9a8c 100644 --- a/va108xx/va108xx-hal/CHANGELOG.md +++ b/va108xx/va108xx-hal/CHANGELOG.md @@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [unreleased] +## [v0.13.0] 2026-05-18 + +- Bump `vorago-shared-hal` dependency to v0.3. +- Integrate `va108xx-embassy` as a `embassy-time` module. + ## [v0.12.0] 2025-09-03 ## Changed diff --git a/va108xx/va108xx-hal/Cargo.toml b/va108xx/va108xx-hal/Cargo.toml index 1883f4b..9f9f5b3 100644 --- a/va108xx/va108xx-hal/Cargo.toml +++ b/va108xx/va108xx-hal/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "va108xx-hal" -version = "0.12.0" +version = "0.13.0" authors = ["Robin Mueller "] -edition = "2021" +edition = "2024" description = "HAL for the Vorago VA108xx family of microcontrollers" homepage = "https://egit.irs.uni-stuttgart.de/rust/vorago-rs" repository = "https://egit.irs.uni-stuttgart.de/rust/vorago-rs" @@ -28,6 +28,14 @@ default = ["rt"] rt = ["va108xx/rt"] defmt = ["dep:defmt", "vorago-shared-hal/defmt", "va108xx/defmt"] +# Embassy time features +_irqs-in-lib = [] +# This determines the reserved interrupt functions for the embassy time drivers. Only one +# is allowed to be selected! +embassy-oc30-oc31 = ["_irqs-in-lib"] +embassy-oc29-oc30 = ["_irqs-in-lib"] +embassy-oc28-oc29 = ["_irqs-in-lib"] + [package.metadata.docs.rs] all-features = true targets = ["thumbv6m-none-eabi"] diff --git a/va108xx/va108xx-embassy/src/lib.rs b/va108xx/va108xx-hal/src/embassy_time.rs similarity index 83% rename from va108xx/va108xx-embassy/src/lib.rs rename to va108xx/va108xx-hal/src/embassy_time.rs index b2ebf97..bdea33e 100644 --- a/va108xx/va108xx-embassy/src/lib.rs +++ b/va108xx/va108xx-hal/src/embassy_time.rs @@ -23,21 +23,20 @@ //! //! You can disable the default features and then specify one of the features above to use the //! documented combination of IRQs. It is also possible to specify custom IRQs by importing and -//! using the [embassy_time_driver_irqs] macro to declare the IRQ handlers in the +//! using the [crate::embassy_time_driver_irqs] macro to declare the IRQ handlers in the //! application code. If this is done, [init_with_custom_irqs] must be used //! method to pass the IRQ numbers to the library. //! //! ## Examples //! //! [embassy example projects](https://egit.irs.uni-stuttgart.de/rust/vorago-rs/src/branch/main/va108xx/examples/embassy) -#![no_std] -#![cfg_attr(docsrs, feature(doc_cfg))] -#[cfg(feature = "irqs-in-lib")] -use va108xx_hal::pac::{self, interrupt}; -use va108xx_hal::time::Hertz; -use va108xx_hal::timer::TimInstance; -use vorago_shared_hal::embassy::time_driver; +#[cfg(feature = "_irqs-in-lib")] +use crate::pac::{self, interrupt}; +use crate::time::Hertz; +use crate::timer::TimInstance; + +pub use vorago_shared_hal::embassy::time_driver; /// Macro to define the IRQ handlers for the time driver. /// @@ -45,7 +44,7 @@ use vorago_shared_hal::embassy::time_driver; /// the feature flags specified. However, the macro is exported to allow users to specify the /// interrupt handlers themselves. /// -/// Please note that you have to explicitely import the [macro@va108xx_hal::pac::interrupt] +/// Please note that you have to explicitely import the [macro@crate::pac::interrupt] /// macro in the application code in case this macro is used there. #[macro_export] macro_rules! embassy_time_driver_irqs { @@ -59,7 +58,7 @@ macro_rules! embassy_time_driver_irqs { #[allow(non_snake_case)] fn $timekeeper_irq() { // Safety: We call it once here. - unsafe { $crate::time_driver().on_interrupt_timekeeping() } + unsafe { $crate::embassy_time::time_driver().on_interrupt_timekeeping() } } const ALARM_IRQ: pac::Interrupt = pac::Interrupt::$alarm_irq; @@ -68,25 +67,25 @@ macro_rules! embassy_time_driver_irqs { #[allow(non_snake_case)] fn $alarm_irq() { // Safety: We call it once here. - unsafe { $crate::time_driver().on_interrupt_alarm() } + unsafe { $crate::embassy_time::time_driver().on_interrupt_alarm() } } }; } // Provide three combinations of IRQs for the time driver by default. -#[cfg(feature = "irq-oc30-oc31")] +#[cfg(feature = "embassy-oc30-oc31")] embassy_time_driver_irqs!(timekeeper_irq = OC31, alarm_irq = OC30); -#[cfg(feature = "irq-oc29-oc30")] +#[cfg(feature = "embassy-oc29-oc30")] embassy_time_driver_irqs!(timekeeper_irq = OC30, alarm_irq = OC29); -#[cfg(feature = "irq-oc28-oc29")] +#[cfg(feature = "embassy-oc28-oc29")] embassy_time_driver_irqs!(timekeeper_irq = OC29, alarm_irq = OC28); /// Initialization method for embassy. /// /// This should be used if the interrupt handler is provided by the library, which is the /// default case. -#[cfg(feature = "irqs-in-lib")] +#[cfg(feature = "_irqs-in-lib")] pub fn init( timekeeper_tim: TimekeeperTim, alarm_tim: AlarmTim, @@ -102,8 +101,8 @@ pub fn init_with_custom_irqs( timekeeper_tim: TimekeeperTim, alarm_tim: AlarmTim, sysclk: Hertz, - timekeeper_irq: pac::Interrupt, - alarm_irq: pac::Interrupt, + timekeeper_irq: crate::pac::Interrupt, + alarm_irq: crate::pac::Interrupt, ) { time_driver().__init(sysclk, timekeeper_tim, alarm_tim, timekeeper_irq, alarm_irq) } diff --git a/va108xx/va108xx-hal/src/lib.rs b/va108xx/va108xx-hal/src/lib.rs index 61e081e..de215b0 100644 --- a/va108xx/va108xx-hal/src/lib.rs +++ b/va108xx/va108xx-hal/src/lib.rs @@ -29,9 +29,11 @@ pub mod time; pub mod timer; pub mod uart; +pub mod embassy_time; + pub use vorago_shared_hal::{ - disable_nvic_interrupt, enable_nvic_interrupt, FunctionSelect, InterruptConfig, - PeripheralSelect, + FunctionSelect, InterruptConfig, PeripheralSelect, disable_nvic_interrupt, + enable_nvic_interrupt, }; /// This is the NONE destination reigster value for the IRQSEL peripheral. diff --git a/va108xx/vorago-reb1/Cargo.toml b/va108xx/vorago-reb1/Cargo.toml index 3d9665f..78c2feb 100644 --- a/va108xx/vorago-reb1/Cargo.toml +++ b/va108xx/vorago-reb1/Cargo.toml @@ -15,11 +15,11 @@ cortex-m = { version = "0.7", features = ["critical-section-single-core"] } cortex-m-rt = "0.7" embedded-hal = "1" nb = "1" -bitbybit = "1.3" +bitbybit = "2" arbitrary-int = "2" max116xx-10bit = "0.3" -va108xx-hal = { version = "0.12", path = "../va108xx-hal", features = ["rt"] } +va108xx-hal = { version = "0.13", path = "../va108xx-hal", features = ["rt"] } [features] rt = ["va108xx-hal/rt"]