aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuliDi <[email protected]>2023-07-28 16:59:13 +0200
committerJuliDi <[email protected]>2023-07-28 16:59:13 +0200
commit6dd2fc59418c9d96f049f184694ddaf4845a4425 (patch)
tree99b761bb715b659af83ac2e317e49a12264653fb
parent937a63ce28beee87ae78756ecf8377f465b8cf9d (diff)
add document-features
-rw-r--r--embassy-stm32/Cargo.toml54
-rw-r--r--embassy-stm32/src/lib.rs3
2 files changed, 42 insertions, 15 deletions
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml
index 6f34c7416..ba279f795 100644
--- a/embassy-stm32/Cargo.toml
+++ b/embassy-stm32/Cargo.toml
@@ -67,6 +67,7 @@ cfg-if = "1.0.0"
67embedded-io = { version = "0.4.0", features = ["async"], optional = true } 67embedded-io = { version = "0.4.0", features = ["async"], optional = true }
68chrono = { version = "^0.4", default-features = false, optional = true} 68chrono = { version = "^0.4", default-features = false, optional = true}
69bit_field = "0.10.2" 69bit_field = "0.10.2"
70document-features = "0.2.7"
70 71
71[dev-dependencies] 72[dev-dependencies]
72critical-section = { version = "1.1", features = ["std"] } 73critical-section = { version = "1.1", features = ["std"] }
@@ -78,40 +79,63 @@ stm32-metapac = { version = "13", default-features = false, features = ["metadat
78 79
79[features] 80[features]
80default = ["rt"] 81default = ["rt"]
82
83## Enable `stm32-metapac`'s `rt` feature
81rt = ["stm32-metapac/rt"] 84rt = ["stm32-metapac/rt"]
82 85
86## Use [`defmt`](https://docs.rs/defmt/latest/defmt/) for logging
83defmt = ["dep:defmt", "bxcan/unstable-defmt", "embassy-sync/defmt", "embassy-embedded-hal/defmt", "embassy-hal-internal/defmt", "embedded-io?/defmt", "embassy-usb-driver?/defmt", "embassy-net-driver/defmt"] 87defmt = ["dep:defmt", "bxcan/unstable-defmt", "embassy-sync/defmt", "embassy-embedded-hal/defmt", "embassy-hal-internal/defmt", "embedded-io?/defmt", "embassy-usb-driver?/defmt", "embassy-net-driver/defmt"]
84memory-x = ["stm32-metapac/memory-x"] 88
85exti = [] 89exti = []
86 90
87# Enables additional driver features that depend on embassy-time 91## Automatically generate `memory.x` file using [`stm32-metapac`](https://docs.rs/stm32-metapac/)
92memory-x = ["stm32-metapac/memory-x"]
93
94## Enable nightly-only features
95nightly = ["embedded-hal-1", "embedded-hal-async", "embedded-storage-async", "dep:embedded-io", "dep:embassy-usb-driver", "embassy-embedded-hal/nightly"]
96
97## Re-export stm32-metapac at `embassy_stm32::pac`.
98## This is unstable because semver-minor (non-breaking) releases of embassy-stm32 may major-bump (breaking) the stm32-metapac version.
99## If this is an issue for you, you're encouraged to directly depend on a fixed version of the PAC.
100## There are no plans to make this stable.
101unstable-pac = []
102
103## Implement embedded-hal 1.0 alpha traits.
104## Implement embedded-hal-async traits if `nightly` is set as well.
105unstable-traits = ["embedded-hal-1", "dep:embedded-hal-nb"]
106
107#! ## Time
108
109## Enables additional driver features that depend on embassy-time
88time = ["dep:embassy-time"] 110time = ["dep:embassy-time"]
89 111
90# Features starting with `_` are for internal use only. They're not intended 112# Features starting with `_` are for internal use only. They're not intended
91# to be enabled by other crates, and are not covered by semver guarantees. 113# to be enabled by other crates, and are not covered by semver guarantees.
92_time-driver = ["time"] 114_time-driver = ["time"]
115
116## Use any time driver
93time-driver-any = ["_time-driver"] 117time-driver-any = ["_time-driver"]
118## Use TIM2 as time driver
94time-driver-tim2 = ["_time-driver"] 119time-driver-tim2 = ["_time-driver"]
120## Use TIM3 as time driver
95time-driver-tim3 = ["_time-driver"] 121time-driver-tim3 = ["_time-driver"]
122## Use TIM4 as time driver
96time-driver-tim4 = ["_time-driver"] 123time-driver-tim4 = ["_time-driver"]
124## Use TIM5 as time driver
97time-driver-tim5 = ["_time-driver"] 125time-driver-tim5 = ["_time-driver"]
126## Use TIM12 as time driver
98time-driver-tim12 = ["_time-driver"] 127time-driver-tim12 = ["_time-driver"]
128## Use TIM15 as time driver
99time-driver-tim15 = ["_time-driver"] 129time-driver-tim15 = ["_time-driver"]
100 130
101# Enable nightly-only features
102nightly = ["embedded-hal-1", "embedded-hal-async", "embedded-storage-async", "dep:embedded-io", "dep:embassy-usb-driver", "embassy-embedded-hal/nightly"]
103
104# Reexport stm32-metapac at `embassy_stm32::pac`.
105# This is unstable because semver-minor (non-breaking) releases of embassy-stm32 may major-bump (breaking) the stm32-metapac version.
106# If this is an issue for you, you're encouraged to directly depend on a fixed version of the PAC.
107# There are no plans to make this stable.
108unstable-pac = []
109 131
110# Implement embedded-hal 1.0 alpha traits. 132#! ## Chip-selection features
111# Implement embedded-hal-async traits if `nightly` is set as well. 133#! Select your chip by specifying the model as a feature, e.g. `stm32c011d6`.
112unstable-traits = ["embedded-hal-1", "dep:embedded-hal-nb"] 134#! Check the `Cargo.toml` for the latest list of supported chips.
135#!
136#! **Important:** Do not forget to adapt the target chip in your toolchain,
137#! e.g. in `.cargo/config.toml`.
113 138
114# Chip-selection features
115stm32c011d6 = [ "stm32-metapac/stm32c011d6" ] 139stm32c011d6 = [ "stm32-metapac/stm32c011d6" ]
116stm32c011f4 = [ "stm32-metapac/stm32c011f4" ] 140stm32c011f4 = [ "stm32-metapac/stm32c011f4" ]
117stm32c011f6 = [ "stm32-metapac/stm32c011f6" ] 141stm32c011f6 = [ "stm32-metapac/stm32c011f6" ]
@@ -1445,4 +1469,4 @@ stm32wle5cb = [ "stm32-metapac/stm32wle5cb" ]
1445stm32wle5cc = [ "stm32-metapac/stm32wle5cc" ] 1469stm32wle5cc = [ "stm32-metapac/stm32wle5cc" ]
1446stm32wle5j8 = [ "stm32-metapac/stm32wle5j8" ] 1470stm32wle5j8 = [ "stm32-metapac/stm32wle5j8" ]
1447stm32wle5jb = [ "stm32-metapac/stm32wle5jb" ] 1471stm32wle5jb = [ "stm32-metapac/stm32wle5jb" ]
1448stm32wle5jc = [ "stm32-metapac/stm32wle5jc" ] \ No newline at end of file 1472stm32wle5jc = [ "stm32-metapac/stm32wle5jc" ]
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs
index bb2ef2fc0..9e67596b0 100644
--- a/embassy-stm32/src/lib.rs
+++ b/embassy-stm32/src/lib.rs
@@ -1,6 +1,9 @@
1#![cfg_attr(not(test), no_std)] 1#![cfg_attr(not(test), no_std)]
2#![cfg_attr(feature = "nightly", feature(async_fn_in_trait, impl_trait_projections))] 2#![cfg_attr(feature = "nightly", feature(async_fn_in_trait, impl_trait_projections))]
3 3
4//! ## Feature flags
5#![doc = document_features::document_features!(feature_label = r#"<span class="stab portability"><code>{feature}</code></span>"#)]
6
4// This must go FIRST so that all the other modules see its macros. 7// This must go FIRST so that all the other modules see its macros.
5pub mod fmt; 8pub mod fmt;
6include!(concat!(env!("OUT_DIR"), "/_macros.rs")); 9include!(concat!(env!("OUT_DIR"), "/_macros.rs"));