From d1664b1f14a3d7c913173f293e495b7cc79916d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Fita?= <4925040+michalfita@users.noreply.github.com> Date: Wed, 3 Jan 2024 19:10:36 +0000 Subject: [PATCH] [Fixes #72] Deal with dependencies to fix things, mostly doctests (#73) Since Rust 1.60 it's possible to enable dependencies' features only for included dependencies. That's going to work for `rt` and `critical-section` and some other features in future. It would be nice to have a tool that extracts all basic checks from workflow to be run before commit. Not working on machine I normally burn for this stuff has downsides, as I rush things... --- .github/workflows/build.yml | 14 +- CHANGELOG.md | 13 +- CONTRIBUTING.md | 57 ++ Cargo.toml | 1 - README.md | 18 +- boards/atsame70_xpro/Cargo.lock | 601 +++++++++++++++- boards/atsame70_xpro/Cargo.toml | 6 +- .../atsame70_xpro/examples/usb_serial_echo.rs | 9 +- boards/atsamv71_xult/Cargo.lock | 660 ++++++++++++++++-- boards/atsamv71_xult/Cargo.toml | 6 +- .../atsamv71_xult/examples/usb_serial_echo.rs | 9 +- hal/Cargo.toml | 266 +++---- hal/build.rs | 6 +- hal/src/afec.rs | 38 +- hal/src/can.rs | 16 +- hal/src/clocks/mod.rs | 6 +- hal/src/efc.rs | 2 +- hal/src/lib.rs | 24 +- hal/src/pio/bank.rs | 68 +- hal/src/pio/dynpin.rs | 8 +- hal/src/pio/mod.rs | 4 +- hal/src/pwm.rs | 56 +- hal/src/rtt.rs | 6 +- hal/src/serial/mod.rs | 2 +- hal/src/serial/spi.rs | 6 +- hal/src/serial/twi.rs | 6 +- hal/src/serial/uart.rs | 16 +- hal/src/serial/usart/mod.rs | 14 +- hal/src/tc/mod.rs | 70 +- hal/src/usb.rs | 15 +- hal/src/watchdog.rs | 1 + tools/patch-pacs | 51 ++ 32 files changed, 1655 insertions(+), 420 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100755 tools/patch-pacs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 10b9f390..73182b9d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: - id: boards run: echo "::set-output name=board_matrix::$(ls ./boards --indicator-style=none | jq -ncR '[inputs]')" - id: features - run: echo "::set-output name=feature_matrix::[\"reconfigurable-system-pins\",\"usart-spi-host-without-select\"]" + run: echo "::set-output name=feature_matrix::[\"reconfigurable-system-pins\",\"usart-spi-host-without-select\",\"rt\",\"critical-section\"]" outputs: pac_matrix: ${{ steps.pacs.outputs.pac_matrix }} board_matrix: ${{ steps.boards.outputs.board_matrix }} @@ -39,7 +39,7 @@ jobs: - name: Install Rust (thumbv7em) run: rustup target add thumbv7em-none-eabihf - name: Build HAL for ${{ matrix.pac }} - run: cargo check --package atsamx7x-hal --features ${{ matrix.pac }},unproven + run: cargo check --package atsamx7x-hal --features ${{ matrix.pac }},unproven,rt,critical-section build-latest: if: github.event.pull_request.head.repo.full_name != github.repository @@ -59,7 +59,7 @@ jobs: - name: Install Rust (thumbv7em) run: rustup target add thumbv7em-none-eabihf - name: Build HAL for ${{ matrix.pac }} - run: cargo check --package atsamx7x-hal --features ${{ matrix.pac }},unproven + run: cargo check --package atsamx7x-hal --features ${{ matrix.pac }},unproven,rt,critical-section build-features: if: github.event.pull_request.head.repo.full_name != github.repository @@ -111,7 +111,7 @@ jobs: - name: Install Clippy run: rustup component add clippy - name: Lint HAL - run: cargo clippy --package atsamx7x-hal --no-deps --features samv71q21b,unproven,reconfigurable-system-pins -- --deny warnings + run: cargo clippy --package atsamx7x-hal --no-deps --features samv71q21b,unproven,reconfigurable-system-pins,rt -- --deny warnings clippy-examples: if: github.event.pull_request.head.repo.full_name != github.repository @@ -146,8 +146,6 @@ jobs: - name: Install Rust (thumbv7em) run: rustup target add thumbv7em-none-eabihf - name: Build HAL documentation - run: cargo doc --package atsamx7x-hal --no-deps --features samv71q21b,unproven,reconfigurable-system-pins + run: cargo doc --package atsamx7x-hal --no-deps --features samv71q21b,unproven,reconfigurable-system-pins,rt,critical-section - name: Build HAL doc tests - run: cargo test --package atsamx7x-hal --doc --features samv71q21b,unproven --target x86_64-unknown-linux-gnu - - + run: cargo test --package atsamx7x-hal --doc --features samv71q21b,unproven,rt,critical-section --target x86_64-unknown-linux-gnu diff --git a/CHANGELOG.md b/CHANGELOG.md index aac033b6..6eeb61ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,21 +6,24 @@ - [Integration](https://crates.io/crates/mcan-core) with the [`mcan`](https://crates.io/crates/mcan) crate. - Implementation of blocking::i2c::Transactional trait from [embedded-hal](https://crates.io/crates/embedded-hal) for TWI device. +- Support for `critical-section` feature, falling down to PAC optional dependency. ### Changed -- Remove `rust-toolchain.toml` and control MSRV from .github/workflow/ files instead. +- Remove `rust-toolchain.toml` and control MSRV from `.github/workflow/` files instead. - Update `cortex-m-rt` version in examples to `0.7.3`. - Switched from AFE0_AD6 to AFE0_AD8 for the atsamv71_xult board ADC example code. +- The `rt` separated to not act as part of chip selection feature any more. ### Removed - Huge generated source code for PACs removed, new location for them [`atsamx7x-pac`](/atsams-rs/atsamx7x-pac) (user side generated) ### Fixed -- Examples now build and link again -- Examples now build again again +- Examples now build and link again. +- Examples now build again again. - [#62] Remove ambiguous reexports from `src/serial/mod.rs`. - TWIHS: Fix issue with clock frequency calculation. -- Fix CI: source of PACs matrix + clippy satisfaction +- Fix CI: source of PACs matrix + clippy satisfaction. +- Fixes doctest use of `take()` which now require `critical-section`. ## [v0.4.2] 2022-11-06 @@ -79,7 +82,7 @@ - `pwm` module: allows frequencies and duty-rates to be independently set for each `pwm::Channel`, with help from `ehal::PwmPin`. - `hal/rust-toolchain.toml` that pins `rustc` (and relevant components/targets) to MSRV 1.63.0. - Crate feature: `reconfigurable-system-pins`; see below. -- CI job that enforces `CHANGELOG.md` additions, unless the MR is labeled `skip-changelog`. +- CI job that enforces `CHANGELOG.md` additions, unless the MR is labelled `skip-changelog`. ### Removed - `serial::Uart::UartError::BaudRateNotInRange` error. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..2116eb88 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,57 @@ +# Contribution Guidelines + +## Branching Scheme + +This repository employs a [trunk-based development](https://trunkbaseddevelopment.com/): development occurs on `development` branch with short-lived branches that merges into it. +When a release is met, for example a `v0.3.2` release, a `v0.3.x` branch is spun of `development` and the release tagged. If this branch already exists, relevant commits are back-ported instead. + +> [!INFO] +> We don't literally stick to it as the pace is too slow to justify branching for each release. + +Development is done towards `development`. + +### Working branches naming scheme + +While we don't care how you name branches in your forks, we encourage you to branch not PR `development` from your fork, however, if you're a contributor working on this repo directly we strongly +advice to name your branches with following format `issue/99/short-kebab-case-name`, where `99` is the number of issue you're trying to fix or address as enhancement. The work `issue` may be +replaced by `bugfix` if you're fixing a bug, or `feature` if you're working on enhancement. + +## Developing with PAC changes aside + +PACs used by HAL in this repository now reside in [atsamx7x-pac](https://github.com/atsams-rs/atsamx7x-pac/) repository. Crates are published from there to crates.io, and released versions +are normally enough to work with HAL. + +However, if you're in need to incorporate some changes related to unreleased PACs, own variants of PACs, or you fix broken HAL after `svd2rust` generated breaking changes, you have to: +1. Clone the PACs repository to the directory one level above this one: + ```sh + git clone git@github.com/atsams-rs/atsamx7x-pac.git ../atsamx7x-pac + ``` + +2. Add `[patch.crates]` section to `.cargo/config`, for example: + ```toml + [patch.crates-io] + # This is example for one PAC kind, you may want to repeat for each you're using + atsamv71q21b = { path = "../../atsamx7x-pac/pac/atsamv71q21b" } + ``` + or try to run: + ```sh + tools/patch-pacs + ``` + > [!WARN] + > Please don't commit this change! + + This feature is documented [here](https://doc.rust-lang.org/cargo/reference/config.html#patch). + +3. Make changes in there and (re)generate (in this directory; with Python 3 installed): + ```sh + pushd ../atsamx7x-pac + tools/pacs.py svd + popd + ``` + +## Pull Requests + +When you submit a **Pull Request** make sure you've described your efforts in `CHANGELOG.md`, otherwise CI will fail. + +Code has to be formatted with `cargo rustfmt`, otherwise CI will fail. + diff --git a/Cargo.toml b/Cargo.toml index 21f7aaf4..4f7c16fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,4 +8,3 @@ exclude = [ "boards/", "pac/templates" ] - diff --git a/README.md b/README.md index 660c0848..33b2c488 100644 --- a/README.md +++ b/README.md @@ -3,21 +3,27 @@ ATSAMx7x Rust HAL and PACs This repository holds the HAL (Hardware Abstraction Layer) and PACs (Peripheral Access Crates) that supports and enable working with Microchip SAM S70/E70/V70/V71-based devices using Rust. -The PACs are generated by SVD files provided by Microchip, publically available at at the [Microship Packs Repository](https://packs.download.microchip.com/). +The PACs are generated by SVD files provided by Microchip, publicly available at at the [Microchip Packs Repository](https://packs.download.microchip.com/). -The HAL is the result of reading the MCU family datasheet, and provide a type-safe layer ovret he raw PACs. +The HAL is the result of reading the MCU family datasheet, and provide a type-safe layer over the raw PACs. Were able, information is stored in the type-layer instead of computed at run-time. The HAL implements traits specified by [embedded-hal](https://docs.rs/embedded-hal/0.2.7/embedded_hal/), making it compatible with various Embedded Rust ecosystem crates. +> [!TIP] +> We're not compatible with incoming Embedded HAL 1.0 as it's still in pre-release state. + Evaluation kit examples are available under `boards/`, and provide examples for most implemented peripherals. At present, examples are available for the [SAM V71 Xplained Ultra](https://www.microchipdeveloper.com/boards:sam-v71-xult) (`boards/atsamv71_xult`) and [SAM E70 Xplained Pro](https://microchipdeveloper.com/boards:sam-e70-xpro) (`boards/atsame70_xpro`). ## Development -This repository employs a [trunk-based development](https://trunkbaseddevelopment.com/): development occurs on `master` with short-lived branches that merges into it. -When a release is met, for example a `v0.3.2` release, a `v0.3.x` branch is spun of `master` and the release tagged. If this branch already exists, relevant commits are back-ported instead. +> [!NOTE] +> See into [contribution guidelines](CONTRIBUTING.md) for more details. + +This repository employs a [trunk-based development](https://trunkbaseddevelopment.com/): development occurs on `development` branch with short-lived branches that merges into it. +When a release is met, for example a `v0.3.2` release, a `v0.3.x` branch is spun of `development` and the release tagged. If this branch already exists, relevant commits are back-ported instead. -Development is done towards `master`. +Development is done towards `development`. ## Building @@ -34,7 +40,7 @@ $ cargo build --examples ``` ## Flashing the device -Refer to the [SAM V71 Xplained Ulta README](boards/atsamv71_xult/README.md). +Refer to the [SAM V71 Xplained Ultra README](boards/atsamv71_xult/README.md). License --- diff --git a/boards/atsame70_xpro/Cargo.lock b/boards/atsame70_xpro/Cargo.lock index d5b9f55a..3e80d571 100644 --- a/boards/atsame70_xpro/Cargo.lock +++ b/boards/atsame70_xpro/Cargo.lock @@ -101,11 +101,131 @@ dependencies = [ "usbd-serial", ] +[[package]] +name = "atsame70j19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f59b792fc5029f0646d51945594f68601df1a9756253421422672945a8d9943d" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsame70j20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad07c279b3928c99186fd0cc1c9e39cbdb33dbddf5b0e26d3d83dd0486a2e66e" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsame70j21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c0a9865d1a0288c9afc1c5b8120397c99b27ee2b197afdd3bd93a75f8aa9a2c" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsame70n19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5921d155748b89dd1229ad5060bfac5a8edd09e4c6212765f838987877f4a2ee" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsame70n20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e9515be929a88112811d46e5b4a997397e13fd1bc3af32317a2977f1ec2ddd" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsame70n21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f359bd6149c3d7f4fb76d89562b30bd588ad335716cb260ff41ed2e3d203c1" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsame70q19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcbba1aed7a1db050c165a39ebf9e61d7d83cc8f884e3e9527f396920bc24d0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsame70q20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "181b3917fdbdc4650f8bff281a4d3f3b639f365549317d7d52f5b1f9675ccd52" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + [[package]] name = "atsame70q21b" -version = "0.29.0-alpha1" +version = "0.29.0-alpha3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a680e943bf86da4f8bea77ce8681101e15e5265eb95a162cf0b5fa80ee0c7c2" +checksum = "9ec88ab8a5e0336ec6d9c45295fa0c843fe609211753c26a0904a5abaa66d406" dependencies = [ "cortex-m", "cortex-m-rt", @@ -117,10 +237,402 @@ dependencies = [ ] [[package]] -name = "atsamx7x-hal" -version = "0.4.3-alpha1" +name = "atsams70j19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bd21f78548bce21f946df44dfa5092649394207168eae1322d8564cb47211b" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70j20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a842e106ba4e543cc6befb1f2a5ab43be788679ae549111405715fcf86a86f8" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70j21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b34fc1317a00bf230b98b3431032723d442a402d0a396f271bb7edd498524383" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70n19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a0ba05baf0a7199fd71fb292f6998a720a69c2a732d50b741d4612ae8bff261" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70n20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b96ea1fcf1acc169085b045e642118fd41c4256a9108f0b21209d0ef8c9261c" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70n21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f657ff8db7ceaed8fc68407b0f9a18b547569297cb59bb255048eb766fc70107" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70q19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5327d54bf890efb9a1ba49a6ec959ca04f9f62e071e56e92181f0cac4a6420b7" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70q20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a36082caa069b65f2dc07110c4a0f643f57dcb3849769ebf12c806780d9e33" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70q21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4d1ddafb14bdc446ec2abc0a525caa24f344dfa3ee735096de14beae2da0f16" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv70j19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e7a56cfe0ad63e1aa21f7d55470ffb89f7b050027d561c8e6cf40aa3ff84b4" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv70j20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66bdc44e938d3f0897230667e2154aa053d2aefb8ceecb1188a5defc57e3c080" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv70n19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9a2c575f8a47d091682ad503b86fa3ba44d59b4a9d4afce258b28e35942c1f" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv70n20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c967624fd921a2144cb04043b873fb4cabbd9fce5c79ca8cf757d2d7930a01fd" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv70q19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d665f962c2e8b29cc874f4a97f9f9dd6e7512b6a623b8cbfcd4c286c1cd7cb" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv70q20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef1adc1925558fdd6d9a4f678f9165ea4b962abc928648e51ec189c457bf4a0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71j19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5afdafae5e1d5ad66e50a70ee346058e3ba7cfb72d8eb6f6729dbd7f816694" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71j20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4588b8c979c378b4d0f1eb3d37729a6cee4979652136d49cf4db92ebb60ed591" dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71j21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4038a6114b0bb6dd41b9d1feec63dd1e55455019e336f3dc624805251f414c" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71n19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b7efb2028637208bea0d98152c83215e2f8fe8ae0b1af69bbd5c92f5b3b3911" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71n20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb4c881959cce3d8050139ad960ae91431fb9596a79a4a28fe7c3830371c745" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71n21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ea446ec36857849f81367a01eb362f4cfc6dad8973445029dbaf99bad65bcbe" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71q19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84deff4deb0b32697422b65d581b0a388ef212c11607c169e1cf04a5ecb3fce" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71q20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6351ec583cc689b79e27e2cedad9bbe0a308d4064b57cae2ab5176aa9a8f4469" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71q21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de4dff2ff428ab3913ce5a2f54cbc2357600957f0b11f857d240b61d66f41aff" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamx7x-hal" +version = "0.4.3-alpha3" +dependencies = [ + "atsame70j19b", + "atsame70j20b", + "atsame70j21b", + "atsame70n19b", + "atsame70n20b", + "atsame70n21b", + "atsame70q19b", + "atsame70q20b", "atsame70q21b", + "atsams70j19b", + "atsams70j20b", + "atsams70j21b", + "atsams70n19b", + "atsams70n20b", + "atsams70n21b", + "atsams70q19b", + "atsams70q20b", + "atsams70q21b", + "atsamv70j19b", + "atsamv70j20b", + "atsamv70n19b", + "atsamv70n20b", + "atsamv70q19b", + "atsamv70q20b", + "atsamv71j19b", + "atsamv71j20b", + "atsamv71j21b", + "atsamv71n19b", + "atsamv71n20b", + "atsamv71n21b", + "atsamv71q19b", + "atsamv71q20b", + "atsamv71q21b", "bit-iter", "cfg-if", "cortex-m", @@ -478,9 +990,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb9c0c76c3c54b6044333d77168a230b24bcf9d1a19c773cd95e8a6aa147750" +checksum = "7cf0f791bf56f483754cb7ef69b88d95a0df7b378ab3324b8a08259a6e7da37e" dependencies = [ "anyhow", "env_logger 0.9.3", @@ -570,6 +1082,15 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +[[package]] +name = "html-escape" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d1ad449764d627e22bfd7cd5e8868264fc9236e07c752972b4080cd351cb476" +dependencies = [ + "utf8-width", +] + [[package]] name = "humantime" version = "2.1.0" @@ -680,9 +1201,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "nb" @@ -699,6 +1220,26 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" +[[package]] +name = "num_enum" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.16", +] + [[package]] name = "once_cell" version = "1.18.0" @@ -727,6 +1268,12 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -771,9 +1318,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.3" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", @@ -783,9 +1330,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", @@ -794,9 +1341,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "roxmltree" @@ -1033,13 +1580,14 @@ dependencies = [ [[package]] name = "svd2rust" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "208592cbbe3726e9cafa9a802b9de2a7e959118fdb8b73ef90309f6b4d9cb86f" +checksum = "fa74088ddea858d2715bf812b0a6347a1340a13e1b91803376967a9dc84602f8" dependencies = [ "anyhow", "clap", "env_logger 0.10.0", + "html-escape", "inflections", "irx-config", "log", @@ -1166,21 +1714,32 @@ checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" [[package]] name = "usb-device" -version = "0.2.9" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" +checksum = "e73e438f527e567fb3982f2370967821fab4f5aea84c42e218a211dd2002b6a2" +dependencies = [ + "heapless", + "num_enum", + "portable-atomic", +] [[package]] name = "usbd-serial" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db75519b86287f12dcf0d171c7cf4ecc839149fe9f3b720ac4cfce52959e1dfe" +checksum = "c73af5da56a26abc61a77a93afe3993e1dd643c73e61b09669bda81068cbb1bf" dependencies = [ "embedded-hal", - "nb 0.1.3", + "nb 1.1.0", "usb-device", ] +[[package]] +name = "utf8-width" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3" + [[package]] name = "utf8parse" version = "0.2.1" diff --git a/boards/atsame70_xpro/Cargo.toml b/boards/atsame70_xpro/Cargo.toml index 45884227..364522a7 100644 --- a/boards/atsame70_xpro/Cargo.toml +++ b/boards/atsame70_xpro/Cargo.toml @@ -13,13 +13,13 @@ cortex-m = "0.7" panic-halt = "0.2" panic-rtt-target = { version = "0.1.2", features = ["cortex-m"] } rtt-target = { version = "0.3.1", features = ["cortex-m"] } -usbd-serial = "0.1.1" +usbd-serial = "0.2.0" heapless = "0.7" [dependencies.atsamx7x-hal] -version = "0.4.3-alpha1" +version = "0.4.3-alpha3" path = "../../hal" -features = ["same70q21b-rt", "unproven"] +features = ["same70q21b", "rt", "unproven"] [profile.dev] debug = true diff --git a/boards/atsame70_xpro/examples/usb_serial_echo.rs b/boards/atsame70_xpro/examples/usb_serial_echo.rs index 631716e5..a345d746 100644 --- a/boards/atsame70_xpro/examples/usb_serial_echo.rs +++ b/boards/atsame70_xpro/examples/usb_serial_echo.rs @@ -55,11 +55,14 @@ mod app { ctx.local.usb_alloc.as_ref().unwrap(), UsbVidPid(0xdead, 0xbeef), ) - .manufacturer("ATSAMx7x HAL Contributors") - .product("Serial port echo") - .serial_number("N/A") + .strings(&[StringDescriptors::new(LangID::EN) + .manufacturer("ATSAMx7x HAL Contributors") + .product("Serial port echo") + .serial_number("N/A")]) + .unwrap() .device_class(USB_CLASS_CDC) .max_packet_size_0(64) // makes control transfers 8x faster + .unwrap() .build(); rprintln!(" done"); diff --git a/boards/atsamv71_xult/Cargo.lock b/boards/atsamv71_xult/Cargo.lock index dd389873..c76a6960 100644 --- a/boards/atsamv71_xult/Cargo.lock +++ b/boards/atsamv71_xult/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "aho-corasick" -version = "0.7.19" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -87,6 +87,366 @@ dependencies = [ "critical-section 0.2.7", ] +[[package]] +name = "atsame70j19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f59b792fc5029f0646d51945594f68601df1a9756253421422672945a8d9943d" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsame70j20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad07c279b3928c99186fd0cc1c9e39cbdb33dbddf5b0e26d3d83dd0486a2e66e" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsame70j21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c0a9865d1a0288c9afc1c5b8120397c99b27ee2b197afdd3bd93a75f8aa9a2c" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsame70n19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5921d155748b89dd1229ad5060bfac5a8edd09e4c6212765f838987877f4a2ee" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsame70n20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e9515be929a88112811d46e5b4a997397e13fd1bc3af32317a2977f1ec2ddd" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsame70n21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f359bd6149c3d7f4fb76d89562b30bd588ad335716cb260ff41ed2e3d203c1" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsame70q19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcbba1aed7a1db050c165a39ebf9e61d7d83cc8f884e3e9527f396920bc24d0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsame70q20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "181b3917fdbdc4650f8bff281a4d3f3b639f365549317d7d52f5b1f9675ccd52" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsame70q21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ec88ab8a5e0336ec6d9c45295fa0c843fe609211753c26a0904a5abaa66d406" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70j19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bd21f78548bce21f946df44dfa5092649394207168eae1322d8564cb47211b" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70j20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a842e106ba4e543cc6befb1f2a5ab43be788679ae549111405715fcf86a86f8" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70j21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b34fc1317a00bf230b98b3431032723d442a402d0a396f271bb7edd498524383" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70n19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a0ba05baf0a7199fd71fb292f6998a720a69c2a732d50b741d4612ae8bff261" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70n20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b96ea1fcf1acc169085b045e642118fd41c4256a9108f0b21209d0ef8c9261c" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70n21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f657ff8db7ceaed8fc68407b0f9a18b547569297cb59bb255048eb766fc70107" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70q19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5327d54bf890efb9a1ba49a6ec959ca04f9f62e071e56e92181f0cac4a6420b7" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70q20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a36082caa069b65f2dc07110c4a0f643f57dcb3849769ebf12c806780d9e33" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsams70q21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4d1ddafb14bdc446ec2abc0a525caa24f344dfa3ee735096de14beae2da0f16" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv70j19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e7a56cfe0ad63e1aa21f7d55470ffb89f7b050027d561c8e6cf40aa3ff84b4" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv70j20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66bdc44e938d3f0897230667e2154aa053d2aefb8ceecb1188a5defc57e3c080" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv70n19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9a2c575f8a47d091682ad503b86fa3ba44d59b4a9d4afce258b28e35942c1f" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv70n20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c967624fd921a2144cb04043b873fb4cabbd9fce5c79ca8cf757d2d7930a01fd" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv70q19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d665f962c2e8b29cc874f4a97f9f9dd6e7512b6a623b8cbfcd4c286c1cd7cb" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv70q20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef1adc1925558fdd6d9a4f678f9165ea4b962abc928648e51ec189c457bf4a0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + [[package]] name = "atsamv71_xult" version = "0.4.3-alpha1" @@ -103,11 +463,131 @@ dependencies = [ "usbd-serial", ] +[[package]] +name = "atsamv71j19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5afdafae5e1d5ad66e50a70ee346058e3ba7cfb72d8eb6f6729dbd7f816694" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71j20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4588b8c979c378b4d0f1eb3d37729a6cee4979652136d49cf4db92ebb60ed591" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71j21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4038a6114b0bb6dd41b9d1feec63dd1e55455019e336f3dc624805251f414c" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71n19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b7efb2028637208bea0d98152c83215e2f8fe8ae0b1af69bbd5c92f5b3b3911" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71n20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb4c881959cce3d8050139ad960ae91431fb9596a79a4a28fe7c3830371c745" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71n21b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ea446ec36857849f81367a01eb362f4cfc6dad8973445029dbaf99bad65bcbe" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71q19b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84deff4deb0b32697422b65d581b0a388ef212c11607c169e1cf04a5ecb3fce" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + +[[package]] +name = "atsamv71q20b" +version = "0.29.0-alpha3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6351ec583cc689b79e27e2cedad9bbe0a308d4064b57cae2ab5176aa9a8f4469" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "derive_more", + "form", + "regex", + "svd2rust", + "vcell", +] + [[package]] name = "atsamv71q21b" -version = "0.29.0-alpha1" +version = "0.29.0-alpha3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a9ae83afc6e088da6a77c63871ab75467bdd242816f2b3262e47f51061622dd" +checksum = "de4dff2ff428ab3913ce5a2f54cbc2357600957f0b11f857d240b61d66f41aff" dependencies = [ "cortex-m", "cortex-m-rt", @@ -120,8 +600,40 @@ dependencies = [ [[package]] name = "atsamx7x-hal" -version = "0.4.3-alpha1" -dependencies = [ +version = "0.4.3-alpha3" +dependencies = [ + "atsame70j19b", + "atsame70j20b", + "atsame70j21b", + "atsame70n19b", + "atsame70n20b", + "atsame70n21b", + "atsame70q19b", + "atsame70q20b", + "atsame70q21b", + "atsams70j19b", + "atsams70j20b", + "atsams70j21b", + "atsams70n19b", + "atsams70n20b", + "atsams70n21b", + "atsams70q19b", + "atsams70q20b", + "atsams70q21b", + "atsamv70j19b", + "atsamv70j20b", + "atsamv70n19b", + "atsamv70n20b", + "atsamv70q19b", + "atsamv70q20b", + "atsamv71j19b", + "atsamv71j20b", + "atsamv71j21b", + "atsamv71n19b", + "atsamv71n20b", + "atsamv71n21b", + "atsamv71q19b", + "atsamv71q20b", "atsamv71q21b", "bit-iter", "cfg-if", @@ -306,7 +818,7 @@ checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.103", ] [[package]] @@ -334,7 +846,7 @@ dependencies = [ "proc-macro2", "quote", "rtic-syntax", - "syn", + "syn 1.0.103", ] [[package]] @@ -376,7 +888,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn", + "syn 1.0.103", ] [[package]] @@ -387,7 +899,7 @@ checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" dependencies = [ "darling_core", "quote", - "syn", + "syn 1.0.103", ] [[package]] @@ -408,7 +920,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn", + "syn 1.0.103", ] [[package]] @@ -418,7 +930,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e" dependencies = [ "derive_builder_core", - "syn", + "syn 1.0.103", ] [[package]] @@ -431,7 +943,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.0", - "syn", + "syn 1.0.103", ] [[package]] @@ -526,9 +1038,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb9c0c76c3c54b6044333d77168a230b24bcf9d1a19c773cd95e8a6aa147750" +checksum = "7cf0f791bf56f483754cb7ef69b88d95a0df7b378ab3324b8a08259a6e7da37e" dependencies = [ "anyhow", "env_logger 0.9.3", @@ -536,7 +1048,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 1.0.103", ] [[package]] @@ -631,6 +1143,15 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +[[package]] +name = "html-escape" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d1ad449764d627e22bfd7cd5e8868264fc9236e07c752972b4080cd351cb476" +dependencies = [ + "utf8-width", +] + [[package]] name = "humantime" version = "2.1.0" @@ -762,9 +1283,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "nb" @@ -781,6 +1302,26 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae" +[[package]] +name = "num_enum" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.42", +] + [[package]] name = "once_cell" version = "1.18.0" @@ -803,6 +1344,12 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -812,7 +1359,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn", + "syn 1.0.103", "version_check", ] @@ -829,27 +1376,39 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.21" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] [[package]] name = "regex" -version = "1.7.0" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", @@ -858,9 +1417,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "riscv" @@ -913,7 +1472,7 @@ dependencies = [ "indexmap 1.9.1", "proc-macro2", "quote", - "syn", + "syn 1.0.103", ] [[package]] @@ -1022,7 +1581,7 @@ checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.103", ] [[package]] @@ -1098,7 +1657,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn", + "syn 1.0.103", ] [[package]] @@ -1127,13 +1686,14 @@ dependencies = [ [[package]] name = "svd2rust" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "208592cbbe3726e9cafa9a802b9de2a7e959118fdb8b73ef90309f6b4d9cb86f" +checksum = "fa74088ddea858d2715bf812b0a6347a1340a13e1b91803376967a9dc84602f8" dependencies = [ "anyhow", "clap", "env_logger 0.10.0", + "html-escape", "inflections", "irx-config", "log", @@ -1145,7 +1705,7 @@ dependencies = [ "serde_yaml", "svd-parser", "svd-rs", - "syn", + "syn 1.0.103", "thiserror", ] @@ -1160,6 +1720,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "termcolor" version = "1.2.0" @@ -1186,7 +1757,7 @@ checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.103", ] [[package]] @@ -1255,21 +1826,32 @@ checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" [[package]] name = "usb-device" -version = "0.2.9" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" +checksum = "e73e438f527e567fb3982f2370967821fab4f5aea84c42e218a211dd2002b6a2" +dependencies = [ + "heapless", + "num_enum", + "portable-atomic", +] [[package]] name = "usbd-serial" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db75519b86287f12dcf0d171c7cf4ecc839149fe9f3b720ac4cfce52959e1dfe" +checksum = "c73af5da56a26abc61a77a93afe3993e1dd643c73e61b09669bda81068cbb1bf" dependencies = [ "embedded-hal", - "nb 0.1.3", + "nb 1.0.0", "usb-device", ] +[[package]] +name = "utf8-width" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3" + [[package]] name = "utf8parse" version = "0.2.1" diff --git a/boards/atsamv71_xult/Cargo.toml b/boards/atsamv71_xult/Cargo.toml index 6d652544..47882b3c 100644 --- a/boards/atsamv71_xult/Cargo.toml +++ b/boards/atsamv71_xult/Cargo.toml @@ -13,7 +13,7 @@ cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } panic-rtt-target = { version = "0.1.2", features = ["cortex-m"] } rtt-target = { version = "0.4.0" } heapless = "0.7" -usbd-serial = "0.1.1" +usbd-serial = "0.2.0" dwt-systick-monotonic = "1.0.0" [dev-dependencies] @@ -21,9 +21,9 @@ mcan = "0.2" typenum = "1" [dependencies.atsamx7x-hal] -version = "0.4.3-alpha1" +version = "0.4.3-alpha3" path = "../../hal" -features = ["samv71q21b-rt", "unproven"] +features = ["samv71q21b", "rt", "unproven"] [profile.dev] debug = true diff --git a/boards/atsamv71_xult/examples/usb_serial_echo.rs b/boards/atsamv71_xult/examples/usb_serial_echo.rs index e926d160..5deed35b 100644 --- a/boards/atsamv71_xult/examples/usb_serial_echo.rs +++ b/boards/atsamv71_xult/examples/usb_serial_echo.rs @@ -55,11 +55,14 @@ mod app { ctx.local.usb_alloc.as_ref().unwrap(), UsbVidPid(0xdead, 0xbeef), ) - .manufacturer("ATSAMx7x HAL Contributors") - .product("Serial port echo") - .serial_number("N/A") + .strings(&[StringDescriptors::new(LangID::EN) + .manufacturer("ATSAMx7x HAL Contributors") + .product("Serial port echo") + .serial_number("N/A")]) + .unwrap() .device_class(USB_CLASS_CDC) .max_packet_size_0(64) // makes control transfers 8x faster + .unwrap() .build(); rprintln!(" done"); diff --git a/hal/Cargo.toml b/hal/Cargo.toml index a6af242c..ef4b91cc 100644 --- a/hal/Cargo.toml +++ b/hal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "atsamx7x-hal" -version = "0.4.3-alpha1" +version = "0.4.3-alpha3" # in no particular order authors = [ "Michal Fita ", @@ -28,182 +28,146 @@ edition = "2021" rust-version = "1.70" [dependencies] -cortex-m = "0.7" +cortex-m = { version = "0.7" } embedded-hal = { version = "0.2.7" } nb = "1" fugit = "0.3.6" paste = "1" -usb-device = "0.2.9" +usb-device = "0.3.1" bit-iter = "1" rtic-monotonic = "1" void = { version = "1", default-features = false } strum = { version = "0.24.1", default-features = false, features = ["derive"]} cfg-if = "1" mcan-core = { version = "0.2", optional = true } -atsame70j19b = { version = "0.29.0-alpha1", optional = true } -atsame70j20b = { version = "0.29.0-alpha1", optional = true } -atsame70j21b = { version = "0.29.0-alpha1", optional = true } -atsame70n19b = { version = "0.29.0-alpha1", optional = true } -atsame70n20b = { version = "0.29.0-alpha1", optional = true } -atsame70n21b = { version = "0.29.0-alpha1", optional = true } -atsame70q19b = { version = "0.29.0-alpha1", optional = true } -atsame70q20b = { version = "0.29.0-alpha1", optional = true } -atsame70q21b = { version = "0.29.0-alpha1", optional = true } -atsams70j19b = { version = "0.29.0-alpha1", optional = true } -atsams70j20b = { version = "0.29.0-alpha1", optional = true } -atsams70j21b = { version = "0.29.0-alpha1", optional = true } -atsams70n19b = { version = "0.29.0-alpha1", optional = true } -atsams70n20b = { version = "0.29.0-alpha1", optional = true } -atsams70n21b = { version = "0.29.0-alpha1", optional = true } -atsams70q19b = { version = "0.29.0-alpha1", optional = true } -atsams70q20b = { version = "0.29.0-alpha1", optional = true } -atsams70q21b = { version = "0.29.0-alpha1", optional = true } -atsamv70j19b = { version = "0.29.0-alpha1", optional = true } -atsamv70j20b = { version = "0.29.0-alpha1", optional = true } -atsamv70n19b = { version = "0.29.0-alpha1", optional = true } -atsamv70n20b = { version = "0.29.0-alpha1", optional = true } -atsamv70q19b = { version = "0.29.0-alpha1", optional = true } -atsamv70q20b = { version = "0.29.0-alpha1", optional = true } -atsamv71j19b = { version = "0.29.0-alpha1", optional = true } -atsamv71j20b = { version = "0.29.0-alpha1", optional = true } -atsamv71j21b = { version = "0.29.0-alpha1", optional = true } -atsamv71n19b = { version = "0.29.0-alpha1", optional = true } -atsamv71n20b = { version = "0.29.0-alpha1", optional = true } -atsamv71n21b = { version = "0.29.0-alpha1", optional = true } -atsamv71q19b = { version = "0.29.0-alpha1", optional = true } -atsamv71q20b = { version = "0.29.0-alpha1", optional = true } -atsamv71q21b = { version = "0.29.0-alpha1", optional = true } - -[patch.crates-io] -atsame70j19b = { path = "../../atsamx7x-pac/pac/atsame70j19b" } -atsame70j20b = { path = "../../atsamx7x-pac/pac/atsame70j20b" } -atsame70j21b = { path = "../../atsamx7x-pac/pac/atsame70j21b" } -atsame70n19b = { path = "../../atsamx7x-pac/pac/atsame70n19b" } -atsame70n20b = { path = "../../atsamx7x-pac/pac/atsame70n20b" } -atsame70n21b = { path = "../../atsamx7x-pac/pac/atsame70n21b" } -atsame70q19b = { path = "../../atsamx7x-pac/pac/atsame70q19b" } -atsame70q20b = { path = "../../atsamx7x-pac/pac/atsame70q20b" } -atsame70q21b = { path = "../../atsamx7x-pac/pac/atsame70q21b" } -atsams70j19b = { path = "../../atsamx7x-pac/pac/atsams70j19b" } -atsams70j20b = { path = "../../atsamx7x-pac/pac/atsams70j20b" } -atsams70j21b = { path = "../../atsamx7x-pac/pac/atsams70j21b" } -atsams70n19b = { path = "../../atsamx7x-pac/pac/atsams70n19b" } -atsams70n20b = { path = "../../atsamx7x-pac/pac/atsams70n20b" } -atsams70n21b = { path = "../../atsamx7x-pac/pac/atsams70n21b" } -atsams70q19b = { path = "../../atsamx7x-pac/pac/atsams70q19b" } -atsams70q20b = { path = "../../atsamx7x-pac/pac/atsams70q20b" } -atsams70q21b = { path = "../../atsamx7x-pac/pac/atsams70q21b" } -atsamv70j19b = { path = "../../atsamx7x-pac/pac/atsamv70j19b" } -atsamv70j20b = { path = "../../atsamx7x-pac/pac/atsamv70j20b" } -atsamv70n19b = { path = "../../atsamx7x-pac/pac/atsamv70n19b" } -atsamv70n20b = { path = "../../atsamx7x-pac/pac/atsamv70n20b" } -atsamv70q19b = { path = "../../atsamx7x-pac/pac/atsamv70q19b" } -atsamv70q20b = { path = "../../atsamx7x-pac/pac/atsamv70q20b" } -atsamv71j19b = { path = "../../atsamx7x-pac/pac/atsamv71j19b" } -atsamv71j20b = { path = "../../atsamx7x-pac/pac/atsamv71j20b" } -atsamv71j21b = { path = "../../atsamx7x-pac/pac/atsamv71j21b" } -atsamv71n19b = { path = "../../atsamx7x-pac/pac/atsamv71n19b" } -atsamv71n20b = { path = "../../atsamx7x-pac/pac/atsamv71n20b" } -atsamv71n21b = { path = "../../atsamx7x-pac/pac/atsamv71n21b" } -atsamv71q19b = { path = "../../atsamx7x-pac/pac/atsamv71q19b" } -atsamv71q20b = { path = "../../atsamx7x-pac/pac/atsamv71q20b" } -atsamv71q21b = { path = "../../atsamx7x-pac/pac/atsamv71q21b" } +atsame70j19b = { version = "0.29.0-alpha3", optional = true } +atsame70j20b = { version = "0.29.0-alpha3", optional = true } +atsame70j21b = { version = "0.29.0-alpha3", optional = true } +atsame70n19b = { version = "0.29.0-alpha3", optional = true } +atsame70n20b = { version = "0.29.0-alpha3", optional = true } +atsame70n21b = { version = "0.29.0-alpha3", optional = true } +atsame70q19b = { version = "0.29.0-alpha3", optional = true } +atsame70q20b = { version = "0.29.0-alpha3", optional = true } +atsame70q21b = { version = "0.29.0-alpha3", optional = true } +atsams70j19b = { version = "0.29.0-alpha3", optional = true } +atsams70j20b = { version = "0.29.0-alpha3", optional = true } +atsams70j21b = { version = "0.29.0-alpha3", optional = true } +atsams70n19b = { version = "0.29.0-alpha3", optional = true } +atsams70n20b = { version = "0.29.0-alpha3", optional = true } +atsams70n21b = { version = "0.29.0-alpha3", optional = true } +atsams70q19b = { version = "0.29.0-alpha3", optional = true } +atsams70q20b = { version = "0.29.0-alpha3", optional = true } +atsams70q21b = { version = "0.29.0-alpha3", optional = true } +atsamv70j19b = { version = "0.29.0-alpha3", optional = true } +atsamv70j20b = { version = "0.29.0-alpha3", optional = true } +atsamv70n19b = { version = "0.29.0-alpha3", optional = true } +atsamv70n20b = { version = "0.29.0-alpha3", optional = true } +atsamv70q19b = { version = "0.29.0-alpha3", optional = true } +atsamv70q20b = { version = "0.29.0-alpha3", optional = true } +atsamv71j19b = { version = "0.29.0-alpha3", optional = true } +atsamv71j20b = { version = "0.29.0-alpha3", optional = true } +atsamv71j21b = { version = "0.29.0-alpha3", optional = true } +atsamv71n19b = { version = "0.29.0-alpha3", optional = true } +atsamv71n20b = { version = "0.29.0-alpha3", optional = true } +atsamv71n21b = { version = "0.29.0-alpha3", optional = true } +atsamv71q19b = { version = "0.29.0-alpha3", optional = true } +atsamv71q20b = { version = "0.29.0-alpha3", optional = true } +atsamv71q21b = { version = "0.29.0-alpha3", optional = true } [features] # Internal-only feature flags; do not set directly. # Refer to §2 in the data sheet. ## Refer to §2. -v71 = ["can"] -v70 = ["can"] -e70 = ["can"] -s70 = [] -pins-64 = [] # J variants -pins-100 = [] # N variants -pins-144 = [] # Q variants -flash-2M = [] # "21"-suffix -flash-1M = [] # "20"-suffix -flash-512K = [] # "19"-suffix -can = ["mcan-core"] - -device-selected = [] +__v71 = ["can"] +__v70 = ["can"] +__e70 = ["can"] +__s70 = [] +__pins-64 = [] # J variants +__pins-100 = [] # N variants +__pins-144 = [] # Q variants +__flash-2M = [] # "21"-suffix +__flash-1M = [] # "20"-suffix +__flash-512K = [] # "19"-suffix +__device-selected = [] +# External feature flags; part of the interface. +can = ["mcan-core"] unproven = ["embedded-hal/unproven"] usart-spi-host-without-select = [] reconfigurable-system-pins = [] -same70j19b = ["atsame70j19b", "e70", "pins-64", "flash-512K", "device-selected"] -same70j19b-rt = ["same70j19b", "atsame70j19b/rt"] -same70j20b = ["atsame70j20b", "e70", "pins-64", "flash-1M", "device-selected"] -same70j20b-rt = ["same70j20b", "atsame70j20b/rt"] -same70j21b = ["atsame70j21b", "e70", "pins-64", "flash-2M", "device-selected"] -same70j21b-rt = ["same70j21b", "atsame70j21b/rt"] -same70n19b = ["atsame70n19b", "e70", "pins-100", "flash-512K", "device-selected"] -same70n19b-rt = ["same70n19b", "atsame70n19b/rt"] -same70n20b = ["atsame70n20b", "e70", "pins-100", "flash-1M", "device-selected"] -same70n20b-rt = ["same70n20b", "atsame70n20b/rt"] -same70n21b = ["atsame70n21b", "e70", "pins-100", "flash-2M", "device-selected"] -same70n21b-rt = ["same70n21b", "atsame70n21b/rt"] -same70q19b = ["atsame70q19b", "e70", "pins-144", "flash-512K", "device-selected"] -same70q19b-rt = ["same70q19b", "atsame70q19b/rt"] -same70q20b = ["atsame70q20b", "e70", "pins-144", "flash-1M", "device-selected"] -same70q20b-rt = ["same70q20b", "atsame70q20b/rt"] -same70q21b = ["atsame70q21b", "e70", "pins-144", "flash-2M", "device-selected"] -same70q21b-rt = ["same70q21b", "atsame70q21b/rt"] +same70j19b = ["atsame70j19b", "__e70", "__pins-64", "__flash-512K", "__device-selected"] +same70j20b = ["atsame70j20b", "__e70", "__pins-64", "__flash-1M", "__device-selected"] +same70j21b = ["atsame70j21b", "__e70", "__pins-64", "__flash-2M", "__device-selected"] +same70n19b = ["atsame70n19b", "__e70", "__pins-100", "__flash-512K", "__device-selected"] +same70n20b = ["atsame70n20b", "__e70", "__pins-100", "__flash-1M", "__device-selected"] +same70n21b = ["atsame70n21b", "__e70", "__pins-100", "__flash-2M", "__device-selected"] +same70q19b = ["atsame70q19b", "__e70", "__pins-144", "__flash-512K", "__device-selected"] +same70q20b = ["atsame70q20b", "__e70", "__pins-144", "__flash-1M", "__device-selected"] +same70q21b = ["atsame70q21b", "__e70", "__pins-144", "__flash-2M", "__device-selected"] + +sams70j19b = ["atsams70j19b", "__s70", "__pins-64", "__flash-512K", "__device-selected"] +sams70j20b = ["atsams70j20b", "__s70", "__pins-64", "__flash-1M", "__device-selected"] +sams70j21b = ["atsams70j21b", "__s70", "__pins-64", "__flash-2M", "__device-selected"] +sams70n19b = ["atsams70n19b", "__s70", "__pins-100", "__flash-512K", "__device-selected"] +sams70n20b = ["atsams70n20b", "__s70", "__pins-100", "__flash-1M", "__device-selected"] +sams70n21b = ["atsams70n21b", "__s70", "__pins-100", "__flash-2M", "__device-selected"] +sams70q19b = ["atsams70q19b", "__s70", "__pins-144", "__flash-512K", "__device-selected"] +sams70q20b = ["atsams70q20b", "__s70", "__pins-144", "__flash-1M", "__device-selected"] +sams70q21b = ["atsams70q21b", "__s70", "__pins-144", "__flash-2M", "__device-selected"] + +samv70j19b = ["atsamv70j19b", "__v70", "__pins-64", "__flash-512K", "__device-selected"] +samv70j20b = ["atsamv70j20b", "__v70", "__pins-64", "__flash-1M", "__device-selected"] +samv70n19b = ["atsamv70n19b", "__v70", "__pins-100", "__flash-512K", "__device-selected"] +samv70n20b = ["atsamv70n20b", "__v70", "__pins-100", "__flash-1M", "__device-selected"] +samv70q19b = ["atsamv70q19b", "__v70", "__pins-144", "__flash-512K", "__device-selected"] +samv70q20b = ["atsamv70q20b", "__v70", "__pins-144", "__flash-1M", "__device-selected"] + +samv71j19b = ["atsamv71j19b", "__v71", "__pins-64", "__flash-512K", "__device-selected"] +samv71j20b = ["atsamv71j20b", "__v71", "__pins-64", "__flash-1M", "__device-selected"] +samv71j21b = ["atsamv71j21b", "__v71", "__pins-64", "__flash-2M", "__device-selected"] +samv71n19b = ["atsamv71n19b", "__v71", "__pins-100", "__flash-512K", "__device-selected"] +samv71n20b = ["atsamv71n20b", "__v71", "__pins-100", "__flash-1M", "__device-selected"] +samv71n21b = ["atsamv71n21b", "__v71", "__pins-100", "__flash-2M", "__device-selected"] +samv71q19b = ["atsamv71q19b", "__v71", "__pins-144", "__flash-512K", "__device-selected"] +samv71q20b = ["atsamv71q20b", "__v71", "__pins-144", "__flash-1M", "__device-selected"] +samv71q21b = ["atsamv71q21b", "__v71", "__pins-144", "__flash-2M", "__device-selected"] -sams70j19b = ["atsams70j19b", "s70", "pins-64", "flash-512K", "device-selected"] -sams70j19b-rt = ["sams70j19b", "atsams70j19b/rt"] -sams70j20b = ["atsams70j20b", "s70", "pins-64", "flash-1M", "device-selected"] -sams70j20b-rt = ["sams70j20b", "atsams70j20b/rt"] -sams70j21b = ["atsams70j21b", "s70", "pins-64", "flash-2M", "device-selected"] -sams70j21b-rt = ["sams70j21b", "atsams70j21b/rt"] -sams70n19b = ["atsams70n19b", "s70", "pins-100", "flash-512K", "device-selected"] -sams70n19b-rt = ["sams70n19b", "atsams70n19b/rt"] -sams70n20b = ["atsams70n20b", "s70", "pins-100", "flash-1M", "device-selected"] -sams70n20b-rt = ["sams70n20b", "atsams70n20b/rt"] -sams70n21b = ["atsams70n21b", "s70", "pins-100", "flash-2M", "device-selected"] -sams70n21b-rt = ["sams70n21b", "atsams70n21b/rt"] -sams70q19b = ["atsams70q19b", "s70", "pins-144", "flash-512K", "device-selected"] -sams70q19b-rt = ["sams70q19b", "atsams70q19b/rt"] -sams70q20b = ["atsams70q20b", "s70", "pins-144", "flash-1M", "device-selected"] -sams70q20b-rt = ["sams70q20b", "atsams70q20b/rt"] -sams70q21b = ["atsams70q21b", "s70", "pins-144", "flash-2M", "device-selected"] -sams70q21b-rt = ["sams70q21b", "atsams70q21b/rt"] +rt = ["atsame70j19b?/rt", "atsame70j20b?/rt", "atsame70j21b?/rt", + "atsame70n19b?/rt", "atsame70n20b?/rt", "atsame70n21b?/rt", + "atsame70q19b?/rt", "atsame70q20b?/rt", "atsame70q21b?/rt", + "atsams70j19b?/rt", "atsams70j20b?/rt", "atsams70j21b?/rt", + "atsams70n19b?/rt", "atsams70n20b?/rt", "atsams70n21b?/rt", + "atsams70q19b?/rt", "atsams70q20b?/rt", "atsams70q21b?/rt", + "atsamv70j19b?/rt", "atsamv70j20b?/rt", "atsamv70n19b?/rt", + "atsamv70n20b?/rt", "atsamv70q19b?/rt", "atsamv70q20b?/rt", + "atsamv71j19b?/rt", "atsamv71j20b?/rt", "atsamv71j21b?/rt", + "atsamv71n19b?/rt", "atsamv71n20b?/rt", "atsamv71n21b?/rt", + "atsamv71q19b?/rt", "atsamv71q20b?/rt", "atsamv71q21b?/rt"] -samv70j19b = ["atsamv70j19b", "v70", "pins-64", "flash-512K", "device-selected"] -samv70j19b-rt = ["samv70j19b", "atsamv70j19b/rt"] -samv70j20b = ["atsamv70j20b", "v70", "pins-64", "flash-1M", "device-selected"] -samv70j20b-rt = ["samv70j20b", "atsamv70j20b/rt"] -samv70n19b = ["atsamv70n19b", "v70", "pins-100", "flash-512K", "device-selected"] -samv70n19b-rt = ["samv70n19b", "atsamv70n19b/rt"] -samv70n20b = ["atsamv70n20b", "v70", "pins-100", "flash-1M", "device-selected"] -samv70n20b-rt = ["samv70n20b", "atsamv70n20b/rt"] -samv70q19b = ["atsamv70q19b", "v70", "pins-144", "flash-512K", "device-selected"] -samv70q19b-rt = ["samv70q19b", "atsamv70q19b/rt"] -samv70q20b = ["atsamv70q20b", "v70", "pins-144", "flash-1M", "device-selected"] -samv70q20b-rt = ["samv70q20b", "atsamv70q20b/rt"] +critical-section = [ + "atsame70j19b?/critical-section", "atsame70j20b?/critical-section", + "atsame70j21b?/critical-section", "atsame70n19b?/critical-section", + "atsame70n20b?/critical-section", "atsame70n21b?/critical-section", + "atsame70q19b?/critical-section", "atsame70q20b?/critical-section", + "atsame70q21b?/critical-section", "atsams70j19b?/critical-section", + "atsams70j20b?/critical-section", "atsams70j21b?/critical-section", + "atsams70n19b?/critical-section", "atsams70n20b?/critical-section", + "atsams70n21b?/critical-section", "atsams70q19b?/critical-section", + "atsams70q20b?/critical-section", "atsams70q21b?/critical-section", + "atsamv70j19b?/critical-section", "atsamv70j20b?/critical-section", + "atsamv70n19b?/critical-section", "atsamv70n20b?/critical-section", + "atsamv70q19b?/critical-section", "atsamv70q20b?/critical-section", + "atsamv71j19b?/critical-section", "atsamv71j20b?/critical-section", + "atsamv71j21b?/critical-section", "atsamv71n19b?/critical-section", + "atsamv71n20b?/critical-section", "atsamv71n21b?/critical-section", + "atsamv71q19b?/critical-section", "atsamv71q20b?/critical-section", + "atsamv71q21b?/critical-section"] -samv71j19b = ["atsamv71j19b", "v71", "pins-64", "flash-512K", "device-selected"] -samv71j19b-rt = ["samv71j19b", "atsamv71j19b/rt"] -samv71j20b = ["atsamv71j20b", "v71", "pins-64", "flash-1M", "device-selected"] -samv71j20b-rt = ["samv71j20b", "atsamv71j20b/rt"] -samv71j21b = ["atsamv71j21b", "v71", "pins-64", "flash-2M", "device-selected"] -samv71j21b-rt = ["samv71j21b", "atsamv71j21b/rt"] -samv71n19b = ["atsamv71n19b", "v71", "pins-100", "flash-512K", "device-selected"] -samv71n19b-rt = ["samv71n19b", "atsamv71n19b/rt"] -samv71n20b = ["atsamv71n20b", "v71", "pins-100", "flash-1M", "device-selected"] -samv71n20b-rt = ["samv71n20b", "atsamv71n20b/rt"] -samv71n21b = ["atsamv71n21b", "v71", "pins-100", "flash-2M", "device-selected"] -samv71n21b-rt = ["samv71n21b", "atsamv71n21b/rt"] -samv71q19b = ["atsamv71q19b", "v71", "pins-144", "flash-512K", "device-selected"] -samv71q19b-rt = ["samv71q19b", "atsamv71q19b/rt"] -samv71q20b = ["atsamv71q20b", "v71", "pins-144", "flash-1M", "device-selected"] -samv71q20b-rt = ["samv71q20b", "atsamv71q20b/rt"] -samv71q21b = ["atsamv71q21b", "v71", "pins-144", "flash-2M", "device-selected"] -samv71q21b-rt = ["samv71q21b", "atsamv71q21b/rt"] [package.metadata.docs.rs] # docs.rs build target default-target = "thumbv7em-none-eabihf" # enable features to get maximum doc coverage -features = ["samv71q21b-rt", "unproven", "usart-spi-host-without-select", "reconfigurable-system-pins"] +features = ["samv71q21b", "rt", "unproven", "usart-spi-host-without-select", "reconfigurable-system-pins"] diff --git a/hal/build.rs b/hal/build.rs index a0428af9..a47ab0b7 100644 --- a/hal/build.rs +++ b/hal/build.rs @@ -11,7 +11,11 @@ fn main() -> Result<(), &'static str> { .is_ok() } - if !feat("device-selected") || ["e70", "s70", "v70", "v71"].iter().all(|&f| !feat(f)) { + if !feat("__device-selected") + || ["__e70", "__s70", "__v70", "__v71"] + .iter() + .all(|&f| !feat(f)) + { return Err( "The HAL is built for a specific target device selected using a feature, but no such a feature was selected." ); diff --git a/hal/src/afec.rs b/hal/src/afec.rs index cd398f88..f33d599f 100644 --- a/hal/src/afec.rs +++ b/hal/src/afec.rs @@ -20,7 +20,7 @@ This implementation presumes that VREFP is 3.3V. # use hal::efc::*; # use hal::afec::*; # use hal::fugit::RateExtU32; -# let pac = unsafe{ hal::pac::Peripherals::steal() }; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); let banka = BankA::new(pac.PIOA, &mut mck, &slck, BankConfiguration::default()); @@ -76,49 +76,49 @@ impl_channel_pins!( Afec0 { // Channel 11 is dedicated to the temperature sensor. - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA17, 6), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA18, 7), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA19, 8), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA20, 9), (PA21, 1), (PB0, 10), (PB2, 5), (PB3, 2), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PD30, 0), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PE4, 4), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PE5, 3), } Afec1 { (PB1, 0), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PC0, 9), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PC12, 3), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PC13, 1), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PC15, 2), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PC26, 7), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PC27, 8), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PC29, 4), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PC30, 5), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PC31, 6), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PE0, 11), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PE3, 10), } ); diff --git a/hal/src/can.rs b/hal/src/can.rs index 8df8a4fe..ad244ebd 100644 --- a/hal/src/can.rs +++ b/hal/src/can.rs @@ -54,10 +54,10 @@ unsafe impl mcan_core::CanId for Can0 { } /// Identity type for `MCAN1` -#[cfg(any(feature = "pins-100", feature = "pins-144"))] +#[cfg(any(feature = "__pins-100", feature = "__pins-144"))] pub enum Can1 {} -#[cfg(any(feature = "pins-100", feature = "pins-144"))] +#[cfg(any(feature = "__pins-100", feature = "__pins-144"))] impl CanMeta for Can1 { const PID: PeripheralIdentifier = PeripheralIdentifier::MCAN1; type REG = crate::pac::MCAN1; @@ -66,10 +66,10 @@ impl CanMeta for Can1 { } } -#[cfg(any(feature = "pins-100", feature = "pins-144"))] +#[cfg(any(feature = "__pins-100", feature = "__pins-144"))] impl generics::Sealed for Can1 {} -#[cfg(any(feature = "pins-100", feature = "pins-144"))] +#[cfg(any(feature = "__pins-100", feature = "__pins-144"))] unsafe impl mcan_core::CanId for Can1 { const ADDRESS: *const () = ::REG::PTR as _; } @@ -159,22 +159,22 @@ impl TxPin for Pin { type ValidFor = Can0; } -#[cfg(feature = "pins-144")] +#[cfg(feature = "__pins-144")] impl RxPin for Pin { type ValidFor = Can1; } -#[cfg(feature = "pins-100")] +#[cfg(feature = "__pins-100")] impl RxPin for Pin { type ValidFor = Can1; } -#[cfg(feature = "pins-144")] +#[cfg(feature = "__pins-144")] impl TxPin for Pin { type ValidFor = Can1; } -#[cfg(any(feature = "pins-100", feature = "pins-144"))] +#[cfg(any(feature = "__pins-100", feature = "__pins-144"))] impl TxPin for Pin { type ValidFor = Can1; } diff --git a/hal/src/clocks/mod.rs b/hal/src/clocks/mod.rs index ea9f8004..3f8f2ee8 100644 --- a/hal/src/clocks/mod.rs +++ b/hal/src/clocks/mod.rs @@ -28,7 +28,7 @@ For example, if we want to configure the [`MainClock`]: use atsamx7x_hal as hal; use hal::fugit::RateExtU32; -let pac = unsafe{hal::pac::Peripherals::steal()}; +let pac = hal::pac::Peripherals::take().unwrap(); let clocks = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()); let mainck = clocks .mainck @@ -72,7 +72,7 @@ use hal::efc::{Efc, VddioLevel}; use hal::fugit::RateExtU32; // configure the clock hierarchy -let pac = unsafe{hal::pac::Peripherals::steal()}; +let pac = hal::pac::Peripherals::take().unwrap(); let clocks = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()); let slck = clocks.slck.configure_external_normal(); let mainck = clocks @@ -238,7 +238,7 @@ pub enum ClockError { InvalidHccFreq(Megahertz), /// The V70/V71 must be driven with VDDIO = 3.3V, typical. - #[cfg(any(feature = "v70", feature = "v71"))] + #[cfg(any(feature = "__v70", feature = "__v71"))] InvalidVddioLevel, } diff --git a/hal/src/efc.rs b/hal/src/efc.rs index 74341cd4..245000b0 100644 --- a/hal/src/efc.rs +++ b/hal/src/efc.rs @@ -66,7 +66,7 @@ enum FlashWaitStates { impl FlashWaitStates { pub fn calculate(freq: Megahertz, vddio: &VddioLevel) -> Result { - #[cfg(any(feature = "v70", feature = "v71"))] + #[cfg(any(feature = "__v70", feature = "__v71"))] if vddio == &VddioLevel::V1 { // V70/V71 must be driven with VDDIO = 3.3V, typical return Err(ClockError::InvalidVddioLevel); diff --git a/hal/src/lib.rs b/hal/src/lib.rs index 5c8a9be0..13c837d3 100644 --- a/hal/src/lib.rs +++ b/hal/src/lib.rs @@ -171,27 +171,27 @@ pub use atsamv71q21 as pac; #[cfg(feature = "samv71q21b")] pub use atsamv71q21b as pac; -#[cfg(feature = "device-selected")] +#[cfg(feature = "__device-selected")] pub mod afec; -#[cfg(all(feature = "device-selected", feature = "can"))] +#[cfg(all(feature = "__device-selected", feature = "can"))] pub mod can; -#[cfg(feature = "device-selected")] +#[cfg(feature = "__device-selected")] pub mod clocks; -#[cfg(feature = "device-selected")] +#[cfg(feature = "__device-selected")] pub mod efc; -#[cfg(feature = "device-selected")] +#[cfg(feature = "__device-selected")] pub mod generics; -#[cfg(feature = "device-selected")] +#[cfg(feature = "__device-selected")] pub mod pio; -#[cfg(feature = "device-selected")] +#[cfg(feature = "__device-selected")] pub mod pwm; -#[cfg(feature = "device-selected")] +#[cfg(feature = "__device-selected")] pub mod rtt; -#[cfg(feature = "device-selected")] +#[cfg(feature = "__device-selected")] pub mod serial; -#[cfg(feature = "device-selected")] +#[cfg(feature = "__device-selected")] pub mod tc; -#[cfg(feature = "device-selected")] +#[cfg(feature = "__device-selected")] pub mod usb; -#[cfg(feature = "device-selected")] +#[cfg(feature = "__device-selected")] pub mod watchdog; diff --git a/hal/src/pio/bank.rs b/hal/src/pio/bank.rs index e79e76f3..27cb34d6 100644 --- a/hal/src/pio/bank.rs +++ b/hal/src/pio/bank.rs @@ -42,7 +42,7 @@ impl BankInterrupts { /// # use hal::pio::*; /// # use hal::clocks::*; /// # use hal::efc::*; - /// # let pac = unsafe{hal::pac::Peripherals::steal()}; + /// # let pac = hal::pac::Peripherals::take().unwrap(); /// # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); /// let mut banka = BankA::new(pac.PIOA, &mut mck, &slck, BankConfiguration::default()); /// for pin in banka.interrupts.iter() { @@ -315,16 +315,16 @@ macro_rules! banks { banks!( A { - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA0, 0), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA1, 1), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA2, 2), (PA3, 3), (PA4, 4), (PA5, 5), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PA6, 6), (PA7, 7), (PA8, 8), @@ -334,35 +334,35 @@ banks!( (PA12, 12), (PA13, 13), (PA14, 14), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA15, 15), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA16, 16), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA17, 17), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA18, 18), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA19, 19), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA20, 20), (PA21, 21), (PA22, 22), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA23, 23), (PA24, 24), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA25, 25), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA26, 26), (PA27, 27), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA28, 28), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PA29, 29), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA30, 30), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PA31, 31), } @@ -383,11 +383,11 @@ banks!( (PB9, 9), #[cfg(feature = "reconfigurable-system-pins")] (PB12, 12), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PB13, 13), } - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] C { (PC0, 0), (PC1, 1), @@ -437,41 +437,41 @@ banks!( (PD10, 10), (PD11, 11), (PD12, 12), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PD13, 13), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PD14, 14), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PD15, 15), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PD16, 16), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PD17, 17), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PD18, 18), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PD19, 19), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PD20, 20), (PD21, 21), (PD22, 22), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PD23, 23), (PD24, 24), (PD25, 25), (PD26, 26), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PD27, 27), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PD28, 28), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] (PD29, 29), - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] (PD30, 30), (PD31, 31), } - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] E { (PE0, 0), (PE1, 1), diff --git a/hal/src/pio/dynpin.rs b/hal/src/pio/dynpin.rs index d0d1774f..84489dc1 100644 --- a/hal/src/pio/dynpin.rs +++ b/hal/src/pio/dynpin.rs @@ -86,10 +86,10 @@ pub enum DynPinMode { pub enum DynBank { A, B, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] C, D, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] E, } @@ -98,10 +98,10 @@ impl DynBank { match self { Self::A => PIOA::ptr(), Self::B => PIOB::ptr(), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Self::C => PIOC::ptr(), Self::D => PIOD::ptr(), - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Self::E => PIOE::ptr(), } } diff --git a/hal/src/pio/mod.rs b/hal/src/pio/mod.rs index 48ea302c..d50b5ea8 100644 --- a/hal/src/pio/mod.rs +++ b/hal/src/pio/mod.rs @@ -86,7 +86,7 @@ The below example configures [`Pin`] to trigger on # use hal::pio::*; # use hal::clocks::*; # use hal::efc::*; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); let banka = BankA::new( @@ -129,7 +129,7 @@ use crate::pac::{ PIOB, PIOD, }; -#[cfg(feature = "pins-144")] +#[cfg(feature = "__pins-144")] use crate::pac::{PIOC, PIOE}; pub mod pin; diff --git a/hal/src/pwm.rs b/hal/src/pwm.rs index 89073111..8d280b67 100644 --- a/hal/src/pwm.rs +++ b/hal/src/pwm.rs @@ -17,7 +17,7 @@ Refer to §51 for a full description of the PWM peripheral. # use hal::efc::*; # use hal::pwm::*; # use hal::fugit::RateExtU32; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); use hal::ehal::PwmPin; @@ -441,23 +441,23 @@ impl_pwm!( Ch0: { // PWMC0_PWMH0 H: [ - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin, Pin, - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin, Pin, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Pin, Pin, - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin, ], // PWMC0_PWML0 L: [ - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin, - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin, #[cfg(feature = "reconfigurable-system-pins")] Pin, @@ -476,7 +476,7 @@ impl_pwm!( Ch1: { // PWMC0_PWMH1 H: [ - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin, Pin, Pin, @@ -485,15 +485,15 @@ impl_pwm!( ], // PWMC0_PWML1 L: [ - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin, - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin, #[cfg(feature = "reconfigurable-system-pins")] Pin, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Pin, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Pin, Pin, ], @@ -510,22 +510,22 @@ impl_pwm!( // PWMC0_PWMH2 H: [ Pin, - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin, #[cfg(feature = "reconfigurable-system-pins")] Pin, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Pin, Pin, ], // PWMC0_PWML2 L: [ - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin, Pin, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Pin, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Pin, Pin, ], @@ -541,26 +541,26 @@ impl_pwm!( H: [ Pin, Pin, - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Pin, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Pin, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Pin, ], // PWMC0_PWML3 L: [ - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Pin, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Pin, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Pin, - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin, ], // PWMC0_PWMEXTRG3 @@ -614,13 +614,13 @@ impl_pwm!( Ch2: { // PWMC1_PWMH2 H: [ - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin, Pin, ], // PWMC1_PWML2 L: [ - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin, Pin, ], diff --git a/hal/src/rtt.rs b/hal/src/rtt.rs index 906d4bed..d738ca59 100644 --- a/hal/src/rtt.rs +++ b/hal/src/rtt.rs @@ -23,7 +23,7 @@ via [`Rtt::new_8192Hz`]. # use hal::rtt::*; # use hal::fugit::RateExtU32; # use rtic_monotonic::*; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); let mono: Mono<100> = Rtt::new(pac.RTT, &slck, 100.Hz()).unwrap().into_monotonic(); @@ -37,7 +37,7 @@ or # use hal::rtt::*; # use hal::fugit::RateExtU32; # use rtic_monotonic::Monotonic; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); use hal::ehal::{blocking::delay::DelayMs, timer::{CountDown, Cancel}}; @@ -83,7 +83,7 @@ pub enum RttError { /// # use hal::efc::*; /// # use hal::rtt::*; /// # use hal::fugit::RateExtU32; - /// # let pac = unsafe{hal::pac::Peripherals::steal()}; + /// # let pac = hal::pac::Peripherals::take().unwrap(); /// # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); /// let rtt: Rtt<100> = Rtt::new(pac.RTT, &slck, 100.Hz()).unwrap(); /// ``` diff --git a/hal/src/serial/mod.rs b/hal/src/serial/mod.rs index 653a6418..e6537acb 100644 --- a/hal/src/serial/mod.rs +++ b/hal/src/serial/mod.rs @@ -26,5 +26,5 @@ pub mod usart; pub mod twi; pub use twi::*; -#[cfg(not(feature = "pins-64"))] +#[cfg(not(feature = "__pins-64"))] pub mod spi; diff --git a/hal/src/serial/spi.rs b/hal/src/serial/spi.rs index 5ffcb784..cde2c683 100644 --- a/hal/src/serial/spi.rs +++ b/hal/src/serial/spi.rs @@ -23,7 +23,7 @@ Interrupt event management is handled by the [`event system`](crate::generics::e # use hal::serial::spi::*; # use hal::serial::ExtBpsU32; # use hal::fugit::ExtU32; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); let bankd = BankD::new(pac.PIOD, &mut mck, &slck, BankConfiguration::default()); @@ -63,7 +63,7 @@ use super::Bps; use crate::clocks::{Clock, HostClock, PeripheralIdentifier}; use crate::ehal::blocking; use crate::fugit::{ExtU32, NanosDurationU32 as NanosDuration}; -#[cfg(feature = "pins-144")] +#[cfg(feature = "__pins-144")] use crate::pac::SPI1; use crate::pac::{spi0::tdr::PCSSELECT_AW as HwChipSelect, spi0::RegisterBlock, SPI0}; use crate::{ehal, nb}; @@ -578,7 +578,7 @@ impl_spi!( ], }, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Spi1: { MISO: [ Pin ], MOSI: [ Pin ], diff --git a/hal/src/serial/twi.rs b/hal/src/serial/twi.rs index 678b9af9..4c548282 100644 --- a/hal/src/serial/twi.rs +++ b/hal/src/serial/twi.rs @@ -20,7 +20,7 @@ implemented. # use hal::efc::*; # use hal::serial::twi::*; # use hal::fugit::RateExtU32; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); let banka = BankA::new(pac.PIOA, &mut mck, &slck, BankConfiguration::default()); @@ -47,7 +47,7 @@ use crate::ehal::blocking; use crate::generics; #[cfg(feature = "reconfigurable-system-pins")] use crate::pac::TWIHS1; -#[cfg(not(feature = "pins-64"))] +#[cfg(not(feature = "__pins-64"))] use crate::pac::TWIHS2; use crate::pac::{ twihs0::{sr::R as StatusRegister, RegisterBlock}, @@ -301,7 +301,7 @@ impl_twi!( DATA: Pin, CLOCK: Pin, }, - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] TwiHS2: { DATA: Pin, CLOCK: Pin, diff --git a/hal/src/serial/uart.rs b/hal/src/serial/uart.rs index ef233d99..75030924 100644 --- a/hal/src/serial/uart.rs +++ b/hal/src/serial/uart.rs @@ -26,7 +26,7 @@ Interrupt event management is handled by the [`event system`](crate::generics::e # use hal::serial::uart::*; # use hal::serial::ExtBpsU32; # use hal::fugit::{ExtU32, RateExtU32}; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); let clocks = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()); let slck = clocks.slck.configure_external_normal(); let mainck = clocks @@ -72,8 +72,8 @@ use crate::fugit::HertzU32 as Hertz; use crate::pac::uart0::mr::{CHMODESELECT_A as ChannelModeInner, PARSELECT_A as ParityModeInner}; use crate::pac::{uart0::RegisterBlock, UART0, UART1, UART2}; #[cfg(all( - any(feature = "e70", feature = "s70", feature = "v71"), - any(feature = "pins-100", feature = "pins-144") + any(feature = "__e70", feature = "__s70", feature = "__v71"), + any(feature = "__pins-100", feature = "__pins-144") ))] use crate::pac::{UART3, UART4}; use crate::serial::Bps; @@ -511,7 +511,7 @@ impl_uart!( RX: [ Pin ], TX: [ Pin, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] Pin, Pin, ], @@ -521,16 +521,16 @@ impl_uart!( TX: [ Pin, ], }, #[cfg(all( - any(feature = "e70", feature = "s70", feature = "v71"), - any(feature = "pins-100", feature = "pins-144") + any(feature = "__e70", feature = "__s70", feature = "__v71"), + any(feature = "__pins-100", feature = "__pins-144") ))] Uart3: { RX: [ Pin ], TX: [ Pin, Pin, ], }, #[cfg(all( - any(feature = "e70", feature = "s70", feature = "v71"), - any(feature = "pins-100", feature = "pins-144") + any(feature = "__e70", feature = "__s70", feature = "__v71"), + any(feature = "__pins-100", feature = "__pins-144") ))] Uart4: { RX: [ Pin ], diff --git a/hal/src/serial/usart/mod.rs b/hal/src/serial/usart/mod.rs index ab2ba6ac..0215814a 100644 --- a/hal/src/serial/usart/mod.rs +++ b/hal/src/serial/usart/mod.rs @@ -32,7 +32,7 @@ Mode support depends on what [`Pin`]s that are available for the # use hal::serial::usart::*; # use hal::serial::ExtBpsU32; # use hal::fugit::{ExtU32, RateExtU32}; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); use hal::generics::events::EventHandler; use hal::ehal::serial::{Read, Write}; @@ -89,7 +89,7 @@ use crate::clocks::{Clock, Hertz, HostClock, Pck, Pck4, PeripheralIdentifier}; use crate::generics::{self, Token}; #[cfg(feature = "reconfigurable-system-pins")] use crate::pac::USART1; -#[cfg(not(feature = "pins-64"))] +#[cfg(not(feature = "__pins-64"))] use crate::pac::USART2; use crate::pac::{ usart0::us_mr_usart_mode::CHMODESELECT_A as HwChannelMode, @@ -617,7 +617,7 @@ The [pins]("[<$Usart Pins>]") specified determine what [`UsartMode`]s are valid impl_usart!( Usart0: { SCK: [ - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin ], RX: [ Pin ], @@ -634,7 +634,7 @@ impl_usart!( #[cfg(feature = "reconfigurable-system-pins")] Usart1: { SCK: [ - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin ], RX: [ Pin ], @@ -646,12 +646,12 @@ impl_usart!( // DCD: [ Pin ], // DTR: [ Pin ], CTS: [ - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Pin ], RTS: [ Pin ], }, - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] Usart2: { SCK: [ Pin ], RX: [ Pin ], @@ -668,7 +668,7 @@ impl_usart!( ); cfg_if::cfg_if! { - if #[cfg(all(feature = "usart-spi-host-without-select", not(feature = "pins-64")))] { + if #[cfg(all(feature = "usart-spi-host-without-select", not(feature = "__pins-64")))] { impl_pins!( Usart0: { (/* TX */ Pin, /* RX */ Pin, /* SCK */ Pin): { diff --git a/hal/src/tc/mod.rs b/hal/src/tc/mod.rs index b5581761..57f1d3b2 100644 --- a/hal/src/tc/mod.rs +++ b/hal/src/tc/mod.rs @@ -22,7 +22,7 @@ Refer to §50 for a full description on the capabilities offered by a [`Tc`]. # use hal::efc::*; # use hal::tc::*; # use hal::fugit::ExtU32; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); let banka = hal::pio::BankA::new( pac.PIOA, @@ -54,7 +54,7 @@ counter.sample_freq(100.millis()); # use hal::clocks::*; # use hal::efc::*; # use hal::tc::*; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); let tc = Tc::new_tc0(pac.TC0, &mut mck); let driver = tc @@ -80,7 +80,7 @@ let mono: Monotonic> # use hal::clocks::*; # use hal::efc::*; # use hal::tc::*; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); let tc = Tc::new_tc0(pac.TC0, &mut mck); let driver = tc @@ -410,7 +410,7 @@ pub enum TcError { /// # use hal::clocks::*; /// # use hal::efc::*; /// # use hal::tc::*; - /// # let pac = unsafe{hal::pac::Peripherals::steal()}; + /// # let pac = hal::pac::Peripherals::take().unwrap(); /// # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); /// let tc = Tc::new_tc0(pac.TC0, &mut mck); /// let ch = tc.channel_0.generate::<15_000_000>(&mck).unwrap(); @@ -705,127 +705,127 @@ impl_tc!( Tc0: { Ch0: { // TIOA0 - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] TIOA: Pin, // TIOB0 - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] TIOB: Pin, // TCLK0 TCLK: Pin, }, Ch1: { // TIOA1 - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] TIOA: Pin, // TIOB1 - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] TIOB: Pin, // TCLK1 - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] TCLK: Pin, }, Ch2: { // TIOA2 - #[cfg(not(feature = "pins-64"))] + #[cfg(not(feature = "__pins-64"))] TIOA: Pin, // TIOB2 TIOB: Pin, // TCLK2 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TCLK: Pin, }, }, Tc1: { Ch0: { // TIOA3 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TIOA: Pin, // TIOB3 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TIOB: Pin, // TCLK3 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TCLK: Pin, }, Ch1: { // TIOA4 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TIOA: Pin, // TIOB4 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TIOB: Pin, // TCLK4 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TCLK: Pin, }, Ch2: { // TIOA5 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TIOA: Pin, // TIOB5 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TIOB: Pin, // TCLK5 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TCLK: Pin, }, }, Tc2: { Ch0: { // TIOA6 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TIOA: Pin, // TIOB6 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TIOB: Pin, // TCLK6 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TCLK: Pin, }, Ch1: { // TIOA7 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TIOA: Pin, // TIOB7 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TIOB: Pin, // TCLK7 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TCLK: Pin, }, Ch2: { // TIOA8 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TIOA: Pin, - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] // TIOB8 TIOB: Pin, // TCLK8 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TCLK: Pin, }, }, Tc3: { Ch0: { // TIOA9 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TIOA: Pin, // TIOB9 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TIOB: Pin, // TCLK9 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TCLK: Pin, }, Ch1: { // TIOA10 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TIOA: Pin, // TIOB10 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TIOB: Pin, // TCLK10 - #[cfg(feature = "pins-144")] + #[cfg(feature = "__pins-144")] TCLK: Pin, }, Ch2: { diff --git a/hal/src/usb.rs b/hal/src/usb.rs index da549ee1..8d4e8ded 100644 --- a/hal/src/usb.rs +++ b/hal/src/usb.rs @@ -16,7 +16,7 @@ extensively tested, and should be considered unstable at the moment. # use hal::efc::*; # use hal::usb::*; # use hal::fugit::RateExtU32; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let clocks = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()); # let slck = clocks.slck.configure_external_normal(); # let mainck = clocks @@ -46,10 +46,13 @@ use usb_device::prelude::*; let usb_alloc = Usb::new(pac.USBHS, &mut mck, &upllck).into_usb_allocator(); let mut usb_dev = UsbDeviceBuilder::new(&usb_alloc, UsbVidPid(0x16c0, 0x27dd)) - .manufacturer("Fake company") - .product("Serial port") - .serial_number("TEST") + .strings(&[StringDescriptors::new(LangID::EN) + .manufacturer("Fake company") + .product("Serial port") + .serial_number("TEST")]) + .unwrap() .max_packet_size_0(64) // makes control transfers 8x faster + .unwrap() .build(); loop { @@ -64,6 +67,8 @@ use crate::clocks::{HostClock, PeripheralIdentifier, UpllClock}; use crate::pac::{usbhs::RegisterBlock, USBHS}; use core::cell::UnsafeCell; +use core::option::Option; +use core::result::Result::{Err, Ok}; use cortex_m::interrupt::{self, Mutex}; use usb_device::bus::{PollResult, UsbBusAllocator}; @@ -258,7 +263,7 @@ impl Inner { // single-bank endpoint w.epbk()._1_bank(); - w.eptype().bits(conf.ep_type as u8); + w.eptype().bits(conf.ep_type.to_bm_attributes()); w.alloc().set_bit(); w diff --git a/hal/src/watchdog.rs b/hal/src/watchdog.rs index bc52c68f..1b999ec5 100644 --- a/hal/src/watchdog.rs +++ b/hal/src/watchdog.rs @@ -1,6 +1,7 @@ //! Watchdog timer configuration. use crate::{generics, pac::WDT}; +use core::convert::From; use core::marker::PhantomData; /// The state of the [`Watchdog`]. diff --git a/tools/patch-pacs b/tools/patch-pacs new file mode 100755 index 00000000..6f760cef --- /dev/null +++ b/tools/patch-pacs @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +set -euo pipefail + +declare -r REPO=$(git rev-parse --show-toplevel) +declare -r CARGO_CONFIG="${REPO}/.cargo/config" + +if grep -q "\[patch.crates-io\]" "${CARGO_CONFIG}" ; then + echo "Error: The [patch] section is already in \`${CARGO_CONFIG}\`" >&2 + exit 1 +fi + +cat <> ${CARGO_CONFIG} + +[patch.crates-io] +atsame70j19b = { path = "../../atsamx7x-pac/pac/atsame70j19b" } +atsame70j20b = { path = "../../atsamx7x-pac/pac/atsame70j20b" } +atsame70j21b = { path = "../../atsamx7x-pac/pac/atsame70j21b" } +atsame70n19b = { path = "../../atsamx7x-pac/pac/atsame70n19b" } +atsame70n20b = { path = "../../atsamx7x-pac/pac/atsame70n20b" } +atsame70n21b = { path = "../../atsamx7x-pac/pac/atsame70n21b" } +atsame70q19b = { path = "../../atsamx7x-pac/pac/atsame70q19b" } +atsame70q20b = { path = "../../atsamx7x-pac/pac/atsame70q20b" } +atsame70q21b = { path = "../../atsamx7x-pac/pac/atsame70q21b" } +atsams70j19b = { path = "../../atsamx7x-pac/pac/atsams70j19b" } +atsams70j20b = { path = "../../atsamx7x-pac/pac/atsams70j20b" } +atsams70j21b = { path = "../../atsamx7x-pac/pac/atsams70j21b" } +atsams70n19b = { path = "../../atsamx7x-pac/pac/atsams70n19b" } +atsams70n20b = { path = "../../atsamx7x-pac/pac/atsams70n20b" } +atsams70n21b = { path = "../../atsamx7x-pac/pac/atsams70n21b" } +atsams70q19b = { path = "../../atsamx7x-pac/pac/atsams70q19b" } +atsams70q20b = { path = "../../atsamx7x-pac/pac/atsams70q20b" } +atsams70q21b = { path = "../../atsamx7x-pac/pac/atsams70q21b" } +atsamv70j19b = { path = "../../atsamx7x-pac/pac/atsamv70j19b" } +atsamv70j20b = { path = "../../atsamx7x-pac/pac/atsamv70j20b" } +atsamv70n19b = { path = "../../atsamx7x-pac/pac/atsamv70n19b" } +atsamv70n20b = { path = "../../atsamx7x-pac/pac/atsamv70n20b" } +atsamv70q19b = { path = "../../atsamx7x-pac/pac/atsamv70q19b" } +atsamv70q20b = { path = "../../atsamx7x-pac/pac/atsamv70q20b" } +atsamv71j19b = { path = "../../atsamx7x-pac/pac/atsamv71j19b" } +atsamv71j20b = { path = "../../atsamx7x-pac/pac/atsamv71j20b" } +atsamv71j21b = { path = "../../atsamx7x-pac/pac/atsamv71j21b" } +atsamv71n19b = { path = "../../atsamx7x-pac/pac/atsamv71n19b" } +atsamv71n20b = { path = "../../atsamx7x-pac/pac/atsamv71n20b" } +atsamv71n21b = { path = "../../atsamx7x-pac/pac/atsamv71n21b" } +atsamv71q19b = { path = "../../atsamx7x-pac/pac/atsamv71q19b" } +atsamv71q20b = { path = "../../atsamx7x-pac/pac/atsamv71q20b" } +atsamv71q21b = { path = "../../atsamx7x-pac/pac/atsamv71q21b" } +EOF + +echo "Development patching added to \`${CARGO_CONFIG}\`."