diff options
| author | JuliDi <[email protected]> | 2023-07-28 16:59:13 +0200 |
|---|---|---|
| committer | JuliDi <[email protected]> | 2023-07-28 16:59:13 +0200 |
| commit | 6dd2fc59418c9d96f049f184694ddaf4845a4425 (patch) | |
| tree | 99b761bb715b659af83ac2e317e49a12264653fb | |
| parent | 937a63ce28beee87ae78756ecf8377f465b8cf9d (diff) | |
add document-features
| -rw-r--r-- | embassy-stm32/Cargo.toml | 54 | ||||
| -rw-r--r-- | embassy-stm32/src/lib.rs | 3 |
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" | |||
| 67 | embedded-io = { version = "0.4.0", features = ["async"], optional = true } | 67 | embedded-io = { version = "0.4.0", features = ["async"], optional = true } |
| 68 | chrono = { version = "^0.4", default-features = false, optional = true} | 68 | chrono = { version = "^0.4", default-features = false, optional = true} |
| 69 | bit_field = "0.10.2" | 69 | bit_field = "0.10.2" |
| 70 | document-features = "0.2.7" | ||
| 70 | 71 | ||
| 71 | [dev-dependencies] | 72 | [dev-dependencies] |
| 72 | critical-section = { version = "1.1", features = ["std"] } | 73 | critical-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] |
| 80 | default = ["rt"] | 81 | default = ["rt"] |
| 82 | |||
| 83 | ## Enable `stm32-metapac`'s `rt` feature | ||
| 81 | rt = ["stm32-metapac/rt"] | 84 | rt = ["stm32-metapac/rt"] |
| 82 | 85 | ||
| 86 | ## Use [`defmt`](https://docs.rs/defmt/latest/defmt/) for logging | ||
| 83 | defmt = ["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"] | 87 | defmt = ["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"] |
| 84 | memory-x = ["stm32-metapac/memory-x"] | 88 | |
| 85 | exti = [] | 89 | exti = [] |
| 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/) |
| 92 | memory-x = ["stm32-metapac/memory-x"] | ||
| 93 | |||
| 94 | ## Enable nightly-only features | ||
| 95 | nightly = ["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. | ||
| 101 | unstable-pac = [] | ||
| 102 | |||
| 103 | ## Implement embedded-hal 1.0 alpha traits. | ||
| 104 | ## Implement embedded-hal-async traits if `nightly` is set as well. | ||
| 105 | unstable-traits = ["embedded-hal-1", "dep:embedded-hal-nb"] | ||
| 106 | |||
| 107 | #! ## Time | ||
| 108 | |||
| 109 | ## Enables additional driver features that depend on embassy-time | ||
| 88 | time = ["dep:embassy-time"] | 110 | time = ["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 | ||
| 93 | time-driver-any = ["_time-driver"] | 117 | time-driver-any = ["_time-driver"] |
| 118 | ## Use TIM2 as time driver | ||
| 94 | time-driver-tim2 = ["_time-driver"] | 119 | time-driver-tim2 = ["_time-driver"] |
| 120 | ## Use TIM3 as time driver | ||
| 95 | time-driver-tim3 = ["_time-driver"] | 121 | time-driver-tim3 = ["_time-driver"] |
| 122 | ## Use TIM4 as time driver | ||
| 96 | time-driver-tim4 = ["_time-driver"] | 123 | time-driver-tim4 = ["_time-driver"] |
| 124 | ## Use TIM5 as time driver | ||
| 97 | time-driver-tim5 = ["_time-driver"] | 125 | time-driver-tim5 = ["_time-driver"] |
| 126 | ## Use TIM12 as time driver | ||
| 98 | time-driver-tim12 = ["_time-driver"] | 127 | time-driver-tim12 = ["_time-driver"] |
| 128 | ## Use TIM15 as time driver | ||
| 99 | time-driver-tim15 = ["_time-driver"] | 129 | time-driver-tim15 = ["_time-driver"] |
| 100 | 130 | ||
| 101 | # Enable nightly-only features | ||
| 102 | nightly = ["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. | ||
| 108 | unstable-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`. |
| 112 | unstable-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 | ||
| 115 | stm32c011d6 = [ "stm32-metapac/stm32c011d6" ] | 139 | stm32c011d6 = [ "stm32-metapac/stm32c011d6" ] |
| 116 | stm32c011f4 = [ "stm32-metapac/stm32c011f4" ] | 140 | stm32c011f4 = [ "stm32-metapac/stm32c011f4" ] |
| 117 | stm32c011f6 = [ "stm32-metapac/stm32c011f6" ] | 141 | stm32c011f6 = [ "stm32-metapac/stm32c011f6" ] |
| @@ -1445,4 +1469,4 @@ stm32wle5cb = [ "stm32-metapac/stm32wle5cb" ] | |||
| 1445 | stm32wle5cc = [ "stm32-metapac/stm32wle5cc" ] | 1469 | stm32wle5cc = [ "stm32-metapac/stm32wle5cc" ] |
| 1446 | stm32wle5j8 = [ "stm32-metapac/stm32wle5j8" ] | 1470 | stm32wle5j8 = [ "stm32-metapac/stm32wle5j8" ] |
| 1447 | stm32wle5jb = [ "stm32-metapac/stm32wle5jb" ] | 1471 | stm32wle5jb = [ "stm32-metapac/stm32wle5jb" ] |
| 1448 | stm32wle5jc = [ "stm32-metapac/stm32wle5jc" ] \ No newline at end of file | 1472 | stm32wle5jc = [ "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. |
| 5 | pub mod fmt; | 8 | pub mod fmt; |
| 6 | include!(concat!(env!("OUT_DIR"), "/_macros.rs")); | 9 | include!(concat!(env!("OUT_DIR"), "/_macros.rs")); |
