From 969f0f4ca5fbe971a91784f3081bf734c0a6a2a5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 Feb 2025 18:16:58 +0100 Subject: [PATCH] prepare HAL patch and embassy release --- examples/embassy/Cargo.toml | 2 +- va416xx-embassy/Cargo.toml | 13 ++++++++----- va416xx-embassy/src/lib.rs | 4 ++-- va416xx-hal/CHANGELOG.md | 5 +++++ va416xx-hal/Cargo.toml | 2 +- va416xx-hal/README.md | 7 +++++-- va416xx-hal/src/lib.rs | 22 ++++++++-------------- 7 files changed, 30 insertions(+), 25 deletions(-) diff --git a/examples/embassy/Cargo.toml b/examples/embassy/Cargo.toml index 0885f5d..a29c23f 100644 --- a/examples/embassy/Cargo.toml +++ b/examples/embassy/Cargo.toml @@ -28,7 +28,7 @@ embassy-executor = { version = "0.7", features = [ "executor-interrupt" ]} -va416xx-hal = { version = "0.4", features = ["va41630"] } +va416xx-hal = { version = "0.4", path = "../../va416xx-hal" } va416xx-embassy = { path = "../../va416xx-embassy", default-features = false } [features] diff --git a/va416xx-embassy/Cargo.toml b/va416xx-embassy/Cargo.toml index fe95dd2..88c3e1b 100644 --- a/va416xx-embassy/Cargo.toml +++ b/va416xx-embassy/Cargo.toml @@ -21,17 +21,20 @@ portable-atomic = "1" once_cell = { version = "1", default-features = false, features = ["critical-section"] } -va416xx-hal = { version = "0.4" } +va416xx-hal = { version = "0.4", path = "../va416xx-hal" } [features] default = ["irq-tim14-tim15"] -irqs-in-lib = [] + # This determines the reserved interrupt functions for the embassy time drivers. Only one # is allowed to be selected! -irq-tim14-tim15 = ["irqs-in-lib"] -irq-tim13-tim14 = ["irqs-in-lib"] +irq-tim14-tim15 = ["_irqs-in-lib"] +irq-tim13-tim14 = ["_irqs-in-lib"] # These TIMs are clocked slower! -irq-tim22-tim23 = ["irqs-in-lib"] +irq-tim22-tim23 = ["_irqs-in-lib"] + +# Private feature. +_irqs-in-lib = [] [package.metadata.docs.rs] rustdoc-args = ["--generate-link-to-definition"] diff --git a/va416xx-embassy/src/lib.rs b/va416xx-embassy/src/lib.rs index 1d3928d..b1f6864 100644 --- a/va416xx-embassy/src/lib.rs +++ b/va416xx-embassy/src/lib.rs @@ -136,13 +136,13 @@ pub unsafe fn init< alarm: AlarmTim, clocks: &Clocks, ) { - #[cfg(feature = "irqs-in-lib")] + #[cfg(feature = "_irqs-in-lib")] assert_eq!( TimekeeperTim::ID, TIMEKEEPER_IRQ as u8 - TIM_IRQ_OFFSET as u8, "Timekeeper TIM and IRQ missmatch" ); - #[cfg(feature = "irqs-in-lib")] + #[cfg(feature = "_irqs-in-lib")] assert_eq!( AlarmTim::ID, ALARM_IRQ as u8 - TIM_IRQ_OFFSET as u8, diff --git a/va416xx-hal/CHANGELOG.md b/va416xx-hal/CHANGELOG.md index 57de1be..67c831d 100644 --- a/va416xx-hal/CHANGELOG.md +++ b/va416xx-hal/CHANGELOG.md @@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). # [unreleased] +# [v0.4.1] 2025-02-18 + +- Chip selection is not enforced anymore, but advised through documentation. This makes using + the HAL in libraries a lot easier. + # [v0.4.0] 2025-02-18 ## Changed diff --git a/va416xx-hal/Cargo.toml b/va416xx-hal/Cargo.toml index 38dc7e4..5fb9def 100644 --- a/va416xx-hal/Cargo.toml +++ b/va416xx-hal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "va416xx-hal" -version = "0.4.0" +version = "0.4.1" authors = ["Robin Mueller "] edition = "2021" description = "HAL for the Vorago VA416xx family of MCUs" diff --git a/va416xx-hal/README.md b/va416xx-hal/README.md index b21c0ee..1ce98ba 100644 --- a/va416xx-hal/README.md +++ b/va416xx-hal/README.md @@ -11,14 +11,17 @@ raw PAC. This crate also implements traits specified by the [embedded-hal](https://github.com/rust-embedded/embedded-hal) project, making it compatible with various drivers in the embedded rust ecosystem. -You have to enable one of the following device features to use this crate depending on -which chip you are using: +It is generally advised to enable ONE of the following device features to use this crate +depending on which chip you are using: - `va41630` - `va41629` - `va41628` - `va41620` +If no chip is specified, only access to APIs which are common for all families or +which are not disabled for specific families is granted. + ## Building Building an application requires the `thumbv7em-none-eabihf` cross-compiler toolchain. diff --git a/va416xx-hal/src/lib.rs b/va416xx-hal/src/lib.rs index b068054..676a702 100644 --- a/va416xx-hal/src/lib.rs +++ b/va416xx-hal/src/lib.rs @@ -1,20 +1,23 @@ //! This is the **H**ardware **A**bstraction **L**ayer (HAL) for the VA416xx MCU family. //! //! It is an additional hardware abstraction on top of the [peripheral access API](https://egit.irs.uni-stuttgart.de/rust/va416xx-rs/src/branch/main/va416xx). - +//! //! It is the result of reading the datasheet for the device and encoding a type-safe layer over the //! raw PAC. This crate also implements traits specified by the //! [embedded-hal](https://github.com/rust-embedded/embedded-hal) project, making it compatible with //! various drivers in the embedded rust ecosystem. - -//! You have to enable one of the following device features to use this crate depending on -//! which chip you are using: - +//! +//! It is generally advised to enable ONE of the following device features to use this crate +//! depending on which chip you are using: +//! //! - `va41630` //! - `va41629` //! - `va41628` //! - `va41620` //! +//! If no option is specified, only access to APIs which are common for all families or +//! which are not disabled for specific families is granted. +//! //! When using this HAL and writing applications for the VA416xx family in general, it is strongly //! recommended that you set up the clock properly, because the default internal HBO clock //! is not very accurate. You can use the [crate::clock] module for this. If you are working @@ -26,15 +29,6 @@ #[cfg(test)] extern crate std; -#[cfg(not(feature = "device-selected"))] -compile_error!( - "This crate requires one of the following device features enabled: - va41630 - va41629 - va41628 -" -); - use gpio::Port; pub use va416xx as device; pub use va416xx as pac; -- 2.43.0