Skip to content

Commit

Permalink
prepare HAL patch and embassy release
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Feb 18, 2025
1 parent b6971ab commit 969f0f4
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 25 deletions.
2 changes: 1 addition & 1 deletion examples/embassy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
13 changes: 8 additions & 5 deletions va416xx-embassy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
4 changes: 2 additions & 2 deletions va416xx-embassy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions va416xx-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion va416xx-hal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "va416xx-hal"
version = "0.4.0"
version = "0.4.1"
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
edition = "2021"
description = "HAL for the Vorago VA416xx family of MCUs"
Expand Down
7 changes: 5 additions & 2 deletions va416xx-hal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 8 additions & 14 deletions va416xx-hal/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand Down

0 comments on commit 969f0f4

Please sign in to comment.