diff --git a/.github/workflows/build esp.yml b/.github/workflows/build esp.yml deleted file mode 100644 index e34ebc4fd..000000000 --- a/.github/workflows/build esp.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Build ESP examples - -on: - push: - branches: ["main"] - paths: ["examples/**", "rmk/**", "rmk-macro/**"] - pull_request: - branches: ["main"] - paths: ["examples/**", "rmk/**", "rmk-macro/**"] - workflow_dispatch: - -# Cancel any currently running workflows from the same PR, branch, or -# tag when a new workflow is triggered. -# -# https://stackoverflow.com/a/66336834 -concurrency: - cancel-in-progress: true - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - -env: - CARGO_TERM_COLOR: always - -jobs: - build_esp: - runs-on: ubuntu-22.04 - strategy: - matrix: - chip: - - esp32c3 - - esp32c6 - - esp32s3 - example_type: - - use_rust - - use_config - steps: - - uses: cargo-bins/cargo-binstall@main - - uses: actions/checkout@v3 - - name: Install ldproxy and espup - run: cargo binstall ldproxy espup -y - - name: Install esp toolchain - run: espup install - - name: Build - working-directory: ./examples/${{ matrix.example_type }}/${{ matrix.chip }}_ble - run: cargo +esp build --release diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 79a3d3cfe..07e8c8917 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ env: CARGO_TERM_COLOR: always jobs: - build_examples: + build-examples: runs-on: ubuntu-latest strategy: matrix: @@ -35,6 +35,8 @@ jobs: - stm32f1 - stm32f4 - stm32h7 + - esp32c3_ble + - esp32c6_ble example_type: - use_rust - use_config @@ -47,13 +49,33 @@ jobs: - name: Install cargo-make and flip-link run: cargo binstall cargo-make flip-link - name: Install target - run: rustup target add thumbv6m-none-eabi thumbv7em-none-eabihf thumbv7m-none-eabi + run: rustup target add thumbv6m-none-eabi thumbv7em-none-eabihf thumbv7m-none-eabi riscv32imac-unknown-none-elf riscv32imc-unknown-none-elf - name: Build example working-directory: ./examples/${{ matrix.example_type }}/${{ matrix.example }} run: cargo build --release - name: Build example uf2 + if: ${{ matrix.example != 'esp32c3_ble' && matrix.example != 'esp32c6_ble' }} working-directory: ./examples/${{ matrix.example_type }}/${{ matrix.example }} run: cargo make uf2 --release + build-esp32s3: + runs-on: ubuntu-latest + strategy: + matrix: + chip: + - esp32s3 + example_type: + - use_rust + - use_config + steps: + - uses: cargo-bins/cargo-binstall@main + - uses: actions/checkout@v3 + - name: Install ldproxy and espup + run: cargo binstall ldproxy espup -y + - name: Install esp toolchain + run: espup install + - name: Build + working-directory: ./examples/${{ matrix.example_type }}/${{ matrix.chip }}_ble + run: . /home/runner/export-esp.sh && cargo +esp build --release binary-size: # Copied from sequential-storage: https://github.com/tweedegolf/sequential-storage/blob/master/.github/workflows/ci.yaml runs-on: ubuntu-latest diff --git a/.github/workflows/build_docs.sh b/.github/workflows/build_docs.sh deleted file mode 100644 index 06647f3fb..000000000 --- a/.github/workflows/build_docs.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail - -# Usage: build_docs.sh -# -# Build the course as of the date specified specified in the -# POT-Creation-Date header of docs/po/$book_lang.po. The output can be -# found in $dest_dir. -# -# The src/ and third_party/ directories are left in a dirty state so -# you can run `mdbook test` and other commands afterwards. - -book_lang=${1:?"Usage: $0 "} -dest_dir=${2:?"Usage: $0 "} - -if [ "$book_lang" = "en" ]; then - echo "::group::Building English docs" -else - pot_creation_date=$(grep --max-count 1 '^"POT-Creation-Date:' "docs/po/$book_lang.po" | sed -E 's/".*: (.*)\\n"/\1/') - pot_creation_date=${pot_creation_date:-now} - echo "::group::Building $book_lang translation as of $pot_creation_date" - - # Back-date the sources to POT-Creation-Date. The content lives in two - # directories: - # rm -r src/ third_party/ - # git restore --source "$(git rev-list -n 1 --before "$pot_creation_date" @)" src/ third_party/ - - # Set language and adjust site URL. Clear the redirects since they are - # in sync with the source files, not the translation. - export MDBOOK_BOOK__LANGUAGE=$book_lang - export MDBOOK_OUTPUT__HTML__SITE_URL=/rmk/$book_lang/ - export MDBOOK_OUTPUT__HTML__REDIRECT='{}' - - # # Include language-specific Pandoc configuration - # if [ -f ".github/pandoc/$book_lang.yaml" ]; then - # export MDBOOK_OUTPUT__PANDOC__PROFILE__PDF__DEFAULTS=".github/pandoc/$book_lang.yaml" - # fi -fi - -# Enable mdbook-pandoc to build PDF version of the course -# export MDBOOK_OUTPUT__PANDOC__DISABLED=false - -cd docs -mdbook build -d "$dest_dir" - -# # Disable the redbox button in built versions of the course -# echo '// Disabled in published builds, see build.sh' > "${dest_dir}/html/theme/redbox.js" - -# mv "$dest_dir/pandoc/pdf/comprehensive-rust.pdf" "$dest_dir/html/" -# (cd "$dest_dir/exerciser" && zip --recurse-paths ../html/comprehensive-rust-exercises.zip comprehensive-rust-exercises/) - -echo "::endgroup::" \ No newline at end of file diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml index 1cbd462cc..4f2e596c8 100644 --- a/.github/workflows/unit_test.yml +++ b/.github/workflows/unit_test.yml @@ -35,4 +35,4 @@ jobs: - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - name: Run tests working-directory: ./rmk - run: cargo test --tests --no-default-features --verbose \ No newline at end of file + run: cargo test --tests --no-default-features features="log, std" --verbose \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index f15c84451..cb89d1de6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,8 @@ { + "[rust]": { + "editor.formatOnSave": true, + "editor.formatOnSaveMode": "file", + }, "cortex-debug.variableUseNaturalFormat": false, "rust-analyzer.check.allTargets": false, "rust-analyzer.check.noDefaultFeatures": true, @@ -7,57 +11,48 @@ // Uncomment the target of your chip. //"rust-analyzer.cargo.target": "thumbv6m-none-eabi", //"rust-analyzer.cargo.target": "thumbv7m-none-eabi", - "rust-analyzer.cargo.target": "thumbv7em-none-eabi", - //"rust-analyzer.cargo.target": "thumbv7em-none-eabihf", + // "rust-analyzer.cargo.target": "thumbv7em-none-eabi", + // "rust-analyzer.cargo.target": "thumbv7em-none-eabihf", //"rust-analyzer.cargo.target": "thumbv8m.main-none-eabihf", - //"rust-analyzer.cargo.target": "riscv32imafc-unknown-none-elf", - //"rust-analyzer.cargo.target": "riscv32imc-esp-espidf", - //"rust-analyzer.cargo.target": "riscv32imac-esp-espidf", - //"rust-analyzer.cargo.target": "xtensa-esp32s3-espidf", - //"rust-analyzer.cargo.target": "riscv32imafc-unknown-none-elf", - "rust-analyzer.cargo.features": [ - // Comment out these features when working on the examples. Most example crates do not have any cargo features. - // "stm32f446re", - // "time-driver-any", - // "unstable-pac", - // "exti", - // "rt", - ], + // "rust-analyzer.cargo.target": "riscv32imc-unknown-none-elf", // for esp32c3 + // "rust-analyzer.cargo.target": "riscv32imac-unknown-none-elf", // for esp32c6 "rust-analyzer.linkedProjects": [ "rmk-macro/Cargo.toml", "rmk/Cargo.toml", // To work on the examples, comment the line above and all of the cargo.features lines, // then uncomment ONE line below to select the chip you want to work on. // This makes rust-analyzer work on the example crate and all its dependencies. + // "examples/use_config/esp32c3_ble/Cargo.toml", + // "examples/use_config/esp32c6_ble/Cargo.toml", + // "examples/use_config/esp32s3_ble/Cargo.toml", + // "examples/use_config/nef52832_ble/Cargo.toml", + // "examples/use_config/nrf52840_ble/Cargo.toml", + // "examples/use_config/nrf52840_ble_split/Cargo.toml", + // "examples/use_config/nrf52840_ble_split_direct_pin/Cargo.toml", + // "examples/use_config/rp2040/Cargo.toml" + // "examples/use_config/rp2040_direct_pin/Cargo.toml" + // "examples/use_config/rp2040_split/Cargo.toml" + // "examples/use_config/rp2040_split_pio/Cargo.toml" + // "examples/use_config/stm32f1/Cargo.toml", + // "examples/use_config/stm32f4/Cargo.toml", + // "examples/use_config/stm32h7/Cargo.toml", // "examples/use_rust/ch32v307/Cargo.toml", // "examples/use_rust/esp32c3_ble/Cargo.toml", // "examples/use_rust/esp32c6_ble/Cargo.toml", // "examples/use_rust/esp32s3_ble/Cargo.toml", // "examples/use_rust/hpm5300/Cargo.toml", // "examples/use_rust/nef52832_ble/Cargo.toml", + // "examples/use_rust/nrf52840/Cargo.toml", // "examples/use_rust/nrf52840_ble/Cargo.toml", // "examples/use_rust/nrf52840_ble_split/Cargo.toml", // "examples/use_rust/py32f07x/Cargo.toml", // "examples/use_rust/rp2040/Cargo.toml" // "examples/use_rust/rp2040_direct_pin/Cargo.toml" // "examples/use_rust/rp2040_split/Cargo.toml" + // "examples/use_rust/rp2040_split_pio/Cargo.toml" // "examples/use_rust/rp2350/Cargo.toml" // "examples/use_rust/stm32f1/Cargo.toml", // "examples/use_rust/stm32f4/Cargo.toml", // "examples/use_rust/stm32h7/Cargo.toml", - // "examples/use_config/esp32c3_ble/Cargo.toml", - // "examples/use_config/esp32c6_ble/Cargo.toml", - // "examples/use_config/esp32s3_ble/Cargo.toml", - // "examples/use_config/nef52832_ble/Cargo.toml", - // "examples/use_config/nrf52840_ble/Cargo.toml", - // "examples/use_config/nrf52840_ble_split/Cargo.toml", - // "examples/use_config/nrf52840_ble_split_direct_pin/Cargo.toml", - // "examples/use_config/nrf52840_usb/Cargo.toml", - // "examples/use_config/rp2040/Cargo.toml" - // "examples/use_config/rp2040_direct_pin/Cargo.toml" - // "examples/use_config/rp2040_split/Cargo.toml" - // "examples/use_config/stm32f1/Cargo.toml", - // "examples/use_config/stm32f4/Cargo.toml", - // "examples/use_config/stm32h7/Cargo.toml", ], } \ No newline at end of file diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 4d7760cf4..6ba5af908 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -16,7 +16,17 @@ # Features - [Keyboard Configuration](keyboard_configuration.md) -- [Keymap](keymap.md) + - [Keyboard and matrix](configuration/keyboard_matrix.md) + - [Layout](configuration/layout.md) + - [Split keyboard](configuration/split.md) + - [Storage](configuration/storage.md) + - [Behavior](configuration/behavior.md) + - [Input device](configuration/input_device.md) + - [Wireless/Bluetooth](configuration/wireless.md) + - [Light](configuration/light.md) + - [Appendix](configuration/appendix.md) +- [Keymap](keymap/keymap.md) + - [Special keys](keymap/special_keys.md) - [Vial support](vial_support.md) - [Wireless](wireless.md) - [Low-power](low_power.md) diff --git a/docs/src/binary_size_optimization.md b/docs/src/binary_size_optimization.md index 931d37aec..e8d03f533 100644 --- a/docs/src/binary_size_optimization.md +++ b/docs/src/binary_size_optimization.md @@ -31,8 +31,8 @@ By default, RMK uses `panic-probe` to print error messages if panic occurs. But ```diff # In your binary's Cargo.toml -- panic-probe = { version = "0.3", features = ["print-defmt"] } -+ panic-halt = "0.2" +- panic-probe = { version = "1.0", features = ["print-defmt"] } ++ panic-halt = "1.0" ``` The in `main.rs`, use `panic-halt` instead: @@ -51,7 +51,7 @@ You can also remove the entire defmt-rtt logger to save flash. ```diff # In your binary's Cargo.toml -- defmt-rtt = "0.4" +- defmt-rtt = "1.0" ``` In this case, you have to implement an empty defmt logger. diff --git a/docs/src/configuration/appendix.md b/docs/src/configuration/appendix.md new file mode 100644 index 000000000..6b320b108 --- /dev/null +++ b/docs/src/configuration/appendix.md @@ -0,0 +1,247 @@ +# Appendix + +### `keyboard.toml` + +The following toml contains all available settings in `keyboard.toml` + +```toml +# Basic info of the keyboard +[keyboard] +name = "RMK Keyboard" # Keyboard name +product_name = "RMK Keyboard" # Display name of this keyboard +vendor_id = 0x4c4b +product_id = 0x4643 +manufacturer = "haobo" +serial_number = "vial:f64c2b3c:000001" +# The chip or existing board used in keyboard +# Either \"board\" or \"chip\" can be set, but not both +chip = "rp2040" +board = "nice!nano_v2" +# USB is enabled by default for most chips +# Set to false if you don't want USB +usb_enable = true + +# Set matrix IO for the board. This section is for non-split keyboard and is conflict with [split] section +[matrix] +# `matrix_type` is optional. Default is "normal" +matrix_type = "normal" +# Input and output pins +input_pins = ["PIN_6", "PIN_7", "PIN_8", "PIN_9"] +output_pins = ["PIN_19", "PIN_20", "PIN_21"] +# WARNING: Currently row2col/col2row is set in RMK's feature gate, row2col config here is valid ONLY when you're using cloud compilation + +# Direct Pin Matrix is a Matrix of buttons connected directly to pins. It conflicts with the above. +matrix_type = "direct_pin" +direct_pins = [ + ["PIN_0", "PIN_1", "PIN_2"], + ["PIN_3", "_", "PIN_5"] +] + +# `direct_pin_low_active` is optional. Default is `true`. +# If your pin needs to be pulled up and the pin is pulled down when the button is turned on, please set it to true +# WARNING: If you use a normal matrix, it will be ineffective +direct_pin_low_active = true + +# Layout info for the keyboard, this section is mandatory +[layout] +# Number of rows. For split keyboard, this is the total rows contains all splits +rows = 5 +# Number of cols. For split keyboard, this is the total cols contains all splits +cols = 4 +# Number of layers. Be careful, since large layer number takes more flash and RAM +layers = 3 +# keypad example: +# ┌───┬───┬───┬───┐ +# │NUM│ / │ * │ - │ <-- row 0, col 0..4 +# ├───┼───┼───┼───┤ +# │ 7 │ 8 │ 9 │ │ +# ├───┼───┼───┤ + │ +# │ 4 │ 5 │ 6 │ │ +# ├───┼───┼───┼───┤ +# │ 1 │ 2 │ 3 │ E │ +# ├───┴───┼───┤ N │ +# │ 0 │ . │ T │ +# └───────┴───┴───┘ +matrix_map = """ +(0,0) (0,1) (0,2) (0,3) +(1,0) (1,1) (1,2) (1,3) +(2,0) (2,1) (2,2) +(3,0) (3,1) (3,2) (3,3) +(4,0) (4,1) +""" + +# here are the aliases for the example layer.keys below +[aliases] +my_cut = "WM(X, LCtrl)" +my_copy = "WM(C, LCtrl)" +my_paste = "WM(V, LCtrl)" + +# Key map definitions per layer: +# The number (and order) of entries on each layer should be +# identical with the number (and order) of entries in `matrix_map`. +# Empty layers will be used to fill if the number of explicitly +# defined layers is smaller then `layout.layers` setting + +# layer 0 (default): +# (the number comes from the order of '[[layer]] entries' in the file) +[[layer]] +name = "base_layer" #optional name for the layer +keys = """ +NumLock KpSlash KpAsterisk KpMinus +Kp7 Kp8 Kp9 KpPlus +Kp4 Kp5 Kp6 +Kp1 Kp2 Kp3 Enter + Kp0 KpDot +""" + +# layer 1: +[[layer]] +name = "mouse_navigation" #optional name for the layer +keys = """ +TO(base_layer) @MyCut @MyCopy @MyPaste +MouseBtn1 MouseUp MouseBtn2 MouseWheelUp +MouseLeft MouseBtn4 MouseRight +MouseWheelLeft MouseDown MouseWheelRight MouseWheelDown + MouseBtn1 MouseBtn12 +""" + +# Behavior configuration, if you don't want to customize anything, just ignore this section +[behavior] +# Tri Layer configuration +tri_layer = { uppper = 1, lower = 2, adjust = 3 } +# One Shot configuration +one_shot = { timeout = "1s" } + +# Lighting configuration, if you don't have any light, just ignore this section. +[light] +# LED pins, capslock, scrolllock, numslock. You can safely ignore any of them if you don't have +capslock = { pin = "PIN_0", low_active = true } +scrolllock = { pin = "PIN_1", low_active = true } +numslock = { pin = "PIN_2", low_active = true } + +# Storage configuration. +# To use the default configuration, ignore this section completely +[storage] +# Whether the storage is enabled +enabled = true +# The start address of storage +start_addr = 0x60000 +# Number of sectors used for storage, >= 2 +start_addr = 16 + +# Ble configuration +# To use the default configuration, ignore this section completely +[ble] +# Whether the ble is enabled +enabled = true +# BLE related pins, ignore any of them if you don't have +battery_adc_pin = "vddh" +# If the voltage divider is used for adc, you can use the following two values to define a voltage divider. +# For example, nice!nano have 806 + 2M resistors, the saadc measures voltage on 2M resistor, so the two values should be set to 2000 and 2806 +# Measured resistance for input adc, it should be less than adc_divider_total +adc_divider_measured = 2000 +# Total resistance of the full path for input adc +adc_divider_total = 2806 +# Pin that reads battery's charging state, `low-active` means the battery is charging when `charge_state.pin` is low +# Input pin that indicates the charging state +charge_state = { pin = "PIN_1", low_active = true } +# Output LED pin that blinks when the battery is low +charge_led= { pin = "PIN_2", low_active = true } + +# Split configuration +# This section is conflict with [split] section, you could only have either [matrix] or [split], but NOT BOTH +[split] +# Connection type of split, "serial" or "ble" +connection = "serial" + +# Split central config +[split.central] +# Number of rows on central board +rows = 2 +# Number of cols on central board +cols = 2 +# Row offset of central matrix to the whole matrix +row_offset = 0 +# Col offset of central matrix to the whole matrix +col_offset = 0 +# If the connection type is "serial", the serial instances used on the central board are defined using "serial" field. +# It's a list of serial instances with a length equal to the number of splits. +# The order of the serial instances is important: the first serial instance on the central board +# communicates with the first split peripheral defined, and so on. +serial = [ + { instance = "UART0", tx_pin = "PIN_0", rx_pin = "PIN_1" }, + { instance = "UART1", tx_pin = "PIN_4", rx_pin = "PIN_5" }, + # For the RP2040 only, you can also use RMK's Programmable IO (PIO) UART serial port using either or both of the RP2040's two PIO blocks, PIO0 and PIO1, by enabling the RMK `rp2040_pio` feature gate in Cargo.toml. + # The PIO serial port can be used in half-duplex mode using the same pin for RX/TX + { instance = "PIO0", tx_pin = "PIN_6", rx_pin = "PIN_6" }, + # Or use the PIO serial port in full-duplex mode using different pins for RX/TX + { instance = "PIO1", tx_pin = "PIN_7", rx_pin = "PIN_8" }, +] +# If the connection type is "ble", we should have `ble_addr` to define the central's BLE static address +# This address should be a valid BLE random static address, see: https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-2-bluetooth-le-advertising/topic/bluetooth-address/ +ble_addr = [0x18, 0xe2, 0x21, 0x80, 0xc0, 0xc7] + +[split.central.matrix] +matrix_type = "normal" +# Matrix IO definition on central board +input_pins = ["PIN_9", "PIN_11"] +output_pins = ["PIN_10", "PIN_12"] + +# Configuration for the first split peripheral +# Note the double brackets [[ ]], which indicate that multiple split peripherals can be defined. +# The order of peripherals is important: it should match the order of the serial instances(if serial is used). +[[split.peripheral]] +# Number of rows on peripheral board +rows = 2 +# Number of cols on peripheral board +cols = 1 +# Row offset of peripheral matrix to the whole matrix +row_offset = 2 +# Col offset of peripheral matrix to the whole matrix +col_offset = 2 +# The serial instance used to communication with the central board, if the connection type is "serial" +serial = [{ instance = "UART0", tx_pin = "PIN_0", rx_pin = "PIN_1" }] +# The BLE random static address of the peripheral board +ble_addr = [0x7e, 0xfe, 0x73, 0x9e, 0x66, 0xe3] + +[split.peripheral.matrix] +matrix_type = "normal" +# Matrix IO definition on peripheral board +input_pins = ["PIN_9", "PIN_11"] +output_pins = ["PIN_10"] + +# More split peripherals(if you have) +[[split.peripheral]] +# The configuration is same with the first split peripheral +... +... +... + +# Dependency config +[dependency] +# Whether to enable defmt, set to false for reducing binary size +defmt_log = true +``` + +### Available chip names + +Available chip names in `chip` field: +- rp2040 +- nrf52840 +- nrf52833 +- nrf52832 +- nrf52811 +- nrf52810 +- esp32c3 +- esp32c6 +- esp32s3 +- ALL stm32s supported by [embassy-stm32](https://github.com/embassy-rs/embassy/blob/main/embassy-stm32/Cargo.toml) with USB + +### Available board names + +Available board names in `board` field: +- nice!nano +- nice!nano_v2 +- XIAO BLE + +If you want to add more built-in boards, feel free to open a PR! diff --git a/docs/src/configuration/behavior.md b/docs/src/configuration/behavior.md new file mode 100644 index 000000000..03c2a6bb8 --- /dev/null +++ b/docs/src/configuration/behavior.md @@ -0,0 +1,154 @@ +# Behavior + +## `[behavior]` + +`[behavior]` section contains configuration for how different keyboard actions should behave: + +```toml +[behavior] +tri_layer = { uppper = 1, lower = 2, adjust = 3 } +one_shot = { timeout = "1s" } +``` + +### Tri Layer + +`Tri Layer` works by enabling a layer (called `adjust`) when other two layers (`upper` and `lower`) are both enabled. + +You can enable Tri Layer by specifying the `upper`, `lower` and `adjust` layers in the `tri_layer` sub-table: + +```toml +[behavior.tri_layer] +uppper = 1 +lower = 2 +adjust = 3 +``` +In this example, when both layers 1 (`upper`) and 2 (`lower`) are active, layer 3 (`adjust`) will also be enabled. + +Note that `"#layer_name"` could also be used in place of layer numbers. + +### Tap Hold + +In the `tap_hold` sub-table, you can configure the following parameters: + +- `enable_hrm`: Enables or disables HRM (Home Row Mod) mode. When enabled, the `prior_idle_time` setting becomes functional. Defaults to `false`. +- `prior_idle_time`: If the previous non-modifier key is released within this period before pressing the current tap-hold key, the tap action for the tap-hold behavior will be triggered. This parameter is effective only when enable_hrm is set to `true`. Defaults to 120ms. +- `hold_timeout`: Defines the duration a tap-hold key must be pressed to determine hold behavior. If tap-hold key is released within this time, the key is recognized as a "tap". Holding it beyond this duration triggers the "hold" action. Defaults to 250ms. +- `post_wait_time`: Adds an additional delay after releasing a tap-hold key to check if any keys pressed during the `hold_timeout` are released. This helps accommodate fast typing scenarios where some keys may not be fully released during a hold. Defaults to 50ms + +The following are the typical configurations: + +```toml +[behavior] +# Enable HRM +tap_hold = { enable_hrm = true, prior_idle_time = "120ms", hold_timeout = "250ms", post_wait_time = "50ms"} +# Disable HRM, you can safely ignore any fields if you don't want to change them +tap_hold = { enable_hrm = false, hold_timeout = "200ms" } +``` + +### One Shot + +In the `one_shot` sub-table you can define how long OSM or OSL will wait before releasing the modifier/layer with the `timeout` option, default is one second. +`timeout` is a string with a suffix of either "s" or "ms". + +```toml +[behavior.one_shot] +timeout = "5s" +``` + +### Combo + +In the `combo` sub-table, you can configure the keyboard's combo key functionality. Combo allows you to define a group of keys that, when pressed simultaneously, will trigger a specific output action. + +Combo configuration includes the following parameters: + +- `timeout`: Defines the maximum time window for pressing all combo keys. If the time exceeds this, the combo key will not be triggered. The format is a string, which can be milliseconds (e.g. "200ms") or seconds (e.g. "1s"). +- `combos`: An array containing all defined combos. Each combo configuration is an object containing the following attributes: + - `actions`: An array of strings defining the keys that need to be pressed simultaneously to trigger the combo action. + - `output`: A string defining the output action to be triggered when all keys in `actions` are pressed simultaneously. + - `layer`: An optional parameter, a number, specifying which layer the combo is valid on. If not specified, the combo is valid on all layers. + +Here is an example of combo configuration: + +```toml +[behavior.combo] +timeout = "150ms" +combos = [ + # Press J and K keys simultaneously to output Escape key + { actions = ["J", "K"], output = "Escape" }, + # Press F and D keys simultaneously to output Tab key, but only valid on layer 0 + { actions = ["F", "D"], output = "Tab", layer = 0 }, + # Three-key combo, press A, S, and D keys to switch to layer 2 + { actions = ["A", "S", "D"], output = "TO(2)" } +] +``` + +### Fork + +In the `fork` sub-table, you can configure the keyboard's state based key fork functionality. Forks allows you to define a trigger key and condition dependent possible replacement keys. When the trigger key is pressed, the condition is checked by the following rule: +If any of the `match_any` states are active AND none of the `match_none` states active, the trigger key will be replaced with positive_output, otherwise with the negative_output. By default the modifiers listed in `match_any` will be suppressed (even the one-shot modifiers) for the time the replacement key action is executed. However, with `kept_modifiers` some of them can be kept instead of automatic suppression. + +Fork configuration includes the following parameters: + +- `forks`: An array containing all defined forks. Each fork configuration is an object containing the following attributes: + - `trigger`: Defines the triggering key. + - `negative_output`: A string defining the output action to be triggered when the conditions are not met + - `positive_output`: A string defining the output action to be triggered when the conditions are met + - `match_any`: A strings defining a combination of modifier keys, lock leds, mouse buttons (optional) + - `match_none`: A strings defining a combination of modifier keys, lock leds, mouse buttons (optional) + - `kept_modifiers`: A strings defining a combination of modifier keys, which should not be 'suppressed' form the keyboard state for the time the replacement action is executed. (optional) + - `bindable`: Enables the evaluation of not yet triggered forks on the output of this fork to further manipulate the output. Advanced use cases can be solved using this option. (optional) + +For `match_any`, `match_none` the legal values are listed below (many values may be combined with "|"): + - `LShift`, `LCtrl`, `LAlt`, `LGui`, `RShift`, `RCtrl`, `RAlt`, `RGui` (these are including the effect of explicitly held and one-shot modifiers too) + - `CapsLock`, `ScrollLock`, `NumLock`, `Compose`, `Kana` + - `MouseBtn1` .. `MouseBtn8` + +Here is a sample of fork configuration with random examples: + +```toml +[behavior.fork] +forks = [ + # Shift + '.' output ':' key + { trigger = "Dot", negative_output = "Dot", positive_output = "WM(Semicolon, LShift)", match_any = "LShift|RShift" }, + + # Shift + ',' output ';' key but only if no Alt is pressed + { trigger = "Comma", negative_output = "Comma", positive_output = "Semicolon", match_any = "LShift|RShift", match_none = "LAlt|RAlt" }, + + # left bracket outputs by default '{', with shifts pressed outputs '[' + { trigger = "LeftBracket", negative_output = "WM(LeftBracket, LShift)", positive_output = "LeftBracket", match_any = "LShift|RShift" }, + + # Flip the effect of shift on 'x'/'X' + { trigger = "X", negative_output = "WM(X, LShift)", positive_output = "X", match_any = "LShift|RShift" }, + + # F24 usually outputs 'a', except when Left Shift or Ctrl pressed, in that case triggers a macro + { trigger = "F24", negative_output = "A", positive_output = "Macro1", match_any = "LShift|LCtrl" }, + + # Swap Z and Y keys if MouseBtn1 is pressed (on the keyboard) (Note that these must not be bindable to avoid infinite fork loops!) + { trigger = "Y", negative_output = "Y", positive_output = "Z", match_any = "MouseBtn1", bindable = false }, + { trigger = "Z", negative_output = "Z", positive_output = "Y", match_any = "MouseBtn1", bindable = false }, + + # Shift + Backspace output Delete key (inside a layer tap/hold) + { trigger = "LT(2, Backspace)", negative_output = "LT(2, Backspace)", positive_output = "LT(2, Delete)", match_any = "LShift|RShift" }, + + # Ctrl + play/pause will send next track. MediaPlayPause -> MediaNextTrack + # Ctrl + Shift + play/pause will send previous track. MediaPlayPause -> MediaPrevTrack + # Alt + play/pause will send volume up. MediaPlayPause -> AudioVolUp + # Alt + Shift + play/pause will send volume down. MediaPlayPause -> AudioVolDown + # Ctrl + Alt + play/pause will send brightness up. MediaPlayPause -> BrightnessUp + # Ctrl + Alt + Shift + play/pause will send brightness down. MediaPlayPause -> BrightnessDown + # ( Note that the trigger and immediate trigger keys of the fork chain could be 'virtual keys', + # which will never output, like F23, but here multiple overrides demonstrated.) + { trigger = "MediaPlayPause", negative_output = "MediaPlayPause", positive_output = "MediaNextTrack", match_any = "LCtrl|RCtrl", bindable = true }, + { trigger = "MediaNextTrack", negative_output = "MediaNextTrack", positive_output = "BrightnessUp", match_any = "LAlt|RAlt", bindable = true }, + { trigger = "BrightnessUp", negative_output = "BrightnessUp", positive_output = "BrightnessDown", match_any = "LShift|RShift", bindable = false }, + { trigger = "MediaNextTrack", negative_output = "MediaNextTrack", positive_output = "MediaPrevTrack", match_any = "LShift|RShift", match_none = "LAlt|RAlt", bindable = false}, + { trigger = "MediaPlayPause", negative_output = "MediaPlayPause", positive_output = "AudioVolUp", match_any = "LAlt|RAlt", match_none = "LCtrl|RCtrl", bindable = true }, + { trigger = "AudioVolUp", negative_output = "AudioVolUp", positive_output = "AudioVolDown", match_any = "LShift|RShift", match_none = "LCtrl|RCtrl", bindable = false } +] +``` + +Please note that the processing of forks happen after combos and before others, so the trigger key must be the one listed in your keymap (or combo output). +For example if `LT(2, Backspace)` is in your keymap, then `trigger = "Backspace"` will NOT work, you should "replace" the full key and use `trigger = "LT(2, Backspace)"` instead, like in the example above. +You may want to include `F24` or similar dummy keys in your keymap, and use them as trigger for your pre-configured forks, such as Shift/CapsLock dependent macros to enter unicode characters of your language. + +Vial does not support fork configuration yet. \ No newline at end of file diff --git a/docs/src/configuration/input_device.md b/docs/src/configuration/input_device.md new file mode 100644 index 000000000..c81b42627 --- /dev/null +++ b/docs/src/configuration/input_device.md @@ -0,0 +1,139 @@ +# Input devices + +All input devices are defined in the `[input_device]` table. Currently supported input device types include: + +- Rotary Encoder (encoder) +- Joystick (joystick) + +## Rotary Encoder(not ready yet) + +A rotary encoder is a common input device that can be used for volume control, page scrolling, and other functions. It can be defined in the configuration file as follows: + +```toml +[[input_device.encoder]] +pin_a = "P0_30" +pin_b = "P0_31" + +# Working mode of the encoder +# Available modes: +# - default: EC11 compatible mode, resolution = 1 +# - e8h7: resolution = 2, direction reversed +# - resolution: custom resolution, requires specifying resolution and reverse parameters +phase = "default" + +# Resolution represents the number of pulses generated per detent +# For example: if your encoder has 30 detents and generates 15 pulses per 360-degree rotation, then resolution = 30/15 = 2 +# The number of detents and pulses can be found in your encoder's datasheet +resolution = 2 + +# Whether to reverse the encoder direction +reverse = false +``` + +Multiple encoders can be added, and their indices are determined by the order of addition: + +```toml +# Encoder 0 +[[input_device.encoder]] +pin_a = "P0_01" +pin_b = "P0_02" +phase = "default" + +# Encoder 1 +[[input_device.encoder]] +pin_a = "P0_03" +pin_b = "P0_04" +phase = "default" +``` + +## Joystick + +A joystick is an analog input device that can be used for mouse control and other functions. Currently only NRF series chips are supported. + +```toml +[[input_device.joystick]] +name = "default" +pin_x = "P0_31" +pin_y = "P0_29" +pin_z = "_" +transform = [[80, 0], [0, 80]] +bias = [29130, 29365] +resolution = 6 +``` + +### Parameters: + +- `name`: Unique name for the joystick. If you have multiple joysticks, they need different names +- `pin_x`: Pin for X-axis +- `pin_y`: Pin for Y-axis +- `pin_z`: Pin for Z-axis +- `transform`: Transformation matrix for the joystick +- `bias`: Bias value for each axis +- `resolution`: Resolution for each axis + +> #### Axis Configuration Note: +> +> `_` indicates that the axis does not exist. +> +> `_` is only allowed for: +> 1. Both y and z axes are missing +> 2. Only z axis is missing +> +> For example: `pin_x = "_"` `pin_y = "P0_29"` `pin_z = "P0_30"` is not allowed + +### Working Principle + +1. Device reads values from each axis +2. Adds `bias` value to each axis to make the value close to 0 when the joystick is released +3. About the `transform` matrix: + 1. New x-axis value = (axis_x + bias[0]) / transform[0][0] + (axis_y + bias[1]) / transform[0][1] + (axis_z + bias[2]) / transform[0][2] + 2. New y-axis value = (axis_x + bias[0]) / transform[1][0] + (axis_y + bias[1]) / transform[1][1] + (axis_z + bias[2]) / transform[1][2] + 3. New z-axis value = (axis_x + bias[0]) / transform[2][0] + (axis_y + bias[1]) / transform[2][1] + (axis_z + bias[2]) / transform[2][2] + + If `transform[new_axis][old_axis]` is 0, that old axis value is ignored. + + Since the value range read by the ADC device is usually much larger than the mouse report range of -256~255, `transform` is designed as a divisor. +4. Each axis value is adjusted to the largest integer multiple of `resolution` that is less than its original value to reduce noise from ADC device readings. + +### Quick Configuration Guide + +1. First set `bias` to 0, `resolution` to 1, and `transform` to `[[1, 0, 0], [0, 1, 0], [0, 0, 1]]` (matrix dimension depends on the number of axes) + +2. Find the optimal `bias` value: + - Use a debug probe to find the output `JoystickProcessor::generate_report: record = [axis_x, axis_y, axis_z]` in debug information + - Observe these values to find the `bias` value that makes each axis closest to 0 when the joystick is released + +3. If the mouse moves too fast, gradually increase the `transform` value until you find the right sensitivity + +4. If the mouse jitters, gradually increase the `resolution` value until the jitter disappears + +## Pointing Device(Draft, not implemented) + +Pointing devices (such as touchpads) can be connected via I2C or SPI interface. Configuration examples: + +```toml +[[input_device.pointing]] +interface = { i2c = { instance = "TWIM0", scl = "P0_27", sda = "P0_26" } } +``` + +or + +```toml +[[input_device.pointing]] +interface = { spi = { instance = "SPIM0", sck = "P0_25", mosi = "P0_24", miso = "P0_23", cs = "P0_22", cpi = 1000 } } +``` + +### Parameters: + +#### I2C Configuration +- `instance`: I2C instance name +- `scl`: Clock pin +- `sda`: Data pin + +#### SPI Configuration +- `instance`: SPI instance name +- `sck`: Clock pin +- `mosi`: Master Out Slave In pin +- `miso`: Master In Slave Out pin +- `cs`: Chip Select pin (optional) +- `cpi`: Counts Per Inch (optional) diff --git a/docs/src/configuration/keyboard_matrix.md b/docs/src/configuration/keyboard_matrix.md new file mode 100644 index 000000000..7cda8bdbd --- /dev/null +++ b/docs/src/configuration/keyboard_matrix.md @@ -0,0 +1,73 @@ +# Keyboard and matrix + +## `[keyboard]` + +`[keyboard]` section contains basic information of the keyboard, such as keyboard's name, chip, etc: + +```toml +[keyboard] +name = "RMK Keyboard" +vendor_id = 0x4c4b +product_id = 0x4643 +manufacturer = "RMK" +chip = "stm32h7b0vb" +# If your chip doesn't have a functional USB peripheral, for example, nRF52832/esp32c3(esp32c3 has only USB serial, not full functional USB), set `usb_enable` to false +usb_enable = true +``` + +## `[matrix]` + +`[matrix]` section defines the physical [key matrix](https://docs.qmk.fm/how_a_matrix_works) IO information of the keyboard, aka input/output pins. + +
+For split keyboard, this section should be just ignored, the matrix IO pins for split keyboard are defined in `[split]` section. +
+ +### Key matrix + +For the normal key matrix, in order to identify the IO pins take a look at your keyboard's schematic: The pin going to the [diode](https://en.wikipedia.org/wiki/Diode) (called anode) is an output pin, the pin coming out (called cathode) is an input pin: +``` +output_pin => >| => input_pin + ↑ + diode(be aware of it's direction) +``` + +
+Per default RMK assumes that your pins are col2row, meaning that the output pins (anodes) represent the columns and the input pins (cathodes) represent the rows. If your schemata shows the opposite you need to change the configuration to `row2col` +
+ +IO pins are represented with an array of string, the string value should be the **GPIO peripheral name** of the chip. For example, if you're using stm32h750xb, you can go to to get the valid GPIO peripheral name: + +![gpio_peripheral_name](../images/gpio_peripheral_name.png) + +The GPIO peripheral name varies for different chips. For example, RP2040 has `PIN_0`, nRF52840 has `P0_00` and stm32 has `PA0`. So it's recommended to check the embassy's doc for your chip to get the valid GPIO name first. + +Here is an example toml of `[matrix]` section for stm32: + +```toml +[matrix] +# Input and output pins are mandatory +input_pins = ["PD4", "PD5", "PD6", "PD3"] +output_pins = ["PD7", "PD8", "PD9"] +# WARNING: Currently row2col/col2row is set in RMK's feature gate, row2col config here is valid ONLY when you're using cloud compilation +# row2col = true +``` + +### Direct pins + +If your keys are directly connected to the microcontroller pins, set `matrix_type` to `direct_pin`. (The default value for `matrix_type` is `normal`) + +`direct_pins` is a two-dimensional array that represents the physical layout of your keys. + +If your pin requires a pull-up resistor and the button press pulls the pin low, set `direct_pin_low_active` to true. Conversely, set it to false if your pin requires a pull-down resistor and the button press pulls the pin high. + +Here is an example for rp2040. +```toml +matrix_type = "direct_pin" +direct_pins = [ + ["PIN_0", "PIN_1", "PIN_2"], + ["PIN_3", "_", "PIN_5"] +] +# `direct_pin_low_active` is optional. Default to `true`. +direct_pin_low_active = true +``` diff --git a/docs/src/configuration/layout.md b/docs/src/configuration/layout.md new file mode 100644 index 000000000..acde51f76 --- /dev/null +++ b/docs/src/configuration/layout.md @@ -0,0 +1,138 @@ +# Layout + + +## `[layout]` + +`[matrix]` defines the physical key matrix on your board, while `[layout]` section contains the layout and the default keymap for the keyboard: + +```toml +[layout] +rows = 5 +cols = 4 +layers = 3 +matrix_map = """ + ... the mapping between the "electronic matrix" of your keyboard + and your key map configuration is described here ... +""" +``` + +The `matrix_map` is a string built from `(row, col)` coordinate pairs, listed in the same order as you want to define your keys in your key map. The `(row, col)` coordinates are using zero based indexing and referring to the position in the "electronic matrix" of your keyboard. As you can see in [matrix configuration](keyboard_matrix.md), even the direct pin based keyboards are represented with a matrix. In case of split keyboards, the positions refer to the position in the "big unified matrix" of all split parts. +With the help of this matrix map, the configuration of non-regular key matrices can be intuitively arranged in your key maps. +(Triple quote mark `"""` is used to limit multi-line strings + +```toml +# ┌───┬───┬───┬───┐ +# │NUM│ / │ * │ - │ <-- row 0, col 0..4 +# ├───┼───┼───┼───┤ +# │ 7 │ 8 │ 9 │ │ +# ├───┼───┼───┤ + │ +# │ 4 │ 5 │ 6 │ │ +# ├───┼───┼───┼───┤ +# │ 1 │ 2 │ 3 │ E │ +# ├───┴───┼───┤ N │ +# │ 0 │ . │ T │ +# └───────┴───┴───┘ +[layout] +rows = 5 +cols = 4 +layers = 3 +matrix_map = """ +(0,0) (0,1) (0,2) (0,3) +(1,0) (1,1) (1,2) (1,3) +(2,0) (2,1) (2,2) +(3,0) (3,1) (3,2) (3,3) + (4,0) (4,1) +""" +``` + +Once the layout is defined, the key mapping can be described for each layer: + +```toml +# layer 0 (default): +[[layer]] +name = "base_layer" #optional name for the layer +keys = """ +NumLock KpSlash KpAsterisk KpMinus +Kp7 Kp8 Kp9 KpPlus +Kp4 Kp5 Kp6 +Kp1 Kp2 Kp3 Enter + Kp0 KpDot +""" + +# layer 1: +[[layer]] +name = "mouse_navigation" #optional name for the layer +keys = """ +TO(base_layer) @my_cut @my_copy @my_paste +MouseBtn1 MouseUp MouseBtn2 MouseWheelUp +MouseLeft MouseBtn4 MouseRight +MouseWheelLeft MouseDown MouseWheelRight MouseWheelDown + MouseBtn1 MouseBtn12 +""" +``` + +The number and order of entries on each defined layers must be identical with the number and order of entries in `matrix_map`. +White spaces, line breaks are free to vary, but its worth to keep a consistent arrangement with the real keyboard. + + +
+If the number of defined layers is smaller than what was defined in `layout.layers`, RMK will fill empty layers automatically (so you can configure them freely in Vial). But the empty layers still consumes flash and RAM, so if you don't have a enough space for them, it's not recommended to use a big layer count. +
+ +In each `layer.keys`, the keys are bound to various key actions. Due to the limitation of `toml` file, this is done in a string. +RMK parses the string and fill the to actual keymap initializer, like what's in [`keymap.rs`](https://github.com/HaoboGu/rmk/tree/main/examples/use_rust/rp2040/src/keymap.rs) + +The `layer.keys` string should follow several rules: + +1. For a simple keycode(aka keys in RMK's [`KeyCode`](https://docs.rs/rmk/latest/rmk/keycode/enum.KeyCode.html) enum), just fill its name. + + For example, if you set a keycode `Backspace`, it will be turned to `KeyCode::Backspace`. So you have to ensure that the keycode string is valid, or RMK wouldn't compile! + However, to make things easier a number of [alternative key names](https://github.com/HaoboGu/rmk/blob/main/rmk-macro/src/keycode_alias.rs) were added and also case-insensitive search is used to find the valid [KeyCode](https://docs.rs/rmk/latest/rmk/keycode/enum.KeyCode.html). + + For simple keycodes with modifiers active, you can use `WM(key, modifier)` to create a keypress with modifier action. Modifiers can be chained together like `LShift | RGui` to have multiple modifiers active. + + You may use aliases, prefixed with `@`, like `@my_copy` in the above example. The alias names are case sensitive. The definition of aliases is described below. + + You may use layer names instead of layer numbers, like `TO(base_layer)` in the above example. +
+ Please note that layer name if used like this, may not contain white spaces and may not be a number. Layer names are case sensitive. +
+ +2. For no-key (`KeyAction::No`), use `No` + +3. For transparent key (`KeyAction::Transparent`), use `_` or `__` (you can put any number of `_`) + +4. RMK supports many advanced layer operations: + 1. Use `DF(n)` to create a switch default layer action, `n` is the layer number + 2. Use `MO(n)` to create a layer activate action, `n` is the layer number + 3. Use `LM(n, modifier)` to create layer activate with modifier action. The modifier can be chained in the same way as `WM` + 4. Use `LT(n, key)` to create a layer activate action or tap key(tap/hold). The `key` here is the RMK [`KeyCode`](https://docs.rs/rmk/latest/rmk/keycode/enum.KeyCode.html) + 5. Use `OSL(n)` to create a one-shot layer action, `n` is the layer number + 6. Use `OSM(modifier)` to create a one-shot modifier action. The modifier can be chained in the same way as `WM` + 7. Use `TT(n)` to create a layer activate or tap toggle action, `n` is the layer number + 8. Use `TG(n)` to create a layer toggle action, `n` is the layer number + 9. Use `TO(n)` to create a layer toggle only action (activate layer `n` and deactivate all other layers), `n` is the layer number + + The definitions of those operations are same with QMK, you can found [here](https://docs.qmk.fm/#/feature_layers). If you want other actions, please [fire an issue](https://github.com/HaoboGu/rmk/issues/new). + +5. For modifier-tap-hold, use `MT(key, modifier)` where the modifier can be a chain like explained on point 1. For example for a Home row modifier config you can use `MT(F, LShift)` + +6. For generic key tap-hold, use `TH(key-tap, key-hold)` + +7. For shifted key, use `SHIFTED(key)` + +### `[aliases]` + +`[aliases]` section contains a table of user defined names and an associated replacement string, which can be used in the `layer.keys`: + +```toml +# here are the aliases for the example above +[aliases] +my_cut = "WM(X, LCtrl)" +my_copy = "WM(C, LCtrl)" +my_paste = "WM(V, LCtrl)" +``` + +
+Please note that alias names may not contain white spaces and they are case sensitive. +
\ No newline at end of file diff --git a/docs/src/configuration/light.md b/docs/src/configuration/light.md new file mode 100644 index 000000000..4c087743b --- /dev/null +++ b/docs/src/configuration/light.md @@ -0,0 +1,16 @@ +# Light + +## `[light]` + +`[light]` section defines lights of the keyboard, aka `capslock`, `scrolllock` and `numslock`. They are actually an input pin, so there are two fields available: `pin` and `low_active`. + +`pin` field is just like IO pins in `[matrix]`, `low_active` defines whether the light low-active or high-active(`true` means low-active). + +You can safely ignore any of them, or the whole `[light]` section if you don't need them. + +```toml +[light] +capslock = { pin = "PIN_0", low_active = true } +scrolllock = { pin = "PIN_1", low_active = true } +numslock= { pin = "PIN_2", low_active = true } +``` \ No newline at end of file diff --git a/docs/src/configuration/split.md b/docs/src/configuration/split.md new file mode 100644 index 000000000..743044062 --- /dev/null +++ b/docs/src/configuration/split.md @@ -0,0 +1,3 @@ +# Split keyboard + +See [Split Keyboard](../split_keyboard.md) section \ No newline at end of file diff --git a/docs/src/configuration/storage.md b/docs/src/configuration/storage.md new file mode 100644 index 000000000..8f0ad330d --- /dev/null +++ b/docs/src/configuration/storage.md @@ -0,0 +1,15 @@ +# Storage + +## `[storage]` + +`[storage]` section defines storage related configs. Storage feature is required to persist keymap data, it's strongly recommended to make it enabled(and it's enabled by default!). RMK will automatically use the last two section of chip's internal flash as the pre-served storage space. For some chips, there's also predefined default configuration, such as [nRF52840](https://github.com/HaoboGu/rmk/blob/main/rmk-macro/src/default_config/nrf52840.rs). If you don't want to change the default setting, just ignore this section. +```toml +[storage] +# Storage feature is enabled by default +enabled = true +# Start address of local storage, MUST BE start of a sector. +# If start_addr is set to 0(this is the default value), the last `num_sectors` sectors will be used. +start_addr = 0x00000000 +# How many sectors are used for storage, the default value is 2 +num_sectors = 2 +``` \ No newline at end of file diff --git a/docs/src/configuration/wireless.md b/docs/src/configuration/wireless.md new file mode 100644 index 000000000..1e9108604 --- /dev/null +++ b/docs/src/configuration/wireless.md @@ -0,0 +1,25 @@ +# Wireless/Bluetooth + +### `[ble]` + +To enable BLE, add `enabled = true` under the `[ble]` section. + +There are several more configs for reading battery level and charging state, now they are available for nRF52840 only. + +```toml +# Ble configuration +# To use the default configuration, ignore this section completely +[ble] +# Whether to enable BLE feature +enabled = true +# nRF52840's saadc pin for reading battery level, you can use a pin number or "vddh" +battery_adc_pin = "vddh" +# The voltage divider setting for saadc. +# For example, nice!nano have 806 + 2M resistors, the saadc measures voltage on 2M resistor, so the two values should be set to 2000 and 2806 +adc_divider_measured = 2000 +adc_divider_total = 2806 +# Pin that reads battery's charging state, `low-active` means the battery is charging when `charge_state.pin` is low +charge_state = { pin = "PIN_1", low_active = true } +# Output LED pin that blinks when the battery is low +charge_led= { pin = "PIN_2", low_active = true } +``` \ No newline at end of file diff --git a/docs/src/input_devices/encoder.md b/docs/src/input_devices/encoder.md index 4e2238789..c0087e721 100644 --- a/docs/src/input_devices/encoder.md +++ b/docs/src/input_devices/encoder.md @@ -50,8 +50,8 @@ With Rust, you can define a rotary encoder as the following: ```rust use rmk::input_device::rotary_encoder::RotaryEncoder; use rmk::input_device::rotary_encoder::DefaultPhase; - let pin_a = Input::new(AnyPin::from(p.P1_06), embassy_nrf::gpio::Pull::None); - let pin_b = Input::new(AnyPin::from(p.P1_04), embassy_nrf::gpio::Pull::None); + let pin_a = Input::new(p.P1_06, embassy_nrf::gpio::Pull::None); + let pin_b = Input::new(p.P1_04, embassy_nrf::gpio::Pull::None); let mut encoder = RotaryEncoder::with_phase(pin_a, pin_b, DefaultPhase, encoder_id); ``` @@ -59,8 +59,8 @@ You can also use the resolution based phase: ```rust use rmk::input_device::rotary_encoder::RotaryEncoder; - let pin_a = Input::new(AnyPin::from(p.P1_06), embassy_nrf::gpio::Pull::None); - let pin_b = Input::new(AnyPin::from(p.P1_04), embassy_nrf::gpio::Pull::None); + let pin_a = Input::new(p.P1_06, embassy_nrf::gpio::Pull::None); + let pin_b = Input::new(p.P1_04, embassy_nrf::gpio::Pull::None); // Create an encoder with resolution = 2, reversed = false let mut encoder = RotaryEncoder::with_resolution(pin_a, pin_b, 2, false, encoder_id) ``` diff --git a/docs/src/keyboard_configuration.md b/docs/src/keyboard_configuration.md index b56acad12..295581a95 100644 --- a/docs/src/keyboard_configuration.md +++ b/docs/src/keyboard_configuration.md @@ -4,7 +4,7 @@ RMK provides an easy and accessible way to set up the keyboard with a toml confi ## Usage -A `toml` file named `keyboard.toml` is used as a configuration file. The following is the spec of `toml` if you're unfamiliar with toml: +A `toml` file named `keyboard.toml` is used as the configuration file of RMK. The following is the spec of `toml` if you're unfamiliar with toml: - [English](https://toml.io/en/v1.0.0) / [中文](https://toml.io/cn/v1.0.0) RMK provides a proc-macro to load the `keyboard.toml` at your projects root: `#[rmk_keyboard]`, add it to your `main.rs` like: @@ -16,705 +16,26 @@ use rmk::macros::rmk_keyboard; mod my_keyboard {} ``` -And, that's it! `#[rmk_keyboard]` macro would load your `keyboard.toml` config and create everything that's needed for creating a RMK keyboard instance. +And, that's it! The `#[rmk_keyboard]` macro would load your `keyboard.toml` config and create everything that's needed for creating a RMK keyboard instance. -If you don't want any other customizations beyond the `keyboard.toml`, `#[rmk_keyboard]` macro will just work. For the full examples, please check the [`example/use_config`](https://github.com/HaoboGu/rmk/tree/main/examples/use_config) folder. +If you don't want any other customizations beyond the `keyboard.toml`, `#[rmk_keyboard]` macro will just work. For the examples, please check the [`example/use_config`](https://github.com/HaoboGu/rmk/tree/main/examples/use_config) folder. ## What's in the config file? -The config file contains almost EVERYTHING to customize a keyboard. For the full reference of `keyboard.toml`, please refer to [this](#keyboardtoml). Also, we have pre-defined default configurations for chips, at [`rmk-macro/src/default_config`](https://github.com/HaoboGu/rmk/blob/main/rmk-macro/src/default_config) folder. We're going to add default configurations for more chips, contributions are welcome! +The config file contains almost EVERYTHING to customize a keyboard. For the full reference of `keyboard.toml`, please refer to [**this doc**](configuration/appendix.md). Also, we have pre-defined default configurations for chips, at [`rmk-macro/src/default_config`](https://github.com/HaoboGu/rmk/blob/main/rmk-macro/src/default_config) folder. We're going to add default configurations for more chips, contributions are welcome! -The following is the introduction of each section: +The following are the available tables and related documentaion available in `keyboard.toml`: -### `[keyboard]` - -`[keyboard]` section contains basic information of the keyboard, such as keyboard's name, chip, etc: - -```toml -[keyboard] -name = "RMK Keyboard" -vendor_id = 0x4c4b -product_id = 0x4643 -manufacturer = "RMK" -chip = "stm32h7b0vb" -# If your chip doesn't have a functional USB peripheral, for example, nRF52832/esp32c3(esp32c3 has only USB serial, not full functional USB), set `usb_enable` to false -usb_enable = true -``` - -### `[matrix]` - -`[matrix]` section defines the [key matrix](https://docs.qmk.fm/how_a_matrix_works) information of the keyboard, aka input/output pins. - -
-For split keyboard, this section should be just ignored, the matrix IO pins for split keyboard are defined in `[split]` section. -
- -In order to identify the IO pins take a look at your keyboard's schematic: The pin going to the [diode](https://en.wikipedia.org/wiki/Diode) (called anode) is an output pin, the pin coming out (called cathode) is an input pin: -``` -output_pin => >| => input_pin - ↑ - diode(be aware of it's direction) -``` -
-Per default RMK assumes that your pins are `col2row`, meaning that the output pins (anodes) represent the columns and the input pins (cathodes) represent the rows. If your schemata shows the opposite you need to [change the configuration to `row2col`](https://haobogu.github.io/rmk/faq.html#my-matrix-is-row2col-the-matrix-doesnt-work) -
- -IO pins are represented with an array of string, the string value should be the **GPIO peripheral name** of the chip. For example, if you're using stm32h750xb, you can go to to get the valid GPIO peripheral name: - -![gpio_peripheral_name](images/gpio_peripheral_name.png) - -The GPIO peripheral name varies for different chips. For example, RP2040 has `PIN_0`, nRF52840 has `P0_00` and stm32 has `PA0`. So it's recommended to check the embassy's doc for your chip to get the valid GPIO name first. - -Here is an example toml of `[matrix]` section for stm32: - -```toml -[matrix] -# Input and output pins are mandatory -input_pins = ["PD4", "PD5", "PD6", "PD3"] -output_pins = ["PD7", "PD8", "PD9"] -# WARNING: Currently row2col/col2row is set in RMK's feature gate, row2col config here is valid ONLY when you're using cloud compilation -# row2col = true -``` - -If your keys are directly connected to the micro-controller pins, set `matrix_type` to `direct_pin`. (The default value for `matrix_type` is `normal`) - -`direct_pins` is a two-dimensional array that represents the physical layout of your keys. - -If your pin requires a pull-up resistor and the button press pulls the pin low, set `direct_pin_low_active` to true. Conversely, set it to false if your pin requires a pull-down resistor and the button press pulls the pin high. - -Currently, col2row is used as the default matrix type. If you want to use row2col matrix, you should edit your `Cargo.toml`, disable the default feature as the following: - -```toml -# Cargo.toml -rmk = { version = "0.4", default-features = false, features = ["nrf52840_ble"] } -``` - -Here is an example for rp2040. -```toml -matrix_type = "direct_pin" -direct_pins = [ - ["PIN_0", "PIN_1", "PIN_2"], - ["PIN_3", "_", "PIN_5"] -] -# `direct_pin_low_active` is optional. Default is `true`. -direct_pin_low_active = true -``` - -### `[layout]` - -`[layout]` section contains the layout and the default keymap for the keyboard: - -```toml -[layout] -rows = 5 -cols = 4 -layers = 3 -matrix_map = """ - ... the mapping between the "electronic matrix" of your keyboard - and your key map configuration is described here ... -""" -``` - -The `matrix_map` is a string built from `(row, col)` coordinate pairs, listed in the same order as you want to define your keys in your key map. The `(row, col)` coordinates are using zero based indexing and referring to the position in the "electronic matrix" of your keyboard. As you can see above, even the direct pin based keyboards are represented with a matrix. In case of split keyboards, the positions refer to the position in the "big unified matrix" of all split parts. -With the help of this matrix map, the configuration of non-regular key matrices can be intuitively arranged in your key maps. -(Triple quote mark `"""` is used to limit multi-line strings in toml.) - -```toml -# ┌───┬───┬───┬───┐ -# │NUM│ / │ * │ - │ <-- row 0, col 0..4 -# ├───┼───┼───┼───┤ -# │ 7 │ 8 │ 9 │ │ -# ├───┼───┼───┤ + │ -# │ 4 │ 5 │ 6 │ │ -# ├───┼───┼───┼───┤ -# │ 1 │ 2 │ 3 │ E │ -# ├───┴───┼───┤ N │ -# │ 0 │ . │ T │ -# └───────┴───┴───┘ -[layout] -rows = 5 -cols = 4 -layers = 3 -matrix_map = """ -(0,0) (0,1) (0,2) (0,3) -(1,0) (1,1) (1,2) (1,3) -(2,0) (2,1) (2,2) -(3,0) (3,1) (3,2) (3,3) - (4,0) (4,1) -""" -``` - -Once the layout is defined, the key mapping can be described for each layer: - -```toml -# layer 0 (default): -[[layer]] -name = "base_layer" #optional name for the layer -keys = """ -NumLock KpSlash KpAsterisk KpMinus -Kp7 Kp8 Kp9 KpPlus -Kp4 Kp5 Kp6 -Kp1 Kp2 Kp3 Enter - Kp0 KpDot -""" - -# layer 1: -[[layer]] -name = "mouse_navigation" #optional name for the layer -keys = """ -TO(base_layer) @my_cut @my_copy @my_paste -MouseBtn1 MouseUp MouseBtn2 MouseWheelUp -MouseLeft MouseBtn4 MouseRight -MouseWheelLeft MouseDown MouseWheelRight MouseWheelDown - MouseBtn1 MouseBtn12 -""" -``` - -The number and order of entries on each defined layers must be identical with the number and order of entries in `matrix_map`. -White spaces, line breaks are free to vary, but its worth to keep a consistent arrangement with the real keyboard. - -
-If the number of defined layers is smaller than what was defined in `layout.layers`, RMK will fill empty layers automatically (so you can configure them freely in Vial). But the empty layers still consumes flash and RAM, so if you don't have a enough space for them, it's not recommended to use a big layer count. -
- -In each `layer.keys`, the keys are bound to various key actions. Due to the limitation of `toml` file, this is done in a string. -RMK parses the string and fill the to actual keymap initializer, like what's in [`keymap.rs`](https://github.com/HaoboGu/rmk/tree/main/examples/use_rust/rp2040/src/keymap.rs) - -The `layer.keys` string should follow several rules: - -1. For a simple keycode(aka keys in RMK's [`KeyCode`](https://docs.rs/rmk/latest/rmk/keycode/enum.KeyCode.html) enum), just fill its name. - - For example, if you set a keycode `Backspace`, it will be turned to `KeyCode::Backspace`. So you have to ensure that the keycode string is valid, or RMK wouldn't compile! - However, to make things easier a number of [alternative key names](https://github.com/HaoboGu/rmk/blob/main/rmk-macro/src/keycode_alias.rs) were added and also case-insensitive search is used to find the valid [KeyCode](https://docs.rs/rmk/latest/rmk/keycode/enum.KeyCode.html). - - For simple keycodes with modifiers active, you can use `WM(key, modifier)` to create a keypress with modifier action. Modifiers can be chained together like `LShift | RGui` to have multiple modifiers active. - - You may use aliases, prefixed with `@`, like `@my_copy` in the above example. The alias names are case sensitive. The definition of aliases is described below. - - You may use layer names instead of layer numbers, like `TO(base_layer)` in the above example. -
- Please note that layer name if used like this, may not contain white spaces and may not be a number. Layer names are case sensitive. -
- -2. For no-key (`KeyAction::No`), use `No` - -3. For transparent key (`KeyAction::Transparent`), use `_` or `__` (you can put any number of `_`) - -4. RMK supports many advanced layer operations: - 1. Use `DF(n)` to create a switch default layer action, `n` is the layer number - 2. Use `MO(n)` to create a layer activate action, `n` is the layer number - 3. Use `LM(n, modifier)` to create layer activate with modifier action. The modifier can be chained in the same way as `WM` - 4. Use `LT(n, key)` to create a layer activate action or tap key(tap/hold). The `key` here is the RMK [`KeyCode`](https://docs.rs/rmk/latest/rmk/keycode/enum.KeyCode.html) - 5. Use `OSL(n)` to create a one-shot layer action, `n` is the layer number - 6. Use `OSM(modifier)` to create a one-shot modifier action. The modifier can be chained in the same way as `WM` - 7. Use `TT(n)` to create a layer activate or tap toggle action, `n` is the layer number - 8. Use `TG(n)` to create a layer toggle action, `n` is the layer number - 9. Use `TO(n)` to create a layer toggle only action (activate layer `n` and deactivate all other layers), `n` is the layer number - - The definitions of those operations are same with QMK, you can found [here](https://docs.qmk.fm/#/feature_layers). If you want other actions, please [fire an issue](https://github.com/HaoboGu/rmk/issues/new). - -5. For modifier-tap-hold, use `MT(key, modifier)` where the modifier can be a chain like explained on point 1. For example for a Home row modifier config you can use `MT(F, LShift)` - -6. For generic key tap-hold, use `TH(key-tap, key-hold)` - -7. For shifted key, use `SHIFTED(key)` - -### `[aliases]` - -`[aliases]` section contains a table of user defined names and an associated replacement string, which can be used in the `layer.keys`: - -```toml -# here are the aliases for the example above -[aliases] -my_cut = "WM(X, LCtrl)" -my_copy = "WM(C, LCtrl)" -my_paste = "WM(V, LCtrl)" -``` - -
-Please note that alias names may not contain white spaces and they are case sensitive. -
- -### `[behavior]` - -`[behavior]` section contains configuration for how different keyboard actions should behave: - -```toml -[behavior] -tri_layer = { uppper = 1, lower = 2, adjust = 3 } -one_shot = { timeout = "1s" } -``` - -#### Tri Layer - -`Tri Layer` works by enabling a layer (called `adjust`) when other two layers (`upper` and `lower`) are both enabled. - -You can enable Tri Layer by specifying the `upper`, `lower` and `adjust` layers in the `tri_layer` sub-table: - -```toml -[behavior.tri_layer] -uppper = 1 -lower = 2 -adjust = 3 -``` -In this example, when both layers 1 (`upper`) and 2 (`lower`) are active, layer 3 (`adjust`) will also be enabled. - -Note that `"#layer_name"` could also be used in place of layer numbers. - -#### Tap Hold - -In the `tap_hold` sub-table, you can configure the following parameters: - -- `enable_hrm`: Enables or disables HRM (Home Row Mod) mode. When enabled, the `prior_idle_time` setting becomes functional. Defaults to `false`. -- `prior_idle_time`: If the previous non-modifier key is released within this period before pressing the current tap-hold key, the tap action for the tap-hold behavior will be triggered. This parameter is effective only when enable_hrm is set to `true`. Defaults to 120ms. -- `hold_timeout`: Defines the duration a tap-hold key must be pressed to determine hold behavior. If tap-hold key is released within this time, the key is recognized as a "tap". Holding it beyond this duration triggers the "hold" action. Defaults to 250ms. -- `post_wait_time`: Adds an additional delay after releasing a tap-hold key to check if any keys pressed during the `hold_timeout` are released. This helps accommodate fast typing scenarios where some keys may not be fully released during a hold. Defaults to 50ms - -The following are the typical configurations: - -```toml -[behavior] -# Enable HRM -tap_hold = { enable_hrm = true, prior_idle_time = "120ms", hold_timeout = "250ms", post_wait_time = "50ms"} -# Disable HRM, you can safely ignore any fields if you don't want to change them -tap_hold = { enable_hrm = false, hold_timeout = "200ms" } -``` - -#### One Shot - -In the `one_shot` sub-table you can define how long OSM or OSL will wait before releasing the modifier/layer with the `timeout` option, default is one second. -`timeout` is a string with a suffix of either "s" or "ms". - -```toml -[behavior.one_shot] -timeout = "5s" -``` - -#### Combo - -In the `combo` sub-table, you can configure the keyboard's combo key functionality. Combo allows you to define a group of keys that, when pressed simultaneously, will trigger a specific output action. - -Combo configuration includes the following parameters: - -- `timeout`: Defines the maximum time window for pressing all combo keys. If the time exceeds this, the combo key will not be triggered. The format is a string, which can be milliseconds (e.g. "200ms") or seconds (e.g. "1s"). -- `combos`: An array containing all defined combos. Each combo configuration is an object containing the following attributes: - - `actions`: An array of strings defining the keys that need to be pressed simultaneously to trigger the combo action. - - `output`: A string defining the output action to be triggered when all keys in `actions` are pressed simultaneously. - - `layer`: An optional parameter, a number, specifying which layer the combo is valid on. If not specified, the combo is valid on all layers. - -Here is an example of combo configuration: - -```toml -[behavior.combo] -timeout = "150ms" -combos = [ - # Press J and K keys simultaneously to output Escape key - { actions = ["J", "K"], output = "Escape" }, - # Press F and D keys simultaneously to output Tab key, but only valid on layer 0 - { actions = ["F", "D"], output = "Tab", layer = 0 }, - # Three-key combo, press A, S, and D keys to switch to layer 2 - { actions = ["A", "S", "D"], output = "TO(2)" } -] -``` - -#### Fork - -In the `fork` sub-table, you can configure the keyboard's state based key fork functionality. Forks allows you to define a trigger key and condition dependent possible replacement keys. When the trigger key is pressed, the condition is checked by the following rule: -If any of the `match_any` states are active AND none of the `match_none` states active, the trigger key will be replaced with positive_output, otherwise with the negative_output. By default the modifiers listed in `match_any` will be suppressed (even the one-shot modifiers) for the time the replacement key action is executed. However, with `kept_modifiers` some of them can be kept instead of automatic suppression. - -Fork configuration includes the following parameters: - -- `forks`: An array containing all defined forks. Each fork configuration is an object containing the following attributes: - - `trigger`: Defines the triggering key. - - `negative_output`: A string defining the output action to be triggered when the conditions are not met - - `positive_output`: A string defining the output action to be triggered when the conditions are met - - `match_any`: A strings defining a combination of modifier keys, lock leds, mouse buttons (optional) - - `match_none`: A strings defining a combination of modifier keys, lock leds, mouse buttons (optional) - - `kept_modifiers`: A strings defining a combination of modifier keys, which should not be 'suppressed' form the keyboard state for the time the replacement action is executed. (optional) - - `bindable`: Enables the evaluation of not yet triggered forks on the output of this fork to further manipulate the output. Advanced use cases can be solved using this option. (optional) - -For `match_any`, `match_none` the legal values are listed below (many values may be combined with "|"): - - `LShift`, `LCtrl`, `LAlt`, `LGui`, `RShift`, `RCtrl`, `RAlt`, `RGui` (these are including the effect of explicitly held and one-shot modifiers too) - - `CapsLock`, `ScrollLock`, `NumLock`, `Compose`, `Kana` - - `MouseBtn1` .. `MouseBtn8` - -Here is a sample of fork configuration with random examples: - -```toml -[behavior.fork] -forks = [ - # Shift + '.' output ':' key - { trigger = "Dot", negative_output = "Dot", positive_output = "WM(Semicolon, LShift)", match_any = "LShift|RShift" }, - - # Shift + ',' output ';' key but only if no Alt is pressed - { trigger = "Comma", negative_output = "Comma", positive_output = "Semicolon", match_any = "LShift|RShift", match_none = "LAlt|RAlt" }, - - # left bracket outputs by default '{', with shifts pressed outputs '[' - { trigger = "LeftBracket", negative_output = "WM(LeftBracket, LShift)", positive_output = "LeftBracket", match_any = "LShift|RShift" }, - - # Flip the effect of shift on 'x'/'X' - { trigger = "X", negative_output = "WM(X, LShift)", positive_output = "X", match_any = "LShift|RShift" }, - - # F24 usually outputs 'a', except when Left Shift or Ctrl pressed, in that case triggers a macro - { trigger = "F24", negative_output = "A", positive_output = "Macro1", match_any = "LShift|LCtrl" }, - - # Swap Z and Y keys if MouseBtn1 is pressed (on the keyboard) (Note that these must not be bindable to avoid infinite fork loops!) - { trigger = "Y", negative_output = "Y", positive_output = "Z", match_any = "MouseBtn1", bindable = false }, - { trigger = "Z", negative_output = "Z", positive_output = "Y", match_any = "MouseBtn1", bindable = false }, - - # Shift + Backspace output Delete key (inside a layer tap/hold) - { trigger = "LT(2, Backspace)", negative_output = "LT(2, Backspace)", positive_output = "LT(2, Delete)", match_any = "LShift|RShift" }, - - # Ctrl + play/pause will send next track. MediaPlayPause -> MediaNextTrack - # Ctrl + Shift + play/pause will send previous track. MediaPlayPause -> MediaPrevTrack - # Alt + play/pause will send volume up. MediaPlayPause -> AudioVolUp - # Alt + Shift + play/pause will send volume down. MediaPlayPause -> AudioVolDown - # Ctrl + Alt + play/pause will send brightness up. MediaPlayPause -> BrightnessUp - # Ctrl + Alt + Shift + play/pause will send brightness down. MediaPlayPause -> BrightnessDown - # ( Note that the trigger and immediate trigger keys of the fork chain could be 'virtual keys', - # which will never output, like F23, but here multiple overrides demonstrated.) - { trigger = "MediaPlayPause", negative_output = "MediaPlayPause", positive_output = "MediaNextTrack", match_any = "LCtrl|RCtrl", bindable = true }, - { trigger = "MediaNextTrack", negative_output = "MediaNextTrack", positive_output = "BrightnessUp", match_any = "LAlt|RAlt", bindable = true }, - { trigger = "BrightnessUp", negative_output = "BrightnessUp", positive_output = "BrightnessDown", match_any = "LShift|RShift", bindable = false }, - { trigger = "MediaNextTrack", negative_output = "MediaNextTrack", positive_output = "MediaPrevTrack", match_any = "LShift|RShift", match_none = "LAlt|RAlt", bindable = false}, - { trigger = "MediaPlayPause", negative_output = "MediaPlayPause", positive_output = "AudioVolUp", match_any = "LAlt|RAlt", match_none = "LCtrl|RCtrl", bindable = true }, - { trigger = "AudioVolUp", negative_output = "AudioVolUp", positive_output = "AudioVolDown", match_any = "LShift|RShift", match_none = "LCtrl|RCtrl", bindable = false } -] -``` - -Please note that the processing of forks happen after combos and before others, so the trigger key must be the one listed in your keymap (or combo output). -For example if `LT(2, Backspace)` is in your keymap, then `trigger = "Backspace"` will NOT work, you should "replace" the full key and use `trigger = "LT(2, Backspace)"` instead, like in the example above. -You may want to include `F24` or similar dummy keys in your keymap, and use them as trigger for your pre-configured forks, such as Shift/CapsLock dependent macros to enter unicode characters of your language. - -Vial does not support fork configuration yet. - -### `[light]` - -`[light]` section defines lights of the keyboard, aka `capslock`, `scrolllock` and `numslock`. They are actually an input pin, so there are two fields available: `pin` and `low_active`. - -`pin` field is just like IO pins in `[matrix]`, `low_active` defines whether the light low-active or high-active(`true` means low-active). - -You can safely ignore any of them, or the whole `[light]` section if you don't need them. - -```toml -[light] -capslock = { pin = "PIN_0", low_active = true } -scrolllock = { pin = "PIN_1", low_active = true } -numslock= { pin = "PIN_2", low_active = true } -``` - -### `[storage]` - -`[storage]` section defines storage related configs. Storage feature is required to persist keymap data, it's strongly recommended to make it enabled(and it's enabled by default!). RMK will automatically use the last two section of chip's internal flash as the pre-served storage space. For some chips, there's also predefined default configuration, such as [nRF52840](https://github.com/HaoboGu/rmk/blob/main/rmk-macro/src/default_config/nrf52840.rs). If you don't want to change the default setting, just ignore this section. -```toml -[storage] -# Storage feature is enabled by default -enabled = true -# Start address of local storage, MUST BE start of a sector. -# If start_addr is set to 0(this is the default value), the last `num_sectors` sectors will be used. -start_addr = 0x00000000 -# How many sectors are used for storage, the default value is 2 -num_sectors = 2 -``` - -### `[ble]` - -To enable BLE, add `enabled = true` under the `[ble]` section. - -There are several more configs for reading battery level and charging state, now they are available for nRF52840 only. - -```toml -# Ble configuration -# To use the default configuration, ignore this section completely -[ble] -# Whether to enable BLE feature -enabled = true -# nRF52840's saadc pin for reading battery level, you can use a pin number or "vddh" -battery_adc_pin = "vddh" -# The voltage divider setting for saadc. -# For example, nice!nano have 806 + 2M resistors, the saadc measures voltage on 2M resistor, so the two values should be set to 2000 and 2806 -adc_divider_measured = 2000 -adc_divider_total = 2806 -# Pin that reads battery's charging state, `low-active` means the battery is charging when `charge_state.pin` is low -charge_state = { pin = "PIN_1", low_active = true } -# Output LED pin that blinks when the battery is low -charge_led= { pin = "PIN_2", low_active = true } -``` - - - - -## Appendix - -### `keyboard.toml` - -The following toml contains all available settings in `keyboard.toml` - -```toml -# Basic info of the keyboard -[keyboard] -name = "RMK Keyboard" # Keyboard name -product_name = "RMK Keyboard" # Display name of this keyboard -vendor_id = 0x4c4b -product_id = 0x4643 -manufacturer = "haobo" -serial_number = "vial:f64c2b3c:000001" -# The chip or existing board used in keyboard -# Either \"board\" or \"chip\" can be set, but not both -chip = "rp2040" -board = "nice!nano_v2" -# USB is enabled by default for most chips -# Set to false if you don't want USB -usb_enable = true - -# Set matrix IO for the board. This section is for non-split keyboard and is conflict with [split] section -[matrix] -# `matrix_type` is optional. Default is "normal" -matrix_type = "normal" -# Input and output pins -input_pins = ["PIN_6", "PIN_7", "PIN_8", "PIN_9"] -output_pins = ["PIN_19", "PIN_20", "PIN_21"] -# WARNING: Currently row2col/col2row is set in RMK's feature gate, row2col config here is valid ONLY when you're using cloud compilation - -# Direct Pin Matrix is a Matrix of buttons connected directly to pins. It conflicts with the above. -matrix_type = "direct_pin" -direct_pins = [ - ["PIN_0", "PIN_1", "PIN_2"], - ["PIN_3", "_", "PIN_5"] -] - -# `direct_pin_low_active` is optional. Default is `true`. -# If your pin needs to be pulled up and the pin is pulled down when the button is turned on, please set it to true -# WARNING: If you use a normal matrix, it will be ineffective -direct_pin_low_active = true - -# Layout info for the keyboard, this section is mandatory -[layout] -# Number of rows. For split keyboard, this is the total rows contains all splits -rows = 5 -# Number of cols. For split keyboard, this is the total cols contains all splits -cols = 4 -# Number of layers. Be careful, since large layer number takes more flash and RAM -layers = 3 -# keypad example: -# ┌───┬───┬───┬───┐ -# │NUM│ / │ * │ - │ <-- row 0, col 0..4 -# ├───┼───┼───┼───┤ -# │ 7 │ 8 │ 9 │ │ -# ├───┼───┼───┤ + │ -# │ 4 │ 5 │ 6 │ │ -# ├───┼───┼───┼───┤ -# │ 1 │ 2 │ 3 │ E │ -# ├───┴───┼───┤ N │ -# │ 0 │ . │ T │ -# └───────┴───┴───┘ -matrix_map = """ -(0,0) (0,1) (0,2) (0,3) -(1,0) (1,1) (1,2) (1,3) -(2,0) (2,1) (2,2) -(3,0) (3,1) (3,2) (3,3) -(4,0) (4,1) -""" - -# here are the aliases for the example layer.keys below -[aliases] -my_cut = "WM(X, LCtrl)" -my_copy = "WM(C, LCtrl)" -my_paste = "WM(V, LCtrl)" - -# Key map definitions per layer: -# The number (and order) of entries on each layer should be -# identical with the number (and order) of entries in `matrix_map`. -# Empty layers will be used to fill if the number of explicitly -# defined layers is smaller then `layout.layers` setting - -# layer 0 (default): -# (the number comes from the order of '[[layer]] entries' in the file) -[[layer]] -name = "base_layer" #optional name for the layer -keys = """ -NumLock KpSlash KpAsterisk KpMinus -Kp7 Kp8 Kp9 KpPlus -Kp4 Kp5 Kp6 -Kp1 Kp2 Kp3 Enter - Kp0 KpDot -""" - -# layer 1: -[[layer]] -name = "mouse_navigation" #optional name for the layer -keys = """ -TO(base_layer) @MyCut @MyCopy @MyPaste -MouseBtn1 MouseUp MouseBtn2 MouseWheelUp -MouseLeft MouseBtn4 MouseRight -MouseWheelLeft MouseDown MouseWheelRight MouseWheelDown - MouseBtn1 MouseBtn12 -""" - -# Behavior configuration, if you don't want to customize anything, just ignore this section -[behavior] -# Tri Layer configuration -tri_layer = { uppper = 1, lower = 2, adjust = 3 } -# One Shot configuration -one_shot = { timeout = "1s" } - -# Lighting configuration, if you don't have any light, just ignore this section. -[light] -# LED pins, capslock, scrolllock, numslock. You can safely ignore any of them if you don't have -capslock = { pin = "PIN_0", low_active = true } -scrolllock = { pin = "PIN_1", low_active = true } -numslock = { pin = "PIN_2", low_active = true } - -# Storage configuration. -# To use the default configuration, ignore this section completely -[storage] -# Whether the storage is enabled -enabled = true -# The start address of storage -start_addr = 0x60000 -# Number of sectors used for storage, >= 2 -start_addr = 16 - -# Ble configuration -# To use the default configuration, ignore this section completely -[ble] -# Whether the ble is enabled -enabled = true -# BLE related pins, ignore any of them if you don't have -battery_adc_pin = "vddh" -# If the voltage divider is used for adc, you can use the following two values to define a voltage divider. -# For example, nice!nano have 806 + 2M resistors, the saadc measures voltage on 2M resistor, so the two values should be set to 2000 and 2806 -# Measured resistance for input adc, it should be less than adc_divider_total -adc_divider_measured = 2000 -# Total resistance of the full path for input adc -adc_divider_total = 2806 -# Pin that reads battery's charging state, `low-active` means the battery is charging when `charge_state.pin` is low -# Input pin that indicates the charging state -charge_state = { pin = "PIN_1", low_active = true } -# Output LED pin that blinks when the battery is low -charge_led= { pin = "PIN_2", low_active = true } - -# Split configuration -# This section is conflict with [split] section, you could only have either [matrix] or [split], but NOT BOTH -[split] -# Connection type of split, "serial" or "ble" -connection = "serial" - -# Split central config -[split.central] -# Number of rows on central board -rows = 2 -# Number of cols on central board -cols = 2 -# Row offset of central matrix to the whole matrix -row_offset = 0 -# Col offset of central matrix to the whole matrix -col_offset = 0 -# If the connection type is "serial", the serial instances used on the central board are defined using "serial" field. -# It's a list of serial instances with a length equal to the number of splits. -# The order of the serial instances is important: the first serial instance on the central board -# communicates with the first split peripheral defined, and so on. -serial = [ - { instance = "UART0", tx_pin = "PIN_0", rx_pin = "PIN_1" }, - { instance = "UART1", tx_pin = "PIN_4", rx_pin = "PIN_5" }, - # For the RP2040 only, you can also use RMK's Programmable IO (PIO) UART serial port using either or both of the RP2040's two PIO blocks, PIO0 and PIO1, by enabling the RMK `rp2040_pio` feature gate in Cargo.toml. - # The PIO serial port can be used in half-duplex mode using the same pin for RX/TX - { instance = "PIO0", tx_pin = "PIN_6", rx_pin = "PIN_6" }, - # Or use the PIO serial port in full-duplex mode using different pins for RX/TX - { instance = "PIO1", tx_pin = "PIN_7", rx_pin = "PIN_8" }, -] -# If the connection type is "ble", we should have `ble_addr` to define the central's BLE static address -# This address should be a valid BLE random static address, see: https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-2-bluetooth-le-advertising/topic/bluetooth-address/ -ble_addr = [0x18, 0xe2, 0x21, 0x80, 0xc0, 0xc7] - -[split.central.matrix] -matrix_type = "normal" -# Matrix IO definition on central board -input_pins = ["PIN_9", "PIN_11"] -output_pins = ["PIN_10", "PIN_12"] - -# Configuration for the first split peripheral -# Note the double brackets [[ ]], which indicate that multiple split peripherals can be defined. -# The order of peripherals is important: it should match the order of the serial instances(if serial is used). -[[split.peripheral]] -# Number of rows on peripheral board -rows = 2 -# Number of cols on peripheral board -cols = 1 -# Row offset of peripheral matrix to the whole matrix -row_offset = 2 -# Col offset of peripheral matrix to the whole matrix -col_offset = 2 -# The serial instance used to communication with the central board, if the connection type is "serial" -serial = [{ instance = "UART0", tx_pin = "PIN_0", rx_pin = "PIN_1" }] -# The BLE random static address of the peripheral board -ble_addr = [0x7e, 0xfe, 0x73, 0x9e, 0x66, 0xe3] - -[split.peripheral.matrix] -matrix_type = "normal" -# Matrix IO definition on peripheral board -input_pins = ["PIN_9", "PIN_11"] -output_pins = ["PIN_10"] - -# More split peripherals(if you have) -[[split.peripheral]] -# The configuration is same with the first split peripheral -... -... -... - -# Dependency config -[dependency] -# Whether to enable defmt, set to false for reducing binary size -defmt_log = true -``` - -### Available chip names - -Available chip names in `chip` field: -- rp2040 -- nrf52840 -- nrf52833 -- nrf52832 -- nrf52811 -- nrf52810 -- esp32c3 -- esp32c6 -- esp32s3 -- ALL stm32s supported by [embassy-stm32](https://github.com/embassy-rs/embassy/blob/main/embassy-stm32/Cargo.toml) with USB - -### Available board names - -Available board names in `board` field: -- nice!nano -- nice!nano_v2 -- XIAO BLE - -If you want to add more built-in boards, feel free to open a PR! +- [Keyboard and matrix](configuration/keyboard_matrix.md): basic information and physical key matrix definition of the keyboard +- [Layout](configuration/layout.md): layout and default keymap configuration of the keyboard +- [Split keyboard](configuration/split.md): split keyboard configuration +- [Storage](configuration/storage.md): configuration for storage, which is used for on-board config and keymap +- [Behavior](configuration/behavior.md): configuration for advanced keyboard behaviors, such as one-shot key, tri-layer, tap-hold(including HRM mode), etc. +- [Input device](configuration/input_device.md): configuration for input devices, such as rotary encoder, joystick, etc. +- [Wireless/Bluetooth](configuration/wireless.md): configuration for wireless/bluetooth +- [Light](configuration/light.md): configuration for lights +- [Appendix](configuration/appendix.md): full spec and references of the `keyboard.toml` ## TODOs: -- [x] gen keymap from `keyboard.toml` -- [ ] read vial.json and gen +- [ ] read vial.json and check whether vial.json is consist of keyboard.toml diff --git a/docs/src/split_keyboard.md b/docs/src/split_keyboard.md index 420e94699..cb5b1dd1c 100644 --- a/docs/src/split_keyboard.md +++ b/docs/src/split_keyboard.md @@ -162,41 +162,32 @@ In RMK, split keyboard's matrix are defined with row/col number and their offset ### Central -Running split central is quite similar with the general keyboard, the only difference is for split central, total row/col number, central matrix's row/col number, and central matrix's offsets should be passed to `run_rmk_split_central`: +Matrix configuration on the split central is quite similar with the general keyboard, the only difference is for split central, central matrix's row/col number, and central matrix's offsets should be passed to the central matrix: ```rust -// nRF52840 split central, arguments might be different for other microcontrollers, check the API docs for the detail. -run_rmk_split_central::< - Input<'_>, - Output<'_>, - Driver<'_, USBD, &SoftwareVbusDetect>, - ROW, // TOTAL_ROW - COL, // TOTAL_COL - 2, // CENTRAL_ROW - 2, // CENTRAL_COL - 0, // CENTRAL_ROW_OFFSET - 0, // CENTRAL_COL_OFFSET - NUM_LAYER, - >( - input_pins, - output_pins, - driver, - &mut get_default_keymap(), - keyboard_config, - central_addr, - spawner, - ) +// Suppose that the central matrix is col2row +let mut matrix = CentralMatrix::< + _, + _, + _, + 0, // ROW OFFSET + 0, // COL OFFSET + 4, // ROW + 7, // COL +>::new(input_pins, output_pins, debouncer); ``` -In peripheral central, you should also run the peripheral manager for each peripheral. This task monitors the peripheral key changes and forwards them to central core keyboard task +On the central, you should also run the peripheral manager for each peripheral. This task monitors the peripheral key changes and forwards them to central core keyboard task ```rust +// nRF52840 split central, arguments might be different for other microcontrollers, check the API docs for the detail. run_peripheral_manager< 2, // PERIPHERAL_ROW 1, // PERIPHERAL_COL 2, // PERIPHERAL_ROW_OFFSET 2, // PERIPHERAL_COL_OFFSET - >(peripheral_id, peripheral_addr) + _, + >(peripheral_id, peripheral_addr, &stack) ``` ### Peripheral @@ -204,13 +195,11 @@ run_peripheral_manager< Running split peripheral is simplier. For peripheral, we don't need to specify peripheral matrix's offsets(we've done it in central!). So, the split peripheral API is like: ```rust -run_rmk_split_peripheral::, Output<'_>, 2, 2>( - input_pins, - output_pins, - central_addr, - peripheral_addr, - spawner, -) +// Use normal matrix on the peripheral +let mut matrix = Matrix::<_, _, _, 4, 7>::new(input_pins, output_pins, debouncer); + +// nRF52840 split peripheral, arguments might be different for other microcontrollers, check the API docs for the detail. +run_rmk_split_peripheral(central_addr, &stack), ``` where `2,2` are the size of peripheral's matrix. diff --git a/docs/src/use_rust_api.md b/docs/src/use_rust_api.md index 7b3ebc55c..b45dba193 100644 --- a/docs/src/use_rust_api.md +++ b/docs/src/use_rust_api.md @@ -8,7 +8,8 @@ By default, the generated project uses `keyboard.toml` to config the RMK keyboar For other ARM Cortex-M microcontrollers, you only need to update the `LENGTH` of FLASH and RAM to your microcontroller. -If you're using **nRF52840**, generally you have to change start address in `memory.x` to 0x27000 or 0x26000, according to your softdevice version. For example, softdevice v6.1.x should use 0x00026000 and v7.1.x should be 0x00027000 +If you're using **nRF52840**, ensure that you have [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader) flashed to your board. Most nice!nano compatible boards have it already. As long as you can open a USB drive for your board and update uf2 firmware by dragging and dropping, you're all set. + You can either checkout your microcontroller's datasheet or existing Rust project of your microcontroller for it. diff --git a/docs/src/user_guide/2-2_local_compilation.md b/docs/src/user_guide/2-2_local_compilation.md index 979123fe9..78529cd85 100644 --- a/docs/src/user_guide/2-2_local_compilation.md +++ b/docs/src/user_guide/2-2_local_compilation.md @@ -101,7 +101,7 @@ The [Keyboard Configuration](../keyboard_configuration.md) section has full inst For other ARM Cortex-M microcontrollers, you only need to update the `LENGTH` of FLASH and RAM to your microcontroller. -If you're using **nRF52840**, generally you have to change start address in `memory.x` to 0x27000 or 0x26000, according to your softdevice version. For example, softdevice v6.1.x should use 0x00026000 and v7.3.0 should be 0x00027000 +If you're using **nRF52840**, ensure that you have [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader) flashed to your board. Most nice!nano compatible boards have it already. As long as you can open a USB drive for your board and update uf2 firmware by dragging and dropping, you're all set. You can either checkout your microcontroller's datasheet or an existing Rust project of your microcontroller for it. diff --git a/docs/src/user_guide/3_flash_firmware.md b/docs/src/user_guide/3_flash_firmware.md index b051669ac..268c0ced2 100644 --- a/docs/src/user_guide/3_flash_firmware.md +++ b/docs/src/user_guide/3_flash_firmware.md @@ -10,29 +10,30 @@ If you're using macOS, an error might appear, you can safely ignore it. ### Tips for nRF52840 -For nRF52840, there are several widely used UF2 bootloaders, they require slight different configs. - -First, you should check the used softdevice version of your bootloader. Enter bootloader mode, there will be an USB driver shown in your computer. Open `INFO_UF2.TXT` in the USB driver, the content of `INFO_UF2.TXT` should be like: +For nRF52840, you need to check whether your have a UF2 bootloader flashed to your board. If you can enter bootloader mode, there will be an USB drive shown in your computer. If there's `INFO_UF2.TXT` in the USB drive, you have it! Then check the `memory.x`, ensure that the flash origin starts with 0x00001000: ``` -UF2 Bootloader 0.6.0 lib/nrfx (v2.0.0) lib/tinyusb (0.10.1-41-gdf0cda2d) lib/uf2 (remotes/origin/configupdate-9-gadbb8c7) -Model: nice!nano -Board-ID: nRF52840-nicenano -SoftDevice: S140 version 6.1.1 -Date: Jun 19 2021 +MEMORY +{ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 WITH Adafruit nRF52 bootloader */ + FLASH : ORIGIN = 0x00001000, LENGTH = 1020K + RAM : ORIGIN = 0x20000008, LENGTH = 255K + + /* These values correspond to the nRF52840 */ + /* FLASH : ORIGIN = 0x00000000, LENGTH = 1024K */ + /* RAM : ORIGIN = 0x20000000, LENGTH = 256K */ +} ``` -As you can see, the version of softdevice is `S140 version 6.1.1`. For nRF52840, RMK supports S140 version 6.X and 7.X. The `memory.x` config is slightly different for softdevice 6.X and 7.X: +If you have a debug probe and don't want to use the bootloader, use the following `memory.x` config: -```ld -MEMORY +``` { - /* These values correspond to the NRF52840 with Softdevices S140 6.1.1 */ - /* FLASH : ORIGIN = 0x00026000, LENGTH = 824K */ - - /* These values correspond to the NRF52840 with Softdevices S140 7.3.0 */ - FLASH : ORIGIN = 0x00027000, LENGTH = 820K - RAM : ORIGIN = 0x20020000, LENGTH = 128K + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 */ + FLASH : ORIGIN = 0x00000000, LENGTH = 1024K + RAM : ORIGIN = 0x20000000, LENGTH = 256K } ``` diff --git a/examples/use_config/esp32c3_ble/.cargo/config.toml b/examples/use_config/esp32c3_ble/.cargo/config.toml index 29c169db7..0505a90e0 100644 --- a/examples/use_config/esp32c3_ble/.cargo/config.toml +++ b/examples/use_config/esp32c3_ble/.cargo/config.toml @@ -1,18 +1,13 @@ -[build] -target = "riscv32imc-esp-espidf" - -[target.riscv32imc-esp-espidf] -linker = "ldproxy" -runner = "espflash flash --monitor --log-format defmt" -rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110 +[target.'cfg(all(any(target_arch = "riscv32", target_arch = "xtensa"), target_os = "none"))'] +runner = "espflash flash --monitor" -[unstable] -build-std = ["std", "panic_abort"] +[build] +target = "riscv32imc-unknown-none-elf" +rustflags = [ + # Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.) + # NOTE: May negatively impact performance of produced code + "-C", "force-frame-pointers", +] [env] -MCU="esp32c3" -# Note: this variable is not used by the pio builder (`cargo build --features pio`) -ESP_IDF_VERSION = "v5.2" -DEFMT_LOG="debug" -ESP_IDF_PATH_ISSUES="warn" -CRATE_CC_NO_DEFAULTS="1" \ No newline at end of file +ESP_LOG = "info" \ No newline at end of file diff --git a/examples/use_config/esp32c3_ble/Cargo.lock b/examples/use_config/esp32c3_ble/Cargo.lock index ef92edaa7..b51984261 100644 --- a/examples/use_config/esp32c3_ble/Cargo.lock +++ b/examples/use_config/esp32c3_ble/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -34,13 +45,10 @@ dependencies = [ ] [[package]] -name = "aligned" -version = "0.4.2" +name = "allocator-api2" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377e4c0ba83e4431b10df45c1d4666f178ea9c552cac93e60c3a88bf32785923" -dependencies = [ - "as-slice", -] +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android-tzdata" @@ -59,18 +67,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.94" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" - -[[package]] -name = "as-slice" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" -dependencies = [ - "stable_deref_trait", -] +checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" [[package]] name = "atomic-polyfill" @@ -81,24 +80,12 @@ dependencies = [ "critical-section", ] -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "autocfg" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" -[[package]] -name = "az" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" - [[package]] name = "bare-metal" version = "0.2.5" @@ -109,23 +96,18 @@ dependencies = [ ] [[package]] -name = "bindgen" -version = "0.71.1" +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "basic-toml" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" +checksum = "ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a" dependencies = [ - "bitflags 2.6.0", - "cexpr", - "clang-sys", - "itertools", - "log", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.96", + "serde", ] [[package]] @@ -140,15 +122,35 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" +[[package]] +name = "bitfield" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7e6caee68becd795bfd65f1a026e4d00d8f0c2bc9be5eb568e1015f9ce3c34" +dependencies = [ + "bitfield-macros", +] + +[[package]] +name = "bitfield-macros" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "331afbb18ce7b644c0b428726d369c5dd37ca0b815d72a459fcc2896c3c8ad32" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "bitfield-struct" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bedc5f4fa33bdc993f9b8ba7369d1b74fcdafa958924a0a54de6707e360de692" +checksum = "2be5a46ba01b60005ae2c51a36a29cfe134bcacae2dd5cedcd4615fbaad1494b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] @@ -159,44 +161,45 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] -name = "bstr" -version = "1.11.1" +name = "block-buffer" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "memchr", - "serde", + "generic-array", ] [[package]] -name = "build-time" -version = "0.1.3" +name = "bt-hci" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1219c19fc29b7bfd74b7968b420aff5bc951cf517800176e795d6b2300dd382" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" dependencies = [ - "chrono", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.96", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", ] [[package]] name = "bumpalo" -version = "3.16.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "bytemuck" -version = "1.21.0" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" +checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" [[package]] name = "byteorder" @@ -204,38 +207,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "camino" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" -dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.24", - "serde", - "serde_json", - "thiserror 1.0.69", -] - [[package]] name = "cargo_toml" version = "0.21.0" @@ -248,66 +219,52 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.9" +version = "1.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b" +checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" dependencies = [ "shlex", ] -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "chrono" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets", + "windows-link", ] [[package]] -name = "clang-sys" -version = "1.8.1" +name = "cipher" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ - "glob", - "libc", - "libloading", + "crypto-common", + "inout", ] [[package]] -name = "cmake" -version = "0.1.52" +name = "cmac" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" dependencies = [ - "cc", + "cipher", + "dbl", + "digest", ] [[package]] @@ -318,9 +275,9 @@ checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" [[package]] name = "const-gen" -version = "1.6.5" +version = "1.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb4caa28784488578a9aa32e0a33f0543d961345fc25efc3f04243be3fa6299" +checksum = "6d7617801a02ebd66905a39f5a15390bfb7d6ab90316fdbf7dc36a1161ffb56b" dependencies = [ "const-gen-derive", ] @@ -337,24 +294,10 @@ dependencies = [ ] [[package]] -name = "const_format" -version = "0.2.34" +name = "const-oid" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd" -dependencies = [ - "const_format_proc_macros", -] - -[[package]] -name = "const_format_proc_macros" -version = "0.2.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "core-foundation-sys" @@ -375,23 +318,12 @@ dependencies = [ ] [[package]] -name = "cortex-m-rt" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" -dependencies = [ - "cortex-m-rt-macros", -] - -[[package]] -name = "cortex-m-rt-macros" -version = "0.7.5" +name = "cpufeatures" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.96", + "libc", ] [[package]] @@ -410,161 +342,130 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] -name = "crossbeam-deque" -version = "0.8.6" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", ] [[package]] -name = "crossbeam-epoch" -version = "0.9.18" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "cvt" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ae9bf77fbf2d39ef573205d554d87e86c12f1994e9ea335b0651b9b278bcf1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "typenum", ] [[package]] name = "darling" -version = "0.20.10" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", -] - -[[package]] -name = "darling_core" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.11.1", - "syn 2.0.96", + "strsim", + "syn 2.0.100", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.96", + "generic-array", ] [[package]] -name = "defmt" -version = "0.3.10" +name = "delegate" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "b9b6483c2bbed26f97861cf57651d4f2b731964a28cd2257f934a4b452480d21" dependencies = [ - "bitflags 1.3.2", - "defmt-macros", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] -name = "defmt-macros" -version = "0.4.0" +name = "der" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ - "defmt-parser", - "proc-macro-error2", - "proc-macro2", - "quote", - "syn 2.0.96", + "const-oid", + "zeroize", ] [[package]] -name = "defmt-parser" -version = "0.4.1" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "thiserror 2.0.7", + "block-buffer", + "crypto-common", + "subtle", ] [[package]] name = "document-features" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" dependencies = [ "litrs", ] [[package]] -name = "either" -version = "1.13.0" +name = "elliptic-curve" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] [[package]] name = "embassy-embedded-hal" @@ -572,7 +473,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", "embassy-futures", "embassy-sync", "embassy-time", @@ -587,11 +487,9 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "critical-section", - "defmt", "document-features", "embassy-executor-macros", ] @@ -599,35 +497,18 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" -dependencies = [ - "defmt", -] - -[[package]] -name = "embassy-hal-internal" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "num-traits", -] +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" [[package]] name = "embassy-net-driver" @@ -646,45 +527,13 @@ dependencies = [ "embassy-sync", ] -[[package]] -name = "embassy-nrf" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7494efe1e0183568327c7e681d4b77ed5241921dcb5976426d9a65b65a0c81" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cortex-m", - "cortex-m-rt", - "critical-section", - "defmt", - "document-features", - "embassy-embedded-hal", - "embassy-hal-internal", - "embassy-sync", - "embassy-time", - "embassy-usb-driver", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-async", - "embedded-io", - "embedded-io-async", - "embedded-storage", - "embedded-storage-async", - "fixed", - "nrf-pac", - "rand_core", -] - [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", "embedded-io-async", "futures-sink", "futures-util", @@ -699,10 +548,8 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", "document-features", "embassy-time-driver", - "embassy-time-queue-utils", "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-async", @@ -734,7 +581,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -749,9 +595,6 @@ name = "embassy-usb-driver" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" -dependencies = [ - "defmt", -] [[package]] name = "embedded-can" @@ -777,9 +620,6 @@ name = "embedded-hal" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" -dependencies = [ - "defmt", -] [[package]] name = "embedded-hal-async" @@ -787,28 +627,14 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", "embedded-hal 1.0.0", ] -[[package]] -name = "embedded-hal-nb" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" -dependencies = [ - "embedded-hal 1.0.0", - "nb 1.1.0", -] - [[package]] name = "embedded-io" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" -dependencies = [ - "defmt", -] [[package]] name = "embedded-io-async" @@ -816,7 +642,6 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", "embedded-io", ] @@ -835,22 +660,6 @@ dependencies = [ "embedded-storage", ] -[[package]] -name = "embedded-svc" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b85590a7a120e370bed5b6bc2b399b345c60d4c749d3bc06039472da37b9893" -dependencies = [ - "defmt", - "embedded-io", - "embedded-io-async", - "enumset", - "heapless 0.8.0", - "num_enum", - "serde", - "strum 0.25.0", -] - [[package]] name = "embuild" version = "0.33.0" @@ -858,22 +667,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28a8cbd9507fabce8f2741b9ca45da9e898cc2b0f1c2e53d21cb2436aeac811d" dependencies = [ "anyhow", - "bindgen", "bitflags 1.3.2", - "cmake", "filetime", - "globwalk", - "home", "log", - "regex", - "remove_dir_all", - "serde", - "serde_json", "shlex", - "strum 0.24.1", - "tempfile", "thiserror 1.0.69", - "which", ] [[package]] @@ -882,6 +680,18 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "enumset" version = "1.1.5" @@ -897,155 +707,251 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59c3b24c345d8c314966bdc1832f6c2635bfcce8e7cf363bd115987bba2ee242" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] -name = "envy" -version = "0.4.2" +name = "equivalent" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f47e0157f2cb54f5ae1bd371b30a2ae4311e1c028f575cd4e81de7353215965" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "esp-alloc" +version = "0.7.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "serde", + "allocator-api2", + "cfg-if", + "critical-section", + "document-features", + "enumset", + "linked_list_allocator", ] [[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +name = "esp-backtrace" +version = "0.15.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "cfg-if", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-println", + "heapless 0.8.0", +] [[package]] -name = "errno" -version = "0.3.10" +name = "esp-build" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +checksum = "8aa1c8f9954c9506699cf1ca10a2adcc226ff10b6ae3cb9e875cf2c6a0b9a372" dependencies = [ - "libc", - "windows-sys 0.59.0", + "quote", + "syn 2.0.100", + "termcolor", ] [[package]] name = "esp-build" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aa1c8f9954c9506699cf1ca10a2adcc226ff10b6ae3cb9e875cf2c6a0b9a372" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "quote", - "syn 2.0.96", + "syn 2.0.100", "termcolor", ] [[package]] -name = "esp-idf-hal" -version = "0.45.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775ce25171dc4f615146a4a27ed3a64c6fd99ced77d7112062f2b19bf933f5db" +name = "esp-config" +version = "0.3.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "atomic-waker", + "document-features", + "serde", + "serde_json", +] + +[[package]] +name = "esp-hal" +version = "1.0.0-beta.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "basic-toml", + "bitfield 0.18.1", + "bitflags 2.9.0", + "bytemuck", + "cfg-if", "critical-section", + "delegate", + "document-features", + "embassy-embedded-hal", + "embassy-futures", "embassy-sync", "embedded-can", - "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-async", - "embedded-hal-nb", "embedded-io", "embedded-io-async", - "embuild", "enumset", - "esp-idf-sys", - "heapless 0.8.0", - "log", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal-procmacros", + "esp-metadata", + "esp-riscv-rt", + "esp32c3", + "fugit", + "instability", "nb 1.1.0", - "num_enum", + "paste", + "portable-atomic", + "rand_core 0.6.4", + "rand_core 0.9.3", + "riscv", + "serde", + "strum 0.27.1", + "ufmt-write", + "void", + "xtensa-lx", + "xtensa-lx-rt", ] [[package]] -name = "esp-idf-svc" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc07aaba257d28d54a96af005ca67d0b38876d8837f5d54a3e0547e100b219c" +name = "esp-hal-embassy" +version = "0.7.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "embassy-futures", + "critical-section", + "document-features", + "embassy-executor", + "embassy-sync", + "embassy-time", "embassy-time-driver", "embassy-time-queue-utils", - "embedded-hal-async", - "embedded-storage", - "embedded-svc", - "embuild", - "enumset", - "esp-idf-hal", - "futures-io", - "heapless 0.8.0", - "log", - "num_enum", - "uncased", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal", + "esp-hal-procmacros", + "esp-metadata", + "portable-atomic", + "static_cell", ] [[package]] -name = "esp-idf-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb77a3d02b579a60a811ed9be22b78c5e794bc492d833ee7fc44d3a0155885e1" +name = "esp-hal-procmacros" +version = "0.17.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "darling", + "document-features", + "litrs", + "proc-macro-crate", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "esp-metadata" +version = "0.6.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "anyhow", - "build-time", - "cargo_metadata", - "cmake", - "const_format", - "embuild", - "envy", - "libc", - "regex", + "basic-toml", "serde", - "strum 0.24.1", - "which", + "strum 0.26.3", ] [[package]] name = "esp-println" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645e54eb592ca0a3d60213b1695e2a5fc0b51ca6d693c08d6983857224a629ed" +version = "0.13.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "critical-section", - "defmt", - "esp-build", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", "log", "portable-atomic", ] [[package]] -name = "esp32-nimble" +name = "esp-riscv-rt" version = "0.10.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "document-features", + "riscv", + "riscv-rt-macros", +] + +[[package]] +name = "esp-storage" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88cc737968921dc601fafaf3ca83f8fca5039cfc6a46e402cb042da647a0c00f" +checksum = "1e98b5069bd1482fb85f9236f8ea6cd1b5b6b5a1c3c3fb8c938c97ccfbbb051b" dependencies = [ - "anyhow", - "bitflags 2.6.0", - "bstr", + "critical-section", + "embedded-storage", + "esp-build 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "esp-wifi" +version = "0.13.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "allocator-api2", + "bt-hci", "cfg-if", + "critical-section", + "document-features", "embassy-sync", - "embuild", - "esp-idf-svc", - "heapless 0.8.0", - "log", - "num_enum", - "once_cell", - "uuid", - "zerocopy 0.8.14", - "zerocopy-derive 0.8.14", + "embedded-io", + "embedded-io-async", + "esp-alloc", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal", + "esp-metadata", + "esp-wifi-sys", + "num-derive", + "num-traits", + "portable-atomic", + "portable_atomic_enum", + "rand_core 0.6.4", ] [[package]] -name = "fastrand" -version = "2.3.0" +name = "esp-wifi-sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6b5438361891c431970194a733415006fb3d00b6eb70b3dcb66fd58f04d9b39" +dependencies = [ + "anyhow", +] + +[[package]] +name = "esp32c3" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1bbcfa3ab2979171263db80804dabc38bdd45450c7eb775ee3f81d552cf0ba" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "ff" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] [[package]] name = "filetime" @@ -1056,19 +962,7 @@ dependencies = [ "cfg-if", "libc", "libredox", - "windows-sys 0.59.0", -] - -[[package]] -name = "fixed" -version = "1.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a" -dependencies = [ - "az", - "bytemuck", - "half", - "typenum", + "windows-sys", ] [[package]] @@ -1078,17 +972,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "fs_at" -version = "0.2.1" +name = "fugit" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14af6c9694ea25db25baa2a1788703b9e7c6648dcaeeebeb98f7561b5384c036" +checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" dependencies = [ - "aligned", - "cfg-if", - "cvt", - "libc", - "nix", - "windows-sys 0.52.0", + "gcd", ] [[package]] @@ -1121,6 +1010,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -1135,7 +1034,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] @@ -1165,43 +1064,31 @@ dependencies = [ ] [[package]] -name = "glob" -version = "0.3.1" +name = "gcd" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" [[package]] -name = "globset" -version = "0.4.15" +name = "generic-array" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "globwalk" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" -dependencies = [ - "bitflags 1.3.2", - "ignore", - "walkdir", + "typenum", + "version_check", + "zeroize", ] [[package]] -name = "half" -version = "2.4.1" +name = "group" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ - "cfg-if", - "crunchy", + "ff", + "rand_core 0.6.4", + "subtle", ] [[package]] @@ -1263,29 +1150,39 @@ dependencies = [ [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] -name = "home" -version = "0.5.9" +name = "hkdf" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ - "windows-sys 0.52.0", + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", ] [[package]] name = "iana-time-zone" -version = "0.1.61" +version = "0.1.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +checksum = "b2fd658b06e56721792c5df4475705b6cda790e9298d19d2f8af083457bcd127" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", "windows-core", ] @@ -1306,51 +1203,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] -name = "ignore" -version = "0.4.23" +name = "indexmap" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata", - "same-file", - "walkdir", - "winapi-util", + "equivalent", + "hashbrown 0.15.2", ] [[package]] -name = "indexmap" -version = "2.7.0" +name = "indoc" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd" + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ - "equivalent", - "hashbrown 0.15.2", + "generic-array", ] [[package]] -name = "itertools" -version = "0.12.1" +name = "instability" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "0bf9fed6d91cfb734e7476a06bde8300a1b94e217e1b523b6f0cd1a01998c71d" dependencies = [ - "either", + "darling", + "indoc", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", @@ -1370,19 +1270,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.168" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" - -[[package]] -name = "libloading" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" -dependencies = [ - "cfg-if", - "windows-targets", -] +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "libredox" @@ -1390,22 +1280,25 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "libc", "redox_syscall", ] [[package]] -name = "linux-raw-sys" -version = "0.4.14" +name = "linked_list_allocator" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" [[package]] name = "litrs" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" +dependencies = [ + "proc-macro2", +] [[package]] name = "lock_api" @@ -1419,9 +1312,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.25" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "lzma-sys" @@ -1441,97 +1334,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "nb" -version = "0.1.3" +name = "minijinja" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +checksum = "6e36f1329330bb1614c94b78632b9ce45dd7d761f3304a1bed07b2990a7c5097" dependencies = [ - "nb 1.1.0", + "serde", ] [[package]] name = "nb" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" - -[[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cfg_aliases", - "libc", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "normpath" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8911957c4b1549ac0dc74e30db9c8b0e66ddcd6d7acc33098f4c63a64a6d7ed" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "nrf-pac" -version = "0.1.0" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" -dependencies = [ - "cortex-m", - "cortex-m-rt", -] - -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", +checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +dependencies = [ + "nb 1.1.0", ] [[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +name = "nb" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ - "Inflector", - "darling 0.13.4", "proc-macro2", "quote", - "syn 1.0.109", - "uuid", + "syn 2.0.100", ] [[package]] @@ -1558,17 +1392,26 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "once_cell" -version = "1.20.2" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] [[package]] name = "paste" @@ -1576,11 +1419,56 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror 2.0.12", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -1590,15 +1478,36 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" + +[[package]] +name = "portable_atomic_enum" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d48f60c43e0120bb2bb48589a16d4bed2f4b911be41e299f2d0fc0e0e20885" +dependencies = [ + "portable-atomic", + "portable_atomic_enum_macros", +] + +[[package]] +name = "portable_atomic_enum_macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33fa6ec7f2047f572d49317cca19c87195de99c6e5b6ee492da701cfe02b053" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] [[package]] name = "postcard" @@ -1607,7 +1516,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", "heapless 0.7.17", "postcard-derive", "serde", @@ -1624,21 +1532,39 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" -version = "0.2.25" +version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +checksum = "5316f57387668042f561aae71480de936257848f9c43ce528e311d89a07cadeb" dependencies = [ "proc-macro2", - "syn 2.0.96", + "syn 2.0.100", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", ] [[package]] name = "proc-macro-crate" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" dependencies = [ "toml_edit", ] @@ -1662,40 +1588,62 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] +[[package]] +name = "r0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7a31eed1591dcbc95d92ad7161908e72f4677f8fabf2a32ca49b4237cbf211" + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" + [[package]] name = "redox_syscall" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" +checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", ] [[package]] @@ -1728,55 +1676,80 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] -name = "remove_dir_all" -version = "0.8.4" +name = "riscv" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a694f9e0eb3104451127f6cc1e5de55f59d3b1fc8c5ddfaeb6f1e716479ceb4a" +checksum = "5ea8ff73d3720bdd0a97925f0bf79ad2744b6da8ff36be3840c48ac81191d7a7" dependencies = [ - "cfg-if", - "cvt", - "fs_at", - "libc", - "normpath", - "windows-sys 0.59.0", + "critical-section", + "embedded-hal 1.0.0", + "paste", + "riscv-macros", + "riscv-pac", +] + +[[package]] +name = "riscv-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f265be5d634272320a7de94cea15c22a3bfdd4eb42eb43edc528415f066a1f25" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "riscv-pac" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8188909339ccc0c68cfb5a04648313f09621e8b87dc03095454f1a11f6c5d436" + +[[package]] +name = "riscv-rt-macros" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc71814687c45ba4cd1e47a54e03a2dbc62ca3667098fbae9cc6b423956758fa" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] name = "rmk" -version = "0.5.2" +version = "0.6.1" dependencies = [ "bitfield-struct", "byteorder", "chrono", "cortex-m", "crc32fast", - "defmt", "document-features", "embassy-embedded-hal", "embassy-executor", "embassy-futures", - "embassy-nrf", "embassy-sync", "embassy-time", "embassy-usb", "embedded-hal 1.0.0", - "embedded-hal-async", "embedded-io-async", "embedded-storage", "embedded-storage-async", - "esp-idf-svc", - "esp32-nimble", + "esp-hal", "futures", "heapless 0.8.0", - "nrf-softdevice", + "log", "num_enum", "paste", "postcard", + "rand_core 0.6.4", "rmk-macro", "sequential-storage", "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1784,41 +1757,42 @@ dependencies = [ name = "rmk-esp32c3" version = "0.2.0" dependencies = [ + "bt-hci", "cc", "const-gen", - "defmt", - "embassy-time", + "embassy-executor", "embuild", - "esp-idf-svc", + "esp-alloc", + "esp-backtrace", + "esp-hal", + "esp-hal-embassy", "esp-println", - "esp32-nimble", + "esp-storage", + "esp-wifi", "json", + "rand_core 0.6.4", "rmk", "xz2", ] [[package]] name = "rmk-macro" -version = "0.4.2" +version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", "serde", "serde_derive", - "syn 2.0.96", + "syn 2.0.100", "toml", ] -[[package]] -name = "rustc-hash" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" - [[package]] name = "rustc_version" version = "0.2.3" @@ -1834,42 +1808,20 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.24", -] - -[[package]] -name = "rustix" -version = "0.38.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" -dependencies = [ - "bitflags 2.6.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.59.0", + "semver 1.0.26", ] [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "same-file" -version = "1.0.6" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "scopeguard" @@ -1877,6 +1829,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1888,12 +1853,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" -dependencies = [ - "serde", -] +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" [[package]] name = "semver-parser" @@ -1903,39 +1865,38 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", "embedded-storage-async", ] [[package]] name = "serde" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "serde_json" -version = "1.0.133" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", @@ -1952,6 +1913,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1992,12 +1964,6 @@ dependencies = [ "portable-atomic", ] -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" @@ -2006,48 +1972,54 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.24.1" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ - "strum_macros 0.24.3", + "strum_macros 0.26.4", ] [[package]] name = "strum" -version = "0.25.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32" dependencies = [ - "strum_macros 0.25.3", + "strum_macros 0.27.1", ] [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] name = "strum_macros" -version = "0.25.3" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 2.0.96", + "syn 2.0.100", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "1.0.109" @@ -2061,28 +2033,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.96" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "tempfile" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" -dependencies = [ - "cfg-if", - "fastrand", - "once_cell", - "rustix", - "windows-sys 0.59.0", -] - [[package]] name = "termcolor" version = "1.4.1" @@ -2103,11 +2062,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.7" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93605438cbd668185516ab499d589afb7ee1859ea3d5fc8f6b0755e1c7443767" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.7", + "thiserror-impl 2.0.12", ] [[package]] @@ -2118,25 +2077,25 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "thiserror-impl" -version = "2.0.7" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d8749b4531af2117677a5fcd12b1348a3fe2b81e36e61ffeac5c4aa3273e36" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "toml" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" dependencies = [ "serde", "serde_spanned", @@ -2155,9 +2114,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.22" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", "serde", @@ -2166,32 +2125,65 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "log", + "p256", + "rand_chacha", + "rand_core 0.6.4", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", + "uuid", +] + [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] -name = "uncased" -version = "0.9.10" +name = "ucd-trie" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" -dependencies = [ - "version_check", -] +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] -name = "unicode-ident" -version = "1.0.14" +name = "ufmt-write" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" [[package]] -name = "unicode-xid" -version = "0.2.6" +name = "unicode-ident" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "usb-device" @@ -2199,7 +2191,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", "heapless 0.8.0", "portable-atomic", ] @@ -2210,7 +2201,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", "serde", "ssmarshal", "usb-device", @@ -2244,23 +2234,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" -dependencies = [ - "uuid-macro-internal", -] - -[[package]] -name = "uuid-macro-internal" -version = "1.11.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b91f57fe13a38d0ce9e28a03463d8d3c2468ed03d75375110ec71d93b449a08" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.96", -] +checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" [[package]] name = "vcell" @@ -2289,46 +2265,37 @@ dependencies = [ "vcell", ] -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "wasm-bindgen" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2336,33 +2303,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.99" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" - -[[package]] -name = "which" -version = "4.4.2" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" dependencies = [ - "either", - "home", - "once_cell", - "rustix", + "unicode-ident", ] [[package]] @@ -2371,7 +2329,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys", ] [[package]] @@ -2384,13 +2342,10 @@ dependencies = [ ] [[package]] -name = "windows-sys" -version = "0.52.0" +name = "windows-link" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" [[package]] name = "windows-sys" @@ -2467,13 +2422,50 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.20" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" dependencies = [ "memchr", ] +[[package]] +name = "xtensa-lx" +version = "0.10.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "critical-section", + "document-features", +] + +[[package]] +name = "xtensa-lx-rt" +version = "0.18.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "anyhow", + "document-features", + "enum-as-inner", + "minijinja", + "r0", + "serde", + "strum 0.26.3", + "toml", + "xtensa-lx", + "xtensa-lx-rt-proc-macros", +] + +[[package]] +name = "xtensa-lx-rt-proc-macros" +version = "0.2.2" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "xz2" version = "0.1.7" @@ -2494,11 +2486,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.14" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a367f292d93d4eab890745e75a778da40909cab4d6ff8173693812f79c4a2468" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" dependencies = [ - "zerocopy-derive 0.8.14", + "zerocopy-derive 0.8.24", ] [[package]] @@ -2509,16 +2501,22 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "zerocopy-derive" -version = "0.8.14" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3931cb58c62c13adec22e38686b559c86a30565e16ad6e8510a337cedc611e1" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_config/esp32c3_ble/Cargo.toml b/examples/use_config/esp32c3_ble/Cargo.toml index 6440964e1..2de97ceac 100644 --- a/examples/use_config/esp32c3_ble/Cargo.toml +++ b/examples/use_config/esp32c3_ble/Cargo.toml @@ -10,20 +10,27 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk", features = ["col2row", "esp32c3_ble"] } -esp32-nimble = { version = "0.10" } -defmt = "0.3" -embassy-time = { version = "0.4.0", features = ["defmt", "generic-queue-8"] } -esp-println = { version = "0.13", features = ["esp32c3", "defmt-espflash"] } -esp-idf-svc = { version = "0.51", default-features = false, features = [ - "std", - "alloc", - "binstart", - "embassy-sync", - "critical-section", - "embassy-time-driver", - "native", +rmk = { path = "../../../rmk", default-features = false, features = [ + "col2row", + "esp32c3_ble", + "log", + "storage", ] } +embassy-executor = { version = "0.7.0" } +esp-backtrace = { version = "0.15", features = [ + "esp32c3", + "exception-handler", + "panic-handler", + "println", +] } +esp-storage = { version = "0.5.0", features = ["esp32c3", "nor-flash"] } +esp-hal = { version = "1.0.0-beta.0", features = ["esp32c3", "unstable"] } +esp-hal-embassy = { version = "0.7.0", features = ["esp32c3"] } +esp-alloc = { version = "0.7.0" } +esp-println = { version = "0.13.0", features = ["esp32c3", "log"] } +esp-wifi = { version = "0.13.0", features = ["esp32c3", "ble"] } +bt-hci = { version = "0.3" } +rand_core = { version = "0.6", default-features = false } [build-dependencies] xz2 = "0.1.7" @@ -37,17 +44,30 @@ name = "rmk-esp32c3" test = false bench = false +[profile.dev.package.esp-storage] +opt-level = 3 + [profile.dev] -codegen-units = 1 # better optimizations -debug = true -opt-level = 3 # esp-wifi should be built with opt-level 2 or 3 -overflow-checks = true -lto = false -panic = 'unwind' +# Rust debug is too slow. +# For debug builds always builds with some optimization +opt-level = "s" [profile.release] -codegen-units = 1 # better optimizations -debug = true # no overhead for bare-metal -opt-level = 3 # esp-wifi should be built with opt-level 2 or 3 +codegen-units = 1 # LLVM can perform better optimizations using a single thread +debug = 2 +debug-assertions = false +incremental = false +lto = 'thin' +opt-level = 3 overflow-checks = false -lto = "fat" + +[patch.crates-io] +esp-wifi = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-backtrace = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-hal-embassy = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-alloc = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-println = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } \ No newline at end of file diff --git a/examples/use_config/esp32c3_ble/README.md b/examples/use_config/esp32c3_ble/README.md index bfab99ae9..b3acca19a 100644 --- a/examples/use_config/esp32c3_ble/README.md +++ b/examples/use_config/esp32c3_ble/README.md @@ -1,11 +1,17 @@ # esp32c3 BLE example -To run this example, you should have latest Rust in **esp** channel and `esp-idf` toolchain installed. The full instruction of installing `esp-idf` toolchain can be found [here](https://docs.esp-rs.org/book/installation/index.html) and [here](https://docs.esp-rs.org/std-training/02_2_software.html) +To run this example, you should have latest Rust installed. The full instruction of installing esp Rust toolchain can be found [here](https://docs.esp-rs.org/book/installation/index.html). -To run the example, make sure that you have esp-idf environment, `ldproxy` and `espflash` installed correctly. Then, run +[`espflash`](https://github.com/esp-rs/espflash) should also be installed: ``` -cd examples/use_rust/esp32c3_ble +cargo install cargo-espflash espflash +``` + +After having everything installed, use the following command to run the example: + +``` +cd examples/use_config/esp32c3_ble cargo run --release ``` @@ -16,23 +22,36 @@ cargo run --release Compiling ... ... ... - Finished `release` profile [optimized + debuginfo] target(s) in 51.39s - Running `espflash flash --monitor --log-format defmt target/riscv32imc-esp-espidf/release/rmk-esp32c3` -[2024-04-07T12:49:21Z INFO ] Detected 2 serial ports -[2024-04-07T12:49:21Z INFO ] Ports which match a known common dev board are highlighted -[2024-04-07T12:49:21Z INFO ] Please select a port -[2024-04-07T12:50:24Z INFO ] Serial port: '/dev/cu/xx' -[2024-04-07T12:50:24Z INFO ] Connecting... -[2024-04-07T12:50:24Z INFO ] Using flash stub -Chip type: esp32c3 (revision v0.4) + Finished `release` profile [optimized + debuginfo] target(s) in 11.70s + Running `espflash flash --monitor --port /dev/cu.usbmodem211401 target/riscv32imc-unknown-none-elf/release/rmk-esp32c3` +[2025-04-10T10:01:23Z INFO ] Serial port: '/dev/cu.usbmodem211401' +[2025-04-10T10:01:23Z INFO ] Connecting... +[2025-04-10T10:01:23Z INFO ] Using flash stub +Chip type: esp32c3 (revision v0.1) Crystal frequency: 40 MHz Flash size: 4MB -Features: WiFi, BLE -MAC address: aa:aa:aa:aa:aa:aa -App/part. size: 607,488/4,128,768 bytes, 14.71% -[2024-04-07T12:50:24Z INFO ] Segment at address '0x0' has not changed, skipping write -[2024-04-07T12:50:24Z INFO ] Segment at address '0x8000' has not changed, skipping write -[00:00:03] [========================================] 337/337 0x10000 [2024-04-07T12:50:28Z INFO ] Flashing has completed! +Features: WiFi 6, BT 5 +MAC address: 40:4c:ca:5b:c7:dc +App/part. size: 768,944/4,128,768 bytes, 18.62% +[2025-04-10T10:01:23Z INFO ] Segment at address '0x0' has not changed, skipping write +[2025-04-10T10:01:23Z INFO ] Segment at address '0x8000' has not changed, skipping write +[00:00:06] [========================================] 411/411 0x10000 [2025-04-10T10:01:31Z INFO ] Flashing has completed! +``` + +If espflash reports the following error: + +``` +Error: espflash::connection_failed + + × Error while connecting to device + ╰─▶ Serial port not found +``` + +You should to identify which serial port are connected to your esp board, and use `--port` to specify the used serial port: + +``` +# Suppose that the esp board are connected to /dev/cu.usbmodem211401 +cargo run --release -- --port /dev/cu.usbmodem211401 ``` If you want to get some insight of segments of your binary, [`espsegs`](https://github.com/bjoernQ/espsegs) would help: @@ -42,5 +61,5 @@ If you want to get some insight of segments of your binary, [`espsegs`](https:// cargo install --git https://github.com/bjoernQ/espsegs # Check all segments -espsegs target/riscv32imc-esp-espidf/release/rmk-esp32c3 --chip esp32c3 +espsegs target/riscv32imc-unknown-none-elf/release/rmk-esp32c3 --chip esp32c3 ``` \ No newline at end of file diff --git a/examples/use_config/esp32c3_ble/build.rs b/examples/use_config/esp32c3_ble/build.rs index 97cf282ba..147d1e047 100644 --- a/examples/use_config/esp32c3_ble/build.rs +++ b/examples/use_config/esp32c3_ble/build.rs @@ -1,22 +1,22 @@ -use const_gen::*; use std::fs::File; use std::io::Read; use std::path::Path; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { + println!("cargo:rerun-if-changed=keyboard.toml"); + // Generate vial config at the root of project println!("cargo:rerun-if-changed=vial.json"); generate_vial_config(); - // ESP IDE system env - embuild::espidf::sysenv::output(); - - println!("cargo:rerun-if-changed=keyboard.toml"); + println!("cargo:rustc-link-arg-bins=-Tlinkall.x"); // Set the extra linker script from defmt - println!("cargo:rustc-link-arg=-Tdefmt.x"); + // println!("cargo:rustc-link-arg=-Tdefmt.x"); } fn generate_vial_config() { @@ -27,8 +27,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -44,6 +43,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_config/esp32c3_ble/espflash.toml b/examples/use_config/esp32c3_ble/espflash.toml deleted file mode 100644 index d22b92e77..000000000 --- a/examples/use_config/esp32c3_ble/espflash.toml +++ /dev/null @@ -1 +0,0 @@ -partition_table = "partitions.csv" diff --git a/examples/use_config/esp32c3_ble/keyboard.toml b/examples/use_config/esp32c3_ble/keyboard.toml index e1f873c94..946a810d9 100644 --- a/examples/use_config/esp32c3_ble/keyboard.toml +++ b/examples/use_config/esp32c3_ble/keyboard.toml @@ -9,8 +9,8 @@ usb_enable = false [matrix] # Input and output pins are mandatory -input_pins = ["gpio6", "gpio7", "gpio20", "gpio21"] -output_pins = ["gpio3", "gpio4", "gpio5"] +input_pins = ["GPIO6", "GPIO7", "GPIO20", "GPIO21"] +output_pins = ["GPIO3", "GPIO4", "GPIO5"] # WARNING: Currently row2col/col2row is set in RMK's feature gate, row2col config here is valid ONLY when you're using cloud compilation # row2col = true diff --git a/examples/use_config/esp32c3_ble/rust-toolchain.toml b/examples/use_config/esp32c3_ble/rust-toolchain.toml deleted file mode 100644 index 4c3b3109f..000000000 --- a/examples/use_config/esp32c3_ble/rust-toolchain.toml +++ /dev/null @@ -1,3 +0,0 @@ -[toolchain] -channel = "esp" -components = ["rust-src"] \ No newline at end of file diff --git a/examples/use_config/esp32c3_ble/sdkconfig.defaults b/examples/use_config/esp32c3_ble/sdkconfig.defaults deleted file mode 100644 index 3aff089f7..000000000 --- a/examples/use_config/esp32c3_ble/sdkconfig.defaults +++ /dev/null @@ -1,28 +0,0 @@ -# Rust often needs a bit of an extra main task stack size compared to C (the default is 3K) -CONFIG_ESP_MAIN_TASK_STACK_SIZE=64000 - -# Use this to set FreeRTOS kernel tick frequency to 1000 Hz (100 Hz by default). -# This allows to use 1 ms granuality for thread sleeps (10 ms by default). -CONFIG_FREERTOS_HZ=1000 - -# Workaround for https://github.com/espressif/esp-idf/issues/7631 -#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=n -#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=n - -CONFIG_LOG_DEFAULT_LEVEL=5 - -# Disable watchdog -CONFIG_INT_WDT=n -CONFIG_ESP_TASK_WDT=n - -# esp-nimble config -CONFIG_BT_ENABLED=y -CONFIG_BT_BLE_ENABLED=y -CONFIG_BT_BLUEDROID_ENABLED=n -CONFIG_BT_NIMBLE_ENABLED=y -CONFIG_BT_NIMBLE_NVS_PERSIST=y -# CONFIG_BT_NIMBLE_EXT_ADV=y - -CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y -CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n -CONFIG_BTDM_CTRL_MODE_BTDM=n \ No newline at end of file diff --git a/examples/use_config/esp32c3_ble/src/main.rs b/examples/use_config/esp32c3_ble/src/main.rs index efc5f10e5..c3bc88290 100644 --- a/examples/use_config/esp32c3_ble/src/main.rs +++ b/examples/use_config/esp32c3_ble/src/main.rs @@ -1,4 +1,5 @@ -#![feature(type_alias_impl_trait)] +#![no_std] +#![no_main] use rmk::macros::rmk_keyboard; diff --git a/examples/use_config/esp32c3_ble/vial.json b/examples/use_config/esp32c3_ble/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_config/esp32c3_ble/vial.json +++ b/examples/use_config/esp32c3_ble/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_config/esp32c6_ble/.cargo/config.toml b/examples/use_config/esp32c6_ble/.cargo/config.toml index 816670f82..eccdc6882 100644 --- a/examples/use_config/esp32c6_ble/.cargo/config.toml +++ b/examples/use_config/esp32c6_ble/.cargo/config.toml @@ -1,18 +1,13 @@ -[build] -target = "riscv32imac-esp-espidf" - -[target.riscv32imac-esp-espidf] -linker = "ldproxy" -runner = "espflash flash --monitor --log-format defmt" -rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110 +[target.'cfg(all(any(target_arch = "riscv32", target_arch = "xtensa"), target_os = "none"))'] +runner = "espflash flash --monitor" -[unstable] -build-std = ["std", "panic_abort"] +[build] +target = "riscv32imac-unknown-none-elf" +rustflags = [ + # Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.) + # NOTE: May negatively impact performance of produced code + "-C", "force-frame-pointers", +] [env] -MCU="esp32c6" -# Note: this variable is not used by the pio builder (`cargo build --features pio`) -ESP_IDF_VERSION = "v5.2" -DEFMT_LOG="debug" -ESP_IDF_PATH_ISSUES="warn" -CRATE_CC_NO_DEFAULTS="1" \ No newline at end of file +ESP_LOG = "trace" diff --git a/examples/use_config/esp32c6_ble/Cargo.lock b/examples/use_config/esp32c6_ble/Cargo.lock index 8d334e812..bc7dd5a3b 100644 --- a/examples/use_config/esp32c6_ble/Cargo.lock +++ b/examples/use_config/esp32c6_ble/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -34,13 +45,10 @@ dependencies = [ ] [[package]] -name = "aligned" -version = "0.4.2" +name = "allocator-api2" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377e4c0ba83e4431b10df45c1d4666f178ea9c552cac93e60c3a88bf32785923" -dependencies = [ - "as-slice", -] +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android-tzdata" @@ -59,18 +67,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.94" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" - -[[package]] -name = "as-slice" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" -dependencies = [ - "stable_deref_trait", -] +checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" [[package]] name = "atomic-polyfill" @@ -81,24 +80,12 @@ dependencies = [ "critical-section", ] -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "autocfg" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" -[[package]] -name = "az" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" - [[package]] name = "bare-metal" version = "0.2.5" @@ -109,23 +96,18 @@ dependencies = [ ] [[package]] -name = "bindgen" -version = "0.71.1" +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "basic-toml" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" +checksum = "ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a" dependencies = [ - "bitflags 2.6.0", - "cexpr", - "clang-sys", - "itertools", - "log", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.96", + "serde", ] [[package]] @@ -140,15 +122,35 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" +[[package]] +name = "bitfield" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7e6caee68becd795bfd65f1a026e4d00d8f0c2bc9be5eb568e1015f9ce3c34" +dependencies = [ + "bitfield-macros", +] + +[[package]] +name = "bitfield-macros" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "331afbb18ce7b644c0b428726d369c5dd37ca0b815d72a459fcc2896c3c8ad32" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "bitfield-struct" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bedc5f4fa33bdc993f9b8ba7369d1b74fcdafa958924a0a54de6707e360de692" +checksum = "2be5a46ba01b60005ae2c51a36a29cfe134bcacae2dd5cedcd4615fbaad1494b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] @@ -159,44 +161,45 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] -name = "bstr" -version = "1.11.1" +name = "block-buffer" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "memchr", - "serde", + "generic-array", ] [[package]] -name = "build-time" -version = "0.1.3" +name = "bt-hci" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1219c19fc29b7bfd74b7968b420aff5bc951cf517800176e795d6b2300dd382" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" dependencies = [ - "chrono", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.96", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", ] [[package]] name = "bumpalo" -version = "3.16.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "bytemuck" -version = "1.21.0" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" +checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" [[package]] name = "byteorder" @@ -204,38 +207,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "camino" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" -dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.24", - "serde", - "serde_json", - "thiserror 1.0.69", -] - [[package]] name = "cargo_toml" version = "0.21.0" @@ -248,66 +219,52 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.9" +version = "1.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b" +checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" dependencies = [ "shlex", ] -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "chrono" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets", + "windows-link", ] [[package]] -name = "clang-sys" -version = "1.8.1" +name = "cipher" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ - "glob", - "libc", - "libloading", + "crypto-common", + "inout", ] [[package]] -name = "cmake" -version = "0.1.52" +name = "cmac" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" dependencies = [ - "cc", + "cipher", + "dbl", + "digest", ] [[package]] @@ -318,9 +275,9 @@ checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" [[package]] name = "const-gen" -version = "1.6.5" +version = "1.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb4caa28784488578a9aa32e0a33f0543d961345fc25efc3f04243be3fa6299" +checksum = "6d7617801a02ebd66905a39f5a15390bfb7d6ab90316fdbf7dc36a1161ffb56b" dependencies = [ "const-gen-derive", ] @@ -337,24 +294,10 @@ dependencies = [ ] [[package]] -name = "const_format" -version = "0.2.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd" -dependencies = [ - "const_format_proc_macros", -] - -[[package]] -name = "const_format_proc_macros" -version = "0.2.34" +name = "const-oid" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "core-foundation-sys" @@ -375,23 +318,12 @@ dependencies = [ ] [[package]] -name = "cortex-m-rt" -version = "0.7.5" +name = "cpufeatures" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ - "cortex-m-rt-macros", -] - -[[package]] -name = "cortex-m-rt-macros" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.96", + "libc", ] [[package]] @@ -410,161 +342,130 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] -name = "crossbeam-deque" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "crossbeam-utils", + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", ] [[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "cvt" -version = "0.1.2" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ae9bf77fbf2d39ef573205d554d87e86c12f1994e9ea335b0651b9b278bcf1" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "cfg-if", -] - -[[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "typenum", ] [[package]] name = "darling" -version = "0.20.10" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", -] - -[[package]] -name = "darling_core" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.11.1", - "syn 2.0.96", + "strsim", + "syn 2.0.100", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.96", + "generic-array", ] [[package]] -name = "defmt" -version = "0.3.10" +name = "delegate" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "b9b6483c2bbed26f97861cf57651d4f2b731964a28cd2257f934a4b452480d21" dependencies = [ - "bitflags 1.3.2", - "defmt-macros", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] -name = "defmt-macros" -version = "0.4.0" +name = "der" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ - "defmt-parser", - "proc-macro-error2", - "proc-macro2", - "quote", - "syn 2.0.96", + "const-oid", + "zeroize", ] [[package]] -name = "defmt-parser" -version = "0.4.1" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "thiserror 2.0.7", + "block-buffer", + "crypto-common", + "subtle", ] [[package]] name = "document-features" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" dependencies = [ "litrs", ] [[package]] -name = "either" -version = "1.13.0" +name = "elliptic-curve" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] [[package]] name = "embassy-embedded-hal" @@ -572,7 +473,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", "embassy-futures", "embassy-sync", "embassy-time", @@ -587,11 +487,9 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "critical-section", - "defmt", "document-features", "embassy-executor-macros", ] @@ -599,35 +497,18 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" -dependencies = [ - "defmt", -] - -[[package]] -name = "embassy-hal-internal" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "num-traits", -] +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" [[package]] name = "embassy-net-driver" @@ -646,45 +527,13 @@ dependencies = [ "embassy-sync", ] -[[package]] -name = "embassy-nrf" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7494efe1e0183568327c7e681d4b77ed5241921dcb5976426d9a65b65a0c81" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cortex-m", - "cortex-m-rt", - "critical-section", - "defmt", - "document-features", - "embassy-embedded-hal", - "embassy-hal-internal", - "embassy-sync", - "embassy-time", - "embassy-usb-driver", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-async", - "embedded-io", - "embedded-io-async", - "embedded-storage", - "embedded-storage-async", - "fixed", - "nrf-pac", - "rand_core", -] - [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", "embedded-io-async", "futures-sink", "futures-util", @@ -699,10 +548,8 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", "document-features", "embassy-time-driver", - "embassy-time-queue-utils", "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-async", @@ -734,7 +581,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -749,9 +595,6 @@ name = "embassy-usb-driver" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" -dependencies = [ - "defmt", -] [[package]] name = "embedded-can" @@ -777,28 +620,14 @@ name = "embedded-hal" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" -dependencies = [ - "defmt", -] [[package]] name = "embedded-hal-async" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" -dependencies = [ - "defmt", - "embedded-hal 1.0.0", -] - -[[package]] -name = "embedded-hal-nb" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" dependencies = [ "embedded-hal 1.0.0", - "nb 1.1.0", ] [[package]] @@ -806,9 +635,6 @@ name = "embedded-io" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" -dependencies = [ - "defmt", -] [[package]] name = "embedded-io-async" @@ -816,7 +642,6 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", "embedded-io", ] @@ -835,22 +660,6 @@ dependencies = [ "embedded-storage", ] -[[package]] -name = "embedded-svc" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b85590a7a120e370bed5b6bc2b399b345c60d4c749d3bc06039472da37b9893" -dependencies = [ - "defmt", - "embedded-io", - "embedded-io-async", - "enumset", - "heapless 0.8.0", - "num_enum", - "serde", - "strum 0.25.0", -] - [[package]] name = "embuild" version = "0.33.0" @@ -858,22 +667,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28a8cbd9507fabce8f2741b9ca45da9e898cc2b0f1c2e53d21cb2436aeac811d" dependencies = [ "anyhow", - "bindgen", "bitflags 1.3.2", - "cmake", "filetime", - "globwalk", - "home", "log", - "regex", - "remove_dir_all", - "serde", - "serde_json", "shlex", - "strum 0.24.1", - "tempfile", "thiserror 1.0.69", - "which", ] [[package]] @@ -882,6 +680,18 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "enumset" version = "1.1.5" @@ -897,155 +707,252 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59c3b24c345d8c314966bdc1832f6c2635bfcce8e7cf363bd115987bba2ee242" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] -name = "envy" -version = "0.4.2" +name = "equivalent" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f47e0157f2cb54f5ae1bd371b30a2ae4311e1c028f575cd4e81de7353215965" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "esp-alloc" +version = "0.7.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "serde", + "allocator-api2", + "cfg-if", + "critical-section", + "document-features", + "enumset", + "linked_list_allocator", ] [[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +name = "esp-backtrace" +version = "0.15.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "cfg-if", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-println", + "heapless 0.8.0", +] [[package]] -name = "errno" -version = "0.3.10" +name = "esp-build" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +checksum = "8aa1c8f9954c9506699cf1ca10a2adcc226ff10b6ae3cb9e875cf2c6a0b9a372" dependencies = [ - "libc", - "windows-sys 0.59.0", + "quote", + "syn 2.0.100", + "termcolor", ] [[package]] name = "esp-build" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aa1c8f9954c9506699cf1ca10a2adcc226ff10b6ae3cb9e875cf2c6a0b9a372" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "quote", - "syn 2.0.96", + "syn 2.0.100", "termcolor", ] [[package]] -name = "esp-idf-hal" -version = "0.45.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775ce25171dc4f615146a4a27ed3a64c6fd99ced77d7112062f2b19bf933f5db" +name = "esp-config" +version = "0.3.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "atomic-waker", + "document-features", + "serde", + "serde_json", +] + +[[package]] +name = "esp-hal" +version = "1.0.0-beta.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "basic-toml", + "bitfield 0.18.1", + "bitflags 2.9.0", + "bytemuck", + "cfg-if", "critical-section", + "delegate", + "document-features", + "embassy-embedded-hal", + "embassy-futures", "embassy-sync", "embedded-can", - "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-async", - "embedded-hal-nb", "embedded-io", "embedded-io-async", - "embuild", "enumset", - "esp-idf-sys", - "heapless 0.8.0", - "log", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal-procmacros", + "esp-metadata", + "esp-riscv-rt", + "esp32c6", + "fugit", + "instability", "nb 1.1.0", - "num_enum", + "paste", + "portable-atomic", + "rand_core 0.6.4", + "rand_core 0.9.3", + "riscv", + "serde", + "strum 0.27.1", + "ufmt-write", + "void", + "xtensa-lx", + "xtensa-lx-rt", ] [[package]] -name = "esp-idf-svc" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc07aaba257d28d54a96af005ca67d0b38876d8837f5d54a3e0547e100b219c" +name = "esp-hal-embassy" +version = "0.7.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "embassy-futures", + "critical-section", + "document-features", + "embassy-executor", + "embassy-sync", + "embassy-time", "embassy-time-driver", "embassy-time-queue-utils", - "embedded-hal-async", - "embedded-storage", - "embedded-svc", - "embuild", - "enumset", - "esp-idf-hal", - "futures-io", - "heapless 0.8.0", - "log", - "num_enum", - "uncased", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal", + "esp-hal-procmacros", + "esp-metadata", + "portable-atomic", + "static_cell", ] [[package]] -name = "esp-idf-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb77a3d02b579a60a811ed9be22b78c5e794bc492d833ee7fc44d3a0155885e1" +name = "esp-hal-procmacros" +version = "0.17.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "darling", + "document-features", + "litrs", + "object", + "proc-macro-crate", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "esp-metadata" +version = "0.6.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "anyhow", - "build-time", - "cargo_metadata", - "cmake", - "const_format", - "embuild", - "envy", - "libc", - "regex", + "basic-toml", "serde", - "strum 0.24.1", - "which", + "strum 0.26.3", ] [[package]] name = "esp-println" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645e54eb592ca0a3d60213b1695e2a5fc0b51ca6d693c08d6983857224a629ed" +version = "0.13.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "critical-section", - "defmt", - "esp-build", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", "log", "portable-atomic", ] [[package]] -name = "esp32-nimble" +name = "esp-riscv-rt" version = "0.10.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "document-features", + "riscv", + "riscv-rt-macros", +] + +[[package]] +name = "esp-storage" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88cc737968921dc601fafaf3ca83f8fca5039cfc6a46e402cb042da647a0c00f" +checksum = "1e98b5069bd1482fb85f9236f8ea6cd1b5b6b5a1c3c3fb8c938c97ccfbbb051b" dependencies = [ - "anyhow", - "bitflags 2.6.0", - "bstr", + "critical-section", + "embedded-storage", + "esp-build 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "esp-wifi" +version = "0.13.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "allocator-api2", + "bt-hci", "cfg-if", + "critical-section", + "document-features", "embassy-sync", - "embuild", - "esp-idf-svc", - "heapless 0.8.0", - "log", - "num_enum", - "once_cell", - "uuid", - "zerocopy 0.8.14", - "zerocopy-derive 0.8.14", + "embedded-io", + "embedded-io-async", + "esp-alloc", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal", + "esp-metadata", + "esp-wifi-sys", + "num-derive", + "num-traits", + "portable-atomic", + "portable_atomic_enum", + "rand_core 0.6.4", ] [[package]] -name = "fastrand" -version = "2.3.0" +name = "esp-wifi-sys" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "c6b5438361891c431970194a733415006fb3d00b6eb70b3dcb66fd58f04d9b39" +dependencies = [ + "anyhow", +] + +[[package]] +name = "esp32c6" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ff2a4e1d1b0cb2517af20766004b8e8fb4612043f0b0569703cc90d1880ede4" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] [[package]] name = "filetime" @@ -1056,19 +963,7 @@ dependencies = [ "cfg-if", "libc", "libredox", - "windows-sys 0.59.0", -] - -[[package]] -name = "fixed" -version = "1.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a" -dependencies = [ - "az", - "bytemuck", - "half", - "typenum", + "windows-sys", ] [[package]] @@ -1078,17 +973,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "fs_at" -version = "0.2.1" +name = "fugit" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14af6c9694ea25db25baa2a1788703b9e7c6648dcaeeebeb98f7561b5384c036" +checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" dependencies = [ - "aligned", - "cfg-if", - "cvt", - "libc", - "nix", - "windows-sys 0.52.0", + "gcd", ] [[package]] @@ -1121,6 +1011,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -1135,7 +1035,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] @@ -1165,43 +1065,31 @@ dependencies = [ ] [[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "globset" -version = "0.4.15" +name = "gcd" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata", - "regex-syntax", -] +checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" [[package]] -name = "globwalk" -version = "0.8.1" +name = "generic-array" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ - "bitflags 1.3.2", - "ignore", - "walkdir", + "typenum", + "version_check", + "zeroize", ] [[package]] -name = "half" -version = "2.4.1" +name = "group" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ - "cfg-if", - "crunchy", + "ff", + "rand_core 0.6.4", + "subtle", ] [[package]] @@ -1263,29 +1151,39 @@ dependencies = [ [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] -name = "home" -version = "0.5.9" +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "windows-sys 0.52.0", + "digest", ] [[package]] name = "iana-time-zone" -version = "0.1.61" +version = "0.1.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +checksum = "b2fd658b06e56721792c5df4475705b6cda790e9298d19d2f8af083457bcd127" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", "windows-core", ] @@ -1306,51 +1204,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] -name = "ignore" -version = "0.4.23" +name = "indexmap" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata", - "same-file", - "walkdir", - "winapi-util", + "equivalent", + "hashbrown 0.15.2", ] [[package]] -name = "indexmap" -version = "2.7.0" +name = "indoc" +version = "2.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd" + +[[package]] +name = "inout" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ - "equivalent", - "hashbrown 0.15.2", + "generic-array", ] [[package]] -name = "itertools" -version = "0.12.1" +name = "instability" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "0bf9fed6d91cfb734e7476a06bde8300a1b94e217e1b523b6f0cd1a01998c71d" dependencies = [ - "either", + "darling", + "indoc", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", @@ -1370,19 +1271,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.168" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" - -[[package]] -name = "libloading" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" -dependencies = [ - "cfg-if", - "windows-targets", -] +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "libredox" @@ -1390,22 +1281,25 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "libc", "redox_syscall", ] [[package]] -name = "linux-raw-sys" -version = "0.4.14" +name = "linked_list_allocator" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" [[package]] name = "litrs" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" +dependencies = [ + "proc-macro2", +] [[package]] name = "lock_api" @@ -1419,9 +1313,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.25" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "lzma-sys" @@ -1441,10 +1335,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] -name = "minimal-lexical" -version = "0.2.1" +name = "minijinja" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +checksum = "98642a6dfca91122779a307b77cd07a4aa951fbe32232aaf5bad9febc66be754" +dependencies = [ + "serde", +] [[package]] name = "nb" @@ -1457,81 +1354,19 @@ dependencies = [ [[package]] name = "nb" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" - -[[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cfg_aliases", - "libc", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "normpath" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8911957c4b1549ac0dc74e30db9c8b0e66ddcd6d7acc33098f4c63a64a6d7ed" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "nrf-pac" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" -dependencies = [ - "cortex-m", - "cortex-m-rt", -] - -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" [[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ - "Inflector", - "darling 0.13.4", "proc-macro2", "quote", - "syn 1.0.109", - "uuid", + "syn 2.0.100", ] [[package]] @@ -1558,17 +1393,35 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", ] [[package]] name = "once_cell" -version = "1.20.2" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] [[package]] name = "paste" @@ -1576,11 +1429,56 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror 2.0.12", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -1590,15 +1488,36 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" + +[[package]] +name = "portable_atomic_enum" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d48f60c43e0120bb2bb48589a16d4bed2f4b911be41e299f2d0fc0e0e20885" +dependencies = [ + "portable-atomic", + "portable_atomic_enum_macros", +] + +[[package]] +name = "portable_atomic_enum_macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33fa6ec7f2047f572d49317cca19c87195de99c6e5b6ee492da701cfe02b053" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] [[package]] name = "postcard" @@ -1607,7 +1526,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", "heapless 0.7.17", "postcard-derive", "serde", @@ -1624,21 +1542,39 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" -version = "0.2.25" +version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +checksum = "5316f57387668042f561aae71480de936257848f9c43ce528e311d89a07cadeb" dependencies = [ "proc-macro2", - "syn 2.0.96", + "syn 2.0.100", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", ] [[package]] name = "proc-macro-crate" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" dependencies = [ "toml_edit", ] @@ -1662,40 +1598,62 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] +[[package]] +name = "r0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7a31eed1591dcbc95d92ad7161908e72f4677f8fabf2a32ca49b4237cbf211" + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" + [[package]] name = "redox_syscall" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" +checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", ] [[package]] @@ -1728,55 +1686,80 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] -name = "remove_dir_all" -version = "0.8.4" +name = "riscv" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a694f9e0eb3104451127f6cc1e5de55f59d3b1fc8c5ddfaeb6f1e716479ceb4a" +checksum = "5ea8ff73d3720bdd0a97925f0bf79ad2744b6da8ff36be3840c48ac81191d7a7" dependencies = [ - "cfg-if", - "cvt", - "fs_at", - "libc", - "normpath", - "windows-sys 0.59.0", + "critical-section", + "embedded-hal 1.0.0", + "paste", + "riscv-macros", + "riscv-pac", +] + +[[package]] +name = "riscv-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f265be5d634272320a7de94cea15c22a3bfdd4eb42eb43edc528415f066a1f25" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "riscv-pac" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8188909339ccc0c68cfb5a04648313f09621e8b87dc03095454f1a11f6c5d436" + +[[package]] +name = "riscv-rt-macros" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc71814687c45ba4cd1e47a54e03a2dbc62ca3667098fbae9cc6b423956758fa" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] name = "rmk" -version = "0.5.2" +version = "0.6.1" dependencies = [ "bitfield-struct", "byteorder", "chrono", "cortex-m", "crc32fast", - "defmt", "document-features", "embassy-embedded-hal", "embassy-executor", "embassy-futures", - "embassy-nrf", "embassy-sync", "embassy-time", "embassy-usb", "embedded-hal 1.0.0", - "embedded-hal-async", "embedded-io-async", "embedded-storage", "embedded-storage-async", - "esp-idf-svc", - "esp32-nimble", + "esp-hal", "futures", "heapless 0.8.0", - "nrf-softdevice", + "log", "num_enum", "paste", "postcard", + "rand_core 0.6.4", "rmk-macro", "sequential-storage", "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1784,41 +1767,42 @@ dependencies = [ name = "rmk-esp32c6" version = "0.2.0" dependencies = [ + "bt-hci", "cc", "const-gen", - "defmt", - "embassy-time", + "embassy-executor", "embuild", - "esp-idf-svc", + "esp-alloc", + "esp-backtrace", + "esp-hal", + "esp-hal-embassy", "esp-println", - "esp32-nimble", + "esp-storage", + "esp-wifi", "json", + "rand_core 0.6.4", "rmk", "xz2", ] [[package]] name = "rmk-macro" -version = "0.4.2" +version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", "serde", "serde_derive", - "syn 2.0.96", + "syn 2.0.100", "toml", ] -[[package]] -name = "rustc-hash" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" - [[package]] name = "rustc_version" version = "0.2.3" @@ -1834,42 +1818,20 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.24", -] - -[[package]] -name = "rustix" -version = "0.38.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" -dependencies = [ - "bitflags 2.6.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.59.0", + "semver 1.0.26", ] [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "same-file" -version = "1.0.6" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "scopeguard" @@ -1877,6 +1839,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1888,12 +1863,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" -dependencies = [ - "serde", -] +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" [[package]] name = "semver-parser" @@ -1903,39 +1875,38 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", "embedded-storage-async", ] [[package]] name = "serde" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "serde_json" -version = "1.0.133" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", @@ -1952,6 +1923,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1992,12 +1974,6 @@ dependencies = [ "portable-atomic", ] -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" @@ -2006,48 +1982,54 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.24.1" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ - "strum_macros 0.24.3", + "strum_macros 0.26.4", ] [[package]] name = "strum" -version = "0.25.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32" dependencies = [ - "strum_macros 0.25.3", + "strum_macros 0.27.1", ] [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] name = "strum_macros" -version = "0.25.3" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 2.0.96", + "syn 2.0.100", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "1.0.109" @@ -2061,28 +2043,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.96" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "tempfile" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" -dependencies = [ - "cfg-if", - "fastrand", - "once_cell", - "rustix", - "windows-sys 0.59.0", -] - [[package]] name = "termcolor" version = "1.4.1" @@ -2103,11 +2072,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.7" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93605438cbd668185516ab499d589afb7ee1859ea3d5fc8f6b0755e1c7443767" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.7", + "thiserror-impl 2.0.12", ] [[package]] @@ -2118,25 +2087,25 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "thiserror-impl" -version = "2.0.7" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d8749b4531af2117677a5fcd12b1348a3fe2b81e36e61ffeac5c4aa3273e36" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "toml" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" dependencies = [ "serde", "serde_spanned", @@ -2155,9 +2124,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.22" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", "serde", @@ -2166,32 +2135,65 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "log", + "p256", + "rand_chacha", + "rand_core 0.6.4", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", + "uuid", +] + [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] -name = "uncased" -version = "0.9.10" +name = "ucd-trie" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" -dependencies = [ - "version_check", -] +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] -name = "unicode-ident" -version = "1.0.14" +name = "ufmt-write" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" [[package]] -name = "unicode-xid" -version = "0.2.6" +name = "unicode-ident" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "usb-device" @@ -2199,7 +2201,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", "heapless 0.8.0", "portable-atomic", ] @@ -2210,7 +2211,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", "serde", "ssmarshal", "usb-device", @@ -2244,23 +2244,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" -dependencies = [ - "uuid-macro-internal", -] - -[[package]] -name = "uuid-macro-internal" -version = "1.11.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b91f57fe13a38d0ce9e28a03463d8d3c2468ed03d75375110ec71d93b449a08" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.96", -] +checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" [[package]] name = "vcell" @@ -2289,46 +2275,37 @@ dependencies = [ "vcell", ] -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "wasm-bindgen" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2336,33 +2313,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.99" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" - -[[package]] -name = "which" -version = "4.4.2" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" dependencies = [ - "either", - "home", - "once_cell", - "rustix", + "unicode-ident", ] [[package]] @@ -2371,7 +2339,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys", ] [[package]] @@ -2384,13 +2352,10 @@ dependencies = [ ] [[package]] -name = "windows-sys" -version = "0.52.0" +name = "windows-link" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" [[package]] name = "windows-sys" @@ -2467,13 +2432,50 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.20" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" dependencies = [ "memchr", ] +[[package]] +name = "xtensa-lx" +version = "0.10.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "critical-section", + "document-features", +] + +[[package]] +name = "xtensa-lx-rt" +version = "0.18.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "anyhow", + "document-features", + "enum-as-inner", + "minijinja", + "r0", + "serde", + "strum 0.26.3", + "toml", + "xtensa-lx", + "xtensa-lx-rt-proc-macros", +] + +[[package]] +name = "xtensa-lx-rt-proc-macros" +version = "0.2.2" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "xz2" version = "0.1.7" @@ -2494,11 +2496,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.14" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a367f292d93d4eab890745e75a778da40909cab4d6ff8173693812f79c4a2468" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" dependencies = [ - "zerocopy-derive 0.8.14", + "zerocopy-derive 0.8.24", ] [[package]] @@ -2509,16 +2511,22 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "zerocopy-derive" -version = "0.8.14" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3931cb58c62c13adec22e38686b559c86a30565e16ad6e8510a337cedc611e1" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_config/esp32c6_ble/Cargo.toml b/examples/use_config/esp32c6_ble/Cargo.toml index 1a65ccef3..43b30bf12 100644 --- a/examples/use_config/esp32c6_ble/Cargo.toml +++ b/examples/use_config/esp32c6_ble/Cargo.toml @@ -10,20 +10,27 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk", features = ["col2row", "esp32c6_ble"] } -esp32-nimble = { version = "0.10" } -defmt = "0.3" -embassy-time = { version = "0.4.0", features = ["defmt", "generic-queue-8"] } -esp-println = { version = "0.13", features = ["esp32c6", "defmt-espflash"] } -esp-idf-svc = { version = "0.51", default-features = false, features = [ - "std", - "alloc", - "binstart", - "embassy-sync", - "critical-section", - "embassy-time-driver", - "native", +rmk = { path = "../../../rmk", default-features = false, features = [ + "col2row", + "esp32c6_ble", + "log", + "storage", ] } +embassy-executor = { version = "0.7.0" } +esp-backtrace = { version = "0.15", features = [ + "esp32c6", + "exception-handler", + "panic-handler", + "println", +] } +esp-storage = { version = "0.5.0", features = ["esp32c6", "nor-flash"] } +esp-hal = { version = "1.0.0-beta.0", features = ["esp32c6", "unstable"] } +esp-hal-embassy = { version = "0.7.0", features = ["esp32c6"] } +esp-alloc = { version = "0.7.0" } +esp-println = { version = "0.13.0", features = ["esp32c6", "log"] } +esp-wifi = { version = "0.13.0", features = ["esp32c6", "ble"] } +bt-hci = { version = "0.3" } +rand_core = { version = "0.6", default-features = false } [build-dependencies] xz2 = "0.1.7" @@ -37,17 +44,30 @@ name = "rmk-esp32c6" test = false bench = false +[profile.dev.package.esp-storage] +opt-level = 3 + [profile.dev] -codegen-units = 1 # better optimizations -debug = true -opt-level = 3 # esp-wifi should be built with opt-level 2 or 3 -overflow-checks = true -lto = false -panic = 'unwind' +# Rust debug is too slow. +# For debug builds always builds with some optimization +opt-level = "s" [profile.release] -codegen-units = 1 # better optimizations -debug = true # no overhead for bare-metal -opt-level = 3 # esp-wifi should be built with opt-level 2 or 3 +codegen-units = 1 # LLVM can perform better optimizations using a single thread +debug = 2 +debug-assertions = false +incremental = false +lto = 'thin' +opt-level = 3 overflow-checks = false -lto = "fat" + +[patch.crates-io] +esp-wifi = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-backtrace = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-hal-embassy = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-alloc = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-println = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } \ No newline at end of file diff --git a/examples/use_config/esp32c6_ble/README.md b/examples/use_config/esp32c6_ble/README.md index 381880a4e..e10fee926 100644 --- a/examples/use_config/esp32c6_ble/README.md +++ b/examples/use_config/esp32c6_ble/README.md @@ -1,8 +1,14 @@ # esp32c6 BLE example -To run this example, you should have latest Rust in **esp** channel and `esp-idf` toolchain installed. The full instruction of installing `esp-idf` toolchain can be found [here](https://docs.esp-rs.org/book/installation/index.html) and [here](https://docs.esp-rs.org/std-training/02_2_software.html) +To run this example, you should have latest Rust installed. The full instruction of installing esp Rust toolchain can be found [here](https://docs.esp-rs.org/book/installation/index.html). -To run the example, make sure that you have esp-idf environment, `ldproxy` and `espflash` installed correctly. Then, run +[`espflash`](https://github.com/esp-rs/espflash) should also be installed: + +``` +cargo install cargo-espflash espflash +``` + +After having everything installed, use the following command to run the example: ``` cd examples/use_config/esp32c6_ble @@ -16,20 +22,36 @@ cargo run --release Compiling ... ... ... - Finished `release` profile [optimized + debuginfo] target(s) in 51.39s - Running `espflash flash --monitor --log-format defmt target/riscv32imac-esp-espidf/release/rmk-esp32c6` -[2024-08-29T12:14:05Z INFO ] Serial port: 'COM6' -[2024-08-29T12:14:05Z INFO ] Connecting... -[2024-08-29T12:14:05Z INFO ] Using flash stub -Chip type: esp32c6 (revision v0.0) + Finished `release` profile [optimized + debuginfo] target(s) in 11.70s + Running `espflash flash --monitor --port /dev/cu.usbmodem211401 target/riscv32imac-unknown-none-elf/release/rmk-esp32c6` +[2025-04-10T10:01:23Z INFO ] Serial port: '/dev/cu.usbmodem211401' +[2025-04-10T10:01:23Z INFO ] Connecting... +[2025-04-10T10:01:23Z INFO ] Using flash stub +Chip type: esp32c6 (revision v0.1) Crystal frequency: 40 MHz Flash size: 4MB Features: WiFi 6, BT 5 -MAC address: aa:aa:aa:aa:aa:aa -App/part. size: 892,624/4,128,768 bytes, 21.62% -[2024-08-29T12:14:06Z INFO ] Segment at address '0x0' has not changed, skipping write -[2024-08-29T12:14:06Z INFO ] Segment at address '0x8000' has not changed, skipping write -[00:00:05] [========================================] 483/483 0x10000 [2024-08-29T12:14:12Z INFO ] Flashing has completed! +MAC address: 40:4c:ca:5b:c7:dc +App/part. size: 768,944/4,128,768 bytes, 18.62% +[2025-04-10T10:01:23Z INFO ] Segment at address '0x0' has not changed, skipping write +[2025-04-10T10:01:23Z INFO ] Segment at address '0x8000' has not changed, skipping write +[00:00:06] [========================================] 411/411 0x10000 [2025-04-10T10:01:31Z INFO ] Flashing has completed! +``` + +If espflash reports the following error: + +``` +Error: espflash::connection_failed + + × Error while connecting to device + ╰─▶ Serial port not found +``` + +You should to identify which serial port are connected to your esp board, and use `--port` to specify the used serial port: + +``` +# Suppose that the esp board are connected to /dev/cu.usbmodem211401 +cargo run --release -- --port /dev/cu.usbmodem211401 ``` If you want to get some insight of segments of your binary, [`espsegs`](https://github.com/bjoernQ/espsegs) would help: @@ -39,5 +61,5 @@ If you want to get some insight of segments of your binary, [`espsegs`](https:// cargo install --git https://github.com/bjoernQ/espsegs # Check all segments -espsegs target/riscv32imac-esp-espidf/release/rmk-esp32c6 --chip esp32c6 +espsegs target/riscv32imac-unknown-none-elf/release/rmk-esp32c6 --chip esp32c6 ``` \ No newline at end of file diff --git a/examples/use_config/esp32c6_ble/build.rs b/examples/use_config/esp32c6_ble/build.rs index ce5205115..147d1e047 100644 --- a/examples/use_config/esp32c6_ble/build.rs +++ b/examples/use_config/esp32c6_ble/build.rs @@ -1,34 +1,33 @@ -use const_gen::*; use std::fs::File; use std::io::Read; use std::path::Path; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { + println!("cargo:rerun-if-changed=keyboard.toml"); + // Generate vial config at the root of project + println!("cargo:rerun-if-changed=vial.json"); generate_vial_config(); - // ESP IDE system env - embuild::espidf::sysenv::output(); - - println!("cargo:rerun-if-changed=keyboard.toml"); + println!("cargo:rustc-link-arg-bins=-Tlinkall.x"); // Set the extra linker script from defmt - println!("cargo:rustc-link-arg=-Tdefmt.x"); + // println!("cargo:rustc-link-arg=-Tdefmt.x"); } fn generate_vial_config() { // Generated vial config file - println!("cargo:rerun-if-changed=vial.json"); let out_file = Path::new(&env::var_os("OUT_DIR").unwrap()).join("config_generated.rs"); let p = Path::new("vial.json"); let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -44,6 +43,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_config/esp32c6_ble/espflash.toml b/examples/use_config/esp32c6_ble/espflash.toml deleted file mode 100644 index 13c279b9a..000000000 --- a/examples/use_config/esp32c6_ble/espflash.toml +++ /dev/null @@ -1,9 +0,0 @@ -partition_table = "partitions.csv" - -[connection] - -[[usb_device]] -vid = "303a" -pid = "1001" - -[flash] diff --git a/examples/use_config/esp32c6_ble/keyboard.toml b/examples/use_config/esp32c6_ble/keyboard.toml index 3bc52aad4..c70dae5e9 100644 --- a/examples/use_config/esp32c6_ble/keyboard.toml +++ b/examples/use_config/esp32c6_ble/keyboard.toml @@ -9,8 +9,8 @@ usb_enable = false [matrix] # Input and output pins are mandatory -input_pins = ["gpio6", "gpio7", "gpio20", "gpio21"] -output_pins = ["gpio3", "gpio4", "gpio5"] +input_pins = ["GPIO6", "GPIO7", "GPIO20", "GPIO21"] +output_pins = ["GPIO3", "GPIO4", "GPIO5"] # WARNING: Currently row2col/col2row is set in RMK's feature gate, row2col config here is valid ONLY when you're using cloud compilation # row2col = true diff --git a/examples/use_config/esp32c6_ble/partitions.csv b/examples/use_config/esp32c6_ble/partitions.csv deleted file mode 100644 index 9a7d8a6d7..000000000 --- a/examples/use_config/esp32c6_ble/partitions.csv +++ /dev/null @@ -1,6 +0,0 @@ -# Name, Type, SubType, Offset, Size, Flags -# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap -nvs, data, nvs,0x9000, 0x6000, -phy_init, data, phy,0xf000, 0x1000, -factory, app, factory,0x10000, 0x300000, -rmk, 0x40, 0, 0x3f0000, 0x10000, \ No newline at end of file diff --git a/examples/use_config/esp32c6_ble/rust-toolchain.toml b/examples/use_config/esp32c6_ble/rust-toolchain.toml deleted file mode 100644 index 4c3b3109f..000000000 --- a/examples/use_config/esp32c6_ble/rust-toolchain.toml +++ /dev/null @@ -1,3 +0,0 @@ -[toolchain] -channel = "esp" -components = ["rust-src"] \ No newline at end of file diff --git a/examples/use_config/esp32c6_ble/sdkconfig.defaults b/examples/use_config/esp32c6_ble/sdkconfig.defaults deleted file mode 100644 index 3aff089f7..000000000 --- a/examples/use_config/esp32c6_ble/sdkconfig.defaults +++ /dev/null @@ -1,28 +0,0 @@ -# Rust often needs a bit of an extra main task stack size compared to C (the default is 3K) -CONFIG_ESP_MAIN_TASK_STACK_SIZE=64000 - -# Use this to set FreeRTOS kernel tick frequency to 1000 Hz (100 Hz by default). -# This allows to use 1 ms granuality for thread sleeps (10 ms by default). -CONFIG_FREERTOS_HZ=1000 - -# Workaround for https://github.com/espressif/esp-idf/issues/7631 -#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=n -#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=n - -CONFIG_LOG_DEFAULT_LEVEL=5 - -# Disable watchdog -CONFIG_INT_WDT=n -CONFIG_ESP_TASK_WDT=n - -# esp-nimble config -CONFIG_BT_ENABLED=y -CONFIG_BT_BLE_ENABLED=y -CONFIG_BT_BLUEDROID_ENABLED=n -CONFIG_BT_NIMBLE_ENABLED=y -CONFIG_BT_NIMBLE_NVS_PERSIST=y -# CONFIG_BT_NIMBLE_EXT_ADV=y - -CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y -CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n -CONFIG_BTDM_CTRL_MODE_BTDM=n \ No newline at end of file diff --git a/examples/use_config/esp32c6_ble/src/main.rs b/examples/use_config/esp32c6_ble/src/main.rs index efc5f10e5..c3bc88290 100644 --- a/examples/use_config/esp32c6_ble/src/main.rs +++ b/examples/use_config/esp32c6_ble/src/main.rs @@ -1,4 +1,5 @@ -#![feature(type_alias_impl_trait)] +#![no_std] +#![no_main] use rmk::macros::rmk_keyboard; diff --git a/examples/use_config/esp32c6_ble/vial.json b/examples/use_config/esp32c6_ble/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_config/esp32c6_ble/vial.json +++ b/examples/use_config/esp32c6_ble/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_config/esp32s3_ble/.cargo/config.toml b/examples/use_config/esp32s3_ble/.cargo/config.toml index e5622473f..cab417dca 100644 --- a/examples/use_config/esp32s3_ble/.cargo/config.toml +++ b/examples/use_config/esp32s3_ble/.cargo/config.toml @@ -1,18 +1,19 @@ -[build] -target = "xtensa-esp32s3-espidf" +[target.'cfg(all(any(target_arch = "riscv32", target_arch = "xtensa"), target_os = "none"))'] +runner = "espflash flash --monitor" -[target.xtensa-esp32s3-espidf] -linker = "ldproxy" -runner = "espflash flash --monitor --log-format defmt" -rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110 +[build] +target = "xtensa-esp32s3-none-elf" +rustflags = [ + # Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.) + # NOTE: May negatively impact performance of produced code + "-C", "force-frame-pointers", +] -[unstable] -build-std = ["std", "panic_abort"] [env] -MCU="esp32s3" -# Note: this variable is not used by the pio builder (`cargo build --features pio`) -ESP_IDF_VERSION = "v5.2" -DEFMT_LOG="debug" -ESP_IDF_PATH_ISSUES="warn" -CRATE_CC_NO_DEFAULTS="1" \ No newline at end of file +ESP_LOG = "info" + +# Xtensa only: +# Needed for nightly, until llvm upstream has support for Rust Xtensa. +[unstable] +build-std = ["alloc", "core"] \ No newline at end of file diff --git a/examples/use_config/esp32s3_ble/Cargo.lock b/examples/use_config/esp32s3_ble/Cargo.lock index 8597deb30..002263e7e 100644 --- a/examples/use_config/esp32s3_ble/Cargo.lock +++ b/examples/use_config/esp32s3_ble/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -34,13 +45,10 @@ dependencies = [ ] [[package]] -name = "aligned" -version = "0.4.2" +name = "allocator-api2" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377e4c0ba83e4431b10df45c1d4666f178ea9c552cac93e60c3a88bf32785923" -dependencies = [ - "as-slice", -] +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android-tzdata" @@ -59,18 +67,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" - -[[package]] -name = "as-slice" -version = "0.2.1" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" -dependencies = [ - "stable_deref_trait", -] +checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" [[package]] name = "atomic-polyfill" @@ -81,24 +80,12 @@ dependencies = [ "critical-section", ] -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "autocfg" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" -[[package]] -name = "az" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" - [[package]] name = "bare-metal" version = "0.2.5" @@ -109,23 +96,18 @@ dependencies = [ ] [[package]] -name = "bindgen" -version = "0.71.1" +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "basic-toml" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" +checksum = "ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a" dependencies = [ - "bitflags 2.6.0", - "cexpr", - "clang-sys", - "itertools", - "log", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.96", + "serde", ] [[package]] @@ -140,6 +122,26 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" +[[package]] +name = "bitfield" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7e6caee68becd795bfd65f1a026e4d00d8f0c2bc9be5eb568e1015f9ce3c34" +dependencies = [ + "bitfield-macros", +] + +[[package]] +name = "bitfield-macros" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "331afbb18ce7b644c0b428726d369c5dd37ca0b815d72a459fcc2896c3c8ad32" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "bitfield-struct" version = "0.10.0" @@ -148,7 +150,7 @@ checksum = "bedc5f4fa33bdc993f9b8ba7369d1b74fcdafa958924a0a54de6707e360de692" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] @@ -159,31 +161,32 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] -name = "bstr" -version = "1.11.1" +name = "block-buffer" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "memchr", - "serde", + "generic-array", ] [[package]] -name = "build-time" -version = "0.1.3" +name = "bt-hci" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1219c19fc29b7bfd74b7968b420aff5bc951cf517800176e795d6b2300dd382" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" dependencies = [ - "chrono", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.96", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", ] [[package]] @@ -204,38 +207,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "camino" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" -dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.24", - "serde", - "serde_json", - "thiserror 1.0.69", -] - [[package]] name = "cargo_toml" version = "0.21.0" @@ -255,27 +226,12 @@ dependencies = [ "shlex", ] -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "chrono" version = "0.4.39" @@ -291,23 +247,24 @@ dependencies = [ ] [[package]] -name = "clang-sys" -version = "1.8.1" +name = "cipher" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ - "glob", - "libc", - "libloading", + "crypto-common", + "inout", ] [[package]] -name = "cmake" -version = "0.1.52" +name = "cmac" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" dependencies = [ - "cc", + "cipher", + "dbl", + "digest", ] [[package]] @@ -337,24 +294,10 @@ dependencies = [ ] [[package]] -name = "const_format" -version = "0.2.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd" -dependencies = [ - "const_format_proc_macros", -] - -[[package]] -name = "const_format_proc_macros" -version = "0.2.34" +name = "const-oid" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "core-foundation-sys" @@ -375,23 +318,12 @@ dependencies = [ ] [[package]] -name = "cortex-m-rt" -version = "0.7.5" +name = "cpufeatures" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ - "cortex-m-rt-macros", -] - -[[package]] -name = "cortex-m-rt-macros" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.96", + "libc", ] [[package]] @@ -410,53 +342,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] -name = "crossbeam-deque" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "cvt" -version = "0.1.2" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ae9bf77fbf2d39ef573205d554d87e86c12f1994e9ea335b0651b9b278bcf1" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "cfg-if", + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", ] [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "typenum", ] [[package]] @@ -465,22 +369,8 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -493,78 +383,89 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", - "syn 2.0.96", + "strsim", + "syn 2.0.100", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.96", + "generic-array", ] [[package]] -name = "defmt" -version = "0.3.10" +name = "delegate" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "b9b6483c2bbed26f97861cf57651d4f2b731964a28cd2257f934a4b452480d21" dependencies = [ - "bitflags 1.3.2", - "defmt-macros", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] -name = "defmt-macros" -version = "0.4.0" +name = "der" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ - "defmt-parser", - "proc-macro-error2", - "proc-macro2", - "quote", - "syn 2.0.96", + "const-oid", + "zeroize", ] [[package]] -name = "defmt-parser" -version = "0.4.1" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "thiserror 2.0.7", + "block-buffer", + "crypto-common", + "subtle", ] [[package]] name = "document-features" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" dependencies = [ "litrs", ] [[package]] -name = "either" -version = "1.13.0" +name = "elliptic-curve" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] [[package]] name = "embassy-embedded-hal" @@ -572,7 +473,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", "embassy-futures", "embassy-sync", "embassy-time", @@ -587,11 +487,9 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "critical-section", - "defmt", "document-features", "embassy-executor-macros", ] @@ -599,35 +497,18 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" -dependencies = [ - "defmt", -] - -[[package]] -name = "embassy-hal-internal" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "num-traits", -] +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" [[package]] name = "embassy-net-driver" @@ -646,45 +527,13 @@ dependencies = [ "embassy-sync", ] -[[package]] -name = "embassy-nrf" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7494efe1e0183568327c7e681d4b77ed5241921dcb5976426d9a65b65a0c81" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cortex-m", - "cortex-m-rt", - "critical-section", - "defmt", - "document-features", - "embassy-embedded-hal", - "embassy-hal-internal", - "embassy-sync", - "embassy-time", - "embassy-usb-driver", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-async", - "embedded-io", - "embedded-io-async", - "embedded-storage", - "embedded-storage-async", - "fixed", - "nrf-pac", - "rand_core", -] - [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", "embedded-io-async", "futures-sink", "futures-util", @@ -699,10 +548,8 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", "document-features", "embassy-time-driver", - "embassy-time-queue-utils", "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-async", @@ -734,7 +581,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -749,8 +595,16 @@ name = "embassy-usb-driver" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" + +[[package]] +name = "embassy-usb-synopsys-otg" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08e753b23799329780c7ac434264026d0422044d6649ed70a73441b14a6436d7" dependencies = [ - "defmt", + "critical-section", + "embassy-sync", + "embassy-usb-driver", ] [[package]] @@ -777,9 +631,6 @@ name = "embedded-hal" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" -dependencies = [ - "defmt", -] [[package]] name = "embedded-hal-async" @@ -787,28 +638,14 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", "embedded-hal 1.0.0", ] -[[package]] -name = "embedded-hal-nb" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" -dependencies = [ - "embedded-hal 1.0.0", - "nb 1.1.0", -] - [[package]] name = "embedded-io" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" -dependencies = [ - "defmt", -] [[package]] name = "embedded-io-async" @@ -816,7 +653,6 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", "embedded-io", ] @@ -835,22 +671,6 @@ dependencies = [ "embedded-storage", ] -[[package]] -name = "embedded-svc" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b85590a7a120e370bed5b6bc2b399b345c60d4c749d3bc06039472da37b9893" -dependencies = [ - "defmt", - "embedded-io", - "embedded-io-async", - "enumset", - "heapless 0.8.0", - "num_enum", - "serde", - "strum 0.25.0", -] - [[package]] name = "embuild" version = "0.33.0" @@ -858,22 +678,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28a8cbd9507fabce8f2741b9ca45da9e898cc2b0f1c2e53d21cb2436aeac811d" dependencies = [ "anyhow", - "bindgen", "bitflags 1.3.2", - "cmake", "filetime", - "globwalk", - "home", "log", - "regex", - "remove_dir_all", - "serde", - "serde_json", "shlex", - "strum 0.24.1", - "tempfile", "thiserror 1.0.69", - "which", ] [[package]] @@ -882,6 +691,18 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "enumset" version = "1.1.5" @@ -897,19 +718,10 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59c3b24c345d8c314966bdc1832f6c2635bfcce8e7cf363bd115987bba2ee242" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", - "syn 2.0.96", -] - -[[package]] -name = "envy" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f47e0157f2cb54f5ae1bd371b30a2ae4311e1c028f575cd4e81de7353215965" -dependencies = [ - "serde", + "syn 2.0.100", ] [[package]] @@ -919,13 +731,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] -name = "errno" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +name = "esp-alloc" +version = "0.7.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "libc", - "windows-sys 0.59.0", + "allocator-api2", + "cfg-if", + "critical-section", + "document-features", + "enumset", + "linked_list_allocator", +] + +[[package]] +name = "esp-backtrace" +version = "0.15.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "cfg-if", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-println", + "heapless 0.8.0", + "semihosting", ] [[package]] @@ -935,117 +763,226 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8aa1c8f9954c9506699cf1ca10a2adcc226ff10b6ae3cb9e875cf2c6a0b9a372" dependencies = [ "quote", - "syn 2.0.96", + "syn 2.0.100", "termcolor", ] [[package]] -name = "esp-idf-hal" -version = "0.45.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775ce25171dc4f615146a4a27ed3a64c6fd99ced77d7112062f2b19bf933f5db" +name = "esp-build" +version = "0.2.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "quote", + "syn 2.0.100", + "termcolor", +] + +[[package]] +name = "esp-config" +version = "0.3.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "document-features", + "serde", + "serde_json", +] + +[[package]] +name = "esp-hal" +version = "1.0.0-beta.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "atomic-waker", + "basic-toml", + "bitfield 0.18.1", + "bitflags 2.9.0", + "bytemuck", + "cfg-if", "critical-section", + "delegate", + "document-features", + "embassy-embedded-hal", + "embassy-futures", "embassy-sync", + "embassy-usb-driver", + "embassy-usb-synopsys-otg", "embedded-can", - "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-async", - "embedded-hal-nb", "embedded-io", "embedded-io-async", - "embuild", "enumset", - "esp-idf-sys", - "heapless 0.8.0", - "log", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal-procmacros", + "esp-metadata", + "esp-riscv-rt", + "esp-synopsys-usb-otg", + "esp32s3", + "fugit", + "instability", "nb 1.1.0", - "num_enum", + "paste", + "portable-atomic", + "rand_core 0.6.4", + "rand_core 0.9.3", + "riscv", + "serde", + "strum 0.27.1", + "ufmt-write", + "usb-device", + "void", + "xtensa-lx", + "xtensa-lx-rt", ] [[package]] -name = "esp-idf-svc" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc07aaba257d28d54a96af005ca67d0b38876d8837f5d54a3e0547e100b219c" +name = "esp-hal-embassy" +version = "0.7.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "embassy-futures", + "critical-section", + "document-features", + "embassy-executor", + "embassy-sync", + "embassy-time", "embassy-time-driver", "embassy-time-queue-utils", - "embedded-hal-async", - "embedded-storage", - "embedded-svc", - "embuild", - "enumset", - "esp-idf-hal", - "futures-io", - "heapless 0.8.0", - "log", - "num_enum", - "uncased", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal", + "esp-hal-procmacros", + "esp-metadata", + "portable-atomic", + "static_cell", ] [[package]] -name = "esp-idf-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb77a3d02b579a60a811ed9be22b78c5e794bc492d833ee7fc44d3a0155885e1" +name = "esp-hal-procmacros" +version = "0.17.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "darling", + "document-features", + "litrs", + "object", + "proc-macro-crate", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "esp-metadata" +version = "0.6.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "anyhow", - "build-time", - "cargo_metadata", - "cmake", - "const_format", - "embuild", - "envy", - "libc", - "regex", + "basic-toml", "serde", - "strum 0.24.1", - "which", + "strum 0.26.3", ] [[package]] name = "esp-println" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645e54eb592ca0a3d60213b1695e2a5fc0b51ca6d693c08d6983857224a629ed" +version = "0.13.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "critical-section", - "defmt", - "esp-build", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", "log", "portable-atomic", ] [[package]] -name = "esp32-nimble" +name = "esp-riscv-rt" version = "0.10.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "document-features", + "riscv", + "riscv-rt-macros", +] + +[[package]] +name = "esp-storage" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88cc737968921dc601fafaf3ca83f8fca5039cfc6a46e402cb042da647a0c00f" +checksum = "1e98b5069bd1482fb85f9236f8ea6cd1b5b6b5a1c3c3fb8c938c97ccfbbb051b" dependencies = [ - "anyhow", - "bitflags 2.6.0", - "bstr", + "critical-section", + "embedded-storage", + "esp-build 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "esp-synopsys-usb-otg" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8938451cb19032f13365328ea66ab38c8d16deecdf322067442297110eb74468" +dependencies = [ + "critical-section", + "embedded-hal 0.2.7", + "ral-registers", + "usb-device", + "vcell", +] + +[[package]] +name = "esp-wifi" +version = "0.13.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "allocator-api2", + "bt-hci", "cfg-if", + "critical-section", + "document-features", "embassy-sync", - "embuild", - "esp-idf-svc", - "heapless 0.8.0", - "log", - "num_enum", - "once_cell", - "uuid", - "zerocopy 0.8.14", - "zerocopy-derive 0.8.14", + "embedded-io", + "embedded-io-async", + "esp-alloc", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal", + "esp-metadata", + "esp-wifi-sys", + "num-derive", + "num-traits", + "portable-atomic", + "portable_atomic_enum", + "rand_core 0.6.4", + "xtensa-lx-rt", ] [[package]] -name = "fastrand" -version = "2.3.0" +name = "esp-wifi-sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6b5438361891c431970194a733415006fb3d00b6eb70b3dcb66fd58f04d9b39" +dependencies = [ + "anyhow", +] + +[[package]] +name = "esp32s3" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6d20f119410092abfbc65e46f9362015a7110023528f0dbe855cab80c38ca8" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "ff" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] [[package]] name = "filetime" @@ -1056,19 +993,7 @@ dependencies = [ "cfg-if", "libc", "libredox", - "windows-sys 0.59.0", -] - -[[package]] -name = "fixed" -version = "1.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a" -dependencies = [ - "az", - "bytemuck", - "half", - "typenum", + "windows-sys", ] [[package]] @@ -1078,17 +1003,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "fs_at" -version = "0.2.1" +name = "fugit" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14af6c9694ea25db25baa2a1788703b9e7c6648dcaeeebeb98f7561b5384c036" +checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" dependencies = [ - "aligned", - "cfg-if", - "cvt", - "libc", - "nix", - "windows-sys 0.52.0", + "gcd", ] [[package]] @@ -1121,6 +1041,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -1135,7 +1065,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] @@ -1165,43 +1095,31 @@ dependencies = [ ] [[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "globset" -version = "0.4.15" +name = "gcd" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata", - "regex-syntax", -] +checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" [[package]] -name = "globwalk" -version = "0.8.1" +name = "generic-array" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ - "bitflags 1.3.2", - "ignore", - "walkdir", + "typenum", + "version_check", + "zeroize", ] [[package]] -name = "half" -version = "2.4.1" +name = "group" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ - "cfg-if", - "crunchy", + "ff", + "rand_core 0.6.4", + "subtle", ] [[package]] @@ -1263,17 +1181,26 @@ dependencies = [ [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hkdf" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] [[package]] -name = "home" -version = "0.5.9" +name = "hmac" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "windows-sys 0.52.0", + "digest", ] [[package]] @@ -1305,22 +1232,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "ignore" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" -dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata", - "same-file", - "walkdir", - "winapi-util", -] - [[package]] name = "indexmap" version = "2.7.0" @@ -1332,19 +1243,38 @@ dependencies = [ ] [[package]] -name = "itertools" -version = "0.12.1" +name = "indoc" +version = "2.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd" + +[[package]] +name = "inout" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ - "either", + "generic-array", +] + +[[package]] +name = "instability" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf9fed6d91cfb734e7476a06bde8300a1b94e217e1b523b6f0cd1a01998c71d" +dependencies = [ + "darling", + "indoc", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" @@ -1374,38 +1304,31 @@ version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" -[[package]] -name = "libloading" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" -dependencies = [ - "cfg-if", - "windows-targets", -] - [[package]] name = "libredox" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "libc", "redox_syscall", ] [[package]] -name = "linux-raw-sys" -version = "0.4.14" +name = "linked_list_allocator" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" [[package]] name = "litrs" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" +dependencies = [ + "proc-macro2", +] [[package]] name = "lock_api" @@ -1419,9 +1342,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.25" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "lzma-sys" @@ -1441,10 +1364,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] -name = "minimal-lexical" -version = "0.2.1" +name = "minijinja" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +checksum = "98642a6dfca91122779a307b77cd07a4aa951fbe32232aaf5bad9febc66be754" +dependencies = [ + "serde", +] [[package]] name = "nb" @@ -1462,76 +1388,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" [[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cfg_aliases", - "libc", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "normpath" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8911957c4b1549ac0dc74e30db9c8b0e66ddcd6d7acc33098f4c63a64a6d7ed" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "nrf-pac" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" -dependencies = [ - "cortex-m", - "cortex-m-rt", -] - -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ - "Inflector", - "darling 0.13.4", "proc-macro2", "quote", - "syn 1.0.109", - "uuid", + "syn 2.0.100", ] [[package]] @@ -1558,10 +1422,18 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", ] [[package]] @@ -1570,12 +1442,67 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "paste" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror 2.0.12", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "pin-project-lite" version = "0.2.15" @@ -1596,9 +1523,30 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" + +[[package]] +name = "portable_atomic_enum" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d48f60c43e0120bb2bb48589a16d4bed2f4b911be41e299f2d0fc0e0e20885" +dependencies = [ + "portable-atomic", + "portable_atomic_enum_macros", +] + +[[package]] +name = "portable_atomic_enum_macros" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "a33fa6ec7f2047f572d49317cca19c87195de99c6e5b6ee492da701cfe02b053" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] [[package]] name = "postcard" @@ -1607,7 +1555,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", "heapless 0.7.17", "postcard-derive", "serde", @@ -1624,6 +1571,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" version = "0.2.25" @@ -1631,7 +1587,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" dependencies = [ "proc-macro2", - "syn 2.0.96", + "syn 2.0.100", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", ] [[package]] @@ -1662,14 +1627,14 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] @@ -1683,19 +1648,47 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7a31eed1591dcbc95d92ad7161908e72f4677f8fabf2a32ca49b4237cbf211" + +[[package]] +name = "ral-registers" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46b71a9d9206e8b46714c74255adcaea8b11e0350c1d8456165073c3f75fc81a" + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" + [[package]] name = "redox_syscall" version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", ] [[package]] @@ -1728,55 +1721,80 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] -name = "remove_dir_all" -version = "0.8.4" +name = "riscv" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a694f9e0eb3104451127f6cc1e5de55f59d3b1fc8c5ddfaeb6f1e716479ceb4a" +checksum = "5ea8ff73d3720bdd0a97925f0bf79ad2744b6da8ff36be3840c48ac81191d7a7" dependencies = [ - "cfg-if", - "cvt", - "fs_at", - "libc", - "normpath", - "windows-sys 0.59.0", + "critical-section", + "embedded-hal 1.0.0", + "paste", + "riscv-macros", + "riscv-pac", +] + +[[package]] +name = "riscv-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f265be5d634272320a7de94cea15c22a3bfdd4eb42eb43edc528415f066a1f25" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "riscv-pac" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8188909339ccc0c68cfb5a04648313f09621e8b87dc03095454f1a11f6c5d436" + +[[package]] +name = "riscv-rt-macros" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc71814687c45ba4cd1e47a54e03a2dbc62ca3667098fbae9cc6b423956758fa" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] name = "rmk" -version = "0.5.2" +version = "0.6.1" dependencies = [ "bitfield-struct", "byteorder", "chrono", "cortex-m", "crc32fast", - "defmt", "document-features", "embassy-embedded-hal", "embassy-executor", "embassy-futures", - "embassy-nrf", "embassy-sync", "embassy-time", "embassy-usb", "embedded-hal 1.0.0", - "embedded-hal-async", "embedded-io-async", "embedded-storage", "embedded-storage-async", - "esp-idf-svc", - "esp32-nimble", + "esp-hal", "futures", "heapless 0.8.0", - "nrf-softdevice", + "log", "num_enum", "paste", "postcard", + "rand_core 0.6.4", "rmk-macro", "sequential-storage", "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1784,41 +1802,42 @@ dependencies = [ name = "rmk-esp32s3" version = "0.2.0" dependencies = [ + "bt-hci", "cc", "const-gen", - "defmt", - "embassy-time", + "embassy-executor", "embuild", - "esp-idf-svc", + "esp-alloc", + "esp-backtrace", + "esp-hal", + "esp-hal-embassy", "esp-println", - "esp32-nimble", + "esp-storage", + "esp-wifi", "json", + "rand_core 0.6.4", "rmk", "xz2", ] [[package]] name = "rmk-macro" -version = "0.4.2" +version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", "serde", "serde_derive", - "syn 2.0.96", + "syn 2.0.100", "toml", ] -[[package]] -name = "rustc-hash" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" - [[package]] name = "rustc_version" version = "0.2.3" @@ -1837,19 +1856,6 @@ dependencies = [ "semver 1.0.24", ] -[[package]] -name = "rustix" -version = "0.38.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" -dependencies = [ - "bitflags 2.6.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.59.0", -] - [[package]] name = "rustversion" version = "1.0.18" @@ -1858,24 +1864,34 @@ checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "ryu" -version = "1.0.18" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "scopeguard" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] -name = "same-file" -version = "1.0.6" +name = "sec1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ - "winapi-util", + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", ] [[package]] -name = "scopeguard" -version = "1.2.0" +name = "semihosting" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +checksum = "c3e1c7d2b77d80283c750a39c52f1ab4d17234e8f30bca43550f5b2375f41d5f" [[package]] name = "semver" @@ -1891,9 +1907,6 @@ name = "semver" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" -dependencies = [ - "serde", -] [[package]] name = "semver-parser" @@ -1903,39 +1916,38 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", "embedded-storage-async", ] [[package]] name = "serde" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "serde_json" -version = "1.0.133" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", @@ -1952,6 +1964,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1992,12 +2015,6 @@ dependencies = [ "portable-atomic", ] -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" @@ -2006,48 +2023,54 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.24.1" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ - "strum_macros 0.24.3", + "strum_macros 0.26.4", ] [[package]] name = "strum" -version = "0.25.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32" dependencies = [ - "strum_macros 0.25.3", + "strum_macros 0.27.1", ] [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] name = "strum_macros" -version = "0.25.3" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 2.0.96", + "syn 2.0.100", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "1.0.109" @@ -2061,28 +2084,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.96" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "tempfile" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" -dependencies = [ - "cfg-if", - "fastrand", - "once_cell", - "rustix", - "windows-sys 0.59.0", -] - [[package]] name = "termcolor" version = "1.4.1" @@ -2103,11 +2113,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.7" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93605438cbd668185516ab499d589afb7ee1859ea3d5fc8f6b0755e1c7443767" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.7", + "thiserror-impl 2.0.12", ] [[package]] @@ -2118,18 +2128,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "thiserror-impl" -version = "2.0.7" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d8749b4531af2117677a5fcd12b1348a3fe2b81e36e61ffeac5c4aa3273e36" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] @@ -2166,6 +2176,42 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "log", + "p256", + "rand_chacha", + "rand_core 0.6.4", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" @@ -2173,25 +2219,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] -name = "uncased" -version = "0.9.10" +name = "ucd-trie" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" -dependencies = [ - "version_check", -] +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] -name = "unicode-ident" -version = "1.0.14" +name = "ufmt-write" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" [[package]] -name = "unicode-xid" -version = "0.2.6" +name = "unicode-ident" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "usb-device" @@ -2199,7 +2242,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", "heapless 0.8.0", "portable-atomic", ] @@ -2210,7 +2252,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", "serde", "ssmarshal", "usb-device", @@ -2247,20 +2288,6 @@ name = "uuid" version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" -dependencies = [ - "uuid-macro-internal", -] - -[[package]] -name = "uuid-macro-internal" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b91f57fe13a38d0ce9e28a03463d8d3c2468ed03d75375110ec71d93b449a08" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.96", -] [[package]] name = "vcell" @@ -2289,16 +2316,6 @@ dependencies = [ "vcell", ] -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "wasm-bindgen" version = "0.2.99" @@ -2320,7 +2337,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", "wasm-bindgen-shared", ] @@ -2342,7 +2359,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2353,25 +2370,13 @@ version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - [[package]] name = "winapi-util" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys", ] [[package]] @@ -2383,15 +2388,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] - [[package]] name = "windows-sys" version = "0.59.0" @@ -2474,6 +2470,43 @@ dependencies = [ "memchr", ] +[[package]] +name = "xtensa-lx" +version = "0.10.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "critical-section", + "document-features", +] + +[[package]] +name = "xtensa-lx-rt" +version = "0.18.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "anyhow", + "document-features", + "enum-as-inner", + "minijinja", + "r0", + "serde", + "strum 0.26.3", + "toml", + "xtensa-lx", + "xtensa-lx-rt-proc-macros", +] + +[[package]] +name = "xtensa-lx-rt-proc-macros" +version = "0.2.2" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "xz2" version = "0.1.7" @@ -2494,11 +2527,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.14" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a367f292d93d4eab890745e75a778da40909cab4d6ff8173693812f79c4a2468" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" dependencies = [ - "zerocopy-derive 0.8.14", + "zerocopy-derive 0.8.24", ] [[package]] @@ -2509,16 +2542,22 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "zerocopy-derive" -version = "0.8.14" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3931cb58c62c13adec22e38686b559c86a30565e16ad6e8510a337cedc611e1" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_config/esp32s3_ble/Cargo.toml b/examples/use_config/esp32s3_ble/Cargo.toml index 445b3a120..d9bb42795 100644 --- a/examples/use_config/esp32s3_ble/Cargo.toml +++ b/examples/use_config/esp32s3_ble/Cargo.toml @@ -10,20 +10,28 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk", features = ["col2row", "esp32s3_ble"] } -esp32-nimble = { version = "0.10" } -defmt = "0.3" -embassy-time = { version = "0.4.0", features = ["defmt", "generic-queue-8"] } -esp-println = { version = "0.13", features = ["esp32s3", "defmt-espflash"] } -esp-idf-svc = { version = "0.51", default-features = false, features = [ - "std", - "alloc", - "binstart", - "embassy-sync", - "critical-section", - "embassy-time-driver", - "native", +rmk = { path = "../../../rmk", default-features = false, features = [ + "col2row", + "esp32s3_ble", + "log", + "storage", + "_no_usb", # TODO: Add usb support for esp32s3 ] } +embassy-executor = { version = "0.7.0" } +esp-backtrace = { version = "0.15", features = [ + "esp32s3", + "exception-handler", + "panic-handler", + "println", +] } +esp-hal = { version = "1.0.0-beta.0", features = ["esp32s3", "unstable"] } +esp-hal-embassy = { version = "0.7.0", features = ["esp32s3"] } +esp-storage = { version = "0.5.0", features = ["esp32s3", "nor-flash"] } +esp-alloc = { version = "0.7.0" } +esp-println = { version = "0.13.0", features = ["esp32s3", "log"] } +esp-wifi = { version = "0.13.0", features = ["esp32s3", "ble"] } +bt-hci = { version = "0.3" } +rand_core = { version = "0.6", default-features = false } [build-dependencies] xz2 = "0.1.7" @@ -37,17 +45,30 @@ name = "rmk-esp32s3" test = false bench = false +[profile.dev.package.esp-storage] +opt-level = 3 + [profile.dev] -codegen-units = 1 # better optimizations -debug = true -opt-level = 3 # esp-wifi should be built with opt-level 2 or 3 -overflow-checks = true -lto = false -panic = 'unwind' +# Rust debug is too slow. +# For debug builds always builds with some optimization +opt-level = "s" [profile.release] -codegen-units = 1 # better optimizations -debug = true # no overhead for bare-metal -opt-level = 3 # esp-wifi should be built with opt-level 2 or 3 +codegen-units = 1 # LLVM can perform better optimizations using a single thread +debug = 2 +debug-assertions = false +incremental = false +lto = 'thin' +opt-level = 3 overflow-checks = false -lto = "fat" + +[patch.crates-io] +esp-wifi = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-backtrace = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-hal-embassy = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-alloc = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-println = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } \ No newline at end of file diff --git a/examples/use_config/esp32s3_ble/README.md b/examples/use_config/esp32s3_ble/README.md index 43e4a002b..2641c8d68 100644 --- a/examples/use_config/esp32s3_ble/README.md +++ b/examples/use_config/esp32s3_ble/README.md @@ -1,12 +1,18 @@ # esp32s3 BLE example -To run this example, you should have latest Rust in **esp** channel and `esp-idf` toolchain installed. The full instruction of installing `esp-idf` toolchain can be found [here](https://docs.esp-rs.org/book/installation/index.html) and [here](https://docs.esp-rs.org/std-training/02_2_software.html) +To run this example, you should have latest Rust in **esp** channel installed. The full instruction of installing esp Rust toolchain can be found [here](https://docs.esp-rs.org/book/installation/index.html). -To run the example, make sure that you have esp-idf environment, `ldproxy` and `espflash` installed correctly. Then, run +[`espflash`](https://github.com/esp-rs/espflash) should also be installed: ``` -cd examples/use_rust/esp32s3_ble -cargo run --release +cargo install cargo-espflash espflash +``` + +After having everything installed, use the following command to run the example: + +``` +cd examples/use_config/esp32s3_ble +cargo +esp run --release ``` If everything is good, you'll see the log as the following: @@ -16,23 +22,36 @@ cargo run --release Compiling ... ... ... - Finished `release` profile [optimized + debuginfo] target(s) in 51.39s - Running `espflash flash --monitor --log-format defmt target/xtensa-esp32s3-espidf/release/rmk-esp32s3` -[2024-04-07T12:49:21Z INFO ] Detected 2 serial ports -[2024-04-07T12:49:21Z INFO ] Ports which match a known common dev board are highlighted -[2024-04-07T12:49:21Z INFO ] Please select a port -[2024-04-07T12:50:24Z INFO ] Serial port: '/dev/cu/xx' -[2024-04-07T12:50:24Z INFO ] Connecting... -[2024-04-07T12:50:24Z INFO ] Using flash stub -Chip type: esp32s3 (revision v0.4) + Finished `release` profile [optimized + debuginfo] target(s) in 11.70s + Running `espflash flash --monitor --port /dev/cu.usbmodem211401 target/xtensa-esp32s3-none-elf/release/rmk-esp32s3` +[2025-04-10T10:01:23Z INFO ] Serial port: '/dev/cu.usbmodem211401' +[2025-04-10T10:01:23Z INFO ] Connecting... +[2025-04-10T10:01:23Z INFO ] Using flash stub +Chip type: esp32s3 (revision v0.1) Crystal frequency: 40 MHz Flash size: 4MB -Features: WiFi, BLE -MAC address: aa:aa:aa:aa:aa:aa -App/part. size: 607,488/4,128,768 bytes, 14.71% -[2024-04-07T12:50:24Z INFO ] Segment at address '0x0' has not changed, skipping write -[2024-04-07T12:50:24Z INFO ] Segment at address '0x8000' has not changed, skipping write -[00:00:03] [========================================] 337/337 0x10000 [2024-04-07T12:50:28Z INFO ] Flashing has completed! +Features: WiFi 6, BT 5 +MAC address: 40:4c:ca:5b:c7:dc +App/part. size: 768,944/4,128,768 bytes, 18.62% +[2025-04-10T10:01:23Z INFO ] Segment at address '0x0' has not changed, skipping write +[2025-04-10T10:01:23Z INFO ] Segment at address '0x8000' has not changed, skipping write +[00:00:06] [========================================] 411/411 0x10000 [2025-04-10T10:01:31Z INFO ] Flashing has completed! +``` + +If espflash reports the following error: + +``` +Error: espflash::connection_failed + + × Error while connecting to device + ╰─▶ Serial port not found +``` + +You should to identify which serial port are connected to your esp board, and use `--port` to specify the used serial port: + +``` +# Suppose that the esp board are connected to /dev/cu.usbmodem211401 +cargo run --release -- --port /dev/cu.usbmodem211401 ``` If you want to get some insight of segments of your binary, [`espsegs`](https://github.com/bjoernQ/espsegs) would help: @@ -42,5 +61,5 @@ If you want to get some insight of segments of your binary, [`espsegs`](https:// cargo install --git https://github.com/bjoernQ/espsegs # Check all segments -espsegs target/xtensa-esp32s3-espidf/release/rmk-esp32s3 --chip esp32s3 +espsegs target/xtensa-esp32s3-none-elf/release/rmk-esp32s3 --chip esp32s3 ``` \ No newline at end of file diff --git a/examples/use_config/esp32s3_ble/build.rs b/examples/use_config/esp32s3_ble/build.rs index 97cf282ba..147d1e047 100644 --- a/examples/use_config/esp32s3_ble/build.rs +++ b/examples/use_config/esp32s3_ble/build.rs @@ -1,22 +1,22 @@ -use const_gen::*; use std::fs::File; use std::io::Read; use std::path::Path; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { + println!("cargo:rerun-if-changed=keyboard.toml"); + // Generate vial config at the root of project println!("cargo:rerun-if-changed=vial.json"); generate_vial_config(); - // ESP IDE system env - embuild::espidf::sysenv::output(); - - println!("cargo:rerun-if-changed=keyboard.toml"); + println!("cargo:rustc-link-arg-bins=-Tlinkall.x"); // Set the extra linker script from defmt - println!("cargo:rustc-link-arg=-Tdefmt.x"); + // println!("cargo:rustc-link-arg=-Tdefmt.x"); } fn generate_vial_config() { @@ -27,8 +27,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -44,6 +43,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_config/esp32s3_ble/espflash.toml b/examples/use_config/esp32s3_ble/espflash.toml deleted file mode 100644 index d22b92e77..000000000 --- a/examples/use_config/esp32s3_ble/espflash.toml +++ /dev/null @@ -1 +0,0 @@ -partition_table = "partitions.csv" diff --git a/examples/use_config/esp32s3_ble/keyboard.toml b/examples/use_config/esp32s3_ble/keyboard.toml index 9c4108d70..e78b777b1 100644 --- a/examples/use_config/esp32s3_ble/keyboard.toml +++ b/examples/use_config/esp32s3_ble/keyboard.toml @@ -9,8 +9,8 @@ usb_enable = false [matrix] # Input and output pins are mandatory -input_pins = ["gpio6", "gpio7", "gpio20", "gpio21"] -output_pins = ["gpio3", "gpio4", "gpio5"] +input_pins = ["GPIO6", "GPIO7", "GPIO20", "GPIO21"] +output_pins = ["GPIO3", "GPIO4", "GPIO5"] # WARNING: Currently row2col/col2row is set in RMK's feature gate, row2col config here is valid ONLY when you're using cloud compilation # row2col = true diff --git a/examples/use_config/esp32s3_ble/sdkconfig.defaults b/examples/use_config/esp32s3_ble/sdkconfig.defaults deleted file mode 100644 index 3aff089f7..000000000 --- a/examples/use_config/esp32s3_ble/sdkconfig.defaults +++ /dev/null @@ -1,28 +0,0 @@ -# Rust often needs a bit of an extra main task stack size compared to C (the default is 3K) -CONFIG_ESP_MAIN_TASK_STACK_SIZE=64000 - -# Use this to set FreeRTOS kernel tick frequency to 1000 Hz (100 Hz by default). -# This allows to use 1 ms granuality for thread sleeps (10 ms by default). -CONFIG_FREERTOS_HZ=1000 - -# Workaround for https://github.com/espressif/esp-idf/issues/7631 -#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=n -#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=n - -CONFIG_LOG_DEFAULT_LEVEL=5 - -# Disable watchdog -CONFIG_INT_WDT=n -CONFIG_ESP_TASK_WDT=n - -# esp-nimble config -CONFIG_BT_ENABLED=y -CONFIG_BT_BLE_ENABLED=y -CONFIG_BT_BLUEDROID_ENABLED=n -CONFIG_BT_NIMBLE_ENABLED=y -CONFIG_BT_NIMBLE_NVS_PERSIST=y -# CONFIG_BT_NIMBLE_EXT_ADV=y - -CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y -CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n -CONFIG_BTDM_CTRL_MODE_BTDM=n \ No newline at end of file diff --git a/examples/use_config/esp32s3_ble/src/main.rs b/examples/use_config/esp32s3_ble/src/main.rs index efc5f10e5..c3bc88290 100644 --- a/examples/use_config/esp32s3_ble/src/main.rs +++ b/examples/use_config/esp32s3_ble/src/main.rs @@ -1,4 +1,5 @@ -#![feature(type_alias_impl_trait)] +#![no_std] +#![no_main] use rmk::macros::rmk_keyboard; diff --git a/examples/use_config/esp32s3_ble/vial.json b/examples/use_config/esp32s3_ble/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_config/esp32s3_ble/vial.json +++ b/examples/use_config/esp32s3_ble/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_config/nrf52810_ble/Cargo.toml b/examples/use_config/nrf52810_ble/Cargo.toml index 5adec9366..d7b33c7c2 100644 --- a/examples/use_config/nrf52810_ble/Cargo.toml +++ b/examples/use_config/nrf52810_ble/Cargo.toml @@ -24,13 +24,17 @@ embassy-nrf = { version = "0.3.1", features = [ ] } embassy-executor = { version = "0.7", features = [ "defmt", - "task-arena-size-8192", "arch-cortex-m", "executor-thread", ] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_config/nrf52832_ble/.cargo/config.toml b/examples/use_config/nrf52832_ble/.cargo/config.toml index b77647ad7..41d70ccc9 100644 --- a/examples/use_config/nrf52832_ble/.cargo/config.toml +++ b/examples/use_config/nrf52832_ble/.cargo/config.toml @@ -1,34 +1,9 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -# Have to use simmsb's elf2uf2 fork to flash https://github.com/simmsb/elf2uf2-rs -# runner = "elf2uf2-rs -d" runner = "probe-run --chip nRF52832_xxAA" linker = "flip-link" -rustflags = [ - # Previously, the linker arguments --nmagic and -Tlink.x were set here. - # They are now set by build.rs instead. The linker argument can still - # only be set here, if a custom linker is needed. - - # By default, the LLD linker is used, which is shipped with the Rust - # toolchain. If you run into problems with LLD, you can switch to the - # GNU linker by uncommenting this line: - # "-C", "linker=arm-none-eabi-ld", - - # If you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by uncommenting the three lines below: - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] [build] -# Pick ONE of these default compilation targets -# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ -# target = "thumbv7m-none-eabi" # Cortex-M3 -# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) -# target = "thumbv8m.base-none-eabi" # Cortex-M23 -# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) -# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) [env] DEFMT_LOG = "trace" diff --git a/examples/use_config/nrf52832_ble/Cargo.lock b/examples/use_config/nrf52832_ble/Cargo.lock index 4f16965d3..76e0a67af 100644 --- a/examples/use_config/nrf52832_ble/Cargo.lock +++ b/examples/use_config/nrf52832_ble/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -78,6 +89,32 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "bindgen" +version = "0.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" +dependencies = [ + "bitflags 2.6.0", + "cexpr", + "clang-sys", + "itertools", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.95", +] + [[package]] name = "bitfield" version = "0.13.2" @@ -113,6 +150,31 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -150,6 +212,15 @@ dependencies = [ "shlex", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -170,6 +241,38 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -196,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -234,6 +343,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -256,13 +374,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", ] [[package]] @@ -271,65 +401,58 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", + "strsim", + "syn 2.0.95", ] [[package]] -name = "darling_core" +name = "darling_macro" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", + "darling_core", "quote", - "strsim 0.11.1", "syn 2.0.95", ] [[package]] -name = "darling_macro" -version = "0.13.4" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.13.4", - "quote", - "syn 1.0.109", + "generic-array", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "defmt" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.95", + "defmt 1.0.1", ] [[package]] name = "defmt" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -337,9 +460,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -350,21 +473,42 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", ] [[package]] @@ -376,14 +520,48 @@ dependencies = [ "litrs", ] +[[package]] +name = "doxygen-rs" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "415b6ec780d34dcf624666747194393603d0373b7141eef01d12ee58881507d9" +dependencies = [ + "phf", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e)", "embassy-sync", "embassy-time", "embedded-hal 0.2.7", @@ -397,12 +575,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -410,10 +587,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.95", @@ -422,10 +598,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -433,24 +608,30 @@ name = "embassy-hal-internal" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" +dependencies = [ + "num-traits", +] + +[[package]] +name = "embassy-hal-internal" +version = "0.2.0" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] [[package]] name = "embassy-net-driver" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" [[package]] name = "embassy-net-driver-channel" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4818c32afec43e3cae234f324bad9a976c9aa7501022d26ff60a4017a1a006b7" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "embassy-futures", "embassy-net-driver", @@ -460,18 +641,17 @@ dependencies = [ [[package]] name = "embassy-nrf" version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7494efe1e0183568327c7e681d4b77ed5241921dcb5976426d9a65b65a0c81" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "bitflags 2.6.0", "cfg-if", "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", - "embassy-hal-internal", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e)", "embassy-sync", "embassy-time", "embassy-time-driver", @@ -491,13 +671,12 @@ dependencies = [ [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -507,12 +686,11 @@ dependencies = [ [[package]] name = "embassy-time" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -524,8 +702,7 @@ dependencies = [ [[package]] name = "embassy-time-driver" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "document-features", ] @@ -533,8 +710,7 @@ dependencies = [ [[package]] name = "embassy-time-queue-utils" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "embassy-executor", "heapless 0.8.0", @@ -543,10 +719,9 @@ dependencies = [ [[package]] name = "embassy-usb" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -559,10 +734,9 @@ dependencies = [ [[package]] name = "embassy-usb-driver" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -581,7 +755,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -590,7 +764,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -600,7 +774,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -609,7 +783,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -640,6 +814,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -688,6 +872,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -731,6 +925,34 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" version = "2.4.1" @@ -794,10 +1016,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -837,6 +1078,24 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -865,6 +1124,16 @@ version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +[[package]] +name = "libloading" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +dependencies = [ + "cfg-if", + "windows-targets", +] + [[package]] name = "litrs" version = "0.4.1" @@ -904,6 +1173,12 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "nb" version = "0.1.3" @@ -920,52 +1195,78 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" [[package]] -name = "nrf-pac" -version = "0.1.0" +name = "nom" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ - "cortex-m", - "cortex-m-rt", + "memchr", + "minimal-lexical", ] [[package]] -name = "nrf-softdevice" +name = "nrf-mpsl" version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" dependencies = [ "cortex-m", "critical-section", - "defmt", - "embassy-futures", + "defmt 0.3.100", + "embassy-nrf", "embassy-sync", + "embedded-io", "embedded-storage", "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "nrf-softdevice-s132", - "num_enum", + "nrf-mpsl-sys", ] [[package]] -name = "nrf-softdevice-macro" +name = "nrf-mpsl-sys" version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", + "bindgen", + "doxygen-rs", ] [[package]] -name = "nrf-softdevice-s132" -version = "0.1.2" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +name = "nrf-pac" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" +dependencies = [ + "cortex-m", + "cortex-m-rt", +] + +[[package]] +name = "nrf-sdc" +version = "0.1.0" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" +dependencies = [ + "bt-hci", + "critical-section", + "defmt 0.3.100", + "embassy-hal-internal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "embassy-nrf", + "embassy-sync", + "embedded-io", + "embedded-io-async", + "nrf-mpsl", + "nrf-sdc-sys", + "rand_core", +] + +[[package]] +name = "nrf-sdc-sys" +version = "0.1.0" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" +dependencies = [ + "bindgen", + "doxygen-rs", + "nrf-mpsl-sys", + "winnow", +] [[package]] name = "num-traits" @@ -1006,14 +1307,24 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1022,6 +1333,93 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -1053,7 +1451,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1070,6 +1468,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" version = "0.2.27" @@ -1080,6 +1487,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1120,6 +1536,25 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1164,7 +1599,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1180,16 +1615,16 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", - "once_cell", "paste", "postcard", + "rand_core", "rmk-macro", "sequential-storage", "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1198,8 +1633,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1210,23 +1647,37 @@ dependencies = [ ] [[package]] -name = "rmk-nrf52832-ble" +name = "rmk-nrf52832" version = "0.2.0" dependencies = [ + "bt-hci", "const-gen", "cortex-m", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-nrf", "embassy-time", "json", + "nrf-mpsl", + "nrf-sdc", + "once_cell", "panic-probe", + "rand", + "rand_chacha", + "rand_core", "rmk", + "static_cell", "xz2", ] +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1257,6 +1708,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1280,11 +1744,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1317,12 +1781,29 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "spin" version = "0.9.8" @@ -1359,15 +1840,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1445,12 +1926,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.95", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1463,7 +1986,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1474,7 +1997,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -1694,7 +2217,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -1707,3 +2239,20 @@ dependencies = [ "quote", "syn 2.0.95", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_config/nrf52832_ble/Cargo.toml b/examples/use_config/nrf52832_ble/Cargo.toml index f8260017f..37e57e250 100644 --- a/examples/use_config/nrf52832_ble/Cargo.toml +++ b/examples/use_config/nrf52832_ble/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "rmk-nrf52832-ble" +name = "rmk-nrf52832" version = "0.2.0" authors = ["Haobo Gu "] description = "Keyboard firmware written in Rust" @@ -10,7 +10,19 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk", features = ["nrf52832_ble", "col2row"] } +rmk = { path = "../../../rmk", features = ["async_matrix", "nrf52832_ble"] } +nrf-sdc = { version = "0.1.0", default-features = false, features = [ + "defmt", + "peripheral", + "nrf52832", +] } +nrf-mpsl = { version = "0.1.0", default-features = false, features = [ + "defmt", + "critical-section-impl", + "nrf52832", +] } +bt-hci = { version = "0.3.0", default-features = false, features = ["defmt"] } + cortex-m = "0.7.7" cortex-m-rt = "0.7.5" embassy-time = { version = "0.4", features = ["tick-hz-32_768", "defmt"] } @@ -24,13 +36,31 @@ embassy-nrf = { version = "0.3.1", features = [ ] } embassy-executor = { version = "0.7", features = [ "defmt", - "task-arena-size-16384", "arch-cortex-m", "executor-thread", ] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } +static_cell = "2" + +once_cell = { version = "1.19", features = [ + "atomic-polyfill", +], default-features = false } +rand = { version = "0.8.4", default-features = false } +rand_core = { version = "0.6" } +rand_chacha = { version = "0.3", default-features = false } + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-usb = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +nrf-sdc = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "4f2af99b87ae07c0b5634d32e4a62e26876e5be3" } +nrf-mpsl = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "4f2af99b87ae07c0b5634d32e4a62e26876e5be3" } [build-dependencies] xz2 = "0.1.7" @@ -38,7 +68,7 @@ json = "0.12" const-gen = "1.6" [[bin]] -name = "rmk-nrf52832-ble" +name = "rmk-nrf52832" test = false bench = false diff --git a/examples/use_config/nrf52832_ble/README.md b/examples/use_config/nrf52832_ble/README.md index e62e4027f..b00c84207 100644 --- a/examples/use_config/nrf52832_ble/README.md +++ b/examples/use_config/nrf52832_ble/README.md @@ -1,22 +1,12 @@ # nrf52832 BLE example -To use this example, you should have [nrf s132 softdevice 7.3.0](https://www.nordicsemi.com/Products/Development-software/s132/download) flashed to nrf52832 first. - -The following are the detailed steps: +To use this example, you should have debug proble connected to your board's SWD. Then use `cargo run` to flash the firmware to your board. 1. Enter example folder: ```shell - cd examples/use_rust/nrf52832_ble - ``` -2. Erase the flash: - ```shell - probe-rs erase --chip nrf52832_xxAA - ``` -3. Flash softdevice firmware to flash: - ```shell - probe-rs download --verify --format hex --chip nRF52832_xxAA s132_nrf52_7.3.0_softdevice.hex + cd examples/use_config/nrf52832_ble ``` -4. Compile, flash and run the example +2. Compile, flash and run the example ```shell cargo run --release ``` diff --git a/examples/use_config/nrf52832_ble/build.rs b/examples/use_config/nrf52832_ble/build.rs index 8726ac216..29a181e75 100644 --- a/examples/use_config/nrf52832_ble/build.rs +++ b/examples/use_config/nrf52832_ble/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -64,8 +65,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -81,6 +81,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_config/nrf52832_ble/memory.x b/examples/use_config/nrf52832_ble/memory.x index 52e45692a..c5e07270f 100644 --- a/examples/use_config/nrf52832_ble/memory.x +++ b/examples/use_config/nrf52832_ble/memory.x @@ -1,6 +1,9 @@ MEMORY { - /* nRF52832 s132 7.3.0 */ - FLASH : ORIGIN = 0x26000, LENGTH = 360K - RAM : ORIGIN = 0x20007af8, LENGTH = 64K - 30K + FLASH : ORIGIN = 0x00000000, LENGTH = 512K + RAM : ORIGIN = 0x20000000, LENGTH = 64K + + /* These values correspond to the nRF52832 WITH Adafruit nRF52 bootloader */ + /* FLASH : ORIGIN = 0x00001000, LENGTH = 508K */ + /* RAM : ORIGIN = 0x20000008, LENGTH = 63K */ } \ No newline at end of file diff --git a/examples/use_config/nrf52832_ble/vial.json b/examples/use_config/nrf52832_ble/vial.json index fdb50998e..f685c4ca6 100644 --- a/examples/use_config/nrf52832_ble/vial.json +++ b/examples/use_config/nrf52832_ble/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_config/nrf52840_ble/.cargo/config.toml b/examples/use_config/nrf52840_ble/.cargo/config.toml index c7f579227..35b36cb90 100644 --- a/examples/use_config/nrf52840_ble/.cargo/config.toml +++ b/examples/use_config/nrf52840_ble/.cargo/config.toml @@ -1,38 +1,9 @@ -[target.thumbv7m-none-eabi] -# uncomment this to make `cargo run` execute programs on QEMU -# runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" - [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -# Have to use simmsb's elf2uf2 fork to flash https://github.com/simmsb/elf2uf2-rs -# runner = "elf2uf2-rs -d" runner = "probe-rs run --chip nRF52840_xxAA" linker = "flip-link" -rustflags = [ - # Previously, the linker arguments --nmagic and -Tlink.x were set here. - # They are now set by build.rs instead. The linker argument can still - # only be set here, if a custom linker is needed. - - # By default, the LLD linker is used, which is shipped with the Rust - # toolchain. If you run into problems with LLD, you can switch to the - # GNU linker by uncommenting this line: - # "-C", "linker=arm-none-eabi-ld", - - # If you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by uncommenting the three lines below: - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] [build] -# Pick ONE of these default compilation targets -# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ -# target = "thumbv7m-none-eabi" # Cortex-M3 -# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) -# target = "thumbv8m.base-none-eabi" # Cortex-M23 -# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) -# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) [env] DEFMT_LOG = "trace" \ No newline at end of file diff --git a/examples/use_config/nrf52840_ble/Cargo.lock b/examples/use_config/nrf52840_ble/Cargo.lock index ac5278d09..248f3701e 100644 --- a/examples/use_config/nrf52840_ble/Cargo.lock +++ b/examples/use_config/nrf52840_ble/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -78,6 +89,32 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "bindgen" +version = "0.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" +dependencies = [ + "bitflags 2.6.0", + "cexpr", + "clang-sys", + "itertools", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.95", +] + [[package]] name = "bitfield" version = "0.13.2" @@ -113,6 +150,31 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -150,6 +212,15 @@ dependencies = [ "shlex", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -170,6 +241,38 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -196,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -234,6 +343,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -256,13 +374,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", ] [[package]] @@ -271,65 +401,58 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", + "strsim", + "syn 2.0.95", ] [[package]] -name = "darling_core" +name = "darling_macro" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", + "darling_core", "quote", - "strsim 0.11.1", "syn 2.0.95", ] [[package]] -name = "darling_macro" -version = "0.13.4" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.13.4", - "quote", - "syn 1.0.109", + "generic-array", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "defmt" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.95", + "defmt 1.0.1", ] [[package]] name = "defmt" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -337,9 +460,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -350,21 +473,42 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", ] [[package]] @@ -376,14 +520,48 @@ dependencies = [ "litrs", ] +[[package]] +name = "doxygen-rs" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "415b6ec780d34dcf624666747194393603d0373b7141eef01d12ee58881507d9" +dependencies = [ + "phf", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e)", "embassy-sync", "embassy-time", "embedded-hal 0.2.7", @@ -397,12 +575,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -410,10 +587,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.95", @@ -422,10 +598,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -433,24 +608,30 @@ name = "embassy-hal-internal" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" +dependencies = [ + "num-traits", +] + +[[package]] +name = "embassy-hal-internal" +version = "0.2.0" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] [[package]] name = "embassy-net-driver" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" [[package]] name = "embassy-net-driver-channel" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4818c32afec43e3cae234f324bad9a976c9aa7501022d26ff60a4017a1a006b7" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "embassy-futures", "embassy-net-driver", @@ -460,18 +641,17 @@ dependencies = [ [[package]] name = "embassy-nrf" version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7494efe1e0183568327c7e681d4b77ed5241921dcb5976426d9a65b65a0c81" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "bitflags 2.6.0", "cfg-if", "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", - "embassy-hal-internal", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e)", "embassy-sync", "embassy-time", "embassy-time-driver", @@ -491,13 +671,12 @@ dependencies = [ [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -507,12 +686,11 @@ dependencies = [ [[package]] name = "embassy-time" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -524,8 +702,7 @@ dependencies = [ [[package]] name = "embassy-time-driver" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "document-features", ] @@ -533,8 +710,7 @@ dependencies = [ [[package]] name = "embassy-time-queue-utils" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "embassy-executor", "heapless 0.8.0", @@ -543,10 +719,9 @@ dependencies = [ [[package]] name = "embassy-usb" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -559,10 +734,9 @@ dependencies = [ [[package]] name = "embassy-usb-driver" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -581,7 +755,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -590,7 +764,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -600,7 +774,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -609,7 +783,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -640,6 +814,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -688,6 +872,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -731,6 +925,34 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" version = "2.4.1" @@ -794,10 +1016,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -837,6 +1078,24 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -865,6 +1124,16 @@ version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +[[package]] +name = "libloading" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +dependencies = [ + "cfg-if", + "windows-targets", +] + [[package]] name = "litrs" version = "0.4.1" @@ -904,6 +1173,12 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "nb" version = "0.1.3" @@ -920,52 +1195,78 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" [[package]] -name = "nrf-pac" -version = "0.1.0" +name = "nom" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ - "cortex-m", - "cortex-m-rt", + "memchr", + "minimal-lexical", ] [[package]] -name = "nrf-softdevice" +name = "nrf-mpsl" version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" dependencies = [ "cortex-m", "critical-section", - "defmt", - "embassy-futures", + "defmt 0.3.100", + "embassy-nrf", "embassy-sync", + "embedded-io", "embedded-storage", "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "nrf-softdevice-s140", - "num_enum", + "nrf-mpsl-sys", ] [[package]] -name = "nrf-softdevice-macro" +name = "nrf-mpsl-sys" version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", + "bindgen", + "doxygen-rs", ] [[package]] -name = "nrf-softdevice-s140" -version = "0.1.2" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +name = "nrf-pac" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" +dependencies = [ + "cortex-m", + "cortex-m-rt", +] + +[[package]] +name = "nrf-sdc" +version = "0.1.0" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" +dependencies = [ + "bt-hci", + "critical-section", + "defmt 0.3.100", + "embassy-hal-internal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "embassy-nrf", + "embassy-sync", + "embedded-io", + "embedded-io-async", + "nrf-mpsl", + "nrf-sdc-sys", + "rand_core", +] + +[[package]] +name = "nrf-sdc-sys" +version = "0.1.0" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" +dependencies = [ + "bindgen", + "doxygen-rs", + "nrf-mpsl-sys", + "winnow", +] [[package]] name = "num-traits" @@ -1001,19 +1302,25 @@ name = "once_cell" version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" dependencies = [ - "critical-section", - "portable-atomic", + "elliptic-curve", + "primeorder", ] [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1022,6 +1329,93 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -1053,7 +1447,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1070,6 +1464,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" version = "0.2.27" @@ -1080,6 +1483,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1120,6 +1532,25 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1164,7 +1595,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1180,16 +1611,16 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", - "once_cell", "paste", "postcard", + "rand_core", "rmk-macro", "sequential-storage", "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1198,8 +1629,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1213,20 +1646,33 @@ dependencies = [ name = "rmk-nrf52840" version = "0.2.0" dependencies = [ + "bt-hci", "const-gen", "cortex-m", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-nrf", "embassy-time", "json", + "nrf-mpsl", + "nrf-sdc", "panic-probe", + "rand", + "rand_chacha", + "rand_core", "rmk", + "static_cell", "xz2", ] +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1257,6 +1703,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1280,11 +1739,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1317,12 +1776,29 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "spin" version = "0.9.8" @@ -1359,15 +1835,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1445,12 +1921,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.95", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1463,7 +1981,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1474,7 +1992,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -1694,7 +2212,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -1707,3 +2234,20 @@ dependencies = [ "quote", "syn 2.0.95", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_config/nrf52840_ble/Cargo.toml b/examples/use_config/nrf52840_ble/Cargo.toml index fe744043a..90eead920 100644 --- a/examples/use_config/nrf52840_ble/Cargo.toml +++ b/examples/use_config/nrf52840_ble/Cargo.toml @@ -10,12 +10,19 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk", features = [ - "nrf52840_ble", - "col2row", - "async_matrix", +rmk = { path = "../../../rmk", features = ["async_matrix", "nrf52840_ble", "adafruit_bl"] } +nrf-sdc = { version = "0.1.0", default-features = false, features = [ "defmt", + "peripheral", + "nrf52840", +] } +nrf-mpsl = { version = "0.1.0", default-features = false, features = [ + "defmt", + "critical-section-impl", + "nrf52840", ] } +bt-hci = { version = "0.3.0", default-features = false, features = ["defmt"] } + cortex-m = "0.7.7" cortex-m-rt = "0.7.5" embassy-time = { version = "0.4", features = ["tick-hz-32_768", "defmt"] } @@ -30,13 +37,28 @@ embassy-nrf = { version = "0.3.1", features = [ ] } embassy-executor = { version = "0.7", features = [ "defmt", - "task-arena-size-32768", "arch-cortex-m", "executor-thread", ] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } +static_cell = "2" + +rand = { version = "0.8.4", default-features = false } +rand_core = { version = "0.6" } +rand_chacha = { version = "0.3", default-features = false } + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-usb = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +nrf-sdc = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "4f2af99b87ae07c0b5634d32e4a62e26876e5be3" } +nrf-mpsl = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "4f2af99b87ae07c0b5634d32e4a62e26876e5be3" } [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_config/nrf52840_ble/README.md b/examples/use_config/nrf52840_ble/README.md index b9f299dad..0d1f7016e 100644 --- a/examples/use_config/nrf52840_ble/README.md +++ b/examples/use_config/nrf52840_ble/README.md @@ -1,10 +1,10 @@ # nrf52840 BLE example -RMK supports [nice!nano](https://nicekeyboards.com/) as well as any custom nrf52840 board you have. +RMK supports [nice!nano](https://nicekeyboards.com/nice-nano) as well as any custom nrf52840 board you have. ## Nice!nano support -nice!nano has a bootloader built-in, which supports .uf2 firmware format. That means you don't need any debugging probe to flash your firmware. RMK uses `cargo-make` tool to generate .uf2 firmware, then generation processing is defined in `Makefile.toml` +nice!nano has the [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader) built-in, which supports .uf2 firmware format. That means you don't need any debugging probe to flash your firmware. RMK uses `cargo-make` tool to generate .uf2 firmware, then generation processing is defined in `Makefile.toml` The following are steps of how to get .uf2 firmware work in RMK: @@ -25,23 +25,38 @@ Note that RMK will switch to USB mode if an USB cable is connected. Remember to You can also check the instruction [here](https://nicekeyboards.com/docs/nice-nano/) for more info about nice!nano. ## With debugging probe -With a debugging probe, you can have the full control of you hardware. To use RMK you should have [nrf s140 softdevice 7.3.0](https://www.nordicsemi.com/Products/Development-software/s140/download) flashed to nrf52840 first. -The following are the detailed steps for flashing both nrf's softdevice and RMK firmware: +With a debugging probe, you can have the full control of you hardware. To use RMK you should check whether the bootloader is flashed to your board first. To use RMK with existing bootloader such as [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader), check `memory.x` in the project root, ensure that the flash starts from 0x00001000 + +``` +MEMORY +{ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 WITH Adafruit nRF52 bootloader */ + FLASH : ORIGIN = 0x00001000, LENGTH = 1020K + RAM : ORIGIN = 0x20000008, LENGTH = 255K +} +``` + +Or you can use RMK without bootloader: + +``` +MEMORY +{ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 */ + FLASH : ORIGIN = 0x00000000, LENGTH = 1024K + RAM : ORIGIN = 0x20000000, LENGTH = 256K +} +``` + +After you have `memory.x` set, use `cargo run --release` to flash the RMK firmware to your board: 1. Enter example folder: ```shell - cd examples/use_rust/nrf52840_ble - ``` -2. Erase the flash: - ```shell - probe-rs erase --chip nrf52840_xxAA - ``` -3. Flash softdevice firmware to flash: - ```shell - probe-rs download --verify --format hex --chip nRF52840_xxAA s140_nrf52_7.3.0_softdevice.hex + cd examples/use_config/nrf52840_ble ``` -4. Compile, flash and run the example +2. Compile, flash and run the example ```shell cargo run --release ``` diff --git a/examples/use_config/nrf52840_ble/build.rs b/examples/use_config/nrf52840_ble/build.rs index 8726ac216..29a181e75 100644 --- a/examples/use_config/nrf52840_ble/build.rs +++ b/examples/use_config/nrf52840_ble/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -64,8 +65,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -81,6 +81,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_config/nrf52840_ble/memory.x b/examples/use_config/nrf52840_ble/memory.x index 591f06f6f..3f9d5d2ec 100644 --- a/examples/use_config/nrf52840_ble/memory.x +++ b/examples/use_config/nrf52840_ble/memory.x @@ -1,13 +1,11 @@ MEMORY { - /* NOTE 1 K = 1 KiBi = 1024 bytes */ - /* FLASH : ORIGIN = 0x00000000, LENGTH = 1024K */ - /*RAM : ORIGIN = 0x20000000, LENGTH = 256K */ - - /* These values correspond to the NRF52840 with Softdevices S140 6.1.1 */ - /* FLASH : ORIGIN = 0x00026000, LENGTH = 824K */ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 WITH Adafruit nRF52 bootloader */ + FLASH : ORIGIN = 0x00001000, LENGTH = 1020K + RAM : ORIGIN = 0x20000008, LENGTH = 255K - /* These values correspond to the NRF52840 with Softdevices S140 7.3.0 */ - FLASH : ORIGIN = 0x00027000, LENGTH = 820K - RAM : ORIGIN = 0x20020000, LENGTH = 128K + /* These values correspond to the nRF52840 */ + /* FLASH : ORIGIN = 0x00000000, LENGTH = 1024K */ + /* RAM : ORIGIN = 0x20000000, LENGTH = 256K */ } \ No newline at end of file diff --git a/examples/use_config/nrf52840_ble/vial.json b/examples/use_config/nrf52840_ble/vial.json index fdb50998e..f685c4ca6 100644 --- a/examples/use_config/nrf52840_ble/vial.json +++ b/examples/use_config/nrf52840_ble/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_config/nrf52840_ble_split/.cargo/config.toml b/examples/use_config/nrf52840_ble_split/.cargo/config.toml index 6ab1a74e9..247f03d15 100644 --- a/examples/use_config/nrf52840_ble_split/.cargo/config.toml +++ b/examples/use_config/nrf52840_ble_split/.cargo/config.toml @@ -1,38 +1,9 @@ -[target.thumbv7m-none-eabi] -# uncomment this to make `cargo run` execute programs on QEMU -# runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" - [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -# Have to use simmsb's elf2uf2 fork to flash https://github.com/simmsb/elf2uf2-rs -# runner = "elf2uf2-rs -d" runner = "probe-rs run --chip nRF52840_xxAA" linker = "flip-link" -rustflags = [ - # Previously, the linker arguments --nmagic and -Tlink.x were set here. - # They are now set by build.rs instead. The linker argument can still - # only be set here, if a custom linker is needed. - - # By default, the LLD linker is used, which is shipped with the Rust - # toolchain. If you run into problems with LLD, you can switch to the - # GNU linker by uncommenting this line: - # "-C", "linker=arm-none-eabi-ld", - - # If you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by uncommenting the three lines below: - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] [build] -# Pick ONE of these default compilation targets -# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ -# target = "thumbv7m-none-eabi" # Cortex-M3 -# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) -# target = "thumbv8m.base-none-eabi" # Cortex-M23 -# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) -# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) [env] DEFMT_LOG = "debug" diff --git a/examples/use_config/nrf52840_ble_split/Cargo.lock b/examples/use_config/nrf52840_ble_split/Cargo.lock index 753c6b209..248f3701e 100644 --- a/examples/use_config/nrf52840_ble_split/Cargo.lock +++ b/examples/use_config/nrf52840_ble_split/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -78,6 +89,32 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "bindgen" +version = "0.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" +dependencies = [ + "bitflags 2.6.0", + "cexpr", + "clang-sys", + "itertools", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.95", +] + [[package]] name = "bitfield" version = "0.13.2" @@ -113,6 +150,31 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -150,6 +212,15 @@ dependencies = [ "shlex", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -170,6 +241,38 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -196,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -234,6 +343,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -256,13 +374,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", ] [[package]] @@ -271,65 +401,58 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", + "strsim", + "syn 2.0.95", ] [[package]] -name = "darling_core" +name = "darling_macro" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", + "darling_core", "quote", - "strsim 0.11.1", "syn 2.0.95", ] [[package]] -name = "darling_macro" -version = "0.13.4" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.13.4", - "quote", - "syn 1.0.109", + "generic-array", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "defmt" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.95", + "defmt 1.0.1", ] [[package]] name = "defmt" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -337,9 +460,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -350,21 +473,42 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", ] [[package]] @@ -376,14 +520,48 @@ dependencies = [ "litrs", ] +[[package]] +name = "doxygen-rs" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "415b6ec780d34dcf624666747194393603d0373b7141eef01d12ee58881507d9" +dependencies = [ + "phf", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e)", "embassy-sync", "embassy-time", "embedded-hal 0.2.7", @@ -397,12 +575,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -410,10 +587,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.95", @@ -422,10 +598,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -433,24 +608,30 @@ name = "embassy-hal-internal" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" +dependencies = [ + "num-traits", +] + +[[package]] +name = "embassy-hal-internal" +version = "0.2.0" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] [[package]] name = "embassy-net-driver" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" [[package]] name = "embassy-net-driver-channel" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4818c32afec43e3cae234f324bad9a976c9aa7501022d26ff60a4017a1a006b7" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "embassy-futures", "embassy-net-driver", @@ -460,18 +641,17 @@ dependencies = [ [[package]] name = "embassy-nrf" version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7494efe1e0183568327c7e681d4b77ed5241921dcb5976426d9a65b65a0c81" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "bitflags 2.6.0", "cfg-if", "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", - "embassy-hal-internal", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e)", "embassy-sync", "embassy-time", "embassy-time-driver", @@ -491,13 +671,12 @@ dependencies = [ [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -507,12 +686,11 @@ dependencies = [ [[package]] name = "embassy-time" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -524,8 +702,7 @@ dependencies = [ [[package]] name = "embassy-time-driver" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "document-features", ] @@ -533,8 +710,7 @@ dependencies = [ [[package]] name = "embassy-time-queue-utils" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "embassy-executor", "heapless 0.8.0", @@ -543,10 +719,9 @@ dependencies = [ [[package]] name = "embassy-usb" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -559,10 +734,9 @@ dependencies = [ [[package]] name = "embassy-usb-driver" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -581,7 +755,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -590,7 +764,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -600,7 +774,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -609,7 +783,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -640,6 +814,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -688,6 +872,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -731,6 +925,34 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" version = "2.4.1" @@ -794,10 +1016,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -837,6 +1078,24 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -865,6 +1124,16 @@ version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +[[package]] +name = "libloading" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +dependencies = [ + "cfg-if", + "windows-targets", +] + [[package]] name = "litrs" version = "0.4.1" @@ -904,6 +1173,12 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "nb" version = "0.1.3" @@ -920,52 +1195,78 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" [[package]] -name = "nrf-pac" -version = "0.1.0" +name = "nom" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ - "cortex-m", - "cortex-m-rt", + "memchr", + "minimal-lexical", ] [[package]] -name = "nrf-softdevice" +name = "nrf-mpsl" version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" dependencies = [ "cortex-m", "critical-section", - "defmt", - "embassy-futures", + "defmt 0.3.100", + "embassy-nrf", "embassy-sync", + "embedded-io", "embedded-storage", "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "nrf-softdevice-s140", - "num_enum", + "nrf-mpsl-sys", ] [[package]] -name = "nrf-softdevice-macro" +name = "nrf-mpsl-sys" version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", + "bindgen", + "doxygen-rs", ] [[package]] -name = "nrf-softdevice-s140" -version = "0.1.2" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +name = "nrf-pac" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" +dependencies = [ + "cortex-m", + "cortex-m-rt", +] + +[[package]] +name = "nrf-sdc" +version = "0.1.0" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" +dependencies = [ + "bt-hci", + "critical-section", + "defmt 0.3.100", + "embassy-hal-internal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "embassy-nrf", + "embassy-sync", + "embedded-io", + "embedded-io-async", + "nrf-mpsl", + "nrf-sdc-sys", + "rand_core", +] + +[[package]] +name = "nrf-sdc-sys" +version = "0.1.0" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" +dependencies = [ + "bindgen", + "doxygen-rs", + "nrf-mpsl-sys", + "winnow", +] [[package]] name = "num-traits" @@ -1001,19 +1302,25 @@ name = "once_cell" version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" dependencies = [ - "critical-section", - "portable-atomic", + "elliptic-curve", + "primeorder", ] [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1022,6 +1329,93 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -1053,7 +1447,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1070,6 +1464,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" version = "0.2.27" @@ -1080,6 +1483,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1120,6 +1532,25 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1164,7 +1595,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1180,16 +1611,16 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", - "once_cell", "paste", "postcard", + "rand_core", "rmk-macro", "sequential-storage", "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1198,8 +1629,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1213,21 +1646,33 @@ dependencies = [ name = "rmk-nrf52840" version = "0.2.0" dependencies = [ + "bt-hci", "const-gen", "cortex-m", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", - "embassy-futures", "embassy-nrf", "embassy-time", "json", + "nrf-mpsl", + "nrf-sdc", "panic-probe", + "rand", + "rand_chacha", + "rand_core", "rmk", + "static_cell", "xz2", ] +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1258,6 +1703,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1281,11 +1739,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1318,12 +1776,29 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "spin" version = "0.9.8" @@ -1360,15 +1835,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1446,12 +1921,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.95", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1464,7 +1981,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1475,7 +1992,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -1695,7 +2212,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -1708,3 +2234,20 @@ dependencies = [ "quote", "syn 2.0.95", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_config/nrf52840_ble_split/Cargo.toml b/examples/use_config/nrf52840_ble_split/Cargo.toml index 3a780a965..391cf7025 100644 --- a/examples/use_config/nrf52840_ble_split/Cargo.toml +++ b/examples/use_config/nrf52840_ble_split/Cargo.toml @@ -12,13 +12,26 @@ license = "MIT OR Apache-2.0" [dependencies] rmk = { path = "../../../rmk", features = [ "nrf52840_ble", - "col2row", "split", "async_matrix", + "adafruit_bl", ] } +nrf-sdc = { version = "0.1.0", default-features = false, features = [ + "defmt", + "peripheral", + "central", + "nrf52840", +] } +nrf-mpsl = { version = "0.1.0", default-features = false, features = [ + "defmt", + "critical-section-impl", + "nrf52840", +] } +bt-hci = { version = "0.3.0", default-features = false, features = ["defmt"] } + cortex-m = "0.7.7" cortex-m-rt = "0.7.5" -embassy-time = { version = "0.4", features = ["tick-hz-32_768", "defmt"] } +embassy-time = { version = "0.4", features = ["tick-hz-32_768", "defmt", "defmt-timestamp-uptime"] } embassy-nrf = { version = "0.3.1", features = [ "defmt", "nrf52840", @@ -30,14 +43,29 @@ embassy-nrf = { version = "0.3.1", features = [ ] } embassy-executor = { version = "0.7", features = [ "defmt", - "task-arena-size-32768", "arch-cortex-m", "executor-thread", ] } -embassy-futures = { version = "0.1", features = ["defmt"] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } +static_cell = "2" + +rand = { version = "0.8.4", default-features = false } +rand_core = { version = "0.6" } +rand_chacha = { version = "0.3", default-features = false } + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-usb = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +nrf-sdc = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "4f2af99b87ae07c0b5634d32e4a62e26876e5be3" } +nrf-mpsl = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "4f2af99b87ae07c0b5634d32e4a62e26876e5be3" } + [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_config/nrf52840_ble_split/README.md b/examples/use_config/nrf52840_ble_split/README.md index b0d60ef35..5116592fc 100644 --- a/examples/use_config/nrf52840_ble_split/README.md +++ b/examples/use_config/nrf52840_ble_split/README.md @@ -1,6 +1,6 @@ # nrf52840 BLE split example -RMK supports [nice!nano](https://nicekeyboards.com/) as well as any custom nrf52840 board you have. +RMK supports [nice!nano](https://nicekeyboards.com/nice-nano) as well as any custom nrf52840 board you have. ## Build firmware @@ -16,7 +16,7 @@ cargo build --release --bin peripheral ## Nice!nano support -nice!nano has a bootloader built-in, which supports .uf2 firmware format. That means you don't need any debugging probe to flash your firmware. RMK uses `cargo-make` tool to generate .uf2 firmware, then generation processing is defined in `Makefile.toml` +nice!nano has the [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader) built-in, which supports .uf2 firmware format. That means you don't need any debugging probe to flash your firmware. RMK uses `cargo-make` tool to generate .uf2 firmware, then generation processing is defined in `Makefile.toml` The following are steps of how to get .uf2 firmware work in RMK: @@ -36,24 +36,39 @@ Note that RMK will switch to USB mode if an USB cable is connected. Remember to You can also check the instruction [here](https://nicekeyboards.com/docs/nice-nano/) for more info about nice!nano. -## With debug probe -With a debug probe, you can have the full control of you hardware. To use RMK you should have [nrf s140 softdevice 7.3.0](https://www.nordicsemi.com/Products/Development-software/s140/download) flashed to nrf52840 first. +## With debugging probe -The following are the detailed steps for flashing both nrf's softdevice and RMK firmware: +With a debugging probe, you can have the full control of you hardware. To use RMK you should check whether the bootloader is flashed to your board first. To use RMK with existing bootloader such as [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader), check `memory.x` in the project root, ensure that the flash starts from 0x00001000 + +``` +MEMORY +{ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 WITH Adafruit nRF52 bootloader */ + FLASH : ORIGIN = 0x00001000, LENGTH = 1020K + RAM : ORIGIN = 0x20000008, LENGTH = 255K +} +``` + +Or you can use RMK without bootloader: + +``` +MEMORY +{ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 */ + FLASH : ORIGIN = 0x00000000, LENGTH = 1024K + RAM : ORIGIN = 0x20000000, LENGTH = 256K +} +``` + +After you have `memory.x` set, use `cargo run --release` to flash the RMK firmware to your board: 1. Enter example folder: ```shell - cd examples/use_rust/nrf52840_ble - ``` -2. Erase the flash: - ```shell - probe-rs erase --chip nrf52840_xxAA - ``` -3. Flash softdevice firmware to flash: - ```shell - probe-rs download --verify --format hex --chip nRF52840_xxAA s140_nrf52_7.3.0_softdevice.hex + cd examples/use_config/nrf52840_ble_split ``` -4. Compile, flash and run the example +2. Compile, flash and run the example ```shell # Run central firmware cargo run --release --bin central diff --git a/examples/use_config/nrf52840_ble_split/build.rs b/examples/use_config/nrf52840_ble_split/build.rs index 90ab55a4f..456520637 100644 --- a/examples/use_config/nrf52840_ble_split/build.rs +++ b/examples/use_config/nrf52840_ble_split/build.rs @@ -10,14 +10,17 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { + println!("cargo:rerun-if-changed=keyboard.toml"); + // Generate vial config at the root of project println!("cargo:rerun-if-changed=vial.json"); generate_vial_config(); @@ -62,8 +65,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -79,6 +81,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_config/nrf52840_ble_split/memory.x b/examples/use_config/nrf52840_ble_split/memory.x index 591f06f6f..3f9d5d2ec 100644 --- a/examples/use_config/nrf52840_ble_split/memory.x +++ b/examples/use_config/nrf52840_ble_split/memory.x @@ -1,13 +1,11 @@ MEMORY { - /* NOTE 1 K = 1 KiBi = 1024 bytes */ - /* FLASH : ORIGIN = 0x00000000, LENGTH = 1024K */ - /*RAM : ORIGIN = 0x20000000, LENGTH = 256K */ - - /* These values correspond to the NRF52840 with Softdevices S140 6.1.1 */ - /* FLASH : ORIGIN = 0x00026000, LENGTH = 824K */ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 WITH Adafruit nRF52 bootloader */ + FLASH : ORIGIN = 0x00001000, LENGTH = 1020K + RAM : ORIGIN = 0x20000008, LENGTH = 255K - /* These values correspond to the NRF52840 with Softdevices S140 7.3.0 */ - FLASH : ORIGIN = 0x00027000, LENGTH = 820K - RAM : ORIGIN = 0x20020000, LENGTH = 128K + /* These values correspond to the nRF52840 */ + /* FLASH : ORIGIN = 0x00000000, LENGTH = 1024K */ + /* RAM : ORIGIN = 0x20000000, LENGTH = 256K */ } \ No newline at end of file diff --git a/examples/use_config/nrf52840_ble_split/vial.json b/examples/use_config/nrf52840_ble_split/vial.json index fdb50998e..f685c4ca6 100644 --- a/examples/use_config/nrf52840_ble_split/vial.json +++ b/examples/use_config/nrf52840_ble_split/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_config/nrf52840_ble_split_direct_pin/.cargo/config.toml b/examples/use_config/nrf52840_ble_split_direct_pin/.cargo/config.toml index 784fa95f7..13aec3e34 100644 --- a/examples/use_config/nrf52840_ble_split_direct_pin/.cargo/config.toml +++ b/examples/use_config/nrf52840_ble_split_direct_pin/.cargo/config.toml @@ -1,38 +1,9 @@ -[target.thumbv7m-none-eabi] -# uncomment this to make `cargo run` execute programs on QEMU -# runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" - [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -# Have to use simmsb's elf2uf2 fork to flash https://github.com/simmsb/elf2uf2-rs -# runner = "elf2uf2-rs -d" runner = "probe-rs run --chip nRF52840_xxAA" linker = "flip-link" -rustflags = [ - # Previously, the linker arguments --nmagic and -Tlink.x were set here. - # They are now set by build.rs instead. The linker argument can still - # only be set here, if a custom linker is needed. - - # By default, the LLD linker is used, which is shipped with the Rust - # toolchain. If you run into problems with LLD, you can switch to the - # GNU linker by uncommenting this line: - # "-C", "linker=arm-none-eabi-ld", - - # If you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by uncommenting the three lines below: - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] [build] -# Pick ONE of these default compilation targets -# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ -# target = "thumbv7m-none-eabi" # Cortex-M3 -# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) -# target = "thumbv8m.base-none-eabi" # Cortex-M23 -# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) -# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) [env] DEFMT_LOG = "debug" \ No newline at end of file diff --git a/examples/use_config/nrf52840_ble_split_direct_pin/Cargo.lock b/examples/use_config/nrf52840_ble_split_direct_pin/Cargo.lock index 5600e34d1..fb5904ecd 100644 --- a/examples/use_config/nrf52840_ble_split_direct_pin/Cargo.lock +++ b/examples/use_config/nrf52840_ble_split_direct_pin/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -78,6 +89,32 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "bindgen" +version = "0.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" +dependencies = [ + "bitflags 2.6.0", + "cexpr", + "clang-sys", + "itertools", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.99", +] + [[package]] name = "bitfield" version = "0.13.2" @@ -113,6 +150,31 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -150,6 +212,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -170,6 +241,38 @@ dependencies = [ "windows-link", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -196,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "const_format" version = "0.2.32" @@ -254,6 +363,15 @@ dependencies = [ "syn 2.0.99", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -265,9 +383,9 @@ dependencies = [ [[package]] name = "critical-section" -version = "1.1.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] name = "crunchy" @@ -276,44 +394,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "rand_core", + "subtle", + "zeroize", ] [[package]] -name = "darling" -version = "0.20.3" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "darling_core 0.20.3", - "darling_macro 0.20.3", + "generic-array", + "typenum", ] [[package]] -name = "darling_core" -version = "0.13.4" +name = "darling" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.20.3" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" dependencies = [ "fnv", "ident_case", @@ -325,31 +441,38 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.99", ] [[package]] -name = "darling_macro" -version = "0.20.3" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.3", - "quote", - "syn 2.0.99", + "generic-array", +] + +[[package]] +name = "defmt" +version = "0.3.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" +dependencies = [ + "defmt 1.0.1", ] [[package]] name = "defmt" -version = "0.3.5" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2d011b2fee29fb7d659b83c43fce9a2cb4df453e16d441a51448e448f3f98" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -357,12 +480,12 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.3.6" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54f0216f6c5acb5ae1a47050a6645024e6edafc2ee32d421955eccfef12ef92e" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", - "proc-macro-error", + "proc-macro-error2", "proc-macro2", "quote", "syn 2.0.99", @@ -370,21 +493,42 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.3.3" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "269924c02afd7f94bc4cecbfa5c379f6ffcf9766b3408fe63d22c728654eccd0" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "609923761264dd99ed9c7d209718cda4631c5fe84668e0f0960124cbb844c49f" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", ] [[package]] @@ -396,14 +540,48 @@ dependencies = [ "litrs", ] +[[package]] +name = "doxygen-rs" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "415b6ec780d34dcf624666747194393603d0373b7141eef01d12ee58881507d9" +dependencies = [ + "phf", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e)", "embassy-sync", "embassy-time", "embedded-hal 0.2.7", @@ -417,12 +595,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -430,10 +607,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.3", + "darling", "proc-macro2", "quote", "syn 2.0.99", @@ -442,10 +618,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -453,24 +628,30 @@ name = "embassy-hal-internal" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" +dependencies = [ + "num-traits", +] + +[[package]] +name = "embassy-hal-internal" +version = "0.2.0" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] [[package]] name = "embassy-net-driver" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" [[package]] name = "embassy-net-driver-channel" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4818c32afec43e3cae234f324bad9a976c9aa7501022d26ff60a4017a1a006b7" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "embassy-futures", "embassy-net-driver", @@ -480,18 +661,17 @@ dependencies = [ [[package]] name = "embassy-nrf" version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7494efe1e0183568327c7e681d4b77ed5241921dcb5976426d9a65b65a0c81" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "bitflags 2.6.0", "cfg-if", "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", - "embassy-hal-internal", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e)", "embassy-sync", "embassy-time", "embassy-time-driver", @@ -512,12 +692,11 @@ dependencies = [ [[package]] name = "embassy-sync" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -527,12 +706,11 @@ dependencies = [ [[package]] name = "embassy-time" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -544,8 +722,7 @@ dependencies = [ [[package]] name = "embassy-time-driver" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "document-features", ] @@ -553,8 +730,7 @@ dependencies = [ [[package]] name = "embassy-time-queue-utils" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "embassy-executor", "heapless 0.8.0", @@ -563,10 +739,9 @@ dependencies = [ [[package]] name = "embassy-usb" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -579,10 +754,9 @@ dependencies = [ [[package]] name = "embassy-usb-driver" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -601,7 +775,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -610,7 +784,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -620,7 +794,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -629,7 +803,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -660,6 +834,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.24.0" @@ -708,6 +892,16 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.30" @@ -751,6 +945,34 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" version = "2.3.1" @@ -814,10 +1036,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -857,6 +1098,24 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -881,9 +1140,19 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" + +[[package]] +name = "libloading" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +dependencies = [ + "cfg-if", + "windows-targets", +] [[package]] name = "litrs" @@ -924,6 +1193,12 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "nb" version = "0.1.3" @@ -940,52 +1215,78 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" [[package]] -name = "nrf-pac" -version = "0.1.0" +name = "nom" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ - "cortex-m", - "cortex-m-rt", + "memchr", + "minimal-lexical", ] [[package]] -name = "nrf-softdevice" +name = "nrf-mpsl" version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" dependencies = [ "cortex-m", "critical-section", - "defmt", - "embassy-futures", + "defmt 0.3.100", + "embassy-nrf", "embassy-sync", + "embedded-io", "embedded-storage", "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "nrf-softdevice-s140", - "num_enum", + "nrf-mpsl-sys", ] [[package]] -name = "nrf-softdevice-macro" +name = "nrf-mpsl-sys" version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", + "bindgen", + "doxygen-rs", ] [[package]] -name = "nrf-softdevice-s140" -version = "0.1.2" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +name = "nrf-pac" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" +dependencies = [ + "cortex-m", + "cortex-m-rt", +] + +[[package]] +name = "nrf-sdc" +version = "0.1.0" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" +dependencies = [ + "bt-hci", + "critical-section", + "defmt 0.3.100", + "embassy-hal-internal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "embassy-nrf", + "embassy-sync", + "embedded-io", + "embedded-io-async", + "nrf-mpsl", + "nrf-sdc-sys", + "rand_core", +] + +[[package]] +name = "nrf-sdc-sys" +version = "0.1.0" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" +dependencies = [ + "bindgen", + "doxygen-rs", + "nrf-mpsl-sys", + "winnow 0.6.26", +] [[package]] name = "num-traits" @@ -1021,19 +1322,25 @@ name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" dependencies = [ - "critical-section", - "portable-atomic", + "elliptic-curve", + "primeorder", ] [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1042,6 +1349,93 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.99", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.99", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.13" @@ -1074,7 +1468,7 @@ checksum = "a55c51ee6c0db07e68448e336cf8ea4131a620edefebf9893e759b2d793420f8" dependencies = [ "cobs", "const_format", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1091,6 +1485,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" version = "0.2.17" @@ -1102,27 +1505,34 @@ dependencies = [ ] [[package]] -name = "proc-macro-error" -version = "1.0.4" +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" dependencies = [ - "proc-macro-error-attr", "proc-macro2", "quote", - "syn 1.0.109", - "version_check", ] [[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "proc-macro-error2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" dependencies = [ + "proc-macro-error-attr2", "proc-macro2", "quote", - "version_check", + "syn 2.0.99", ] [[package]] @@ -1143,6 +1553,25 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1187,7 +1616,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1203,16 +1632,16 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", - "once_cell", "paste", "postcard", + "rand_core", "rmk-macro", "sequential-storage", "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1221,8 +1650,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.3", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1236,21 +1667,33 @@ dependencies = [ name = "rmk-nrf52840" version = "0.2.0" dependencies = [ + "bt-hci", "const-gen", "cortex-m", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", - "embassy-futures", "embassy-nrf", "embassy-time", "json", + "nrf-mpsl", + "nrf-sdc", "panic-probe", + "rand", + "rand_chacha", + "rand_core", "rmk", + "static_cell", "xz2", ] +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1281,6 +1724,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1308,7 +1764,7 @@ version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1341,6 +1797,29 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "spin" version = "0.9.8" @@ -1368,18 +1847,24 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "static_cell" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa6ba4cf83bf80d3eb25f098ea5e790a0a1fcb5e357442259b231e412c2d3ca0" +checksum = "d89b0684884a883431282db1e4343f34afc2ff6996fe1f4a1664519b66e14c1e" dependencies = [ "portable-atomic", ] [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1405,18 +1890,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", @@ -1454,7 +1939,43 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.7.3", +] + +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.99", + "uuid", ] [[package]] @@ -1463,6 +1984,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.12" @@ -1481,7 +2008,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1492,7 +2019,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -1526,9 +2053,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.7.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" [[package]] name = "vcell" @@ -1694,6 +2221,15 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winnow" +version = "0.6.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e90edd2ac1aa278a5c4599b1d89cf03074b610800f866d4026dc199d7929a28" +dependencies = [ + "memchr", +] + [[package]] name = "winnow" version = "0.7.3" @@ -1718,7 +2254,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -1731,3 +2276,20 @@ dependencies = [ "quote", "syn 2.0.99", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.99", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_config/nrf52840_ble_split_direct_pin/Cargo.toml b/examples/use_config/nrf52840_ble_split_direct_pin/Cargo.toml index 3a780a965..1120e3dfc 100644 --- a/examples/use_config/nrf52840_ble_split_direct_pin/Cargo.toml +++ b/examples/use_config/nrf52840_ble_split_direct_pin/Cargo.toml @@ -12,13 +12,26 @@ license = "MIT OR Apache-2.0" [dependencies] rmk = { path = "../../../rmk", features = [ "nrf52840_ble", - "col2row", "split", "async_matrix", + "adafruit_bl", ] } +nrf-sdc = { version = "0.1.0", default-features = false, features = [ + "defmt", + "peripheral", + "central", + "nrf52840", +] } +nrf-mpsl = { version = "0.1.0", default-features = false, features = [ + "defmt", + "critical-section-impl", + "nrf52840", +] } +bt-hci = { version = "0.3.0", default-features = false, features = ["defmt"] } + cortex-m = "0.7.7" cortex-m-rt = "0.7.5" -embassy-time = { version = "0.4", features = ["tick-hz-32_768", "defmt"] } +embassy-time = { version = "0.4", features = ["tick-hz-32_768", "defmt", "defmt-timestamp-uptime"] } embassy-nrf = { version = "0.3.1", features = [ "defmt", "nrf52840", @@ -30,14 +43,30 @@ embassy-nrf = { version = "0.3.1", features = [ ] } embassy-executor = { version = "0.7", features = [ "defmt", - "task-arena-size-32768", "arch-cortex-m", "executor-thread", ] } -embassy-futures = { version = "0.1", features = ["defmt"] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } +static_cell = "2" + +rand = { version = "0.8.4", default-features = false } +rand_core = { version = "0.6" } +rand_chacha = { version = "0.3", default-features = false } + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-usb = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +nrf-sdc = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "4f2af99b87ae07c0b5634d32e4a62e26876e5be3" } +nrf-mpsl = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "4f2af99b87ae07c0b5634d32e4a62e26876e5be3" } +# bt-hci = { git = "https://github.com/embassy-rs/bt-hci.git", rev = "3755da87d0ef8660c5f9d4694b928ad7f679299a" } + [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_config/nrf52840_ble_split_direct_pin/README.md b/examples/use_config/nrf52840_ble_split_direct_pin/README.md index b0d60ef35..632c3eb1b 100644 --- a/examples/use_config/nrf52840_ble_split_direct_pin/README.md +++ b/examples/use_config/nrf52840_ble_split_direct_pin/README.md @@ -1,6 +1,6 @@ # nrf52840 BLE split example -RMK supports [nice!nano](https://nicekeyboards.com/) as well as any custom nrf52840 board you have. +RMK supports [nice!nano](https://nicekeyboards.com/nice-nano) as well as any custom nrf52840 board you have. ## Build firmware @@ -16,7 +16,7 @@ cargo build --release --bin peripheral ## Nice!nano support -nice!nano has a bootloader built-in, which supports .uf2 firmware format. That means you don't need any debugging probe to flash your firmware. RMK uses `cargo-make` tool to generate .uf2 firmware, then generation processing is defined in `Makefile.toml` +nice!nano has the [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader) built-in, which supports .uf2 firmware format. That means you don't need any debugging probe to flash your firmware. RMK uses `cargo-make` tool to generate .uf2 firmware, then generation processing is defined in `Makefile.toml` The following are steps of how to get .uf2 firmware work in RMK: @@ -36,24 +36,39 @@ Note that RMK will switch to USB mode if an USB cable is connected. Remember to You can also check the instruction [here](https://nicekeyboards.com/docs/nice-nano/) for more info about nice!nano. -## With debug probe -With a debug probe, you can have the full control of you hardware. To use RMK you should have [nrf s140 softdevice 7.3.0](https://www.nordicsemi.com/Products/Development-software/s140/download) flashed to nrf52840 first. +## With debugging probe -The following are the detailed steps for flashing both nrf's softdevice and RMK firmware: +With a debugging probe, you can have the full control of you hardware. To use RMK you should check whether the bootloader is flashed to your board first. To use RMK with existing bootloader such as [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader), check `memory.x` in the project root, ensure that the flash starts from 0x00001000 + +``` +MEMORY +{ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 WITH Adafruit nRF52 bootloader */ + FLASH : ORIGIN = 0x00001000, LENGTH = 1020K + RAM : ORIGIN = 0x20000008, LENGTH = 255K +} +``` + +Or you can use RMK without bootloader: + +``` +MEMORY +{ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 */ + FLASH : ORIGIN = 0x00000000, LENGTH = 1024K + RAM : ORIGIN = 0x20000000, LENGTH = 256K +} +``` + +After you have `memory.x` set, use `cargo run --release` to flash the RMK firmware to your board: 1. Enter example folder: ```shell - cd examples/use_rust/nrf52840_ble - ``` -2. Erase the flash: - ```shell - probe-rs erase --chip nrf52840_xxAA - ``` -3. Flash softdevice firmware to flash: - ```shell - probe-rs download --verify --format hex --chip nRF52840_xxAA s140_nrf52_7.3.0_softdevice.hex + cd examples/use_config/nrf52840_ble_split_direct_pin ``` -4. Compile, flash and run the example +2. Compile, flash and run the example ```shell # Run central firmware cargo run --release --bin central diff --git a/examples/use_config/nrf52840_ble_split_direct_pin/build.rs b/examples/use_config/nrf52840_ble_split_direct_pin/build.rs index 90ab55a4f..3db04708e 100644 --- a/examples/use_config/nrf52840_ble_split_direct_pin/build.rs +++ b/examples/use_config/nrf52840_ble_split_direct_pin/build.rs @@ -18,6 +18,8 @@ use std::{env, fs}; use xz2::read::XzEncoder; fn main() { + println!("cargo:rerun-if-changed=keyboard.toml"); + // Generate vial config at the root of project println!("cargo:rerun-if-changed=vial.json"); generate_vial_config(); @@ -62,8 +64,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -79,6 +80,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_config/nrf52840_ble_split_direct_pin/memory.x b/examples/use_config/nrf52840_ble_split_direct_pin/memory.x index 591f06f6f..3f9d5d2ec 100644 --- a/examples/use_config/nrf52840_ble_split_direct_pin/memory.x +++ b/examples/use_config/nrf52840_ble_split_direct_pin/memory.x @@ -1,13 +1,11 @@ MEMORY { - /* NOTE 1 K = 1 KiBi = 1024 bytes */ - /* FLASH : ORIGIN = 0x00000000, LENGTH = 1024K */ - /*RAM : ORIGIN = 0x20000000, LENGTH = 256K */ - - /* These values correspond to the NRF52840 with Softdevices S140 6.1.1 */ - /* FLASH : ORIGIN = 0x00026000, LENGTH = 824K */ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 WITH Adafruit nRF52 bootloader */ + FLASH : ORIGIN = 0x00001000, LENGTH = 1020K + RAM : ORIGIN = 0x20000008, LENGTH = 255K - /* These values correspond to the NRF52840 with Softdevices S140 7.3.0 */ - FLASH : ORIGIN = 0x00027000, LENGTH = 820K - RAM : ORIGIN = 0x20020000, LENGTH = 128K + /* These values correspond to the nRF52840 */ + /* FLASH : ORIGIN = 0x00000000, LENGTH = 1024K */ + /* RAM : ORIGIN = 0x20000000, LENGTH = 256K */ } \ No newline at end of file diff --git a/examples/use_config/nrf52840_ble_split_direct_pin/vial.json b/examples/use_config/nrf52840_ble_split_direct_pin/vial.json index fdb50998e..f685c4ca6 100644 --- a/examples/use_config/nrf52840_ble_split_direct_pin/vial.json +++ b/examples/use_config/nrf52840_ble_split_direct_pin/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_config/nrf52840_usb/.cargo/config.toml b/examples/use_config/nrf52840_usb/.cargo/config.toml deleted file mode 100644 index 44b567b56..000000000 --- a/examples/use_config/nrf52840_usb/.cargo/config.toml +++ /dev/null @@ -1,34 +0,0 @@ -[target.'cfg(all(target_arch = "arm", target_os = "none"))'] -# Have to use simmsb's elf2uf2 fork to flash https://github.com/simmsb/elf2uf2-rs -# runner = "elf2uf2-rs -d" -runner = "probe-rs run --chip nRF52840_xxAA" -linker = "flip-link" -rustflags = [ - # Previously, the linker arguments --nmagic and -Tlink.x were set here. - # They are now set by build.rs instead. The linker argument can still - # only be set here, if a custom linker is needed. - - # By default, the LLD linker is used, which is shipped with the Rust - # toolchain. If you run into problems with LLD, you can switch to the - # GNU linker by uncommenting this line: - # "-C", "linker=arm-none-eabi-ld", - - # If you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by uncommenting the three lines below: - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] - -[build] -# Pick ONE of these default compilation targets -# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ -# target = "thumbv7m-none-eabi" # Cortex-M3 -# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) -target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) -# target = "thumbv8m.base-none-eabi" # Cortex-M23 -# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) -# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) - -[env] -DEFMT_LOG = "trace" \ No newline at end of file diff --git a/examples/use_config/nrf52840_usb/Cargo.lock b/examples/use_config/nrf52840_usb/Cargo.lock deleted file mode 100644 index 1ae8ef85d..000000000 --- a/examples/use_config/nrf52840_usb/Cargo.lock +++ /dev/null @@ -1,1699 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "atomic-polyfill" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" -dependencies = [ - "critical-section", -] - -[[package]] -name = "autocfg" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" - -[[package]] -name = "az" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" - -[[package]] -name = "bare-metal" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" -dependencies = [ - "rustc_version 0.2.3", -] - -[[package]] -name = "bitfield" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" - -[[package]] -name = "bitfield" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" - -[[package]] -name = "bitfield-struct" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bedc5f4fa33bdc993f9b8ba7369d1b74fcdafa958924a0a54de6707e360de692" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.95", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[package]] -name = "bumpalo" -version = "3.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" - -[[package]] -name = "bytemuck" -version = "1.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "cargo_toml" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fbd1fe9db3ebf71b89060adaf7b0504c2d6a425cf061313099547e382c2e472" -dependencies = [ - "serde", - "toml", -] - -[[package]] -name = "cc" -version = "1.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7" -dependencies = [ - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "wasm-bindgen", - "windows-targets", -] - -[[package]] -name = "cobs" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" - -[[package]] -name = "const-gen" -version = "1.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb4caa28784488578a9aa32e0a33f0543d961345fc25efc3f04243be3fa6299" -dependencies = [ - "const-gen-derive", -] - -[[package]] -name = "const-gen-derive" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28bbf64501318336d17ffb2ea6c28c791f2af3975f2c11205228c29e3a232f89" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "cortex-m" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" -dependencies = [ - "bare-metal", - "bitfield 0.13.2", - "critical-section", - "embedded-hal 0.2.7", - "volatile-register", -] - -[[package]] -name = "cortex-m-rt" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" -dependencies = [ - "cortex-m-rt-macros", -] - -[[package]] -name = "cortex-m-rt-macros" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.95", -] - -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "critical-section" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", -] - -[[package]] -name = "darling" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" -dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", -] - -[[package]] -name = "darling_core" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.11.1", - "syn 2.0.95", -] - -[[package]] -name = "darling_macro" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" -dependencies = [ - "darling_core 0.13.4", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "darling_macro" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" -dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.95", -] - -[[package]] -name = "defmt" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" -dependencies = [ - "bitflags 1.3.2", - "defmt-macros", -] - -[[package]] -name = "defmt-macros" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" -dependencies = [ - "defmt-parser", - "proc-macro-error2", - "proc-macro2", - "quote", - "syn 2.0.95", -] - -[[package]] -name = "defmt-parser" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" -dependencies = [ - "thiserror", -] - -[[package]] -name = "defmt-rtt" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" -dependencies = [ - "critical-section", - "defmt", -] - -[[package]] -name = "document-features" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" -dependencies = [ - "litrs", -] - -[[package]] -name = "embassy-embedded-hal" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" -dependencies = [ - "defmt", - "embassy-futures", - "embassy-sync", - "embassy-time", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-async", - "embedded-storage", - "embedded-storage-async", - "nb 1.1.0", -] - -[[package]] -name = "embassy-executor" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "document-features", - "embassy-executor-macros", -] - -[[package]] -name = "embassy-executor-macros" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" -dependencies = [ - "darling 0.20.10", - "proc-macro2", - "quote", - "syn 2.0.95", -] - -[[package]] -name = "embassy-futures" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" -dependencies = [ - "defmt", -] - -[[package]] -name = "embassy-hal-internal" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "num-traits", -] - -[[package]] -name = "embassy-net-driver" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" - -[[package]] -name = "embassy-net-driver-channel" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4818c32afec43e3cae234f324bad9a976c9aa7501022d26ff60a4017a1a006b7" -dependencies = [ - "embassy-futures", - "embassy-net-driver", - "embassy-sync", -] - -[[package]] -name = "embassy-nrf" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7494efe1e0183568327c7e681d4b77ed5241921dcb5976426d9a65b65a0c81" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cortex-m", - "cortex-m-rt", - "critical-section", - "defmt", - "document-features", - "embassy-embedded-hal", - "embassy-hal-internal", - "embassy-sync", - "embassy-time", - "embassy-time-driver", - "embassy-time-queue-utils", - "embassy-usb-driver", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-async", - "embedded-io", - "embedded-io-async", - "embedded-storage", - "embedded-storage-async", - "fixed", - "nrf-pac", - "rand_core", -] - -[[package]] -name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" -dependencies = [ - "cfg-if", - "critical-section", - "defmt", - "embedded-io-async", - "futures-sink", - "futures-util", - "heapless 0.8.0", -] - -[[package]] -name = "embassy-time" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" -dependencies = [ - "cfg-if", - "critical-section", - "defmt", - "document-features", - "embassy-time-driver", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-async", - "futures-util", -] - -[[package]] -name = "embassy-time-driver" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" -dependencies = [ - "document-features", -] - -[[package]] -name = "embassy-time-queue-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83" -dependencies = [ - "embassy-executor", - "heapless 0.8.0", -] - -[[package]] -name = "embassy-usb" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" -dependencies = [ - "defmt", - "embassy-futures", - "embassy-net-driver-channel", - "embassy-sync", - "embassy-usb-driver", - "heapless 0.8.0", - "ssmarshal", - "usbd-hid", -] - -[[package]] -name = "embassy-usb-driver" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" -dependencies = [ - "defmt", -] - -[[package]] -name = "embedded-hal" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" -dependencies = [ - "nb 0.1.3", - "void", -] - -[[package]] -name = "embedded-hal" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" -dependencies = [ - "defmt", -] - -[[package]] -name = "embedded-hal-async" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" -dependencies = [ - "defmt", - "embedded-hal 1.0.0", -] - -[[package]] -name = "embedded-io" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" -dependencies = [ - "defmt", -] - -[[package]] -name = "embedded-io-async" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" -dependencies = [ - "defmt", - "embedded-io", -] - -[[package]] -name = "embedded-storage" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" - -[[package]] -name = "embedded-storage-async" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1763775e2323b7d5f0aa6090657f5e21cfa02ede71f5dc40eead06d64dcd15cc" -dependencies = [ - "embedded-storage", -] - -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "fixed" -version = "1.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a" -dependencies = [ - "az", - "bytemuck", - "half", - "typenum", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "futures" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" - -[[package]] -name = "futures-io" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" - -[[package]] -name = "futures-macro" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.95", -] - -[[package]] -name = "futures-sink" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" - -[[package]] -name = "futures-task" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" - -[[package]] -name = "futures-util" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" -dependencies = [ - "futures-core", - "futures-macro", - "futures-sink", - "futures-task", - "pin-project-lite", - "pin-utils", -] - -[[package]] -name = "half" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" -dependencies = [ - "cfg-if", - "crunchy", -] - -[[package]] -name = "hash32" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" -dependencies = [ - "byteorder", -] - -[[package]] -name = "hash32" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" -dependencies = [ - "byteorder", -] - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash", -] - -[[package]] -name = "hashbrown" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" - -[[package]] -name = "heapless" -version = "0.7.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" -dependencies = [ - "atomic-polyfill", - "hash32 0.2.1", - "rustc_version 0.4.1", - "serde", - "spin", - "stable_deref_trait", -] - -[[package]] -name = "heapless" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" -dependencies = [ - "hash32 0.3.1", - "stable_deref_trait", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "indexmap" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" -dependencies = [ - "equivalent", - "hashbrown 0.15.2", -] - -[[package]] -name = "js-sys" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - -[[package]] -name = "json" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd" - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "libc" -version = "0.2.169" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" - -[[package]] -name = "litrs" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" - -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" - -[[package]] -name = "lzma-sys" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "nb" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" -dependencies = [ - "nb 1.1.0", -] - -[[package]] -name = "nb" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" - -[[package]] -name = "nrf-pac" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" -dependencies = [ - "cortex-m", - "cortex-m-rt", -] - -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_enum" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.95", -] - -[[package]] -name = "once_cell" -version = "1.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" - -[[package]] -name = "panic-probe" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" -dependencies = [ - "cortex-m", - "defmt", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "pin-project-lite" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" - -[[package]] -name = "portable-atomic" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" - -[[package]] -name = "postcard" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" -dependencies = [ - "cobs", - "defmt", - "heapless 0.7.17", - "postcard-derive", - "serde", -] - -[[package]] -name = "postcard-derive" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0239fa9c1d225d4b7eb69925c25c5e082307a141e470573fbbe3a817ce6a7a37" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "prettyplease" -version = "0.2.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "483f8c21f64f3ea09fe0f30f5d48c3e8eefe5dac9129f0075f76593b4c1da705" -dependencies = [ - "proc-macro2", - "syn 2.0.95", -] - -[[package]] -name = "proc-macro-error-attr2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" -dependencies = [ - "proc-macro2", - "quote", -] - -[[package]] -name = "proc-macro-error2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" -dependencies = [ - "proc-macro-error-attr2", - "proc-macro2", - "quote", - "syn 2.0.95", -] - -[[package]] -name = "proc-macro2" -version = "1.0.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" - -[[package]] -name = "regex" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "rmk" -version = "0.6.1" -dependencies = [ - "bitfield-struct", - "byteorder", - "chrono", - "cortex-m", - "crc32fast", - "defmt", - "document-features", - "embassy-embedded-hal", - "embassy-executor", - "embassy-futures", - "embassy-nrf", - "embassy-sync", - "embassy-time", - "embassy-usb", - "embedded-hal 1.0.0", - "embedded-hal-async", - "embedded-io-async", - "embedded-storage", - "embedded-storage-async", - "futures", - "heapless 0.8.0", - "nrf-softdevice", - "num_enum", - "paste", - "postcard", - "rmk-macro", - "sequential-storage", - "serde", - "ssmarshal", - "static_cell", - "usbd-hid", -] - -[[package]] -name = "rmk-macro" -version = "0.5.1" -dependencies = [ - "cargo_toml", - "darling 0.20.10", - "once_cell", - "prettyplease", - "proc-macro2", - "quote", - "serde", - "serde_derive", - "syn 2.0.95", - "toml", -] - -[[package]] -name = "rmk-nrf52840" -version = "0.2.0" -dependencies = [ - "const-gen", - "cortex-m", - "cortex-m-rt", - "defmt", - "defmt-rtt", - "embassy-executor", - "embassy-nrf", - "embassy-time", - "json", - "panic-probe", - "rmk", - "xz2", -] - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver 0.9.0", -] - -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver 1.0.24", -] - -[[package]] -name = "rustversion" -version = "1.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "sequential-storage" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" -dependencies = [ - "defmt", - "embedded-storage-async", -] - -[[package]] -name = "serde" -version = "1.0.217" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.217" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.95", -] - -[[package]] -name = "serde_spanned" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" -dependencies = [ - "serde", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] - -[[package]] -name = "ssmarshal" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3e6ad23b128192ed337dfa4f1b8099ced0c2bf30d61e551b65fda5916dbb850" -dependencies = [ - "encode_unicode", - "serde", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "static_cell" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89b0684884a883431282db1e4343f34afc2ff6996fe1f4a1664519b66e14c1e" -dependencies = [ - "portable-atomic", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "thiserror" -version = "2.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.95", -] - -[[package]] -name = "toml" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.22.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "unicode-ident" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" - -[[package]] -name = "usb-device" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" -dependencies = [ - "defmt", - "heapless 0.8.0", - "portable-atomic", -] - -[[package]] -name = "usbd-hid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" -dependencies = [ - "defmt", - "serde", - "ssmarshal", - "usb-device", - "usbd-hid-macros", -] - -[[package]] -name = "usbd-hid-descriptors" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee54712c5d778d2fb2da43b1ce5a7b5060886ef7b09891baeb4bf36910a3ed" -dependencies = [ - "bitfield 0.14.0", -] - -[[package]] -name = "usbd-hid-macros" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb573c76e7884035ac5e1ab4a81234c187a82b6100140af0ab45757650ccda38" -dependencies = [ - "byteorder", - "hashbrown 0.13.2", - "log", - "proc-macro2", - "quote", - "serde", - "syn 1.0.109", - "usbd-hid-descriptors", -] - -[[package]] -name = "uuid" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" - -[[package]] -name = "vcell" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "volatile-register" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" -dependencies = [ - "vcell", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn 2.0.95", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.95", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winnow" -version = "0.6.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39281189af81c07ec09db316b302a3e67bf9bd7cbf6c820b50e35fee9c2fa980" -dependencies = [ - "memchr", -] - -[[package]] -name = "xz2" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2" -dependencies = [ - "lzma-sys", -] - -[[package]] -name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.95", -] diff --git a/examples/use_config/nrf52840_usb/Cargo.toml b/examples/use_config/nrf52840_usb/Cargo.toml deleted file mode 100644 index 5d1e0509b..000000000 --- a/examples/use_config/nrf52840_usb/Cargo.toml +++ /dev/null @@ -1,58 +0,0 @@ -[package] -name = "rmk-nrf52840" -version = "0.2.0" -authors = ["Haobo Gu "] -description = "Keyboard firmware written in Rust" -homepage = "https://github.com/haobogu/rmk" -repository = "https://github.com/haobogu/rmk" -readme = "../../README.md" -edition = "2021" -license = "MIT OR Apache-2.0" - -[dependencies] -rmk = { path = "../../../rmk", features = ["col2row"] } -cortex-m = { version = "0.7.7", features = ["critical-section-single-core"] } -cortex-m-rt = "0.7.5" -embassy-time = { version = "0.4", features = ["tick-hz-32_768", "defmt"] } -embassy-nrf = { version = "0.3.1", features = [ - "defmt", - "nrf52840", - "time-driver-rtc1", - "gpiote", - "unstable-pac", - "time", -] } -embassy-executor = { version = "0.7", features = [ - "defmt", - "arch-cortex-m", - "executor-thread", - "task-arena-size-32768", -] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } - -[build-dependencies] -xz2 = "0.1.7" -json = "0.12" -const-gen = "1.6" - -[[bin]] -name = "rmk-nrf52840" -test = false -bench = false - -[profile.dev] -codegen-units = 1 # better optimizations -debug = true -opt-level = 1 -overflow-checks = true -lto = false -panic = 'unwind' - -[profile.release] -codegen-units = 1 # better optimizations -debug = true # no overhead for bare-metal -opt-level = "z" # optimize for binary size -overflow-checks = false -lto = "fat" diff --git a/examples/use_config/nrf52840_usb/Makefile.toml b/examples/use_config/nrf52840_usb/Makefile.toml deleted file mode 100644 index 843b09e89..000000000 --- a/examples/use_config/nrf52840_usb/Makefile.toml +++ /dev/null @@ -1,31 +0,0 @@ -[tasks.install-llvm-tools] -install_crate = { rustup_component_name = "llvm-tools" } - -[tasks.flip-link] -install_crate = { crate_name = "flip-link", binary = "flip-link", test_arg = ["-h"] } - -[tasks.objcopy] -install_crate = { crate_name = "cargo-binutils", binary = "cargo", test_arg = [ - "objcopy", - "--help", -] } -command = "cargo" -args = ["objcopy", "--release", "--", "-O", "ihex", "rmk.hex"] -dependencies = ["install-llvm-tools", "flip-link"] - -[tasks.uf2] -install_crate = { crate_name = "cargo-hex-to-uf2", binary = "cargo", test_arg = [ - "hex-to-uf2", - "--help", -] } -command = "cargo" -args = [ - "hex-to-uf2", - "--input-path", - "rmk.hex", - "--output-path", - "rmk.uf2", - "--family", - "nrf52840", -] -dependencies = ["objcopy"] diff --git a/examples/use_config/nrf52840_usb/build.rs b/examples/use_config/nrf52840_usb/build.rs deleted file mode 100644 index 90ab55a4f..000000000 --- a/examples/use_config/nrf52840_usb/build.rs +++ /dev/null @@ -1,84 +0,0 @@ -//! This build script copies the `memory.x` file from the crate root into -//! a directory where the linker can always find it at build time. -//! For many projects this is optional, as the linker always searches the -//! project root directory -- wherever `Cargo.toml` is. However, if you -//! are using a workspace or have a more complicated build setup, this -//! build script becomes required. Additionally, by requesting that -//! Cargo re-run the build script whenever `memory.x` is changed, -//! updating `memory.x` ensures a rebuild of the application with the -//! new memory settings. -//! -//! The build script also sets the linker flags to tell it which link script to use. - -use const_gen::*; -use std::fs::File; -use std::io::{Read, Write}; -use std::path::{Path, PathBuf}; -use std::{env, fs}; -use xz2::read::XzEncoder; - -fn main() { - // Generate vial config at the root of project - println!("cargo:rerun-if-changed=vial.json"); - generate_vial_config(); - - // Put `memory.x` in our output directory and ensure it's - // on the linker search path. - let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); - File::create(out.join("memory.x")) - .unwrap() - .write_all(include_bytes!("memory.x")) - .unwrap(); - println!("cargo:rustc-link-search={}", out.display()); - - // By default, Cargo will re-run a build script whenever - // any file in the project changes. By specifying `memory.x` - // here, we ensure the build script is only re-run when - // `memory.x` is changed. - println!("cargo:rerun-if-changed=memory.x"); - - // Specify linker arguments. - - // `--nmagic` is required if memory section addresses are not aligned to 0x10000, - // for example the FLASH and RAM sections in your `memory.x`. - // See https://github.com/rust-embedded/cortex-m-quickstart/pull/95 - println!("cargo:rustc-link-arg=--nmagic"); - - // Set the linker script to the one provided by cortex-m-rt. - println!("cargo:rustc-link-arg=-Tlink.x"); - - // Set the extra linker script from defmt - println!("cargo:rustc-link-arg=-Tdefmt.x"); - - // Use flip-link overflow check: https://github.com/knurling-rs/flip-link - println!("cargo:rustc-linker=flip-link"); -} - -fn generate_vial_config() { - // Generated vial config file - let out_file = Path::new(&env::var_os("OUT_DIR").unwrap()).join("config_generated.rs"); - - let p = Path::new("vial.json"); - let mut content = String::new(); - match File::open(p) { - Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); - } - Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), - }; - - let vial_cfg = json::stringify(json::parse(&content).unwrap()); - let mut keyboard_def_compressed: Vec = Vec::new(); - XzEncoder::new(vial_cfg.as_bytes(), 6) - .read_to_end(&mut keyboard_def_compressed) - .unwrap(); - - let keyboard_id: Vec = vec![0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; - let const_declarations = [ - const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), - const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), - ] - .join("\n"); - fs::write(out_file, const_declarations).unwrap(); -} diff --git a/examples/use_config/nrf52840_usb/keyboard.toml b/examples/use_config/nrf52840_usb/keyboard.toml deleted file mode 100644 index 624d755cc..000000000 --- a/examples/use_config/nrf52840_usb/keyboard.toml +++ /dev/null @@ -1,53 +0,0 @@ -[keyboard] -name = "RMK Keyboard" -product_name = "RMK Keyboard" -vendor_id = 0x4c4b -product_id = 0x4643 -manufacturer = "haobo" -chip = "nrf52840" - -[matrix] -# Input and output pins are mandatory -input_pins = ["P1_00", "P1_01", "P1_02", "P1_03"] -output_pins = ["P1_05", "P1_06", "P1_07"] -# WARNING: Currently row2col/col2row is set in RMK's feature gate, row2col config here is valid ONLY when you're using cloud compilation -# row2col = true - -[layout] -rows = 4 -cols = 3 -layers = 2 -keymap = [ - [ - ["A", "B", "C"], - ["Kc1", "Kc2", "Kc3"], - ["LCtrl", "MO(1)", "LShift"], - ["OSL(1)", "LT(2, Kc9)", "LM(1, LShift | LGui)"] - ], - [ - ["_", "TT(1)", "TG(2)"], - ["_", "_", "_"], - ["_", "_", "_"], - ["_", "_", "_"] - ], -] - -[light] -# All light pins are high-active by default, uncomment if you want it to be low-active -# capslock.pin = "PB2" -# capslock.low_active = true -# scrolllock.pin = "PA3" -# scrolllock.low_active = true -# Just ignore if no light pin is used for it -# numslock.pin = "PA5" -# numslock.low_active = true - - - -[storage] -# Storage feature is enabled by default -# enabled = false - -[ble] -# USB only example -enabled = false \ No newline at end of file diff --git a/examples/use_config/nrf52840_usb/memory.x b/examples/use_config/nrf52840_usb/memory.x deleted file mode 100644 index ed12371f1..000000000 --- a/examples/use_config/nrf52840_usb/memory.x +++ /dev/null @@ -1,10 +0,0 @@ -MEMORY -{ - /* NOTE 1 K = 1 KiBi = 1024 bytes */ - FLASH : ORIGIN = 0x00000000, LENGTH = 1024K - RAM : ORIGIN = 0x20000000, LENGTH = 256K - - /* These values correspond to the NRF52840 with Softdevices S140 7.3.0 */ - /* FLASH : ORIGIN = 0x00027000, LENGTH = 820K - RAM : ORIGIN = 0x20020000, LENGTH = 128K */ -} \ No newline at end of file diff --git a/examples/use_config/nrf52840_usb/src/main.rs b/examples/use_config/nrf52840_usb/src/main.rs deleted file mode 100644 index c3bc88290..000000000 --- a/examples/use_config/nrf52840_usb/src/main.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![no_std] -#![no_main] - -use rmk::macros::rmk_keyboard; - -// Vial config is automatically generated by `build.rs`, according to `vial.json` -// Please put `vial.json` at your project's root -#[rmk_keyboard] -mod keyboard {} diff --git a/examples/use_config/nrf52840_usb/vial.json b/examples/use_config/nrf52840_usb/vial.json deleted file mode 100644 index 040fcabef..000000000 --- a/examples/use_config/nrf52840_usb/vial.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "HID Keyboard", - "vendorId": "0x4C4B", - "productId": "0x4643", - "lighting": "none", - "matrix": { - "rows": 4, - "cols": 3 - }, - "layouts": { - "keymap": [ - [ - "0,0", - "0,1", - "0,2" - ], - [ - "1,0", - "1,1", - "1,2" - ], - [ - "2,0", - "2,1", - "2,2" - ], - [ - { - "y": -2, - "x": 4 - }, - "3,0", - "3,2" - ] - ] - } -} \ No newline at end of file diff --git a/examples/use_config/rp2040/Cargo.lock b/examples/use_config/rp2040/Cargo.lock index 01239047a..670645d44 100644 --- a/examples/use_config/rp2040/Cargo.lock +++ b/examples/use_config/rp2040/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -93,6 +104,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bit-set" version = "0.8.0" @@ -152,6 +169,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -209,6 +242,27 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -245,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -323,23 +383,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "crypto-common" -version = "0.1.6" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "typenum", + "rand_core", + "subtle", + "zeroize", ] [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "typenum", ] [[package]] @@ -348,22 +410,8 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -376,30 +424,28 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.95", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.95", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.95", + "generic-array", ] [[package]] @@ -410,9 +456,18 @@ checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" [[package]] name = "defmt" -version = "0.3.10" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" +dependencies = [ + "defmt 1.0.1", +] + +[[package]] +name = "defmt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -420,9 +475,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -433,21 +488,31 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", ] [[package]] @@ -458,6 +523,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -475,13 +541,32 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -496,12 +581,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -509,10 +593,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.95", @@ -521,10 +604,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -535,7 +617,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -567,7 +649,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -597,7 +679,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -628,12 +710,11 @@ dependencies = [ [[package]] name = "embassy-sync" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -648,7 +729,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -682,7 +763,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -698,7 +779,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -717,7 +798,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -726,7 +807,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -746,7 +827,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -755,7 +836,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -795,6 +876,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -849,6 +940,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -900,6 +1001,18 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", ] [[package]] @@ -965,10 +1078,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "home" version = "0.5.11" @@ -1017,6 +1149,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -1165,38 +1306,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1232,14 +1341,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1271,6 +1390,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "petgraph" version = "0.7.1" @@ -1364,9 +1528,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" dependencies = [ "critical-section", ] @@ -1378,7 +1542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1395,6 +1559,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -1411,6 +1584,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1451,6 +1633,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1513,12 +1705,13 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", "embassy-futures", "embassy-nrf", + "embassy-rp", "embassy-sync", "embassy-time", "embassy-usb", @@ -1529,7 +1722,6 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "postcard", @@ -1538,6 +1730,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1546,8 +1739,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1563,7 +1758,7 @@ version = "0.2.0" dependencies = [ "const-gen", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-rp", @@ -1633,6 +1828,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1656,11 +1864,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1693,6 +1901,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2-const-stable" version = "0.1.0" @@ -1794,15 +2013,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1899,12 +2118,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.95", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1929,7 +2190,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1940,7 +2201,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -2197,7 +2458,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -2210,3 +2480,20 @@ dependencies = [ "quote", "syn 2.0.95", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_config/rp2040/Cargo.toml b/examples/use_config/rp2040/Cargo.toml index 14a87c4d3..b2fab7c04 100644 --- a/examples/use_config/rp2040/Cargo.toml +++ b/examples/use_config/rp2040/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk" } +rmk = { path = "../../../rmk", features = ["rp2040_bl"]} embassy-time = { version = "0.4", features = ["defmt"] } embassy-rp = { version = "0.4", features = [ "rp2040", @@ -22,13 +22,17 @@ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", "executor-thread", - "task-arena-size-32768", ] } cortex-m-rt = "0.7.5" -portable-atomic = { version = "1.10", features = ["critical-section"] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +portable-atomic = { version = "1.11", features = ["critical-section"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } # [features] # avoid having to use --allow-multiple-definition linker flag diff --git a/examples/use_config/rp2040/build.rs b/examples/use_config/rp2040/build.rs index 81ff3e216..3ca23dbf0 100644 --- a/examples/use_config/rp2040/build.rs +++ b/examples/use_config/rp2040/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -63,8 +64,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -80,6 +80,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_config/rp2040/vial.json b/examples/use_config/rp2040/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_config/rp2040/vial.json +++ b/examples/use_config/rp2040/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_config/rp2040_direct_pin/Cargo.lock b/examples/use_config/rp2040_direct_pin/Cargo.lock index 01239047a..670645d44 100644 --- a/examples/use_config/rp2040_direct_pin/Cargo.lock +++ b/examples/use_config/rp2040_direct_pin/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -93,6 +104,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bit-set" version = "0.8.0" @@ -152,6 +169,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -209,6 +242,27 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -245,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -323,23 +383,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "crypto-common" -version = "0.1.6" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "typenum", + "rand_core", + "subtle", + "zeroize", ] [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "typenum", ] [[package]] @@ -348,22 +410,8 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -376,30 +424,28 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.95", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.95", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.95", + "generic-array", ] [[package]] @@ -410,9 +456,18 @@ checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" [[package]] name = "defmt" -version = "0.3.10" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" +dependencies = [ + "defmt 1.0.1", +] + +[[package]] +name = "defmt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -420,9 +475,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -433,21 +488,31 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", ] [[package]] @@ -458,6 +523,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -475,13 +541,32 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -496,12 +581,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -509,10 +593,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.95", @@ -521,10 +604,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -535,7 +617,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -567,7 +649,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -597,7 +679,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -628,12 +710,11 @@ dependencies = [ [[package]] name = "embassy-sync" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -648,7 +729,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -682,7 +763,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -698,7 +779,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -717,7 +798,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -726,7 +807,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -746,7 +827,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -755,7 +836,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -795,6 +876,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -849,6 +940,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -900,6 +1001,18 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", ] [[package]] @@ -965,10 +1078,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "home" version = "0.5.11" @@ -1017,6 +1149,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -1165,38 +1306,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1232,14 +1341,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1271,6 +1390,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "petgraph" version = "0.7.1" @@ -1364,9 +1528,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" dependencies = [ "critical-section", ] @@ -1378,7 +1542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1395,6 +1559,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -1411,6 +1584,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1451,6 +1633,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1513,12 +1705,13 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", "embassy-futures", "embassy-nrf", + "embassy-rp", "embassy-sync", "embassy-time", "embassy-usb", @@ -1529,7 +1722,6 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "postcard", @@ -1538,6 +1730,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1546,8 +1739,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1563,7 +1758,7 @@ version = "0.2.0" dependencies = [ "const-gen", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-rp", @@ -1633,6 +1828,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1656,11 +1864,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1693,6 +1901,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2-const-stable" version = "0.1.0" @@ -1794,15 +2013,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1899,12 +2118,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.95", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1929,7 +2190,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1940,7 +2201,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -2197,7 +2458,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -2210,3 +2480,20 @@ dependencies = [ "quote", "syn 2.0.95", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_config/rp2040_direct_pin/Cargo.toml b/examples/use_config/rp2040_direct_pin/Cargo.toml index 14a87c4d3..c61f3703d 100644 --- a/examples/use_config/rp2040_direct_pin/Cargo.toml +++ b/examples/use_config/rp2040_direct_pin/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk" } +rmk = { path = "../../../rmk", features = ["rp2040_bl"] } embassy-time = { version = "0.4", features = ["defmt"] } embassy-rp = { version = "0.4", features = [ "rp2040", @@ -22,13 +22,17 @@ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", "executor-thread", - "task-arena-size-32768", ] } cortex-m-rt = "0.7.5" -portable-atomic = { version = "1.10", features = ["critical-section"] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +portable-atomic = { version = "1.11", features = ["critical-section"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } # [features] # avoid having to use --allow-multiple-definition linker flag diff --git a/examples/use_config/rp2040_direct_pin/build.rs b/examples/use_config/rp2040_direct_pin/build.rs index 81ff3e216..3ca23dbf0 100644 --- a/examples/use_config/rp2040_direct_pin/build.rs +++ b/examples/use_config/rp2040_direct_pin/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -63,8 +64,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -80,6 +80,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_config/rp2040_direct_pin/vial.json b/examples/use_config/rp2040_direct_pin/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_config/rp2040_direct_pin/vial.json +++ b/examples/use_config/rp2040_direct_pin/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_config/rp2040_split/Cargo.lock b/examples/use_config/rp2040_split/Cargo.lock index baf95c68a..6df51c5f2 100644 --- a/examples/use_config/rp2040_split/Cargo.lock +++ b/examples/use_config/rp2040_split/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -93,6 +104,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bit-set" version = "0.8.0" @@ -152,6 +169,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -209,6 +242,27 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -245,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -323,23 +383,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "crypto-common" -version = "0.1.6" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "typenum", + "rand_core", + "subtle", + "zeroize", ] [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "typenum", ] [[package]] @@ -348,22 +410,8 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -376,30 +424,28 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.95", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.95", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.95", + "generic-array", ] [[package]] @@ -410,9 +456,18 @@ checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" [[package]] name = "defmt" -version = "0.3.10" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" +dependencies = [ + "defmt 1.0.1", +] + +[[package]] +name = "defmt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -420,9 +475,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -433,21 +488,31 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", ] [[package]] @@ -458,6 +523,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -475,13 +541,32 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -496,12 +581,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -509,10 +593,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.95", @@ -521,10 +604,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -535,7 +617,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -567,7 +649,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -597,7 +679,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -628,12 +710,11 @@ dependencies = [ [[package]] name = "embassy-sync" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -648,7 +729,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -682,7 +763,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -698,7 +779,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -717,7 +798,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -726,7 +807,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -746,7 +827,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -755,7 +836,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -795,6 +876,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -849,6 +940,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -900,6 +1001,18 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", ] [[package]] @@ -965,10 +1078,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "home" version = "0.5.11" @@ -1017,6 +1149,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -1165,38 +1306,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1232,14 +1341,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1271,6 +1390,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "petgraph" version = "0.7.1" @@ -1364,9 +1528,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" dependencies = [ "critical-section", ] @@ -1378,7 +1542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1395,6 +1559,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -1411,6 +1584,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1451,6 +1633,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1513,12 +1705,13 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", "embassy-futures", "embassy-nrf", + "embassy-rp", "embassy-sync", "embassy-time", "embassy-usb", @@ -1529,7 +1722,6 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "postcard", @@ -1538,6 +1730,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1546,8 +1739,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1563,7 +1758,7 @@ version = "0.2.0" dependencies = [ "const-gen", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-futures", @@ -1635,6 +1830,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1658,11 +1866,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1695,6 +1903,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2-const-stable" version = "0.1.0" @@ -1796,15 +2015,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1901,12 +2120,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.95", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1931,7 +2192,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1942,7 +2203,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -2199,7 +2460,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -2212,3 +2482,20 @@ dependencies = [ "quote", "syn 2.0.95", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_config/rp2040_split/Cargo.toml b/examples/use_config/rp2040_split/Cargo.toml index 2436d4c25..155356341 100644 --- a/examples/use_config/rp2040_split/Cargo.toml +++ b/examples/use_config/rp2040_split/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk", features = ["split"] } +rmk = { path = "../../../rmk", features = ["split", "rp2040_bl"] } embassy-time = { version = "0.4", features = ["defmt"] } embassy-rp = { version = "0.4", features = [ "rp2040", @@ -22,16 +22,20 @@ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", "executor-thread", - "task-arena-size-32768", ] } embassy-futures = { version = "0.1", features = ["defmt"] } cortex-m-rt = "0.7.5" -portable-atomic = { version = "1.10", features = ["critical-section"] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +portable-atomic = { version = "1.11", features = ["critical-section"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } static_cell = "2" +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } + # [features] # avoid having to use --allow-multiple-definition linker flag # on macOS with Apple Silicon at least diff --git a/examples/use_config/rp2040_split/build.rs b/examples/use_config/rp2040_split/build.rs index 9456a7f91..d08c4464f 100644 --- a/examples/use_config/rp2040_split/build.rs +++ b/examples/use_config/rp2040_split/build.rs @@ -10,14 +10,17 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { + println!("cargo:rerun-if-changed=keyboard.toml"); + // Generate vial config at the root of project println!("cargo:rerun-if-changed=vial.json"); generate_vial_config(); @@ -61,8 +64,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -78,6 +80,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_config/rp2040_split/vial.json b/examples/use_config/rp2040_split/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_config/rp2040_split/vial.json +++ b/examples/use_config/rp2040_split/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_config/rp2040_split_pio/Cargo.lock b/examples/use_config/rp2040_split_pio/Cargo.lock index c9285e512..49bdbc25d 100644 --- a/examples/use_config/rp2040_split_pio/Cargo.lock +++ b/examples/use_config/rp2040_split_pio/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -93,6 +104,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bit-set" version = "0.8.0" @@ -152,6 +169,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -209,6 +242,27 @@ dependencies = [ "windows-link", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -245,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -323,23 +383,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "crypto-common" -version = "0.1.6" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "typenum", + "rand_core", + "subtle", + "zeroize", ] [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "typenum", ] [[package]] @@ -348,22 +410,8 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -376,30 +424,28 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.90", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.90", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.90", + "generic-array", ] [[package]] @@ -410,9 +456,18 @@ checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" [[package]] name = "defmt" -version = "0.3.10" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" +dependencies = [ + "defmt 1.0.1", +] + +[[package]] +name = "defmt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -420,9 +475,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -433,21 +488,31 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", ] [[package]] @@ -458,6 +523,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -475,13 +541,32 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -496,12 +581,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -509,10 +593,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.90", @@ -521,10 +604,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -535,7 +617,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -567,7 +649,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -597,7 +679,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -628,12 +710,11 @@ dependencies = [ [[package]] name = "embassy-sync" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -648,7 +729,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -682,7 +763,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -698,7 +779,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -717,7 +798,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -726,7 +807,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -746,7 +827,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -755,7 +836,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -795,6 +876,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -849,6 +940,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -900,6 +1001,18 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", ] [[package]] @@ -965,10 +1078,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "home" version = "0.5.11" @@ -1017,6 +1149,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -1165,38 +1306,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1232,14 +1341,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1271,6 +1390,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "petgraph" version = "0.7.1" @@ -1364,9 +1528,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" dependencies = [ "critical-section", ] @@ -1378,7 +1542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1395,6 +1559,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -1411,6 +1584,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1451,6 +1633,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1513,7 +1705,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1532,7 +1724,6 @@ dependencies = [ "fixed", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "pio", @@ -1543,6 +1734,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1551,8 +1743,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1568,7 +1762,7 @@ version = "0.2.0" dependencies = [ "const-gen", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-futures", @@ -1640,6 +1834,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1663,11 +1870,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1700,6 +1907,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2-const-stable" version = "0.1.0" @@ -1801,15 +2019,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1906,12 +2124,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.90", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1936,7 +2196,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1947,7 +2207,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -2210,7 +2470,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -2223,3 +2492,20 @@ dependencies = [ "quote", "syn 2.0.90", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_config/rp2040_split_pio/Cargo.toml b/examples/use_config/rp2040_split_pio/Cargo.toml index b5e87f2ce..aa5cb5c6a 100644 --- a/examples/use_config/rp2040_split_pio/Cargo.toml +++ b/examples/use_config/rp2040_split_pio/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk", features = ["split", "rp2040_pio"] } +rmk = { path = "../../../rmk", features = ["split", "rp2040_pio", "rp2040_bl"] } embassy-time = { version = "0.4", features = ["defmt"] } embassy-rp = { version = "0.4", features = [ "rp2040", @@ -22,14 +22,13 @@ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", "executor-thread", - "task-arena-size-32768", ] } embassy-futures = { version = "0.1", features = ["defmt"] } cortex-m-rt = "0.7.5" -portable-atomic = { version = "1.10", features = ["critical-section"] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +portable-atomic = { version = "1.11", features = ["critical-section"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } static_cell = "2" # [features] @@ -37,6 +36,11 @@ static_cell = "2" # on macOS with Apple Silicon at least # default = ["rp-pico/disable-intrinsics"] +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } + [build-dependencies] xz2 = "0.1.7" json = "0.12" diff --git a/examples/use_config/rp2040_split_pio/build.rs b/examples/use_config/rp2040_split_pio/build.rs index 9456a7f91..326a06291 100644 --- a/examples/use_config/rp2040_split_pio/build.rs +++ b/examples/use_config/rp2040_split_pio/build.rs @@ -18,6 +18,8 @@ use std::{env, fs}; use xz2::read::XzEncoder; fn main() { + println!("cargo:rerun-if-changed=keyboard.toml"); + // Generate vial config at the root of project println!("cargo:rerun-if-changed=vial.json"); generate_vial_config(); @@ -61,8 +63,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -78,6 +79,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_config/rp2040_split_pio/vial.json b/examples/use_config/rp2040_split_pio/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_config/rp2040_split_pio/vial.json +++ b/examples/use_config/rp2040_split_pio/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_config/stm32f1/.cargo/config.toml b/examples/use_config/stm32f1/.cargo/config.toml index d3a9579a4..8b415cd8d 100644 --- a/examples/use_config/stm32f1/.cargo/config.toml +++ b/examples/use_config/stm32f1/.cargo/config.toml @@ -1,40 +1,13 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -# uncomment ONE of these three option to make `cargo run` start a GDB session -# which option to pick depends on your system runner = "probe-rs run --chip STM32F103CB" -# runner = "gdb-multiarch -q -x openocd.gdb" -# runner = "gdb -q -x openocd.gdb" linker = "flip-link" -rustflags = [ - # Previously, the linker arguments --nmagic and -Tlink.x were set here. - # They are now set by build.rs instead. The linker argument can still - # only be set here, if a custom linker is needed. - - # By default, the LLD linker is used, which is shipped with the Rust - # toolchain. If you run into problems with LLD, you can switch to the - # GNU linker by uncommenting this line: - # "-C", "linker=arm-none-eabi-ld", - - # If you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by uncommenting the three lines below: - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] [unstable] build-std = ["core"] build-std-features = ["panic_immediate_abort"] [build] -# Pick ONE of these default compilation targets -# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ target = "thumbv7m-none-eabi" # Cortex-M3 -# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) -# target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) -# target = "thumbv8m.base-none-eabi" # Cortex-M23 -# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) -# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) [env] DEFMT_LOG = "error" \ No newline at end of file diff --git a/examples/use_config/stm32f1/Cargo.lock b/examples/use_config/stm32f1/Cargo.lock index 615ea6faf..aa43de7cc 100644 --- a/examples/use_config/stm32f1/Cargo.lock +++ b/examples/use_config/stm32f1/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -96,6 +107,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bit_field" version = "0.10.2" @@ -137,6 +154,15 @@ version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "block-device-driver" version = "0.2.0" @@ -146,6 +172,22 @@ dependencies = [ "aligned", ] +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -203,6 +245,27 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -229,6 +292,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -268,6 +337,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -290,13 +368,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", ] [[package]] @@ -305,65 +395,58 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", + "strsim", + "syn 2.0.90", ] [[package]] -name = "darling_core" +name = "darling_macro" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", + "darling_core", "quote", - "strsim 0.11.1", "syn 2.0.90", ] [[package]] -name = "darling_macro" -version = "0.13.4" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.13.4", - "quote", - "syn 1.0.109", + "generic-array", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "defmt" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.90", + "defmt 1.0.1", ] [[package]] name = "defmt" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -371,9 +454,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -384,13 +467,34 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + [[package]] name = "document-features" version = "0.2.10" @@ -400,13 +504,32 @@ dependencies = [ "litrs", ] +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -421,12 +544,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -434,10 +556,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.90", @@ -446,10 +567,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -460,7 +580,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -470,7 +590,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -495,7 +615,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -528,7 +648,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -564,13 +684,12 @@ dependencies = [ [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -585,7 +704,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -619,7 +738,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -635,7 +754,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -645,7 +764,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08e753b23799329780c7ac434264026d0422044d6649ed70a73441b14a6436d7" dependencies = [ "critical-section", - "defmt", + "defmt 0.3.100", "embassy-sync", "embassy-usb-driver", ] @@ -675,7 +794,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -684,7 +803,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -704,7 +823,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -713,7 +832,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -744,6 +863,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -792,6 +921,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -835,6 +974,28 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" version = "2.4.1" @@ -898,10 +1059,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -941,6 +1121,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -1033,38 +1222,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1100,11 +1257,21 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", ] @@ -1115,6 +1282,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "pin-project-lite" version = "0.2.15" @@ -1146,7 +1358,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1163,6 +1375,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" version = "0.2.25" @@ -1173,6 +1394,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1213,6 +1443,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1257,7 +1497,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1273,7 +1513,6 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "postcard", @@ -1282,6 +1521,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1290,8 +1530,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1308,7 +1550,7 @@ dependencies = [ "const-gen", "cortex-m", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "embassy-executor", "embassy-stm32", "embassy-time", @@ -1354,6 +1596,19 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93c025f9cfe4c388c328ece47d11a54a823da3b5ad0370b22d95ad47137f85a" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1377,11 +1632,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1414,6 +1669,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1481,15 +1747,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1567,12 +1833,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.90", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1585,7 +1893,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1596,7 +1904,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -1816,7 +2124,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -1829,3 +2146,20 @@ dependencies = [ "quote", "syn 2.0.90", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_config/stm32f1/Cargo.toml b/examples/use_config/stm32f1/Cargo.toml index 9a231b68c..032d407a9 100644 --- a/examples/use_config/stm32f1/Cargo.toml +++ b/examples/use_config/stm32f1/Cargo.toml @@ -24,11 +24,14 @@ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", "executor-thread", - "task-arena-size-16384", ] } -defmt = "0.3" -panic-probe = { version = "0.3" } +defmt = "1.0" +panic-probe = { version = "1.0" } +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_config/stm32f1/build.rs b/examples/use_config/stm32f1/build.rs index c13a99b5b..b20f9a795 100644 --- a/examples/use_config/stm32f1/build.rs +++ b/examples/use_config/stm32f1/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::Read; use std::path::Path; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -49,8 +50,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -66,6 +66,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_config/stm32f1/src/main.rs b/examples/use_config/stm32f1/src/main.rs index 9823d24af..de6442ef4 100644 --- a/examples/use_config/stm32f1/src/main.rs +++ b/examples/use_config/stm32f1/src/main.rs @@ -7,7 +7,8 @@ use rmk::macros::rmk_keyboard; #[rmk_keyboard] mod keyboard { use embassy_stm32::rcc::*; - use embassy_stm32::{time::Hertz, Config}; + use embassy_stm32::time::Hertz; + use embassy_stm32::Config; #[Override(chip_config)] fn config() -> Config { diff --git a/examples/use_config/stm32f1/vial.json b/examples/use_config/stm32f1/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_config/stm32f1/vial.json +++ b/examples/use_config/stm32f1/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_config/stm32f4/.cargo/config.toml b/examples/use_config/stm32f4/.cargo/config.toml index 64f86a711..ae07be7bd 100644 --- a/examples/use_config/stm32f4/.cargo/config.toml +++ b/examples/use_config/stm32f4/.cargo/config.toml @@ -1,37 +1,10 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -# uncomment ONE of these three option to make `cargo run` start a GDB session -# which option to pick depends on your system runner = "probe-rs run --chip STM32F411CEUx" # runner = "probe-rs run --chip STM32F407VETx" -# runner = "gdb-multiarch -q -x openocd.gdb" -# runner = "gdb -q -x openocd.gdb" linker = "flip-link" -rustflags = [ - # Previously, the linker arguments --nmagic and -Tlink.x were set here. - # They are now set by build.rs instead. The linker argument can still - # only be set here, if a custom linker is needed. - - # By default, the LLD linker is used, which is shipped with the Rust - # toolchain. If you run into problems with LLD, you can switch to the - # GNU linker by uncommenting this line: - # "-C", "linker=arm-none-eabi-ld", - - # If you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by uncommenting the three lines below: - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] [build] -# Pick ONE of these default compilation targets -# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ -# target = "thumbv7m-none-eabi" # Cortex-M3 -# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) -# target = "thumbv8m.base-none-eabi" # Cortex-M23 -# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) -# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) [env] DEFMT_LOG = "debug" \ No newline at end of file diff --git a/examples/use_config/stm32f4/Cargo.lock b/examples/use_config/stm32f4/Cargo.lock index a549db8cd..340fa1c36 100644 --- a/examples/use_config/stm32f4/Cargo.lock +++ b/examples/use_config/stm32f4/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -96,6 +107,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bit_field" version = "0.10.2" @@ -137,6 +154,15 @@ version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "block-device-driver" version = "0.2.0" @@ -146,6 +172,22 @@ dependencies = [ "aligned", ] +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -203,6 +245,27 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -229,6 +292,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -268,6 +337,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -290,13 +368,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", ] [[package]] @@ -305,65 +395,58 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", + "strsim", + "syn 2.0.90", ] [[package]] -name = "darling_core" +name = "darling_macro" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", + "darling_core", "quote", - "strsim 0.11.1", "syn 2.0.90", ] [[package]] -name = "darling_macro" -version = "0.13.4" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.13.4", - "quote", - "syn 1.0.109", + "generic-array", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "defmt" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.90", + "defmt 1.0.1", ] [[package]] name = "defmt" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -371,9 +454,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -384,21 +467,42 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", ] [[package]] @@ -410,13 +514,32 @@ dependencies = [ "litrs", ] +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -431,12 +554,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -444,10 +566,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.90", @@ -456,10 +577,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -470,7 +590,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -480,7 +600,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -505,7 +625,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -538,7 +658,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -574,13 +694,12 @@ dependencies = [ [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -595,7 +714,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -629,7 +748,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -645,7 +764,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -655,7 +774,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08e753b23799329780c7ac434264026d0422044d6649ed70a73441b14a6436d7" dependencies = [ "critical-section", - "defmt", + "defmt 0.3.100", "embassy-sync", "embassy-usb-driver", ] @@ -685,7 +804,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -694,7 +813,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -714,7 +833,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -723,7 +842,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -754,6 +873,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -802,6 +931,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -845,6 +984,28 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" version = "2.4.1" @@ -908,10 +1069,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -951,6 +1131,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -1043,38 +1232,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1110,14 +1267,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1126,6 +1293,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "pin-project-lite" version = "0.2.15" @@ -1157,7 +1369,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1174,6 +1386,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" version = "0.2.25" @@ -1184,6 +1405,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1224,6 +1454,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1268,7 +1508,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1284,7 +1524,6 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "postcard", @@ -1293,6 +1532,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1301,8 +1541,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1319,7 +1561,7 @@ dependencies = [ "const-gen", "cortex-m", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-stm32", @@ -1367,6 +1609,19 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93c025f9cfe4c388c328ece47d11a54a823da3b5ad0370b22d95ad47137f85a" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1390,11 +1645,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1427,6 +1682,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1494,15 +1760,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1580,12 +1846,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.90", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1598,7 +1906,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1609,7 +1917,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -1829,7 +2137,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -1842,3 +2159,20 @@ dependencies = [ "quote", "syn 2.0.90", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_config/stm32f4/Cargo.toml b/examples/use_config/stm32f4/Cargo.toml index 0cb6d8f40..6eb0aadff 100644 --- a/examples/use_config/stm32f4/Cargo.toml +++ b/examples/use_config/stm32f4/Cargo.toml @@ -25,13 +25,16 @@ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", "executor-thread", - "task-arena-size-32768", ] } static_cell = "2" -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_config/stm32f4/build.rs b/examples/use_config/stm32f4/build.rs index c13a99b5b..b20f9a795 100644 --- a/examples/use_config/stm32f4/build.rs +++ b/examples/use_config/stm32f4/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::Read; use std::path::Path; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -49,8 +50,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -66,6 +66,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_config/stm32f4/src/main.rs b/examples/use_config/stm32f4/src/main.rs index 7015f235b..fd3741d3a 100644 --- a/examples/use_config/stm32f4/src/main.rs +++ b/examples/use_config/stm32f4/src/main.rs @@ -6,7 +6,8 @@ use rmk::macros::rmk_keyboard; // Create and run your keyboard with a single macro: `rmk_keyboard` #[rmk_keyboard] mod keyboard { - use embassy_stm32::{time::Hertz, Config}; + use embassy_stm32::time::Hertz; + use embassy_stm32::Config; #[Override(chip_config)] fn config() -> Config { diff --git a/examples/use_config/stm32f4/vial.json b/examples/use_config/stm32f4/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_config/stm32f4/vial.json +++ b/examples/use_config/stm32f4/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_config/stm32h7/.cargo/config.toml b/examples/use_config/stm32h7/.cargo/config.toml index caf481758..06f836fae 100644 --- a/examples/use_config/stm32h7/.cargo/config.toml +++ b/examples/use_config/stm32h7/.cargo/config.toml @@ -1,40 +1,9 @@ -[target.thumbv7m-none-eabi] -# uncomment this to make `cargo run` execute programs on QEMU -# runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" - [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -# uncomment ONE of these three option to make `cargo run` start a GDB session -# which option to pick depends on your system runner = "probe-rs run --chip STM32H7B0VBTx" -# runner = "gdb-multiarch -q -x openocd.gdb" -# runner = "gdb -q -x openocd.gdb" linker = "flip-link" -rustflags = [ - # Previously, the linker arguments --nmagic and -Tlink.x were set here. - # They are now set by build.rs instead. The linker argument can still - # only be set here, if a custom linker is needed. - - # By default, the LLD linker is used, which is shipped with the Rust - # toolchain. If you run into problems with LLD, you can switch to the - # GNU linker by uncommenting this line: - # "-C", "linker=arm-none-eabi-ld", - - # If you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by uncommenting the three lines below: - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] [build] -# Pick ONE of these default compilation targets -# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ -# target = "thumbv7m-none-eabi" # Cortex-M3 -# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) -# target = "thumbv8m.base-none-eabi" # Cortex-M23 -# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) -# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) [env] DEFMT_LOG = "debug" \ No newline at end of file diff --git a/examples/use_config/stm32h7/Cargo.lock b/examples/use_config/stm32h7/Cargo.lock index ccb4a8672..3af449b82 100644 --- a/examples/use_config/stm32h7/Cargo.lock +++ b/examples/use_config/stm32h7/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -96,6 +107,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bit_field" version = "0.10.2" @@ -137,6 +154,15 @@ version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "block-device-driver" version = "0.2.0" @@ -146,6 +172,22 @@ dependencies = [ "aligned", ] +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -203,6 +245,27 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -229,6 +292,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -268,6 +337,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -290,13 +368,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", ] [[package]] @@ -305,65 +395,58 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", + "strsim", + "syn 2.0.90", ] [[package]] -name = "darling_core" +name = "darling_macro" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", + "darling_core", "quote", - "strsim 0.11.1", "syn 2.0.90", ] [[package]] -name = "darling_macro" -version = "0.13.4" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.13.4", - "quote", - "syn 1.0.109", + "generic-array", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "defmt" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.90", + "defmt 1.0.1", ] [[package]] name = "defmt" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -371,9 +454,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -384,21 +467,42 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", ] [[package]] @@ -410,13 +514,32 @@ dependencies = [ "litrs", ] +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -431,12 +554,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -444,10 +566,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.90", @@ -456,10 +577,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -470,7 +590,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -480,7 +600,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -505,7 +625,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -538,7 +658,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -574,13 +694,12 @@ dependencies = [ [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -595,7 +714,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -629,7 +748,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -645,7 +764,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -655,7 +774,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08e753b23799329780c7ac434264026d0422044d6649ed70a73441b14a6436d7" dependencies = [ "critical-section", - "defmt", + "defmt 0.3.100", "embassy-sync", "embassy-usb-driver", ] @@ -685,7 +804,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -694,7 +813,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -714,7 +833,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -723,7 +842,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -754,6 +873,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -802,6 +931,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -845,6 +984,28 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" version = "2.4.1" @@ -908,10 +1069,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -951,6 +1131,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -1043,38 +1232,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1110,14 +1267,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1126,6 +1293,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "pin-project-lite" version = "0.2.15" @@ -1157,7 +1369,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1174,6 +1386,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" version = "0.2.25" @@ -1184,6 +1405,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1224,6 +1454,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1268,7 +1508,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1284,7 +1524,6 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "postcard", @@ -1293,6 +1532,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1301,8 +1541,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1319,7 +1561,7 @@ dependencies = [ "const-gen", "cortex-m", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-stm32", @@ -1367,6 +1609,19 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93c025f9cfe4c388c328ece47d11a54a823da3b5ad0370b22d95ad47137f85a" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1390,11 +1645,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1427,6 +1682,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1494,15 +1760,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1580,12 +1846,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.90", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1598,7 +1906,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1609,7 +1917,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -1829,7 +2137,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -1842,3 +2159,20 @@ dependencies = [ "quote", "syn 2.0.90", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_config/stm32h7/Cargo.toml b/examples/use_config/stm32h7/Cargo.toml index 8e9737013..17d5d8e1f 100644 --- a/examples/use_config/stm32h7/Cargo.toml +++ b/examples/use_config/stm32h7/Cargo.toml @@ -24,15 +24,17 @@ embassy-stm32 = { version = "0.2", features = [ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", - "task-arena-size-32768", "executor-thread", ] } static_cell = "2" -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } -# embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "92326f1" } +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_config/stm32h7/build.rs b/examples/use_config/stm32h7/build.rs index c13a99b5b..b20f9a795 100644 --- a/examples/use_config/stm32h7/build.rs +++ b/examples/use_config/stm32h7/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::Read; use std::path::Path; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -49,8 +50,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -66,6 +66,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_config/stm32h7/src/main.rs b/examples/use_config/stm32h7/src/main.rs index 4a0fccaf9..acbe79f96 100644 --- a/examples/use_config/stm32h7/src/main.rs +++ b/examples/use_config/stm32h7/src/main.rs @@ -8,11 +8,13 @@ use rmk::macros::rmk_keyboard; /// There is an example of full customization of the keyboard with `rmk_keyboard` macro #[rmk_keyboard] mod my_keyboard { - use embassy_stm32::{time::Hertz, usb::Driver, Config}; - use rmk::{ - channel::EVENT_CHANNEL, futures::future::join3, input_device::Runnable, run_devices, - run_rmk, - }; + use embassy_stm32::time::Hertz; + use embassy_stm32::usb::Driver; + use embassy_stm32::Config; + use rmk::channel::EVENT_CHANNEL; + use rmk::futures::future::join3; + use rmk::input_device::Runnable; + use rmk::{run_devices, run_rmk}; use static_cell::StaticCell; // If you want customize interrupte binding , use `#[Override(bind_interrupt)]` to override default interrupt binding @@ -32,9 +34,7 @@ mod my_keyboard { config.rcc.hsi = Some(HSIPrescaler::DIV1); config.rcc.csi = true; // Needed for USB - config.rcc.hsi48 = Some(Hsi48Config { - sync_from_usb: true, - }); + config.rcc.hsi48 = Some(Hsi48Config { sync_from_usb: true }); // External oscillator 25MHZ config.rcc.hse = Some(Hse { freq: Hertz(25_000_000), @@ -83,7 +83,7 @@ mod my_keyboard { join3( run_devices!((matrix) => EVENT_CHANNEL), keyboard.run(), - run_rmk(&keymap, driver, storage, light_controller, rmk_config), + run_rmk(&keymap, driver, &mut storage, &mut light_controller, rmk_config), ) .await; } diff --git a/examples/use_config/stm32h7/vial.json b/examples/use_config/stm32h7/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_config/stm32h7/vial.json +++ b/examples/use_config/stm32h7/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/ch32v307/Cargo.toml b/examples/use_rust/ch32v307/Cargo.toml index 22a0fbb76..cc7f1e64b 100644 --- a/examples/use_rust/ch32v307/Cargo.toml +++ b/examples/use_rust/ch32v307/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -rmk = { path = "../../../rmk", features = ["_no_external_storage"] } +rmk = { path = "../../../rmk", default-features = false, features = ["col2row", "defmt", "storage"]} ch32-hal = { git = "https://github.com/ch32-rs/ch32-hal", rev = "3ccf0c8", features = [ "ch32v307vct6", "memory-x", @@ -15,23 +15,27 @@ ch32-hal = { git = "https://github.com/ch32-rs/ch32-hal", rev = "3ccf0c8", featu ] } embassy-executor = { version = "0.7.0", features = [ "arch-spin", - "task-arena-size-32768", "executor-thread", ] } static_cell = "2" critical-section = "1.2.0" embassy-time = "0.4" -embassy-usb = "0.3.0" +embassy-usb = "0.4.0" nb = "1.1.0" qingke = { version = "0.5.0", features = ["unsafe-trust-wch-atomics"] } qingke-rt = "0.5.0" # Not working for now -defmt = "0.3" +defmt = "1.0" -panic-halt = "1.0.0" +panic-halt = "1.0" + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_rust/ch32v307/build.rs b/examples/use_rust/ch32v307/build.rs index ed2e8edda..e72ea8382 100644 --- a/examples/use_rust/ch32v307/build.rs +++ b/examples/use_rust/ch32v307/build.rs @@ -38,6 +38,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/ch32v307/vial.json b/examples/use_rust/ch32v307/vial.json index 7831c8336..52014185a 100644 --- a/examples/use_rust/ch32v307/vial.json +++ b/examples/use_rust/ch32v307/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/esp32c3_ble/.cargo/config.toml b/examples/use_rust/esp32c3_ble/.cargo/config.toml index 29c169db7..0505a90e0 100644 --- a/examples/use_rust/esp32c3_ble/.cargo/config.toml +++ b/examples/use_rust/esp32c3_ble/.cargo/config.toml @@ -1,18 +1,13 @@ -[build] -target = "riscv32imc-esp-espidf" - -[target.riscv32imc-esp-espidf] -linker = "ldproxy" -runner = "espflash flash --monitor --log-format defmt" -rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110 +[target.'cfg(all(any(target_arch = "riscv32", target_arch = "xtensa"), target_os = "none"))'] +runner = "espflash flash --monitor" -[unstable] -build-std = ["std", "panic_abort"] +[build] +target = "riscv32imc-unknown-none-elf" +rustflags = [ + # Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.) + # NOTE: May negatively impact performance of produced code + "-C", "force-frame-pointers", +] [env] -MCU="esp32c3" -# Note: this variable is not used by the pio builder (`cargo build --features pio`) -ESP_IDF_VERSION = "v5.2" -DEFMT_LOG="debug" -ESP_IDF_PATH_ISSUES="warn" -CRATE_CC_NO_DEFAULTS="1" \ No newline at end of file +ESP_LOG = "info" \ No newline at end of file diff --git a/examples/use_rust/esp32c3_ble/Cargo.lock b/examples/use_rust/esp32c3_ble/Cargo.lock index 01f592de4..9bd1fcda5 100644 --- a/examples/use_rust/esp32c3_ble/Cargo.lock +++ b/examples/use_rust/esp32c3_ble/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -34,13 +45,10 @@ dependencies = [ ] [[package]] -name = "aligned" -version = "0.4.2" +name = "allocator-api2" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377e4c0ba83e4431b10df45c1d4666f178ea9c552cac93e60c3a88bf32785923" -dependencies = [ - "as-slice", -] +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android-tzdata" @@ -59,18 +67,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.94" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" - -[[package]] -name = "as-slice" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" -dependencies = [ - "stable_deref_trait", -] +checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" [[package]] name = "atomic-polyfill" @@ -81,24 +80,12 @@ dependencies = [ "critical-section", ] -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "autocfg" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" -[[package]] -name = "az" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" - [[package]] name = "bare-metal" version = "0.2.5" @@ -109,23 +96,18 @@ dependencies = [ ] [[package]] -name = "bindgen" -version = "0.71.1" +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "basic-toml" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" +checksum = "ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a" dependencies = [ - "bitflags 2.6.0", - "cexpr", - "clang-sys", - "itertools", - "log", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.96", + "serde", ] [[package]] @@ -140,15 +122,35 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" +[[package]] +name = "bitfield" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7e6caee68becd795bfd65f1a026e4d00d8f0c2bc9be5eb568e1015f9ce3c34" +dependencies = [ + "bitfield-macros", +] + +[[package]] +name = "bitfield-macros" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "331afbb18ce7b644c0b428726d369c5dd37ca0b815d72a459fcc2896c3c8ad32" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "bitfield-struct" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bedc5f4fa33bdc993f9b8ba7369d1b74fcdafa958924a0a54de6707e360de692" +checksum = "2be5a46ba01b60005ae2c51a36a29cfe134bcacae2dd5cedcd4615fbaad1494b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] @@ -159,44 +161,45 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] -name = "bstr" -version = "1.11.1" +name = "block-buffer" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "memchr", - "serde", + "generic-array", ] [[package]] -name = "build-time" -version = "0.1.3" +name = "bt-hci" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1219c19fc29b7bfd74b7968b420aff5bc951cf517800176e795d6b2300dd382" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" dependencies = [ - "chrono", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.96", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", ] [[package]] name = "bumpalo" -version = "3.16.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "bytemuck" -version = "1.21.0" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" +checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" [[package]] name = "byteorder" @@ -204,38 +207,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "camino" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" -dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.24", - "serde", - "serde_json", - "thiserror 1.0.69", -] - [[package]] name = "cargo_toml" version = "0.21.0" @@ -248,66 +219,52 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.9" +version = "1.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b" +checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" dependencies = [ "shlex", ] -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "chrono" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets", + "windows-link", ] [[package]] -name = "clang-sys" -version = "1.8.1" +name = "cipher" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ - "glob", - "libc", - "libloading", + "crypto-common", + "inout", ] [[package]] -name = "cmake" -version = "0.1.52" +name = "cmac" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" dependencies = [ - "cc", + "cipher", + "dbl", + "digest", ] [[package]] @@ -318,9 +275,9 @@ checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" [[package]] name = "const-gen" -version = "1.6.5" +version = "1.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb4caa28784488578a9aa32e0a33f0543d961345fc25efc3f04243be3fa6299" +checksum = "6d7617801a02ebd66905a39f5a15390bfb7d6ab90316fdbf7dc36a1161ffb56b" dependencies = [ "const-gen-derive", ] @@ -337,24 +294,10 @@ dependencies = [ ] [[package]] -name = "const_format" -version = "0.2.34" +name = "const-oid" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd" -dependencies = [ - "const_format_proc_macros", -] - -[[package]] -name = "const_format_proc_macros" -version = "0.2.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "core-foundation-sys" @@ -375,23 +318,12 @@ dependencies = [ ] [[package]] -name = "cortex-m-rt" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" -dependencies = [ - "cortex-m-rt-macros", -] - -[[package]] -name = "cortex-m-rt-macros" -version = "0.7.5" +name = "cpufeatures" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.96", + "libc", ] [[package]] @@ -410,53 +342,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] -name = "crossbeam-deque" -version = "0.8.6" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", ] [[package]] -name = "crossbeam-epoch" -version = "0.9.18" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "cvt" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ae9bf77fbf2d39ef573205d554d87e86c12f1994e9ea335b0651b9b278bcf1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "typenum", ] [[package]] @@ -465,22 +369,8 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -493,78 +383,89 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", - "syn 2.0.96", + "strsim", + "syn 2.0.100", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.96", + "generic-array", ] [[package]] -name = "defmt" -version = "0.3.10" +name = "delegate" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "297806318ef30ad066b15792a8372858020ae3ca2e414ee6c2133b1eb9e9e945" dependencies = [ - "bitflags 1.3.2", - "defmt-macros", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] -name = "defmt-macros" -version = "0.4.0" +name = "der" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ - "defmt-parser", - "proc-macro-error2", - "proc-macro2", - "quote", - "syn 2.0.96", + "const-oid", + "zeroize", ] [[package]] -name = "defmt-parser" -version = "0.4.1" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "thiserror 2.0.7", + "block-buffer", + "crypto-common", + "subtle", ] [[package]] name = "document-features" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" dependencies = [ "litrs", ] [[package]] -name = "either" -version = "1.13.0" +name = "elliptic-curve" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] [[package]] name = "embassy-embedded-hal" @@ -572,7 +473,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", "embassy-futures", "embassy-sync", "embassy-time", @@ -587,11 +487,9 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "critical-section", - "defmt", "document-features", "embassy-executor-macros", ] @@ -599,35 +497,18 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" -dependencies = [ - "defmt", -] - -[[package]] -name = "embassy-hal-internal" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "num-traits", -] +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" [[package]] name = "embassy-net-driver" @@ -646,45 +527,13 @@ dependencies = [ "embassy-sync", ] -[[package]] -name = "embassy-nrf" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7494efe1e0183568327c7e681d4b77ed5241921dcb5976426d9a65b65a0c81" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cortex-m", - "cortex-m-rt", - "critical-section", - "defmt", - "document-features", - "embassy-embedded-hal", - "embassy-hal-internal", - "embassy-sync", - "embassy-time", - "embassy-usb-driver", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-async", - "embedded-io", - "embedded-io-async", - "embedded-storage", - "embedded-storage-async", - "fixed", - "nrf-pac", - "rand_core", -] - [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", "embedded-io-async", "futures-sink", "futures-util", @@ -699,10 +548,8 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", "document-features", "embassy-time-driver", - "embassy-time-queue-utils", "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-async", @@ -734,7 +581,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -749,9 +595,6 @@ name = "embassy-usb-driver" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" -dependencies = [ - "defmt", -] [[package]] name = "embedded-can" @@ -777,9 +620,6 @@ name = "embedded-hal" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" -dependencies = [ - "defmt", -] [[package]] name = "embedded-hal-async" @@ -787,28 +627,14 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", "embedded-hal 1.0.0", ] -[[package]] -name = "embedded-hal-nb" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" -dependencies = [ - "embedded-hal 1.0.0", - "nb 1.1.0", -] - [[package]] name = "embedded-io" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" -dependencies = [ - "defmt", -] [[package]] name = "embedded-io-async" @@ -816,7 +642,6 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", "embedded-io", ] @@ -835,22 +660,6 @@ dependencies = [ "embedded-storage", ] -[[package]] -name = "embedded-svc" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b85590a7a120e370bed5b6bc2b399b345c60d4c749d3bc06039472da37b9893" -dependencies = [ - "defmt", - "embedded-io", - "embedded-io-async", - "enumset", - "heapless 0.8.0", - "num_enum", - "serde", - "strum 0.25.0", -] - [[package]] name = "embuild" version = "0.33.0" @@ -858,22 +667,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28a8cbd9507fabce8f2741b9ca45da9e898cc2b0f1c2e53d21cb2436aeac811d" dependencies = [ "anyhow", - "bindgen", "bitflags 1.3.2", - "cmake", "filetime", - "globwalk", - "home", "log", - "regex", - "remove_dir_all", - "serde", - "serde_json", "shlex", - "strum 0.24.1", - "tempfile", "thiserror 1.0.69", - "which", ] [[package]] @@ -882,6 +680,18 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "enumset" version = "1.1.5" @@ -897,155 +707,251 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59c3b24c345d8c314966bdc1832f6c2635bfcce8e7cf363bd115987bba2ee242" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] -name = "envy" -version = "0.4.2" +name = "equivalent" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f47e0157f2cb54f5ae1bd371b30a2ae4311e1c028f575cd4e81de7353215965" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "esp-alloc" +version = "0.7.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "serde", + "allocator-api2", + "cfg-if", + "critical-section", + "document-features", + "enumset", + "linked_list_allocator", ] [[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +name = "esp-backtrace" +version = "0.15.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "cfg-if", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-println", + "heapless 0.8.0", +] [[package]] -name = "errno" -version = "0.3.10" +name = "esp-build" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +checksum = "8aa1c8f9954c9506699cf1ca10a2adcc226ff10b6ae3cb9e875cf2c6a0b9a372" dependencies = [ - "libc", - "windows-sys 0.59.0", + "quote", + "syn 2.0.100", + "termcolor", ] [[package]] name = "esp-build" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aa1c8f9954c9506699cf1ca10a2adcc226ff10b6ae3cb9e875cf2c6a0b9a372" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "quote", - "syn 2.0.96", + "syn 2.0.100", "termcolor", ] [[package]] -name = "esp-idf-hal" -version = "0.45.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775ce25171dc4f615146a4a27ed3a64c6fd99ced77d7112062f2b19bf933f5db" +name = "esp-config" +version = "0.3.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "document-features", + "serde", + "serde_json", +] + +[[package]] +name = "esp-hal" +version = "1.0.0-beta.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "atomic-waker", + "basic-toml", + "bitfield 0.18.1", + "bitflags 2.9.0", + "bytemuck", + "cfg-if", "critical-section", + "delegate", + "document-features", + "embassy-embedded-hal", + "embassy-futures", "embassy-sync", "embedded-can", - "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-async", - "embedded-hal-nb", "embedded-io", "embedded-io-async", - "embuild", "enumset", - "esp-idf-sys", - "heapless 0.8.0", - "log", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal-procmacros", + "esp-metadata", + "esp-riscv-rt", + "esp32c3", + "fugit", + "instability", "nb 1.1.0", - "num_enum", + "paste", + "portable-atomic", + "rand_core 0.6.4", + "rand_core 0.9.3", + "riscv", + "serde", + "strum 0.27.1", + "ufmt-write", + "void", + "xtensa-lx", + "xtensa-lx-rt", ] [[package]] -name = "esp-idf-svc" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc07aaba257d28d54a96af005ca67d0b38876d8837f5d54a3e0547e100b219c" +name = "esp-hal-embassy" +version = "0.7.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "embassy-futures", + "critical-section", + "document-features", + "embassy-executor", + "embassy-sync", + "embassy-time", "embassy-time-driver", "embassy-time-queue-utils", - "embedded-hal-async", - "embedded-storage", - "embedded-svc", - "embuild", - "enumset", - "esp-idf-hal", - "futures-io", - "heapless 0.8.0", - "log", - "num_enum", - "uncased", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal", + "esp-hal-procmacros", + "esp-metadata", + "portable-atomic", + "static_cell", ] [[package]] -name = "esp-idf-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb77a3d02b579a60a811ed9be22b78c5e794bc492d833ee7fc44d3a0155885e1" +name = "esp-hal-procmacros" +version = "0.17.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "darling", + "document-features", + "litrs", + "proc-macro-crate", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "esp-metadata" +version = "0.6.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "anyhow", - "build-time", - "cargo_metadata", - "cmake", - "const_format", - "embuild", - "envy", - "libc", - "regex", + "basic-toml", "serde", - "strum 0.24.1", - "which", + "strum 0.26.3", ] [[package]] name = "esp-println" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645e54eb592ca0a3d60213b1695e2a5fc0b51ca6d693c08d6983857224a629ed" +version = "0.13.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "critical-section", - "defmt", - "esp-build", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", "log", "portable-atomic", ] [[package]] -name = "esp32-nimble" +name = "esp-riscv-rt" version = "0.10.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "document-features", + "riscv", + "riscv-rt-macros", +] + +[[package]] +name = "esp-storage" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88cc737968921dc601fafaf3ca83f8fca5039cfc6a46e402cb042da647a0c00f" +checksum = "1e98b5069bd1482fb85f9236f8ea6cd1b5b6b5a1c3c3fb8c938c97ccfbbb051b" dependencies = [ - "anyhow", - "bitflags 2.6.0", - "bstr", + "critical-section", + "embedded-storage", + "esp-build 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "esp-wifi" +version = "0.13.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "allocator-api2", + "bt-hci", "cfg-if", + "critical-section", + "document-features", "embassy-sync", - "embuild", - "esp-idf-svc", - "heapless 0.8.0", - "log", - "num_enum", - "once_cell", - "uuid", - "zerocopy 0.8.14", - "zerocopy-derive 0.8.14", + "embedded-io", + "embedded-io-async", + "esp-alloc", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal", + "esp-metadata", + "esp-wifi-sys", + "num-derive", + "num-traits", + "portable-atomic", + "portable_atomic_enum", + "rand_core 0.6.4", ] [[package]] -name = "fastrand" -version = "2.3.0" +name = "esp-wifi-sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6b5438361891c431970194a733415006fb3d00b6eb70b3dcb66fd58f04d9b39" +dependencies = [ + "anyhow", +] + +[[package]] +name = "esp32c3" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1bbcfa3ab2979171263db80804dabc38bdd45450c7eb775ee3f81d552cf0ba" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "ff" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] [[package]] name = "filetime" @@ -1056,19 +962,7 @@ dependencies = [ "cfg-if", "libc", "libredox", - "windows-sys 0.59.0", -] - -[[package]] -name = "fixed" -version = "1.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a" -dependencies = [ - "az", - "bytemuck", - "half", - "typenum", + "windows-sys", ] [[package]] @@ -1078,17 +972,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "fs_at" -version = "0.2.1" +name = "fugit" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14af6c9694ea25db25baa2a1788703b9e7c6648dcaeeebeb98f7561b5384c036" +checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" dependencies = [ - "aligned", - "cfg-if", - "cvt", - "libc", - "nix", - "windows-sys 0.52.0", + "gcd", ] [[package]] @@ -1121,6 +1010,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -1135,7 +1034,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] @@ -1165,43 +1064,31 @@ dependencies = [ ] [[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "globset" -version = "0.4.15" +name = "gcd" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata", - "regex-syntax", -] +checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" [[package]] -name = "globwalk" -version = "0.8.1" +name = "generic-array" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ - "bitflags 1.3.2", - "ignore", - "walkdir", + "typenum", + "version_check", + "zeroize", ] [[package]] -name = "half" -version = "2.4.1" +name = "group" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ - "cfg-if", - "crunchy", + "ff", + "rand_core 0.6.4", + "subtle", ] [[package]] @@ -1263,17 +1150,26 @@ dependencies = [ [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hkdf" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] [[package]] -name = "home" -version = "0.5.9" +name = "hmac" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "windows-sys 0.52.0", + "digest", ] [[package]] @@ -1306,51 +1202,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] -name = "ignore" -version = "0.4.23" +name = "indexmap" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata", - "same-file", - "walkdir", - "winapi-util", + "equivalent", + "hashbrown 0.15.2", ] [[package]] -name = "indexmap" -version = "2.7.0" +name = "indoc" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd" + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ - "equivalent", - "hashbrown 0.15.2", + "generic-array", ] [[package]] -name = "itertools" -version = "0.12.1" +name = "instability" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "0bf9fed6d91cfb734e7476a06bde8300a1b94e217e1b523b6f0cd1a01998c71d" dependencies = [ - "either", + "darling", + "indoc", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", @@ -1370,19 +1269,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.168" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" - -[[package]] -name = "libloading" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" -dependencies = [ - "cfg-if", - "windows-targets", -] +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "libredox" @@ -1390,22 +1279,25 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "libc", "redox_syscall", ] [[package]] -name = "linux-raw-sys" -version = "0.4.14" +name = "linked_list_allocator" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" [[package]] name = "litrs" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" +dependencies = [ + "proc-macro2", +] [[package]] name = "lock_api" @@ -1419,9 +1311,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.25" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" +checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" [[package]] name = "lzma-sys" @@ -1441,97 +1333,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "nb" -version = "0.1.3" +name = "minijinja" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +checksum = "6e36f1329330bb1614c94b78632b9ce45dd7d761f3304a1bed07b2990a7c5097" dependencies = [ - "nb 1.1.0", + "serde", ] [[package]] name = "nb" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" - -[[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cfg_aliases", - "libc", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "normpath" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8911957c4b1549ac0dc74e30db9c8b0e66ddcd6d7acc33098f4c63a64a6d7ed" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "nrf-pac" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" -dependencies = [ - "cortex-m", - "cortex-m-rt", -] - -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +dependencies = [ + "nb 1.1.0", ] [[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +name = "nb" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ - "Inflector", - "darling 0.13.4", "proc-macro2", "quote", - "syn 1.0.109", - "uuid", + "syn 2.0.100", ] [[package]] @@ -1558,17 +1391,26 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "once_cell" -version = "1.20.2" +version = "1.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" + +[[package]] +name = "p256" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] [[package]] name = "paste" @@ -1576,11 +1418,56 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror 2.0.12", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -1590,15 +1477,36 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" + +[[package]] +name = "portable_atomic_enum" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d48f60c43e0120bb2bb48589a16d4bed2f4b911be41e299f2d0fc0e0e20885" +dependencies = [ + "portable-atomic", + "portable_atomic_enum_macros", +] + +[[package]] +name = "portable_atomic_enum_macros" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "a33fa6ec7f2047f572d49317cca19c87195de99c6e5b6ee492da701cfe02b053" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] [[package]] name = "postcard" @@ -1607,7 +1515,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", "heapless 0.7.17", "postcard-derive", "serde", @@ -1624,21 +1531,39 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.23", +] + [[package]] name = "prettyplease" -version = "0.2.25" +version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +checksum = "5316f57387668042f561aae71480de936257848f9c43ce528e311d89a07cadeb" dependencies = [ "proc-macro2", - "syn 2.0.96", + "syn 2.0.100", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", ] [[package]] name = "proc-macro-crate" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" dependencies = [ "toml_edit", ] @@ -1662,40 +1587,62 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] +[[package]] +name = "r0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7a31eed1591dcbc95d92ad7161908e72f4677f8fabf2a32ca49b4237cbf211" + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" + [[package]] name = "redox_syscall" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" +checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", ] [[package]] @@ -1728,17 +1675,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] -name = "remove_dir_all" -version = "0.8.4" +name = "riscv" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a694f9e0eb3104451127f6cc1e5de55f59d3b1fc8c5ddfaeb6f1e716479ceb4a" +checksum = "5ea8ff73d3720bdd0a97925f0bf79ad2744b6da8ff36be3840c48ac81191d7a7" dependencies = [ - "cfg-if", - "cvt", - "fs_at", - "libc", - "normpath", - "windows-sys 0.59.0", + "critical-section", + "embedded-hal 1.0.0", + "paste", + "riscv-macros", + "riscv-pac", +] + +[[package]] +name = "riscv-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f265be5d634272320a7de94cea15c22a3bfdd4eb42eb43edc528415f066a1f25" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "riscv-pac" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8188909339ccc0c68cfb5a04648313f09621e8b87dc03095454f1a11f6c5d436" + +[[package]] +name = "riscv-rt-macros" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc71814687c45ba4cd1e47a54e03a2dbc62ca3667098fbae9cc6b423956758fa" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] @@ -1750,33 +1724,31 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", "document-features", "embassy-embedded-hal", "embassy-executor", "embassy-futures", - "embassy-nrf", "embassy-sync", "embassy-time", "embassy-usb", "embedded-hal 1.0.0", - "embedded-hal-async", "embedded-io-async", "embedded-storage", "embedded-storage-async", - "esp-idf-svc", - "esp32-nimble", + "esp-hal", "futures", "heapless 0.8.0", - "nrf-softdevice", + "log", "num_enum", "paste", "postcard", + "rand_core 0.6.4", "rmk-macro", "sequential-storage", "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1784,15 +1756,20 @@ dependencies = [ name = "rmk-esp32c3" version = "0.2.0" dependencies = [ + "bt-hci", "cc", "const-gen", - "defmt", - "embassy-time", + "embassy-executor", "embuild", - "esp-idf-svc", + "esp-alloc", + "esp-backtrace", + "esp-hal", + "esp-hal-embassy", "esp-println", - "esp32-nimble", + "esp-storage", + "esp-wifi", "json", + "rand_core 0.6.4", "rmk", "xz2", ] @@ -1802,23 +1779,19 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", "serde", "serde_derive", - "syn 2.0.96", + "syn 2.0.100", "toml", ] -[[package]] -name = "rustc-hash" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" - [[package]] name = "rustc_version" version = "0.2.3" @@ -1834,42 +1807,20 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.24", -] - -[[package]] -name = "rustix" -version = "0.38.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" -dependencies = [ - "bitflags 2.6.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.59.0", + "semver 1.0.26", ] [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "same-file" -version = "1.0.6" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "scopeguard" @@ -1877,6 +1828,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1888,12 +1852,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" -dependencies = [ - "serde", -] +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" [[package]] name = "semver-parser" @@ -1903,39 +1864,38 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", "embedded-storage-async", ] [[package]] name = "serde" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "serde_json" -version = "1.0.133" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", @@ -1952,6 +1912,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1992,12 +1963,6 @@ dependencies = [ "portable-atomic", ] -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" @@ -2006,48 +1971,54 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.24.1" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ - "strum_macros 0.24.3", + "strum_macros 0.26.4", ] [[package]] name = "strum" -version = "0.25.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32" dependencies = [ - "strum_macros 0.25.3", + "strum_macros 0.27.1", ] [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] name = "strum_macros" -version = "0.25.3" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 2.0.96", + "syn 2.0.100", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "1.0.109" @@ -2061,28 +2032,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.96" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "tempfile" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" -dependencies = [ - "cfg-if", - "fastrand", - "once_cell", - "rustix", - "windows-sys 0.59.0", -] - [[package]] name = "termcolor" version = "1.4.1" @@ -2103,11 +2061,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.7" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93605438cbd668185516ab499d589afb7ee1859ea3d5fc8f6b0755e1c7443767" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.7", + "thiserror-impl 2.0.12", ] [[package]] @@ -2118,25 +2076,25 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "thiserror-impl" -version = "2.0.7" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d8749b4531af2117677a5fcd12b1348a3fe2b81e36e61ffeac5c4aa3273e36" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "toml" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" dependencies = [ "serde", "serde_spanned", @@ -2155,9 +2113,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.22" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", "serde", @@ -2166,32 +2124,65 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "log", + "p256", + "rand_chacha", + "rand_core 0.6.4", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.23", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", + "uuid", +] + [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] -name = "uncased" -version = "0.9.10" +name = "ucd-trie" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" -dependencies = [ - "version_check", -] +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] -name = "unicode-ident" -version = "1.0.14" +name = "ufmt-write" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" [[package]] -name = "unicode-xid" -version = "0.2.6" +name = "unicode-ident" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "usb-device" @@ -2199,7 +2190,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", "heapless 0.8.0", "portable-atomic", ] @@ -2210,7 +2200,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", "serde", "ssmarshal", "usb-device", @@ -2244,23 +2233,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" -dependencies = [ - "uuid-macro-internal", -] - -[[package]] -name = "uuid-macro-internal" -version = "1.11.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b91f57fe13a38d0ce9e28a03463d8d3c2468ed03d75375110ec71d93b449a08" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.96", -] +checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" [[package]] name = "vcell" @@ -2289,46 +2264,37 @@ dependencies = [ "vcell", ] -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "wasm-bindgen" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2336,33 +2302,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.99" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" - -[[package]] -name = "which" -version = "4.4.2" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" dependencies = [ - "either", - "home", - "once_cell", - "rustix", + "unicode-ident", ] [[package]] @@ -2371,7 +2328,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys", ] [[package]] @@ -2384,13 +2341,10 @@ dependencies = [ ] [[package]] -name = "windows-sys" -version = "0.52.0" +name = "windows-link" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" [[package]] name = "windows-sys" @@ -2467,13 +2421,50 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.20" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" dependencies = [ "memchr", ] +[[package]] +name = "xtensa-lx" +version = "0.10.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "critical-section", + "document-features", +] + +[[package]] +name = "xtensa-lx-rt" +version = "0.18.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "anyhow", + "document-features", + "enum-as-inner", + "minijinja", + "r0", + "serde", + "strum 0.26.3", + "toml", + "xtensa-lx", + "xtensa-lx-rt-proc-macros", +] + +[[package]] +name = "xtensa-lx-rt-proc-macros" +version = "0.2.2" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "xz2" version = "0.1.7" @@ -2494,11 +2485,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.14" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a367f292d93d4eab890745e75a778da40909cab4d6ff8173693812f79c4a2468" +checksum = "fd97444d05a4328b90e75e503a34bad781f14e28a823ad3557f0750df1ebcbc6" dependencies = [ - "zerocopy-derive 0.8.14", + "zerocopy-derive 0.8.23", ] [[package]] @@ -2509,16 +2500,22 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "zerocopy-derive" -version = "0.8.14" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3931cb58c62c13adec22e38686b559c86a30565e16ad6e8510a337cedc611e1" +checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/esp32c3_ble/Cargo.toml b/examples/use_rust/esp32c3_ble/Cargo.toml index 6440964e1..77f176153 100644 --- a/examples/use_rust/esp32c3_ble/Cargo.toml +++ b/examples/use_rust/esp32c3_ble/Cargo.toml @@ -10,20 +10,27 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk", features = ["col2row", "esp32c3_ble"] } -esp32-nimble = { version = "0.10" } -defmt = "0.3" -embassy-time = { version = "0.4.0", features = ["defmt", "generic-queue-8"] } -esp-println = { version = "0.13", features = ["esp32c3", "defmt-espflash"] } -esp-idf-svc = { version = "0.51", default-features = false, features = [ - "std", - "alloc", - "binstart", - "embassy-sync", - "critical-section", - "embassy-time-driver", - "native", +rmk = { path = "../../../rmk", default-features = false, features = [ + "col2row", + "esp32c3_ble", + "log", + "storage" ] } +embassy-executor = { version = "0.7.0" } +esp-backtrace = { version = "0.15", features = [ + "esp32c3", + "exception-handler", + "panic-handler", + "println", +] } +esp-storage = { version = "0.5.0", features = ["esp32c3", "nor-flash"] } +esp-hal = { version = "1.0.0-beta.0", features = ["esp32c3", "unstable"] } +esp-hal-embassy = { version = "0.7.0", features = ["esp32c3"] } +esp-alloc = { version = "0.7.0" } +esp-println = { version = "0.13.0", features = ["esp32c3", "log"] } +esp-wifi = { version = "0.13.0", features = ["esp32c3", "ble"] } +bt-hci = { version = "0.3" } +rand_core = { version = "0.6", default-features = false } [build-dependencies] xz2 = "0.1.7" @@ -37,17 +44,30 @@ name = "rmk-esp32c3" test = false bench = false +[profile.dev.package.esp-storage] +opt-level = 3 + [profile.dev] -codegen-units = 1 # better optimizations -debug = true -opt-level = 3 # esp-wifi should be built with opt-level 2 or 3 -overflow-checks = true -lto = false -panic = 'unwind' +# Rust debug is too slow. +# For debug builds always builds with some optimization +opt-level = "s" [profile.release] -codegen-units = 1 # better optimizations -debug = true # no overhead for bare-metal -opt-level = 3 # esp-wifi should be built with opt-level 2 or 3 +codegen-units = 1 # LLVM can perform better optimizations using a single thread +debug = 2 +debug-assertions = false +incremental = false +lto = 'thin' +opt-level = 3 overflow-checks = false -lto = "fat" + +[patch.crates-io] +esp-wifi = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-backtrace = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-hal-embassy = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-alloc = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-println = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } diff --git a/examples/use_rust/esp32c3_ble/README.md b/examples/use_rust/esp32c3_ble/README.md index bfab99ae9..b2168a3c7 100644 --- a/examples/use_rust/esp32c3_ble/README.md +++ b/examples/use_rust/esp32c3_ble/README.md @@ -1,8 +1,14 @@ # esp32c3 BLE example -To run this example, you should have latest Rust in **esp** channel and `esp-idf` toolchain installed. The full instruction of installing `esp-idf` toolchain can be found [here](https://docs.esp-rs.org/book/installation/index.html) and [here](https://docs.esp-rs.org/std-training/02_2_software.html) +To run this example, you should have latest Rust installed. The full instruction of installing esp Rust toolchain can be found [here](https://docs.esp-rs.org/book/installation/index.html). -To run the example, make sure that you have esp-idf environment, `ldproxy` and `espflash` installed correctly. Then, run +[`espflash`](https://github.com/esp-rs/espflash) should also be installed: + +``` +cargo install cargo-espflash espflash +``` + +After having everything installed, use the following command to run the example: ``` cd examples/use_rust/esp32c3_ble @@ -16,23 +22,36 @@ cargo run --release Compiling ... ... ... - Finished `release` profile [optimized + debuginfo] target(s) in 51.39s - Running `espflash flash --monitor --log-format defmt target/riscv32imc-esp-espidf/release/rmk-esp32c3` -[2024-04-07T12:49:21Z INFO ] Detected 2 serial ports -[2024-04-07T12:49:21Z INFO ] Ports which match a known common dev board are highlighted -[2024-04-07T12:49:21Z INFO ] Please select a port -[2024-04-07T12:50:24Z INFO ] Serial port: '/dev/cu/xx' -[2024-04-07T12:50:24Z INFO ] Connecting... -[2024-04-07T12:50:24Z INFO ] Using flash stub -Chip type: esp32c3 (revision v0.4) + Finished `release` profile [optimized + debuginfo] target(s) in 11.70s + Running `espflash flash --monitor --port /dev/cu.usbmodem211401 target/riscv32imc-unknown-none-elf/release/rmk-esp32c3` +[2025-04-10T10:01:23Z INFO ] Serial port: '/dev/cu.usbmodem211401' +[2025-04-10T10:01:23Z INFO ] Connecting... +[2025-04-10T10:01:23Z INFO ] Using flash stub +Chip type: esp32c3 (revision v0.1) Crystal frequency: 40 MHz Flash size: 4MB -Features: WiFi, BLE -MAC address: aa:aa:aa:aa:aa:aa -App/part. size: 607,488/4,128,768 bytes, 14.71% -[2024-04-07T12:50:24Z INFO ] Segment at address '0x0' has not changed, skipping write -[2024-04-07T12:50:24Z INFO ] Segment at address '0x8000' has not changed, skipping write -[00:00:03] [========================================] 337/337 0x10000 [2024-04-07T12:50:28Z INFO ] Flashing has completed! +Features: WiFi 6, BT 5 +MAC address: 40:4c:ca:5b:c7:dc +App/part. size: 768,944/4,128,768 bytes, 18.62% +[2025-04-10T10:01:23Z INFO ] Segment at address '0x0' has not changed, skipping write +[2025-04-10T10:01:23Z INFO ] Segment at address '0x8000' has not changed, skipping write +[00:00:06] [========================================] 411/411 0x10000 [2025-04-10T10:01:31Z INFO ] Flashing has completed! +``` + +If espflash reports the following error: + +``` +Error: espflash::connection_failed + + × Error while connecting to device + ╰─▶ Serial port not found +``` + +You should to identify which serial port are connected to your esp board, and use `--port` to specify the used serial port: + +``` +# Suppose that the esp board are connected to /dev/cu.usbmodem211401 +cargo run --release -- --port /dev/cu.usbmodem211401 ``` If you want to get some insight of segments of your binary, [`espsegs`](https://github.com/bjoernQ/espsegs) would help: @@ -42,5 +61,5 @@ If you want to get some insight of segments of your binary, [`espsegs`](https:// cargo install --git https://github.com/bjoernQ/espsegs # Check all segments -espsegs target/riscv32imc-esp-espidf/release/rmk-esp32c3 --chip esp32c3 +espsegs target/riscv32imc-unknown-none-elf/release/rmk-esp32c3 --chip esp32c3 ``` \ No newline at end of file diff --git a/examples/use_rust/esp32c3_ble/build.rs b/examples/use_rust/esp32c3_ble/build.rs index 7678c3b7b..bcb8df0a9 100644 --- a/examples/use_rust/esp32c3_ble/build.rs +++ b/examples/use_rust/esp32c3_ble/build.rs @@ -1,8 +1,9 @@ -use const_gen::*; use std::fs::File; use std::io::Read; use std::path::Path; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -10,11 +11,10 @@ fn main() { println!("cargo:rerun-if-changed=vial.json"); generate_vial_config(); - // ESP IDE system env - embuild::espidf::sysenv::output(); + println!("cargo:rustc-link-arg-bins=-Tlinkall.x"); // Set the extra linker script from defmt - println!("cargo:rustc-link-arg=-Tdefmt.x"); + // println!("cargo:rustc-link-arg=-Tdefmt.x"); } fn generate_vial_config() { @@ -25,8 +25,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -42,6 +41,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/esp32c3_ble/espflash.toml b/examples/use_rust/esp32c3_ble/espflash.toml deleted file mode 100644 index d22b92e77..000000000 --- a/examples/use_rust/esp32c3_ble/espflash.toml +++ /dev/null @@ -1 +0,0 @@ -partition_table = "partitions.csv" diff --git a/examples/use_rust/esp32c3_ble/rust-toolchain.toml b/examples/use_rust/esp32c3_ble/rust-toolchain.toml deleted file mode 100644 index 4c3b3109f..000000000 --- a/examples/use_rust/esp32c3_ble/rust-toolchain.toml +++ /dev/null @@ -1,3 +0,0 @@ -[toolchain] -channel = "esp" -components = ["rust-src"] \ No newline at end of file diff --git a/examples/use_rust/esp32c3_ble/sdkconfig.defaults b/examples/use_rust/esp32c3_ble/sdkconfig.defaults deleted file mode 100644 index 3aff089f7..000000000 --- a/examples/use_rust/esp32c3_ble/sdkconfig.defaults +++ /dev/null @@ -1,28 +0,0 @@ -# Rust often needs a bit of an extra main task stack size compared to C (the default is 3K) -CONFIG_ESP_MAIN_TASK_STACK_SIZE=64000 - -# Use this to set FreeRTOS kernel tick frequency to 1000 Hz (100 Hz by default). -# This allows to use 1 ms granuality for thread sleeps (10 ms by default). -CONFIG_FREERTOS_HZ=1000 - -# Workaround for https://github.com/espressif/esp-idf/issues/7631 -#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=n -#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=n - -CONFIG_LOG_DEFAULT_LEVEL=5 - -# Disable watchdog -CONFIG_INT_WDT=n -CONFIG_ESP_TASK_WDT=n - -# esp-nimble config -CONFIG_BT_ENABLED=y -CONFIG_BT_BLE_ENABLED=y -CONFIG_BT_BLUEDROID_ENABLED=n -CONFIG_BT_NIMBLE_ENABLED=y -CONFIG_BT_NIMBLE_NVS_PERSIST=y -# CONFIG_BT_NIMBLE_EXT_ADV=y - -CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y -CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n -CONFIG_BTDM_CTRL_MODE_BTDM=n \ No newline at end of file diff --git a/examples/use_rust/esp32c3_ble/src/keymap.rs b/examples/use_rust/esp32c3_ble/src/keymap.rs index 141d40467..89c143ea5 100644 --- a/examples/use_rust/esp32c3_ble/src/keymap.rs +++ b/examples/use_rust/esp32c3_ble/src/keymap.rs @@ -8,15 +8,15 @@ pub(crate) const NUM_LAYER: usize = 2; pub const fn get_default_keymap() -> [[[KeyAction; COL]; ROW]; NUM_LAYER] { [ layer!([ - [k!(AudioVolUp), k!(B), k!(AudioVolDown)], - [k!(Kp4), k!(LShift), k!(Kp6)], - [mo!(1), k!(Kp2), k!(Kp3)], + [k!(Kp7), k!(Kp8), k!(Kp9)], + [k!(Kp4), k!(Kp5), k!(Kp6)], + [k!(Kp1), k!(Kp2), k!(Kp3)], [mo!(1), a!(No), k!(Kp0)] ]), layer!([ [k!(Kp7), k!(Kp8), k!(Kp9)], - [k!(Kp4), k!(LCtrl), k!(Kp6)], - [mo!(1), k!(Kp2), k!(Kp3)], + [k!(Kp4), k!(Kp5), k!(Kp6)], + [k!(Kp1), k!(Kp2), k!(Kp3)], [mo!(1), a!(No), k!(Kp0)] ]), ] diff --git a/examples/use_rust/esp32c3_ble/src/macros.rs b/examples/use_rust/esp32c3_ble/src/macros.rs index e3aac56c7..5501345c6 100644 --- a/examples/use_rust/esp32c3_ble/src/macros.rs +++ b/examples/use_rust/esp32c3_ble/src/macros.rs @@ -1,8 +1,8 @@ macro_rules! config_matrix_pins_esp { (peripherals: $p:ident, input: [$($in_pin:ident), *], output: [$($out_pin:ident), +]) => { { - let mut output_pins = [$(PinDriver::output($p.pins.$out_pin.downgrade_output()).unwrap()), +]; - let input_pins = [$(PinDriver::input($p.pins.$in_pin.downgrade_input()).unwrap()), +]; + let mut output_pins = [$(Output::new($p.$out_pin, Level::Low, OutputConfig::default())), +]; + let input_pins = [$(Input::new($p.$in_pin, InputConfig::default().with_pull(Pull::Down))), +]; output_pins.iter_mut().for_each(|p| { let _ = p.set_low(); }); diff --git a/examples/use_rust/esp32c3_ble/src/main.rs b/examples/use_rust/esp32c3_ble/src/main.rs index 289840ad7..8a01434ab 100644 --- a/examples/use_rust/esp32c3_ble/src/main.rs +++ b/examples/use_rust/esp32c3_ble/src/main.rs @@ -1,83 +1,98 @@ -#![feature(type_alias_impl_trait)] +#![no_std] +#![no_main] +mod keymap; #[macro_use] mod macros; -mod keymap; mod vial; -use crate::vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; -use defmt::info; -use esp_idf_svc::{ - hal::{gpio::*, peripherals::Peripherals, task::block_on}, - partition::EspPartition, -}; -use esp_println as _; -use keymap::{COL, ROW}; -use rmk::{ - channel::EVENT_CHANNEL, - config::{ControllerConfig, RmkConfig, VialConfig}, - debounce::default_debouncer::DefaultDebouncer, - futures::future::join3, - initialize_keymap_and_storage, - input_device::Runnable, - keyboard::Keyboard, - light::LightController, - matrix::Matrix, - run_devices, run_rmk, - storage::async_flash_wrapper, -}; +use bt_hci::controller::ExternalController; +use embassy_executor::Spawner; +use esp_hal::clock::CpuClock; +use esp_hal::gpio::{Input, InputConfig, Level, Output, OutputConfig, Pull}; +use esp_hal::timer::timg::TimerGroup; +use esp_storage::FlashStorage; +use esp_wifi::ble::controller::BleConnector; +use rmk::ble::trouble::build_ble_stack; +use rmk::channel::EVENT_CHANNEL; +use rmk::config::{ControllerConfig, RmkConfig, StorageConfig, VialConfig}; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::futures::future::join3; +use rmk::input_device::Runnable; +use rmk::keyboard::Keyboard; +use rmk::light::LightController; +use rmk::matrix::Matrix; +use rmk::storage::async_flash_wrapper; +use rmk::{initialize_keymap_and_storage, run_devices, run_rmk, HostResources}; +use {esp_alloc as _, esp_backtrace as _}; -fn main() { - esp_idf_svc::sys::link_patches(); +use crate::keymap::*; +use crate::vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; - // Bind the log crate to the ESP Logging facilities - esp_idf_svc::log::EspLogger::initialize_default(); +#[esp_hal_embassy::main] +async fn main(_s: Spawner) { + // Initialize the peripherals and bluetooth controller + esp_println::logger::init_logger_from_env(); + let peripherals = esp_hal::init(esp_hal::Config::default().with_cpu_clock(CpuClock::max())); + esp_alloc::heap_allocator!(size: 72 * 1024); + let timg0 = TimerGroup::new(peripherals.TIMG0); + let mut rng = esp_hal::rng::Trng::new(peripherals.RNG, peripherals.ADC1); + let init = esp_wifi::init(timg0.timer0, rng.rng.clone(), peripherals.RADIO_CLK).unwrap(); + let systimer = esp_hal::timer::systimer::SystemTimer::new(peripherals.SYSTIMER); + esp_hal_embassy::init(systimer.alarm0); + let bluetooth = peripherals.BT; + let connector = BleConnector::new(&init, bluetooth); + let controller: ExternalController<_, 64> = ExternalController::new(connector); + let central_addr = [0x18, 0xe2, 0x21, 0x80, 0xc0, 0xc7]; + let mut host_resources = HostResources::new(); + let stack = build_ble_stack(controller, central_addr, &mut rng, &mut host_resources).await; - info!("Hello ESP BLE!"); - let peripherals = Peripherals::take().unwrap(); + // Initialize the flash + let flash = FlashStorage::new(); + let flash = async_flash_wrapper(flash); - // Pin config - // WARNING: Some gpio pins shouldn't be used, the initial state is error. - // reference: table 2-3 in https://www.espressif.com.cn/sites/default/files/documentation/esp32-c3_datasheet_en.pdf - let (input_pins, output_pins) = config_matrix_pins_esp!(peripherals: peripherals , input: [gpio6, gpio7, gpio20, gpio21], output: [gpio3, gpio4, gpio5]); + // Initialize the IO pins + let (input_pins, output_pins) = config_matrix_pins_esp!(peripherals: peripherals, input: [GPIO6, GPIO7, GPIO20, GPIO21], output: [GPIO3, GPIO4, GPIO5]); - // Keyboard config + // RMK config let vial_config = VialConfig::new(VIAL_KEYBOARD_ID, VIAL_KEYBOARD_DEF); + let storage_config = StorageConfig { + start_addr: 0x3f0000, + num_sectors: 16, + ..Default::default() + }; let rmk_config = RmkConfig { vial_config, + storage_config, ..Default::default() }; - let flash = async_flash_wrapper(unsafe { - EspPartition::new("rmk") - .expect("Create storage partition error") - .expect("Empty partition") - }); - + // Initialze keyboard stuffs // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let (keymap, storage) = block_on(initialize_keymap_and_storage( + let (keymap, mut storage) = initialize_keymap_and_storage( &mut default_keymap, flash, rmk_config.storage_config, rmk_config.behavior_config.clone(), - )); + ) + .await; - // Initialize the matrix + keyboard + // Initialize the matrix and keyboard let debouncer = DefaultDebouncer::::new(); let mut matrix = Matrix::<_, _, _, ROW, COL>::new(input_pins, output_pins, debouncer); - let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); + // let mut matrix = rmk::matrix::TestMatrix::::new(); + let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); // Initialize the light controller // Initialize the light controller - let light_controller: LightController> = - LightController::new(ControllerConfig::default().light_config); + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); - // Start - block_on(join3( + join3( run_devices! ( (matrix) => EVENT_CHANNEL, ), - keyboard.run(), - run_rmk(&keymap, storage, light_controller, rmk_config), - )); + keyboard.run(), // Keyboard is special + run_rmk(&keymap, &stack, &mut storage, &mut light_controller, rmk_config), + ) + .await; } diff --git a/examples/use_rust/esp32c3_ble/vial.json b/examples/use_rust/esp32c3_ble/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_rust/esp32c3_ble/vial.json +++ b/examples/use_rust/esp32c3_ble/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/esp32c6_ble/.cargo/config.toml b/examples/use_rust/esp32c6_ble/.cargo/config.toml index 816670f82..eccdc6882 100644 --- a/examples/use_rust/esp32c6_ble/.cargo/config.toml +++ b/examples/use_rust/esp32c6_ble/.cargo/config.toml @@ -1,18 +1,13 @@ -[build] -target = "riscv32imac-esp-espidf" - -[target.riscv32imac-esp-espidf] -linker = "ldproxy" -runner = "espflash flash --monitor --log-format defmt" -rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110 +[target.'cfg(all(any(target_arch = "riscv32", target_arch = "xtensa"), target_os = "none"))'] +runner = "espflash flash --monitor" -[unstable] -build-std = ["std", "panic_abort"] +[build] +target = "riscv32imac-unknown-none-elf" +rustflags = [ + # Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.) + # NOTE: May negatively impact performance of produced code + "-C", "force-frame-pointers", +] [env] -MCU="esp32c6" -# Note: this variable is not used by the pio builder (`cargo build --features pio`) -ESP_IDF_VERSION = "v5.2" -DEFMT_LOG="debug" -ESP_IDF_PATH_ISSUES="warn" -CRATE_CC_NO_DEFAULTS="1" \ No newline at end of file +ESP_LOG = "trace" diff --git a/examples/use_rust/esp32c6_ble/Cargo.lock b/examples/use_rust/esp32c6_ble/Cargo.lock index 8d334e812..c195ac202 100644 --- a/examples/use_rust/esp32c6_ble/Cargo.lock +++ b/examples/use_rust/esp32c6_ble/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -34,13 +45,10 @@ dependencies = [ ] [[package]] -name = "aligned" -version = "0.4.2" +name = "allocator-api2" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377e4c0ba83e4431b10df45c1d4666f178ea9c552cac93e60c3a88bf32785923" -dependencies = [ - "as-slice", -] +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android-tzdata" @@ -59,18 +67,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.94" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" - -[[package]] -name = "as-slice" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" -dependencies = [ - "stable_deref_trait", -] +checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" [[package]] name = "atomic-polyfill" @@ -81,24 +80,12 @@ dependencies = [ "critical-section", ] -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "autocfg" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" -[[package]] -name = "az" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" - [[package]] name = "bare-metal" version = "0.2.5" @@ -109,23 +96,18 @@ dependencies = [ ] [[package]] -name = "bindgen" -version = "0.71.1" +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "basic-toml" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" +checksum = "ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a" dependencies = [ - "bitflags 2.6.0", - "cexpr", - "clang-sys", - "itertools", - "log", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.96", + "serde", ] [[package]] @@ -140,15 +122,35 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" +[[package]] +name = "bitfield" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7e6caee68becd795bfd65f1a026e4d00d8f0c2bc9be5eb568e1015f9ce3c34" +dependencies = [ + "bitfield-macros", +] + +[[package]] +name = "bitfield-macros" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "331afbb18ce7b644c0b428726d369c5dd37ca0b815d72a459fcc2896c3c8ad32" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "bitfield-struct" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bedc5f4fa33bdc993f9b8ba7369d1b74fcdafa958924a0a54de6707e360de692" +checksum = "2be5a46ba01b60005ae2c51a36a29cfe134bcacae2dd5cedcd4615fbaad1494b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] @@ -159,44 +161,45 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] -name = "bstr" -version = "1.11.1" +name = "block-buffer" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "memchr", - "serde", + "generic-array", ] [[package]] -name = "build-time" -version = "0.1.3" +name = "bt-hci" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1219c19fc29b7bfd74b7968b420aff5bc951cf517800176e795d6b2300dd382" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" dependencies = [ - "chrono", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.96", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", ] [[package]] name = "bumpalo" -version = "3.16.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "bytemuck" -version = "1.21.0" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" +checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" [[package]] name = "byteorder" @@ -204,38 +207,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "camino" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" -dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.24", - "serde", - "serde_json", - "thiserror 1.0.69", -] - [[package]] name = "cargo_toml" version = "0.21.0" @@ -248,66 +219,52 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.9" +version = "1.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b" +checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" dependencies = [ "shlex", ] -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "chrono" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets", + "windows-link", ] [[package]] -name = "clang-sys" -version = "1.8.1" +name = "cipher" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ - "glob", - "libc", - "libloading", + "crypto-common", + "inout", ] [[package]] -name = "cmake" -version = "0.1.52" +name = "cmac" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" dependencies = [ - "cc", + "cipher", + "dbl", + "digest", ] [[package]] @@ -318,9 +275,9 @@ checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" [[package]] name = "const-gen" -version = "1.6.5" +version = "1.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb4caa28784488578a9aa32e0a33f0543d961345fc25efc3f04243be3fa6299" +checksum = "6d7617801a02ebd66905a39f5a15390bfb7d6ab90316fdbf7dc36a1161ffb56b" dependencies = [ "const-gen-derive", ] @@ -337,24 +294,10 @@ dependencies = [ ] [[package]] -name = "const_format" -version = "0.2.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd" -dependencies = [ - "const_format_proc_macros", -] - -[[package]] -name = "const_format_proc_macros" -version = "0.2.34" +name = "const-oid" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "core-foundation-sys" @@ -375,23 +318,12 @@ dependencies = [ ] [[package]] -name = "cortex-m-rt" -version = "0.7.5" +name = "cpufeatures" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ - "cortex-m-rt-macros", -] - -[[package]] -name = "cortex-m-rt-macros" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.96", + "libc", ] [[package]] @@ -410,53 +342,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] -name = "crossbeam-deque" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "crossbeam-utils", + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", ] [[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "cvt" -version = "0.1.2" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ae9bf77fbf2d39ef573205d554d87e86c12f1994e9ea335b0651b9b278bcf1" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "cfg-if", -] - -[[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "typenum", ] [[package]] @@ -465,22 +369,8 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -493,78 +383,89 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", - "syn 2.0.96", + "strsim", + "syn 2.0.100", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.96", + "generic-array", ] [[package]] -name = "defmt" -version = "0.3.10" +name = "delegate" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "297806318ef30ad066b15792a8372858020ae3ca2e414ee6c2133b1eb9e9e945" dependencies = [ - "bitflags 1.3.2", - "defmt-macros", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] -name = "defmt-macros" -version = "0.4.0" +name = "der" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ - "defmt-parser", - "proc-macro-error2", - "proc-macro2", - "quote", - "syn 2.0.96", + "const-oid", + "zeroize", ] [[package]] -name = "defmt-parser" -version = "0.4.1" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "thiserror 2.0.7", + "block-buffer", + "crypto-common", + "subtle", ] [[package]] name = "document-features" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" dependencies = [ "litrs", ] [[package]] -name = "either" -version = "1.13.0" +name = "elliptic-curve" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] [[package]] name = "embassy-embedded-hal" @@ -572,7 +473,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", "embassy-futures", "embassy-sync", "embassy-time", @@ -587,11 +487,9 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "critical-section", - "defmt", "document-features", "embassy-executor-macros", ] @@ -599,35 +497,18 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" -dependencies = [ - "defmt", -] - -[[package]] -name = "embassy-hal-internal" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "num-traits", -] +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" [[package]] name = "embassy-net-driver" @@ -646,45 +527,13 @@ dependencies = [ "embassy-sync", ] -[[package]] -name = "embassy-nrf" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7494efe1e0183568327c7e681d4b77ed5241921dcb5976426d9a65b65a0c81" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cortex-m", - "cortex-m-rt", - "critical-section", - "defmt", - "document-features", - "embassy-embedded-hal", - "embassy-hal-internal", - "embassy-sync", - "embassy-time", - "embassy-usb-driver", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-async", - "embedded-io", - "embedded-io-async", - "embedded-storage", - "embedded-storage-async", - "fixed", - "nrf-pac", - "rand_core", -] - [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", "embedded-io-async", "futures-sink", "futures-util", @@ -699,10 +548,8 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", "document-features", "embassy-time-driver", - "embassy-time-queue-utils", "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-async", @@ -734,7 +581,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -749,9 +595,6 @@ name = "embassy-usb-driver" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" -dependencies = [ - "defmt", -] [[package]] name = "embedded-can" @@ -777,9 +620,6 @@ name = "embedded-hal" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" -dependencies = [ - "defmt", -] [[package]] name = "embedded-hal-async" @@ -787,28 +627,14 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", "embedded-hal 1.0.0", ] -[[package]] -name = "embedded-hal-nb" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" -dependencies = [ - "embedded-hal 1.0.0", - "nb 1.1.0", -] - [[package]] name = "embedded-io" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" -dependencies = [ - "defmt", -] [[package]] name = "embedded-io-async" @@ -816,7 +642,6 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", "embedded-io", ] @@ -835,22 +660,6 @@ dependencies = [ "embedded-storage", ] -[[package]] -name = "embedded-svc" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b85590a7a120e370bed5b6bc2b399b345c60d4c749d3bc06039472da37b9893" -dependencies = [ - "defmt", - "embedded-io", - "embedded-io-async", - "enumset", - "heapless 0.8.0", - "num_enum", - "serde", - "strum 0.25.0", -] - [[package]] name = "embuild" version = "0.33.0" @@ -858,22 +667,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28a8cbd9507fabce8f2741b9ca45da9e898cc2b0f1c2e53d21cb2436aeac811d" dependencies = [ "anyhow", - "bindgen", "bitflags 1.3.2", - "cmake", "filetime", - "globwalk", - "home", "log", - "regex", - "remove_dir_all", - "serde", - "serde_json", "shlex", - "strum 0.24.1", - "tempfile", "thiserror 1.0.69", - "which", ] [[package]] @@ -882,6 +680,18 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "enumset" version = "1.1.5" @@ -897,155 +707,252 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59c3b24c345d8c314966bdc1832f6c2635bfcce8e7cf363bd115987bba2ee242" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] -name = "envy" -version = "0.4.2" +name = "equivalent" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f47e0157f2cb54f5ae1bd371b30a2ae4311e1c028f575cd4e81de7353215965" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "esp-alloc" +version = "0.7.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "serde", + "allocator-api2", + "cfg-if", + "critical-section", + "document-features", + "enumset", + "linked_list_allocator", ] [[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +name = "esp-backtrace" +version = "0.15.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "cfg-if", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-println", + "heapless 0.8.0", +] [[package]] -name = "errno" -version = "0.3.10" +name = "esp-build" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +checksum = "8aa1c8f9954c9506699cf1ca10a2adcc226ff10b6ae3cb9e875cf2c6a0b9a372" dependencies = [ - "libc", - "windows-sys 0.59.0", + "quote", + "syn 2.0.100", + "termcolor", ] [[package]] name = "esp-build" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aa1c8f9954c9506699cf1ca10a2adcc226ff10b6ae3cb9e875cf2c6a0b9a372" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "quote", - "syn 2.0.96", + "syn 2.0.100", "termcolor", ] [[package]] -name = "esp-idf-hal" -version = "0.45.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775ce25171dc4f615146a4a27ed3a64c6fd99ced77d7112062f2b19bf933f5db" +name = "esp-config" +version = "0.3.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "atomic-waker", + "document-features", + "serde", + "serde_json", +] + +[[package]] +name = "esp-hal" +version = "1.0.0-beta.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "basic-toml", + "bitfield 0.18.1", + "bitflags 2.9.0", + "bytemuck", + "cfg-if", "critical-section", + "delegate", + "document-features", + "embassy-embedded-hal", + "embassy-futures", "embassy-sync", "embedded-can", - "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-async", - "embedded-hal-nb", "embedded-io", "embedded-io-async", - "embuild", "enumset", - "esp-idf-sys", - "heapless 0.8.0", - "log", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal-procmacros", + "esp-metadata", + "esp-riscv-rt", + "esp32c6", + "fugit", + "instability", "nb 1.1.0", - "num_enum", + "paste", + "portable-atomic", + "rand_core 0.6.4", + "rand_core 0.9.3", + "riscv", + "serde", + "strum 0.27.1", + "ufmt-write", + "void", + "xtensa-lx", + "xtensa-lx-rt", ] [[package]] -name = "esp-idf-svc" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc07aaba257d28d54a96af005ca67d0b38876d8837f5d54a3e0547e100b219c" +name = "esp-hal-embassy" +version = "0.7.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "embassy-futures", + "critical-section", + "document-features", + "embassy-executor", + "embassy-sync", + "embassy-time", "embassy-time-driver", "embassy-time-queue-utils", - "embedded-hal-async", - "embedded-storage", - "embedded-svc", - "embuild", - "enumset", - "esp-idf-hal", - "futures-io", - "heapless 0.8.0", - "log", - "num_enum", - "uncased", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal", + "esp-hal-procmacros", + "esp-metadata", + "portable-atomic", + "static_cell", ] [[package]] -name = "esp-idf-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb77a3d02b579a60a811ed9be22b78c5e794bc492d833ee7fc44d3a0155885e1" +name = "esp-hal-procmacros" +version = "0.17.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "darling", + "document-features", + "litrs", + "object", + "proc-macro-crate", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "esp-metadata" +version = "0.6.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "anyhow", - "build-time", - "cargo_metadata", - "cmake", - "const_format", - "embuild", - "envy", - "libc", - "regex", + "basic-toml", "serde", - "strum 0.24.1", - "which", + "strum 0.26.3", ] [[package]] name = "esp-println" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645e54eb592ca0a3d60213b1695e2a5fc0b51ca6d693c08d6983857224a629ed" +version = "0.13.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "critical-section", - "defmt", - "esp-build", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", "log", "portable-atomic", ] [[package]] -name = "esp32-nimble" +name = "esp-riscv-rt" version = "0.10.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "document-features", + "riscv", + "riscv-rt-macros", +] + +[[package]] +name = "esp-storage" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88cc737968921dc601fafaf3ca83f8fca5039cfc6a46e402cb042da647a0c00f" +checksum = "1e98b5069bd1482fb85f9236f8ea6cd1b5b6b5a1c3c3fb8c938c97ccfbbb051b" dependencies = [ - "anyhow", - "bitflags 2.6.0", - "bstr", + "critical-section", + "embedded-storage", + "esp-build 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "esp-wifi" +version = "0.13.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "allocator-api2", + "bt-hci", "cfg-if", + "critical-section", + "document-features", "embassy-sync", - "embuild", - "esp-idf-svc", - "heapless 0.8.0", - "log", - "num_enum", - "once_cell", - "uuid", - "zerocopy 0.8.14", - "zerocopy-derive 0.8.14", + "embedded-io", + "embedded-io-async", + "esp-alloc", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal", + "esp-metadata", + "esp-wifi-sys", + "num-derive", + "num-traits", + "portable-atomic", + "portable_atomic_enum", + "rand_core 0.6.4", ] [[package]] -name = "fastrand" -version = "2.3.0" +name = "esp-wifi-sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6b5438361891c431970194a733415006fb3d00b6eb70b3dcb66fd58f04d9b39" +dependencies = [ + "anyhow", +] + +[[package]] +name = "esp32c6" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ff2a4e1d1b0cb2517af20766004b8e8fb4612043f0b0569703cc90d1880ede4" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "ff" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] [[package]] name = "filetime" @@ -1056,19 +963,7 @@ dependencies = [ "cfg-if", "libc", "libredox", - "windows-sys 0.59.0", -] - -[[package]] -name = "fixed" -version = "1.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a" -dependencies = [ - "az", - "bytemuck", - "half", - "typenum", + "windows-sys", ] [[package]] @@ -1078,17 +973,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "fs_at" -version = "0.2.1" +name = "fugit" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14af6c9694ea25db25baa2a1788703b9e7c6648dcaeeebeb98f7561b5384c036" +checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" dependencies = [ - "aligned", - "cfg-if", - "cvt", - "libc", - "nix", - "windows-sys 0.52.0", + "gcd", ] [[package]] @@ -1121,6 +1011,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -1135,7 +1035,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] @@ -1165,43 +1065,31 @@ dependencies = [ ] [[package]] -name = "glob" -version = "0.3.1" +name = "gcd" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" [[package]] -name = "globset" -version = "0.4.15" +name = "generic-array" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "globwalk" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" -dependencies = [ - "bitflags 1.3.2", - "ignore", - "walkdir", + "typenum", + "version_check", + "zeroize", ] [[package]] -name = "half" -version = "2.4.1" +name = "group" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ - "cfg-if", - "crunchy", + "ff", + "rand_core 0.6.4", + "subtle", ] [[package]] @@ -1263,29 +1151,39 @@ dependencies = [ [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] [[package]] -name = "home" -version = "0.5.9" +name = "hmac" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "windows-sys 0.52.0", + "digest", ] [[package]] name = "iana-time-zone" -version = "0.1.61" +version = "0.1.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +checksum = "b2fd658b06e56721792c5df4475705b6cda790e9298d19d2f8af083457bcd127" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", "windows-core", ] @@ -1306,51 +1204,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] -name = "ignore" -version = "0.4.23" +name = "indexmap" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata", - "same-file", - "walkdir", - "winapi-util", + "equivalent", + "hashbrown 0.15.2", ] [[package]] -name = "indexmap" -version = "2.7.0" +name = "indoc" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd" + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ - "equivalent", - "hashbrown 0.15.2", + "generic-array", ] [[package]] -name = "itertools" -version = "0.12.1" +name = "instability" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "0bf9fed6d91cfb734e7476a06bde8300a1b94e217e1b523b6f0cd1a01998c71d" dependencies = [ - "either", + "darling", + "indoc", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", @@ -1370,19 +1271,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.168" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" - -[[package]] -name = "libloading" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" -dependencies = [ - "cfg-if", - "windows-targets", -] +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "libredox" @@ -1390,22 +1281,25 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "libc", "redox_syscall", ] [[package]] -name = "linux-raw-sys" -version = "0.4.14" +name = "linked_list_allocator" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" [[package]] name = "litrs" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" +dependencies = [ + "proc-macro2", +] [[package]] name = "lock_api" @@ -1419,9 +1313,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.25" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" +checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" [[package]] name = "lzma-sys" @@ -1441,10 +1335,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] -name = "minimal-lexical" -version = "0.2.1" +name = "minijinja" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +checksum = "6e36f1329330bb1614c94b78632b9ce45dd7d761f3304a1bed07b2990a7c5097" +dependencies = [ + "serde", +] [[package]] name = "nb" @@ -1457,81 +1354,19 @@ dependencies = [ [[package]] name = "nb" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" - -[[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cfg_aliases", - "libc", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "normpath" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8911957c4b1549ac0dc74e30db9c8b0e66ddcd6d7acc33098f4c63a64a6d7ed" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "nrf-pac" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" -dependencies = [ - "cortex-m", - "cortex-m-rt", -] - -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" [[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ - "Inflector", - "darling 0.13.4", "proc-macro2", "quote", - "syn 1.0.109", - "uuid", + "syn 2.0.100", ] [[package]] @@ -1558,17 +1393,35 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", ] [[package]] name = "once_cell" -version = "1.20.2" +version = "1.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] [[package]] name = "paste" @@ -1576,11 +1429,56 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror 2.0.12", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -1590,15 +1488,36 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" + +[[package]] +name = "portable_atomic_enum" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d48f60c43e0120bb2bb48589a16d4bed2f4b911be41e299f2d0fc0e0e20885" +dependencies = [ + "portable-atomic", + "portable_atomic_enum_macros", +] + +[[package]] +name = "portable_atomic_enum_macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33fa6ec7f2047f572d49317cca19c87195de99c6e5b6ee492da701cfe02b053" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] [[package]] name = "postcard" @@ -1607,7 +1526,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", "heapless 0.7.17", "postcard-derive", "serde", @@ -1624,21 +1542,39 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" -version = "0.2.25" +version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +checksum = "5316f57387668042f561aae71480de936257848f9c43ce528e311d89a07cadeb" dependencies = [ "proc-macro2", - "syn 2.0.96", + "syn 2.0.100", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", ] [[package]] name = "proc-macro-crate" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" dependencies = [ "toml_edit", ] @@ -1662,40 +1598,62 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] +[[package]] +name = "r0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7a31eed1591dcbc95d92ad7161908e72f4677f8fabf2a32ca49b4237cbf211" + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" + [[package]] name = "redox_syscall" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" +checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", ] [[package]] @@ -1728,55 +1686,80 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] -name = "remove_dir_all" -version = "0.8.4" +name = "riscv" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a694f9e0eb3104451127f6cc1e5de55f59d3b1fc8c5ddfaeb6f1e716479ceb4a" +checksum = "5ea8ff73d3720bdd0a97925f0bf79ad2744b6da8ff36be3840c48ac81191d7a7" dependencies = [ - "cfg-if", - "cvt", - "fs_at", - "libc", - "normpath", - "windows-sys 0.59.0", + "critical-section", + "embedded-hal 1.0.0", + "paste", + "riscv-macros", + "riscv-pac", +] + +[[package]] +name = "riscv-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f265be5d634272320a7de94cea15c22a3bfdd4eb42eb43edc528415f066a1f25" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "riscv-pac" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8188909339ccc0c68cfb5a04648313f09621e8b87dc03095454f1a11f6c5d436" + +[[package]] +name = "riscv-rt-macros" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc71814687c45ba4cd1e47a54e03a2dbc62ca3667098fbae9cc6b423956758fa" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] name = "rmk" -version = "0.5.2" +version = "0.6.1" dependencies = [ "bitfield-struct", "byteorder", "chrono", "cortex-m", "crc32fast", - "defmt", "document-features", "embassy-embedded-hal", "embassy-executor", "embassy-futures", - "embassy-nrf", "embassy-sync", "embassy-time", "embassy-usb", "embedded-hal 1.0.0", - "embedded-hal-async", "embedded-io-async", "embedded-storage", "embedded-storage-async", - "esp-idf-svc", - "esp32-nimble", + "esp-hal", "futures", "heapless 0.8.0", - "nrf-softdevice", + "log", "num_enum", "paste", "postcard", + "rand_core 0.6.4", "rmk-macro", "sequential-storage", "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1784,41 +1767,42 @@ dependencies = [ name = "rmk-esp32c6" version = "0.2.0" dependencies = [ + "bt-hci", "cc", "const-gen", - "defmt", - "embassy-time", + "embassy-executor", "embuild", - "esp-idf-svc", + "esp-alloc", + "esp-backtrace", + "esp-hal", + "esp-hal-embassy", "esp-println", - "esp32-nimble", + "esp-storage", + "esp-wifi", "json", + "rand_core 0.6.4", "rmk", "xz2", ] [[package]] name = "rmk-macro" -version = "0.4.2" +version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", "serde", "serde_derive", - "syn 2.0.96", + "syn 2.0.100", "toml", ] -[[package]] -name = "rustc-hash" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" - [[package]] name = "rustc_version" version = "0.2.3" @@ -1834,42 +1818,20 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.24", -] - -[[package]] -name = "rustix" -version = "0.38.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" -dependencies = [ - "bitflags 2.6.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.59.0", + "semver 1.0.26", ] [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "same-file" -version = "1.0.6" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "scopeguard" @@ -1877,6 +1839,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1888,12 +1863,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" -dependencies = [ - "serde", -] +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" [[package]] name = "semver-parser" @@ -1903,39 +1875,38 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", "embedded-storage-async", ] [[package]] name = "serde" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "serde_json" -version = "1.0.133" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", @@ -1952,6 +1923,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1992,12 +1974,6 @@ dependencies = [ "portable-atomic", ] -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" @@ -2006,48 +1982,54 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.24.1" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ - "strum_macros 0.24.3", + "strum_macros 0.26.4", ] [[package]] name = "strum" -version = "0.25.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32" dependencies = [ - "strum_macros 0.25.3", + "strum_macros 0.27.1", ] [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] name = "strum_macros" -version = "0.25.3" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 2.0.96", + "syn 2.0.100", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "1.0.109" @@ -2061,28 +2043,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.96" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "tempfile" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" -dependencies = [ - "cfg-if", - "fastrand", - "once_cell", - "rustix", - "windows-sys 0.59.0", -] - [[package]] name = "termcolor" version = "1.4.1" @@ -2103,11 +2072,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.7" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93605438cbd668185516ab499d589afb7ee1859ea3d5fc8f6b0755e1c7443767" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.7", + "thiserror-impl 2.0.12", ] [[package]] @@ -2118,25 +2087,25 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "thiserror-impl" -version = "2.0.7" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d8749b4531af2117677a5fcd12b1348a3fe2b81e36e61ffeac5c4aa3273e36" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "toml" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" dependencies = [ "serde", "serde_spanned", @@ -2155,9 +2124,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.22" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", "serde", @@ -2166,32 +2135,65 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "log", + "p256", + "rand_chacha", + "rand_core 0.6.4", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", + "uuid", +] + [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] -name = "uncased" -version = "0.9.10" +name = "ucd-trie" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" -dependencies = [ - "version_check", -] +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] -name = "unicode-ident" -version = "1.0.14" +name = "ufmt-write" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" [[package]] -name = "unicode-xid" -version = "0.2.6" +name = "unicode-ident" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "usb-device" @@ -2199,7 +2201,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", "heapless 0.8.0", "portable-atomic", ] @@ -2210,7 +2211,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", "serde", "ssmarshal", "usb-device", @@ -2244,23 +2244,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" -dependencies = [ - "uuid-macro-internal", -] - -[[package]] -name = "uuid-macro-internal" -version = "1.11.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b91f57fe13a38d0ce9e28a03463d8d3c2468ed03d75375110ec71d93b449a08" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.96", -] +checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" [[package]] name = "vcell" @@ -2289,46 +2275,37 @@ dependencies = [ "vcell", ] -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "wasm-bindgen" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2336,33 +2313,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.99" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" - -[[package]] -name = "which" -version = "4.4.2" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" dependencies = [ - "either", - "home", - "once_cell", - "rustix", + "unicode-ident", ] [[package]] @@ -2371,7 +2339,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys", ] [[package]] @@ -2384,13 +2352,10 @@ dependencies = [ ] [[package]] -name = "windows-sys" -version = "0.52.0" +name = "windows-link" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" [[package]] name = "windows-sys" @@ -2467,13 +2432,50 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.20" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" dependencies = [ "memchr", ] +[[package]] +name = "xtensa-lx" +version = "0.10.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "critical-section", + "document-features", +] + +[[package]] +name = "xtensa-lx-rt" +version = "0.18.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "anyhow", + "document-features", + "enum-as-inner", + "minijinja", + "r0", + "serde", + "strum 0.26.3", + "toml", + "xtensa-lx", + "xtensa-lx-rt-proc-macros", +] + +[[package]] +name = "xtensa-lx-rt-proc-macros" +version = "0.2.2" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "xz2" version = "0.1.7" @@ -2494,11 +2496,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.14" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a367f292d93d4eab890745e75a778da40909cab4d6ff8173693812f79c4a2468" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" dependencies = [ - "zerocopy-derive 0.8.14", + "zerocopy-derive 0.8.24", ] [[package]] @@ -2509,16 +2511,22 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "zerocopy-derive" -version = "0.8.14" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3931cb58c62c13adec22e38686b559c86a30565e16ad6e8510a337cedc611e1" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/esp32c6_ble/Cargo.toml b/examples/use_rust/esp32c6_ble/Cargo.toml index fc3b21c2a..7a4616107 100644 --- a/examples/use_rust/esp32c6_ble/Cargo.toml +++ b/examples/use_rust/esp32c6_ble/Cargo.toml @@ -10,20 +10,22 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk", features = ["col2row", "esp32c6_ble"] } -esp32-nimble = { version = "0.10" } -defmt = "0.3" -embassy-time = { version = "0.4.0", features = ["defmt", "generic-queue-8", "defmt-timestamp-uptime"] } -esp-println = { version = "0.13", features = ["esp32c6", "defmt-espflash"] } -esp-idf-svc = { version = "0.51", default-features = false, features = [ - "std", - "alloc", - "binstart", - "embassy-sync", - "critical-section", - "embassy-time-driver", - "native", +rmk = { path = "../../../rmk", default-features = false, features = ["col2row", "esp32c6_ble", "log", "storage"] } +embassy-executor = { version = "0.7.0" } +esp-backtrace = { version = "0.15", features = [ + "esp32c6", + "exception-handler", + "panic-handler", + "println", ] } +esp-storage = { version = "0.5.0", features = ["esp32c6", "nor-flash"] } +esp-hal = { version = "1.0.0-beta.0", features = ["esp32c6", "unstable"] } +esp-hal-embassy = { version = "0.7.0", features = ["esp32c6"] } +esp-alloc = { version = "0.7.0" } +esp-println = { version = "0.13.0", features = ["esp32c6", "log"] } +esp-wifi = { version = "0.13.0", features = ["esp32c6", "ble"] } +bt-hci = { version = "0.3" } +rand_core = { version = "0.6", default-features = false } [build-dependencies] xz2 = "0.1.7" @@ -37,17 +39,30 @@ name = "rmk-esp32c6" test = false bench = false +[profile.dev.package.esp-storage] +opt-level = 3 + [profile.dev] -codegen-units = 1 # better optimizations -debug = true -opt-level = 3 # esp-wifi should be built with opt-level 2 or 3 -overflow-checks = true -lto = false -panic = 'abort' +# Rust debug is too slow. +# For debug builds always builds with some optimization +opt-level = "s" [profile.release] -codegen-units = 1 # better optimizations -debug = true # no overhead for bare-metal -opt-level = 3 # esp-wifi should be built with opt-level 2 or 3 +codegen-units = 1 # LLVM can perform better optimizations using a single thread +debug = 2 +debug-assertions = false +incremental = false +lto = 'thin' +opt-level = 3 overflow-checks = false -lto = "fat" + +[patch.crates-io] +esp-wifi = {git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd"} +esp-backtrace = {git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd"} +esp-hal = {git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd"} +esp-hal-embassy = {git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd"} +esp-alloc = {git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd"} +esp-println = {git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd"} +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } diff --git a/examples/use_rust/esp32c6_ble/README.md b/examples/use_rust/esp32c6_ble/README.md index 0ce9ae3fb..c71ed56a5 100644 --- a/examples/use_rust/esp32c6_ble/README.md +++ b/examples/use_rust/esp32c6_ble/README.md @@ -1,8 +1,14 @@ # esp32c6 BLE example -To run this example, you should have latest Rust in **esp** channel and `esp-idf` toolchain installed. The full instruction of installing `esp-idf` toolchain can be found [here](https://docs.esp-rs.org/book/installation/index.html) and [here](https://docs.esp-rs.org/std-training/02_2_software.html) +To run this example, you should have latest Rust installed. The full instruction of installing esp Rust toolchain can be found [here](https://docs.esp-rs.org/book/installation/index.html). -To run the example, make sure that you have esp-idf environment, `ldproxy` and `espflash` installed correctly. Then, run +[`espflash`](https://github.com/esp-rs/espflash) should also be installed: + +``` +cargo install cargo-espflash espflash +``` + +After having everything installed, use the following command to run the example: ``` cd examples/use_rust/esp32c6_ble @@ -16,20 +22,36 @@ cargo run --release Compiling ... ... ... - Finished `release` profile [optimized + debuginfo] target(s) in 51.39s - Running `espflash flash --monitor --log-format defmt target/riscv32imac-esp-espidf/release/rmk-esp32c6` -[2024-08-29T12:14:05Z INFO ] Serial port: 'COM6' -[2024-08-29T12:14:05Z INFO ] Connecting... -[2024-08-29T12:14:05Z INFO ] Using flash stub -Chip type: esp32c6 (revision v0.0) + Finished `release` profile [optimized + debuginfo] target(s) in 11.70s + Running `espflash flash --monitor --port /dev/cu.usbmodem211401 target/riscv32imac-unknown-none-elf/release/rmk-esp32c6` +[2025-04-10T10:01:23Z INFO ] Serial port: '/dev/cu.usbmodem211401' +[2025-04-10T10:01:23Z INFO ] Connecting... +[2025-04-10T10:01:23Z INFO ] Using flash stub +Chip type: esp32c6 (revision v0.1) Crystal frequency: 40 MHz Flash size: 4MB Features: WiFi 6, BT 5 -MAC address: aa:aa:aa:aa:aa:aa -App/part. size: 892,624/4,128,768 bytes, 21.62% -[2024-08-29T12:14:06Z INFO ] Segment at address '0x0' has not changed, skipping write -[2024-08-29T12:14:06Z INFO ] Segment at address '0x8000' has not changed, skipping write -[00:00:05] [========================================] 483/483 0x10000 [2024-08-29T12:14:12Z INFO ] Flashing has completed! +MAC address: 40:4c:ca:5b:c7:dc +App/part. size: 768,944/4,128,768 bytes, 18.62% +[2025-04-10T10:01:23Z INFO ] Segment at address '0x0' has not changed, skipping write +[2025-04-10T10:01:23Z INFO ] Segment at address '0x8000' has not changed, skipping write +[00:00:06] [========================================] 411/411 0x10000 [2025-04-10T10:01:31Z INFO ] Flashing has completed! +``` + +If espflash reports the following error: + +``` +Error: espflash::connection_failed + + × Error while connecting to device + ╰─▶ Serial port not found +``` + +You should to identify which serial port are connected to your esp board, and use `--port` to specify the used serial port: + +``` +# Suppose that the esp board are connected to /dev/cu.usbmodem211401 +cargo run --release -- --port /dev/cu.usbmodem211401 ``` If you want to get some insight of segments of your binary, [`espsegs`](https://github.com/bjoernQ/espsegs) would help: @@ -39,5 +61,5 @@ If you want to get some insight of segments of your binary, [`espsegs`](https:// cargo install --git https://github.com/bjoernQ/espsegs # Check all segments -espsegs target/riscv32imac-esp-espidf/release/rmk-esp32c6 --chip esp32c6 +espsegs target/riscv32imac-unknown-none-elf/release/rmk-esp32c6 --chip esp32c6 ``` \ No newline at end of file diff --git a/examples/use_rust/esp32c6_ble/build.rs b/examples/use_rust/esp32c6_ble/build.rs index 83c60fa85..bcb8df0a9 100644 --- a/examples/use_rust/esp32c6_ble/build.rs +++ b/examples/use_rust/esp32c6_ble/build.rs @@ -1,32 +1,31 @@ -use const_gen::*; use std::fs::File; use std::io::Read; use std::path::Path; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { // Generate vial config at the root of project + println!("cargo:rerun-if-changed=vial.json"); generate_vial_config(); - // ESP IDE system env - embuild::espidf::sysenv::output(); + println!("cargo:rustc-link-arg-bins=-Tlinkall.x"); // Set the extra linker script from defmt - println!("cargo:rustc-link-arg=-Tdefmt.x"); + // println!("cargo:rustc-link-arg=-Tdefmt.x"); } fn generate_vial_config() { // Generated vial config file - println!("cargo:rerun-if-changed=vial.json"); let out_file = Path::new(&env::var_os("OUT_DIR").unwrap()).join("config_generated.rs"); let p = Path::new("vial.json"); let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -42,6 +41,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/esp32c6_ble/espflash.toml b/examples/use_rust/esp32c6_ble/espflash.toml deleted file mode 100644 index d22b92e77..000000000 --- a/examples/use_rust/esp32c6_ble/espflash.toml +++ /dev/null @@ -1 +0,0 @@ -partition_table = "partitions.csv" diff --git a/examples/use_rust/esp32c6_ble/partitions.csv b/examples/use_rust/esp32c6_ble/partitions.csv deleted file mode 100644 index 9a7d8a6d7..000000000 --- a/examples/use_rust/esp32c6_ble/partitions.csv +++ /dev/null @@ -1,6 +0,0 @@ -# Name, Type, SubType, Offset, Size, Flags -# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap -nvs, data, nvs,0x9000, 0x6000, -phy_init, data, phy,0xf000, 0x1000, -factory, app, factory,0x10000, 0x300000, -rmk, 0x40, 0, 0x3f0000, 0x10000, \ No newline at end of file diff --git a/examples/use_rust/esp32c6_ble/rust-toolchain.toml b/examples/use_rust/esp32c6_ble/rust-toolchain.toml deleted file mode 100644 index 2e2757849..000000000 --- a/examples/use_rust/esp32c6_ble/rust-toolchain.toml +++ /dev/null @@ -1,2 +0,0 @@ -[toolchain] -channel = "esp" \ No newline at end of file diff --git a/examples/use_rust/esp32c6_ble/sdkconfig.defaults b/examples/use_rust/esp32c6_ble/sdkconfig.defaults deleted file mode 100644 index 9f4bee91a..000000000 --- a/examples/use_rust/esp32c6_ble/sdkconfig.defaults +++ /dev/null @@ -1,29 +0,0 @@ -# Rust often needs a bit of an extra main task stack size compared to C (the default is 3K) -CONFIG_ESP_MAIN_TASK_STACK_SIZE=64000 -CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=7000 - -# Use this to set FreeRTOS kernel tick frequency to 1000 Hz (100 Hz by default). -# This allows to use 1 ms granuality for thread sleeps (10 ms by default). -CONFIG_FREERTOS_HZ=1000 - -# Workaround for https://github.com/espressif/esp-idf/issues/7631 -#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=n -#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=n - -CONFIG_LOG_DEFAULT_LEVEL=5 - -# Disable watchdog -CONFIG_ESP_INT_WDT=n -CONFIG_ESP_TASK_WDT_EN=n - -# esp-nimble config -CONFIG_BT_ENABLED=y -CONFIG_BT_BLE_ENABLED=y -CONFIG_BT_BLUEDROID_ENABLED=n -CONFIG_BT_NIMBLE_ENABLED=y -CONFIG_BT_NIMBLE_NVS_PERSIST=y -# CONFIG_BT_NIMBLE_EXT_ADV=y - -CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y -CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n -CONFIG_BTDM_CTRL_MODE_BTDM=n \ No newline at end of file diff --git a/examples/use_rust/esp32c6_ble/src/keymap.rs b/examples/use_rust/esp32c6_ble/src/keymap.rs index 141d40467..89c143ea5 100644 --- a/examples/use_rust/esp32c6_ble/src/keymap.rs +++ b/examples/use_rust/esp32c6_ble/src/keymap.rs @@ -8,15 +8,15 @@ pub(crate) const NUM_LAYER: usize = 2; pub const fn get_default_keymap() -> [[[KeyAction; COL]; ROW]; NUM_LAYER] { [ layer!([ - [k!(AudioVolUp), k!(B), k!(AudioVolDown)], - [k!(Kp4), k!(LShift), k!(Kp6)], - [mo!(1), k!(Kp2), k!(Kp3)], + [k!(Kp7), k!(Kp8), k!(Kp9)], + [k!(Kp4), k!(Kp5), k!(Kp6)], + [k!(Kp1), k!(Kp2), k!(Kp3)], [mo!(1), a!(No), k!(Kp0)] ]), layer!([ [k!(Kp7), k!(Kp8), k!(Kp9)], - [k!(Kp4), k!(LCtrl), k!(Kp6)], - [mo!(1), k!(Kp2), k!(Kp3)], + [k!(Kp4), k!(Kp5), k!(Kp6)], + [k!(Kp1), k!(Kp2), k!(Kp3)], [mo!(1), a!(No), k!(Kp0)] ]), ] diff --git a/examples/use_rust/esp32c6_ble/src/macros.rs b/examples/use_rust/esp32c6_ble/src/macros.rs index e3aac56c7..5501345c6 100644 --- a/examples/use_rust/esp32c6_ble/src/macros.rs +++ b/examples/use_rust/esp32c6_ble/src/macros.rs @@ -1,8 +1,8 @@ macro_rules! config_matrix_pins_esp { (peripherals: $p:ident, input: [$($in_pin:ident), *], output: [$($out_pin:ident), +]) => { { - let mut output_pins = [$(PinDriver::output($p.pins.$out_pin.downgrade_output()).unwrap()), +]; - let input_pins = [$(PinDriver::input($p.pins.$in_pin.downgrade_input()).unwrap()), +]; + let mut output_pins = [$(Output::new($p.$out_pin, Level::Low, OutputConfig::default())), +]; + let input_pins = [$(Input::new($p.$in_pin, InputConfig::default().with_pull(Pull::Down))), +]; output_pins.iter_mut().for_each(|p| { let _ = p.set_low(); }); diff --git a/examples/use_rust/esp32c6_ble/src/main.rs b/examples/use_rust/esp32c6_ble/src/main.rs index 289840ad7..fc7209e80 100644 --- a/examples/use_rust/esp32c6_ble/src/main.rs +++ b/examples/use_rust/esp32c6_ble/src/main.rs @@ -1,83 +1,98 @@ -#![feature(type_alias_impl_trait)] +#![no_std] +#![no_main] +mod keymap; #[macro_use] mod macros; -mod keymap; mod vial; -use crate::vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; -use defmt::info; -use esp_idf_svc::{ - hal::{gpio::*, peripherals::Peripherals, task::block_on}, - partition::EspPartition, -}; -use esp_println as _; -use keymap::{COL, ROW}; -use rmk::{ - channel::EVENT_CHANNEL, - config::{ControllerConfig, RmkConfig, VialConfig}, - debounce::default_debouncer::DefaultDebouncer, - futures::future::join3, - initialize_keymap_and_storage, - input_device::Runnable, - keyboard::Keyboard, - light::LightController, - matrix::Matrix, - run_devices, run_rmk, - storage::async_flash_wrapper, -}; +use bt_hci::controller::ExternalController; +use embassy_executor::Spawner; +use esp_hal::clock::CpuClock; +use esp_hal::gpio::{Input, InputConfig, Level, Output, OutputConfig, Pull}; +use esp_hal::timer::timg::TimerGroup; +use esp_storage::FlashStorage; +use esp_wifi::ble::controller::BleConnector; +use rmk::ble::trouble::build_ble_stack; +use rmk::channel::EVENT_CHANNEL; +use rmk::config::{ControllerConfig, RmkConfig, StorageConfig, VialConfig}; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::futures::future::join3; +use rmk::input_device::Runnable; +use rmk::keyboard::Keyboard; +use rmk::light::LightController; +use rmk::matrix::Matrix; +use rmk::storage::async_flash_wrapper; +use rmk::{initialize_keymap_and_storage, run_devices, run_rmk, HostResources}; +use {esp_alloc as _, esp_backtrace as _}; -fn main() { - esp_idf_svc::sys::link_patches(); +use crate::keymap::*; +use crate::vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; - // Bind the log crate to the ESP Logging facilities - esp_idf_svc::log::EspLogger::initialize_default(); +#[esp_hal_embassy::main] +async fn main(_s: Spawner) { + // Initialize the peripherals and bluetooth controller + esp_println::logger::init_logger_from_env(); + let peripherals = esp_hal::init(esp_hal::Config::default().with_cpu_clock(CpuClock::max())); + esp_alloc::heap_allocator!(size: 64 * 1024); + let timg0 = TimerGroup::new(peripherals.TIMG0); + let mut rng = esp_hal::rng::Trng::new(peripherals.RNG, peripherals.ADC1); + let init = esp_wifi::init(timg0.timer0, rng.rng.clone(), peripherals.RADIO_CLK).unwrap(); + let systimer = esp_hal::timer::systimer::SystemTimer::new(peripherals.SYSTIMER); + esp_hal_embassy::init(systimer.alarm0); + let bluetooth = peripherals.BT; + let connector = BleConnector::new(&init, bluetooth); + let controller: ExternalController<_, 64> = ExternalController::new(connector); + let central_addr = [0x18, 0xe2, 0x21, 0x80, 0xc0, 0xc7]; + let mut host_resources = HostResources::new(); + let stack = build_ble_stack(controller, central_addr, &mut rng, &mut host_resources).await; - info!("Hello ESP BLE!"); - let peripherals = Peripherals::take().unwrap(); + // Initialize the flash + let flash = FlashStorage::new(); + let flash = async_flash_wrapper(flash); - // Pin config - // WARNING: Some gpio pins shouldn't be used, the initial state is error. - // reference: table 2-3 in https://www.espressif.com.cn/sites/default/files/documentation/esp32-c3_datasheet_en.pdf - let (input_pins, output_pins) = config_matrix_pins_esp!(peripherals: peripherals , input: [gpio6, gpio7, gpio20, gpio21], output: [gpio3, gpio4, gpio5]); + // Initialize the IO pins + let (input_pins, output_pins) = config_matrix_pins_esp!(peripherals: peripherals, input: [GPIO6, GPIO7, GPIO20, GPIO21], output: [GPIO3, GPIO4, GPIO5]); - // Keyboard config + // RMK config let vial_config = VialConfig::new(VIAL_KEYBOARD_ID, VIAL_KEYBOARD_DEF); + let storage_config = StorageConfig { + start_addr: 0x3f0000, + num_sectors: 16, + ..Default::default() + }; let rmk_config = RmkConfig { vial_config, + storage_config, ..Default::default() }; - let flash = async_flash_wrapper(unsafe { - EspPartition::new("rmk") - .expect("Create storage partition error") - .expect("Empty partition") - }); - + // Initialze keyboard stuffs // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let (keymap, storage) = block_on(initialize_keymap_and_storage( + let (keymap, mut storage) = initialize_keymap_and_storage( &mut default_keymap, flash, rmk_config.storage_config, rmk_config.behavior_config.clone(), - )); + ) + .await; - // Initialize the matrix + keyboard + // Initialize the matrix and keyboard let debouncer = DefaultDebouncer::::new(); let mut matrix = Matrix::<_, _, _, ROW, COL>::new(input_pins, output_pins, debouncer); - let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); + // let mut matrix = rmk::matrix::TestMatrix::::new(); + let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); // Initialize the light controller // Initialize the light controller - let light_controller: LightController> = - LightController::new(ControllerConfig::default().light_config); + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); - // Start - block_on(join3( + join3( run_devices! ( (matrix) => EVENT_CHANNEL, ), - keyboard.run(), - run_rmk(&keymap, storage, light_controller, rmk_config), - )); + keyboard.run(), // Keyboard is special + run_rmk(&keymap, &stack, &mut storage, &mut light_controller, rmk_config), + ) + .await; } diff --git a/examples/use_rust/esp32c6_ble/vial.json b/examples/use_rust/esp32c6_ble/vial.json index 165c1d55f..eba77b1c5 100644 --- a/examples/use_rust/esp32c6_ble/vial.json +++ b/examples/use_rust/esp32c6_ble/vial.json @@ -1,7 +1,7 @@ { - "name": "VIAL Keyboard", - "vendorId": "0x4B4C", - "productId": "0x4346", + "name": "RMK Keyboard", + "vendorId": "0x4C4B", + "productId": "0x4643", "lighting": "none", "matrix": { "rows": 4, diff --git a/examples/use_rust/esp32s3_ble/.cargo/config.toml b/examples/use_rust/esp32s3_ble/.cargo/config.toml index e5622473f..cab417dca 100644 --- a/examples/use_rust/esp32s3_ble/.cargo/config.toml +++ b/examples/use_rust/esp32s3_ble/.cargo/config.toml @@ -1,18 +1,19 @@ -[build] -target = "xtensa-esp32s3-espidf" +[target.'cfg(all(any(target_arch = "riscv32", target_arch = "xtensa"), target_os = "none"))'] +runner = "espflash flash --monitor" -[target.xtensa-esp32s3-espidf] -linker = "ldproxy" -runner = "espflash flash --monitor --log-format defmt" -rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110 +[build] +target = "xtensa-esp32s3-none-elf" +rustflags = [ + # Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.) + # NOTE: May negatively impact performance of produced code + "-C", "force-frame-pointers", +] -[unstable] -build-std = ["std", "panic_abort"] [env] -MCU="esp32s3" -# Note: this variable is not used by the pio builder (`cargo build --features pio`) -ESP_IDF_VERSION = "v5.2" -DEFMT_LOG="debug" -ESP_IDF_PATH_ISSUES="warn" -CRATE_CC_NO_DEFAULTS="1" \ No newline at end of file +ESP_LOG = "info" + +# Xtensa only: +# Needed for nightly, until llvm upstream has support for Rust Xtensa. +[unstable] +build-std = ["alloc", "core"] \ No newline at end of file diff --git a/examples/use_rust/esp32s3_ble/Cargo.lock b/examples/use_rust/esp32s3_ble/Cargo.lock index 8597deb30..016231008 100644 --- a/examples/use_rust/esp32s3_ble/Cargo.lock +++ b/examples/use_rust/esp32s3_ble/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -34,13 +45,10 @@ dependencies = [ ] [[package]] -name = "aligned" -version = "0.4.2" +name = "allocator-api2" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377e4c0ba83e4431b10df45c1d4666f178ea9c552cac93e60c3a88bf32785923" -dependencies = [ - "as-slice", -] +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android-tzdata" @@ -59,18 +67,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" - -[[package]] -name = "as-slice" -version = "0.2.1" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" -dependencies = [ - "stable_deref_trait", -] +checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" [[package]] name = "atomic-polyfill" @@ -81,24 +80,12 @@ dependencies = [ "critical-section", ] -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "autocfg" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" -[[package]] -name = "az" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" - [[package]] name = "bare-metal" version = "0.2.5" @@ -109,23 +96,18 @@ dependencies = [ ] [[package]] -name = "bindgen" -version = "0.71.1" +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "basic-toml" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" +checksum = "ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a" dependencies = [ - "bitflags 2.6.0", - "cexpr", - "clang-sys", - "itertools", - "log", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.96", + "serde", ] [[package]] @@ -140,15 +122,35 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" +[[package]] +name = "bitfield" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7e6caee68becd795bfd65f1a026e4d00d8f0c2bc9be5eb568e1015f9ce3c34" +dependencies = [ + "bitfield-macros", +] + +[[package]] +name = "bitfield-macros" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "331afbb18ce7b644c0b428726d369c5dd37ca0b815d72a459fcc2896c3c8ad32" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "bitfield-struct" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bedc5f4fa33bdc993f9b8ba7369d1b74fcdafa958924a0a54de6707e360de692" +checksum = "2be5a46ba01b60005ae2c51a36a29cfe134bcacae2dd5cedcd4615fbaad1494b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] @@ -159,44 +161,45 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] -name = "bstr" -version = "1.11.1" +name = "block-buffer" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "memchr", - "serde", + "generic-array", ] [[package]] -name = "build-time" -version = "0.1.3" +name = "bt-hci" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1219c19fc29b7bfd74b7968b420aff5bc951cf517800176e795d6b2300dd382" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" dependencies = [ - "chrono", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.96", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", ] [[package]] name = "bumpalo" -version = "3.16.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "bytemuck" -version = "1.21.0" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" +checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" [[package]] name = "byteorder" @@ -204,38 +207,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "camino" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" -dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.24", - "serde", - "serde_json", - "thiserror 1.0.69", -] - [[package]] name = "cargo_toml" version = "0.21.0" @@ -248,66 +219,52 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.9" +version = "1.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b" +checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" dependencies = [ "shlex", ] -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "chrono" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets", + "windows-link", ] [[package]] -name = "clang-sys" -version = "1.8.1" +name = "cipher" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ - "glob", - "libc", - "libloading", + "crypto-common", + "inout", ] [[package]] -name = "cmake" -version = "0.1.52" +name = "cmac" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" dependencies = [ - "cc", + "cipher", + "dbl", + "digest", ] [[package]] @@ -318,9 +275,9 @@ checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" [[package]] name = "const-gen" -version = "1.6.5" +version = "1.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb4caa28784488578a9aa32e0a33f0543d961345fc25efc3f04243be3fa6299" +checksum = "6d7617801a02ebd66905a39f5a15390bfb7d6ab90316fdbf7dc36a1161ffb56b" dependencies = [ "const-gen-derive", ] @@ -337,24 +294,10 @@ dependencies = [ ] [[package]] -name = "const_format" -version = "0.2.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd" -dependencies = [ - "const_format_proc_macros", -] - -[[package]] -name = "const_format_proc_macros" -version = "0.2.34" +name = "const-oid" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "core-foundation-sys" @@ -375,23 +318,12 @@ dependencies = [ ] [[package]] -name = "cortex-m-rt" -version = "0.7.5" +name = "cpufeatures" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ - "cortex-m-rt-macros", -] - -[[package]] -name = "cortex-m-rt-macros" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.96", + "libc", ] [[package]] @@ -410,53 +342,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] -name = "crossbeam-deque" -version = "0.8.6" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", ] [[package]] -name = "crossbeam-epoch" -version = "0.9.18" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "cvt" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ae9bf77fbf2d39ef573205d554d87e86c12f1994e9ea335b0651b9b278bcf1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "typenum", ] [[package]] @@ -465,22 +369,8 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -493,78 +383,89 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", - "syn 2.0.96", + "strsim", + "syn 2.0.100", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.96", + "generic-array", ] [[package]] -name = "defmt" -version = "0.3.10" +name = "delegate" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "b9b6483c2bbed26f97861cf57651d4f2b731964a28cd2257f934a4b452480d21" dependencies = [ - "bitflags 1.3.2", - "defmt-macros", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] -name = "defmt-macros" -version = "0.4.0" +name = "der" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ - "defmt-parser", - "proc-macro-error2", - "proc-macro2", - "quote", - "syn 2.0.96", + "const-oid", + "zeroize", ] [[package]] -name = "defmt-parser" -version = "0.4.1" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "thiserror 2.0.7", + "block-buffer", + "crypto-common", + "subtle", ] [[package]] name = "document-features" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" dependencies = [ "litrs", ] [[package]] -name = "either" -version = "1.13.0" +name = "elliptic-curve" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] [[package]] name = "embassy-embedded-hal" @@ -572,7 +473,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", "embassy-futures", "embassy-sync", "embassy-time", @@ -587,11 +487,9 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "critical-section", - "defmt", "document-features", "embassy-executor-macros", ] @@ -599,35 +497,18 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" -dependencies = [ - "defmt", -] - -[[package]] -name = "embassy-hal-internal" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "num-traits", -] +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" [[package]] name = "embassy-net-driver" @@ -646,45 +527,13 @@ dependencies = [ "embassy-sync", ] -[[package]] -name = "embassy-nrf" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7494efe1e0183568327c7e681d4b77ed5241921dcb5976426d9a65b65a0c81" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cortex-m", - "cortex-m-rt", - "critical-section", - "defmt", - "document-features", - "embassy-embedded-hal", - "embassy-hal-internal", - "embassy-sync", - "embassy-time", - "embassy-usb-driver", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-async", - "embedded-io", - "embedded-io-async", - "embedded-storage", - "embedded-storage-async", - "fixed", - "nrf-pac", - "rand_core", -] - [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", "embedded-io-async", "futures-sink", "futures-util", @@ -699,10 +548,8 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", "document-features", "embassy-time-driver", - "embassy-time-queue-utils", "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-async", @@ -734,7 +581,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -749,8 +595,16 @@ name = "embassy-usb-driver" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" + +[[package]] +name = "embassy-usb-synopsys-otg" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08e753b23799329780c7ac434264026d0422044d6649ed70a73441b14a6436d7" dependencies = [ - "defmt", + "critical-section", + "embassy-sync", + "embassy-usb-driver", ] [[package]] @@ -777,28 +631,14 @@ name = "embedded-hal" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" -dependencies = [ - "defmt", -] [[package]] name = "embedded-hal-async" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" -dependencies = [ - "defmt", - "embedded-hal 1.0.0", -] - -[[package]] -name = "embedded-hal-nb" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" dependencies = [ "embedded-hal 1.0.0", - "nb 1.1.0", ] [[package]] @@ -806,9 +646,6 @@ name = "embedded-io" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" -dependencies = [ - "defmt", -] [[package]] name = "embedded-io-async" @@ -816,7 +653,6 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", "embedded-io", ] @@ -835,22 +671,6 @@ dependencies = [ "embedded-storage", ] -[[package]] -name = "embedded-svc" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b85590a7a120e370bed5b6bc2b399b345c60d4c749d3bc06039472da37b9893" -dependencies = [ - "defmt", - "embedded-io", - "embedded-io-async", - "enumset", - "heapless 0.8.0", - "num_enum", - "serde", - "strum 0.25.0", -] - [[package]] name = "embuild" version = "0.33.0" @@ -858,22 +678,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28a8cbd9507fabce8f2741b9ca45da9e898cc2b0f1c2e53d21cb2436aeac811d" dependencies = [ "anyhow", - "bindgen", "bitflags 1.3.2", - "cmake", "filetime", - "globwalk", - "home", "log", - "regex", - "remove_dir_all", - "serde", - "serde_json", "shlex", - "strum 0.24.1", - "tempfile", "thiserror 1.0.69", - "which", ] [[package]] @@ -882,6 +691,18 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "enumset" version = "1.1.5" @@ -897,155 +718,271 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59c3b24c345d8c314966bdc1832f6c2635bfcce8e7cf363bd115987bba2ee242" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] -name = "envy" -version = "0.4.2" +name = "equivalent" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f47e0157f2cb54f5ae1bd371b30a2ae4311e1c028f575cd4e81de7353215965" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "esp-alloc" +version = "0.7.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "serde", + "allocator-api2", + "cfg-if", + "critical-section", + "document-features", + "enumset", + "linked_list_allocator", ] [[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +name = "esp-backtrace" +version = "0.15.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "cfg-if", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-println", + "heapless 0.8.0", + "semihosting", +] [[package]] -name = "errno" -version = "0.3.10" +name = "esp-build" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +checksum = "8aa1c8f9954c9506699cf1ca10a2adcc226ff10b6ae3cb9e875cf2c6a0b9a372" dependencies = [ - "libc", - "windows-sys 0.59.0", + "quote", + "syn 2.0.100", + "termcolor", ] [[package]] name = "esp-build" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aa1c8f9954c9506699cf1ca10a2adcc226ff10b6ae3cb9e875cf2c6a0b9a372" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "quote", - "syn 2.0.96", + "syn 2.0.100", "termcolor", ] [[package]] -name = "esp-idf-hal" -version = "0.45.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775ce25171dc4f615146a4a27ed3a64c6fd99ced77d7112062f2b19bf933f5db" +name = "esp-config" +version = "0.3.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "atomic-waker", + "document-features", + "serde", + "serde_json", +] + +[[package]] +name = "esp-hal" +version = "1.0.0-beta.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "basic-toml", + "bitfield 0.18.1", + "bitflags 2.9.0", + "bytemuck", + "cfg-if", "critical-section", + "delegate", + "document-features", + "embassy-embedded-hal", + "embassy-futures", "embassy-sync", + "embassy-usb-driver", + "embassy-usb-synopsys-otg", "embedded-can", - "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-async", - "embedded-hal-nb", "embedded-io", "embedded-io-async", - "embuild", "enumset", - "esp-idf-sys", - "heapless 0.8.0", - "log", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal-procmacros", + "esp-metadata", + "esp-riscv-rt", + "esp-synopsys-usb-otg", + "esp32s3", + "fugit", + "instability", "nb 1.1.0", - "num_enum", + "paste", + "portable-atomic", + "rand_core 0.6.4", + "rand_core 0.9.3", + "riscv", + "serde", + "strum 0.27.1", + "ufmt-write", + "usb-device", + "void", + "xtensa-lx", + "xtensa-lx-rt", ] [[package]] -name = "esp-idf-svc" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc07aaba257d28d54a96af005ca67d0b38876d8837f5d54a3e0547e100b219c" +name = "esp-hal-embassy" +version = "0.7.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ - "embassy-futures", + "critical-section", + "document-features", + "embassy-executor", + "embassy-sync", + "embassy-time", "embassy-time-driver", "embassy-time-queue-utils", - "embedded-hal-async", - "embedded-storage", - "embedded-svc", - "embuild", - "enumset", - "esp-idf-hal", - "futures-io", - "heapless 0.8.0", - "log", - "num_enum", - "uncased", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal", + "esp-hal-procmacros", + "esp-metadata", + "portable-atomic", + "static_cell", ] [[package]] -name = "esp-idf-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb77a3d02b579a60a811ed9be22b78c5e794bc492d833ee7fc44d3a0155885e1" +name = "esp-hal-procmacros" +version = "0.17.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "darling", + "document-features", + "litrs", + "object", + "proc-macro-crate", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "esp-metadata" +version = "0.6.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "anyhow", - "build-time", - "cargo_metadata", - "cmake", - "const_format", - "embuild", - "envy", - "libc", - "regex", + "basic-toml", "serde", - "strum 0.24.1", - "which", + "strum 0.26.3", ] [[package]] name = "esp-println" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645e54eb592ca0a3d60213b1695e2a5fc0b51ca6d693c08d6983857224a629ed" +version = "0.13.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" dependencies = [ "critical-section", - "defmt", - "esp-build", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", "log", "portable-atomic", ] [[package]] -name = "esp32-nimble" +name = "esp-riscv-rt" version = "0.10.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "document-features", + "riscv", + "riscv-rt-macros", +] + +[[package]] +name = "esp-storage" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88cc737968921dc601fafaf3ca83f8fca5039cfc6a46e402cb042da647a0c00f" +checksum = "1e98b5069bd1482fb85f9236f8ea6cd1b5b6b5a1c3c3fb8c938c97ccfbbb051b" dependencies = [ - "anyhow", - "bitflags 2.6.0", - "bstr", + "critical-section", + "embedded-storage", + "esp-build 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "esp-synopsys-usb-otg" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8938451cb19032f13365328ea66ab38c8d16deecdf322067442297110eb74468" +dependencies = [ + "critical-section", + "embedded-hal 0.2.7", + "ral-registers", + "usb-device", + "vcell", +] + +[[package]] +name = "esp-wifi" +version = "0.13.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "allocator-api2", + "bt-hci", "cfg-if", + "critical-section", + "document-features", "embassy-sync", - "embuild", - "esp-idf-svc", - "heapless 0.8.0", - "log", - "num_enum", - "once_cell", - "uuid", - "zerocopy 0.8.14", - "zerocopy-derive 0.8.14", + "embedded-io", + "embedded-io-async", + "esp-alloc", + "esp-build 0.2.0 (git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd)", + "esp-config", + "esp-hal", + "esp-metadata", + "esp-wifi-sys", + "num-derive", + "num-traits", + "portable-atomic", + "portable_atomic_enum", + "rand_core 0.6.4", + "xtensa-lx-rt", ] [[package]] -name = "fastrand" -version = "2.3.0" +name = "esp-wifi-sys" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "c6b5438361891c431970194a733415006fb3d00b6eb70b3dcb66fd58f04d9b39" +dependencies = [ + "anyhow", +] + +[[package]] +name = "esp32s3" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6d20f119410092abfbc65e46f9362015a7110023528f0dbe855cab80c38ca8" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] [[package]] name = "filetime" @@ -1056,19 +993,7 @@ dependencies = [ "cfg-if", "libc", "libredox", - "windows-sys 0.59.0", -] - -[[package]] -name = "fixed" -version = "1.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a" -dependencies = [ - "az", - "bytemuck", - "half", - "typenum", + "windows-sys", ] [[package]] @@ -1078,17 +1003,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "fs_at" -version = "0.2.1" +name = "fugit" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14af6c9694ea25db25baa2a1788703b9e7c6648dcaeeebeb98f7561b5384c036" +checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" dependencies = [ - "aligned", - "cfg-if", - "cvt", - "libc", - "nix", - "windows-sys 0.52.0", + "gcd", ] [[package]] @@ -1121,6 +1041,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -1135,7 +1065,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] @@ -1165,43 +1095,31 @@ dependencies = [ ] [[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "globset" -version = "0.4.15" +name = "gcd" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata", - "regex-syntax", -] +checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" [[package]] -name = "globwalk" -version = "0.8.1" +name = "generic-array" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ - "bitflags 1.3.2", - "ignore", - "walkdir", + "typenum", + "version_check", + "zeroize", ] [[package]] -name = "half" -version = "2.4.1" +name = "group" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ - "cfg-if", - "crunchy", + "ff", + "rand_core 0.6.4", + "subtle", ] [[package]] @@ -1263,29 +1181,39 @@ dependencies = [ [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] -name = "home" -version = "0.5.9" +name = "hkdf" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ - "windows-sys 0.52.0", + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", ] [[package]] name = "iana-time-zone" -version = "0.1.61" +version = "0.1.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +checksum = "b2fd658b06e56721792c5df4475705b6cda790e9298d19d2f8af083457bcd127" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", "windows-core", ] @@ -1306,51 +1234,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] -name = "ignore" -version = "0.4.23" +name = "indexmap" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata", - "same-file", - "walkdir", - "winapi-util", + "equivalent", + "hashbrown 0.15.2", ] [[package]] -name = "indexmap" -version = "2.7.0" +name = "indoc" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd" + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ - "equivalent", - "hashbrown 0.15.2", + "generic-array", ] [[package]] -name = "itertools" -version = "0.12.1" +name = "instability" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "0bf9fed6d91cfb734e7476a06bde8300a1b94e217e1b523b6f0cd1a01998c71d" dependencies = [ - "either", + "darling", + "indoc", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", @@ -1370,19 +1301,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.168" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" - -[[package]] -name = "libloading" -version = "0.8.6" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" -dependencies = [ - "cfg-if", - "windows-targets", -] +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "libredox" @@ -1390,22 +1311,25 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "libc", "redox_syscall", ] [[package]] -name = "linux-raw-sys" -version = "0.4.14" +name = "linked_list_allocator" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" [[package]] name = "litrs" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" +dependencies = [ + "proc-macro2", +] [[package]] name = "lock_api" @@ -1419,9 +1343,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.25" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "lzma-sys" @@ -1441,10 +1365,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] -name = "minimal-lexical" -version = "0.2.1" +name = "minijinja" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +checksum = "6e36f1329330bb1614c94b78632b9ce45dd7d761f3304a1bed07b2990a7c5097" +dependencies = [ + "serde", +] [[package]] name = "nb" @@ -1459,79 +1386,17 @@ dependencies = [ name = "nb" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" - -[[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cfg_aliases", - "libc", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "normpath" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8911957c4b1549ac0dc74e30db9c8b0e66ddcd6d7acc33098f4c63a64a6d7ed" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "nrf-pac" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" -dependencies = [ - "cortex-m", - "cortex-m-rt", -] - -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" [[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ - "Inflector", - "darling 0.13.4", "proc-macro2", "quote", - "syn 1.0.109", - "uuid", + "syn 2.0.100", ] [[package]] @@ -1558,17 +1423,35 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", ] [[package]] name = "once_cell" -version = "1.20.2" +version = "1.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2806eaa3524762875e21c3dcd057bc4b7bfa01ce4da8d46be1cd43649e1cc6b" + +[[package]] +name = "p256" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] [[package]] name = "paste" @@ -1576,11 +1459,56 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror 2.0.12", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -1590,15 +1518,36 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" + +[[package]] +name = "portable_atomic_enum" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d48f60c43e0120bb2bb48589a16d4bed2f4b911be41e299f2d0fc0e0e20885" +dependencies = [ + "portable-atomic", + "portable_atomic_enum_macros", +] + +[[package]] +name = "portable_atomic_enum_macros" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "a33fa6ec7f2047f572d49317cca19c87195de99c6e5b6ee492da701cfe02b053" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] [[package]] name = "postcard" @@ -1607,7 +1556,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", "heapless 0.7.17", "postcard-derive", "serde", @@ -1624,21 +1572,39 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" -version = "0.2.25" +version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +checksum = "5316f57387668042f561aae71480de936257848f9c43ce528e311d89a07cadeb" dependencies = [ "proc-macro2", - "syn 2.0.96", + "syn 2.0.100", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", ] [[package]] name = "proc-macro-crate" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" dependencies = [ "toml_edit", ] @@ -1662,40 +1628,68 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] +[[package]] +name = "r0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7a31eed1591dcbc95d92ad7161908e72f4677f8fabf2a32ca49b4237cbf211" + +[[package]] +name = "ral-registers" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46b71a9d9206e8b46714c74255adcaea8b11e0350c1d8456165073c3f75fc81a" + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" + [[package]] name = "redox_syscall" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" +checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", ] [[package]] @@ -1728,55 +1722,80 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] -name = "remove_dir_all" -version = "0.8.4" +name = "riscv" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a694f9e0eb3104451127f6cc1e5de55f59d3b1fc8c5ddfaeb6f1e716479ceb4a" +checksum = "5ea8ff73d3720bdd0a97925f0bf79ad2744b6da8ff36be3840c48ac81191d7a7" dependencies = [ - "cfg-if", - "cvt", - "fs_at", - "libc", - "normpath", - "windows-sys 0.59.0", + "critical-section", + "embedded-hal 1.0.0", + "paste", + "riscv-macros", + "riscv-pac", +] + +[[package]] +name = "riscv-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f265be5d634272320a7de94cea15c22a3bfdd4eb42eb43edc528415f066a1f25" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "riscv-pac" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8188909339ccc0c68cfb5a04648313f09621e8b87dc03095454f1a11f6c5d436" + +[[package]] +name = "riscv-rt-macros" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc71814687c45ba4cd1e47a54e03a2dbc62ca3667098fbae9cc6b423956758fa" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] name = "rmk" -version = "0.5.2" +version = "0.6.1" dependencies = [ "bitfield-struct", "byteorder", "chrono", "cortex-m", "crc32fast", - "defmt", "document-features", "embassy-embedded-hal", "embassy-executor", "embassy-futures", - "embassy-nrf", "embassy-sync", "embassy-time", "embassy-usb", "embedded-hal 1.0.0", - "embedded-hal-async", "embedded-io-async", "embedded-storage", "embedded-storage-async", - "esp-idf-svc", - "esp32-nimble", + "esp-hal", "futures", "heapless 0.8.0", - "nrf-softdevice", + "log", "num_enum", "paste", "postcard", + "rand_core 0.6.4", "rmk-macro", "sequential-storage", "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1784,41 +1803,42 @@ dependencies = [ name = "rmk-esp32s3" version = "0.2.0" dependencies = [ + "bt-hci", "cc", "const-gen", - "defmt", - "embassy-time", + "embassy-executor", "embuild", - "esp-idf-svc", + "esp-alloc", + "esp-backtrace", + "esp-hal", + "esp-hal-embassy", "esp-println", - "esp32-nimble", + "esp-storage", + "esp-wifi", "json", + "rand_core 0.6.4", "rmk", "xz2", ] [[package]] name = "rmk-macro" -version = "0.4.2" +version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", "serde", "serde_derive", - "syn 2.0.96", + "syn 2.0.100", "toml", ] -[[package]] -name = "rustc-hash" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" - [[package]] name = "rustc_version" version = "0.2.3" @@ -1834,48 +1854,45 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.24", + "semver 1.0.26", ] [[package]] -name = "rustix" -version = "0.38.42" +name = "rustversion" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" -dependencies = [ - "bitflags 2.6.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.59.0", -] +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] -name = "rustversion" -version = "1.0.18" +name = "ryu" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] -name = "ryu" -version = "1.0.18" +name = "scopeguard" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] -name = "same-file" -version = "1.0.6" +name = "sec1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ - "winapi-util", + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", ] [[package]] -name = "scopeguard" -version = "1.2.0" +name = "semihosting" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +checksum = "c3e1c7d2b77d80283c750a39c52f1ab4d17234e8f30bca43550f5b2375f41d5f" [[package]] name = "semver" @@ -1888,12 +1905,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" -dependencies = [ - "serde", -] +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" [[package]] name = "semver-parser" @@ -1903,39 +1917,38 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", "embedded-storage-async", ] [[package]] name = "serde" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "serde_json" -version = "1.0.133" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", @@ -1952,6 +1965,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1992,12 +2016,6 @@ dependencies = [ "portable-atomic", ] -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" @@ -2006,48 +2024,54 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.24.1" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ - "strum_macros 0.24.3", + "strum_macros 0.26.4", ] [[package]] name = "strum" -version = "0.25.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32" dependencies = [ - "strum_macros 0.25.3", + "strum_macros 0.27.1", ] [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] name = "strum_macros" -version = "0.25.3" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 2.0.96", + "syn 2.0.100", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "1.0.109" @@ -2061,28 +2085,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.96" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "tempfile" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" -dependencies = [ - "cfg-if", - "fastrand", - "once_cell", - "rustix", - "windows-sys 0.59.0", -] - [[package]] name = "termcolor" version = "1.4.1" @@ -2103,11 +2114,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.7" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93605438cbd668185516ab499d589afb7ee1859ea3d5fc8f6b0755e1c7443767" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.7", + "thiserror-impl 2.0.12", ] [[package]] @@ -2118,25 +2129,25 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "thiserror-impl" -version = "2.0.7" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d8749b4531af2117677a5fcd12b1348a3fe2b81e36e61ffeac5c4aa3273e36" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "toml" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" dependencies = [ "serde", "serde_spanned", @@ -2155,9 +2166,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.22" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", "serde", @@ -2166,32 +2177,65 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "log", + "p256", + "rand_chacha", + "rand_core 0.6.4", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", + "uuid", +] + [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] -name = "uncased" -version = "0.9.10" +name = "ucd-trie" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" -dependencies = [ - "version_check", -] +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] -name = "unicode-ident" -version = "1.0.14" +name = "ufmt-write" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" [[package]] -name = "unicode-xid" -version = "0.2.6" +name = "unicode-ident" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "usb-device" @@ -2199,7 +2243,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", "heapless 0.8.0", "portable-atomic", ] @@ -2210,7 +2253,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", "serde", "ssmarshal", "usb-device", @@ -2244,23 +2286,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" -dependencies = [ - "uuid-macro-internal", -] - -[[package]] -name = "uuid-macro-internal" -version = "1.11.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b91f57fe13a38d0ce9e28a03463d8d3c2468ed03d75375110ec71d93b449a08" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.96", -] +checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" [[package]] name = "vcell" @@ -2289,46 +2317,37 @@ dependencies = [ "vcell", ] -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "wasm-bindgen" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2336,33 +2355,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.99" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" - -[[package]] -name = "which" -version = "4.4.2" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" dependencies = [ - "either", - "home", - "once_cell", - "rustix", + "unicode-ident", ] [[package]] @@ -2371,7 +2381,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys", ] [[package]] @@ -2384,13 +2394,10 @@ dependencies = [ ] [[package]] -name = "windows-sys" -version = "0.52.0" +name = "windows-link" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" [[package]] name = "windows-sys" @@ -2467,13 +2474,50 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.20" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" dependencies = [ "memchr", ] +[[package]] +name = "xtensa-lx" +version = "0.10.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "critical-section", + "document-features", +] + +[[package]] +name = "xtensa-lx-rt" +version = "0.18.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "anyhow", + "document-features", + "enum-as-inner", + "minijinja", + "r0", + "serde", + "strum 0.26.3", + "toml", + "xtensa-lx", + "xtensa-lx-rt-proc-macros", +] + +[[package]] +name = "xtensa-lx-rt-proc-macros" +version = "0.2.2" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=56be259c41305f24276852d2af4fce16247107bd#56be259c41305f24276852d2af4fce16247107bd" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "xz2" version = "0.1.7" @@ -2494,11 +2538,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.14" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a367f292d93d4eab890745e75a778da40909cab4d6ff8173693812f79c4a2468" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" dependencies = [ - "zerocopy-derive 0.8.14", + "zerocopy-derive 0.8.24", ] [[package]] @@ -2509,16 +2553,22 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] [[package]] name = "zerocopy-derive" -version = "0.8.14" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3931cb58c62c13adec22e38686b559c86a30565e16ad6e8510a337cedc611e1" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.100", ] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/esp32s3_ble/Cargo.toml b/examples/use_rust/esp32s3_ble/Cargo.toml index 445b3a120..c9879e938 100644 --- a/examples/use_rust/esp32s3_ble/Cargo.toml +++ b/examples/use_rust/esp32s3_ble/Cargo.toml @@ -10,20 +10,27 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk", features = ["col2row", "esp32s3_ble"] } -esp32-nimble = { version = "0.10" } -defmt = "0.3" -embassy-time = { version = "0.4.0", features = ["defmt", "generic-queue-8"] } -esp-println = { version = "0.13", features = ["esp32s3", "defmt-espflash"] } -esp-idf-svc = { version = "0.51", default-features = false, features = [ - "std", - "alloc", - "binstart", - "embassy-sync", - "critical-section", - "embassy-time-driver", - "native", +rmk = { path = "../../../rmk", default-features = false, features = [ + "col2row", + "esp32s3_ble", + "log", + "storage", ] } +embassy-executor = { version = "0.7.0" } +esp-backtrace = { version = "0.15", features = [ + "esp32s3", + "exception-handler", + "panic-handler", + "println", +] } +esp-hal = { version = "1.0.0-beta.0", features = ["esp32s3", "unstable"] } +esp-hal-embassy = { version = "0.7.0", features = ["esp32s3"] } +esp-storage = { version = "0.5.0", features = ["esp32s3", "nor-flash"] } +esp-alloc = { version = "0.7.0" } +esp-println = { version = "0.13.0", features = ["esp32s3", "log"] } +esp-wifi = { version = "0.13.0", features = ["esp32s3", "ble"] } +bt-hci = { version = "0.3" } +rand_core = { version = "0.6", default-features = false } [build-dependencies] xz2 = "0.1.7" @@ -37,17 +44,30 @@ name = "rmk-esp32s3" test = false bench = false +[profile.dev.package.esp-storage] +opt-level = 3 + [profile.dev] -codegen-units = 1 # better optimizations -debug = true -opt-level = 3 # esp-wifi should be built with opt-level 2 or 3 -overflow-checks = true -lto = false -panic = 'unwind' +# Rust debug is too slow. +# For debug builds always builds with some optimization +opt-level = "s" [profile.release] -codegen-units = 1 # better optimizations -debug = true # no overhead for bare-metal -opt-level = 3 # esp-wifi should be built with opt-level 2 or 3 +codegen-units = 1 # LLVM can perform better optimizations using a single thread +debug = 2 +debug-assertions = false +incremental = false +lto = 'thin' +opt-level = 3 overflow-checks = false -lto = "fat" + +[patch.crates-io] +esp-wifi = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-backtrace = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-hal-embassy = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-alloc = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +esp-println = { git = "https://github.com/esp-rs/esp-hal.git", rev = "56be259c41305f24276852d2af4fce16247107bd" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } \ No newline at end of file diff --git a/examples/use_rust/esp32s3_ble/README.md b/examples/use_rust/esp32s3_ble/README.md index 43e4a002b..2e1038062 100644 --- a/examples/use_rust/esp32s3_ble/README.md +++ b/examples/use_rust/esp32s3_ble/README.md @@ -1,12 +1,18 @@ # esp32s3 BLE example -To run this example, you should have latest Rust in **esp** channel and `esp-idf` toolchain installed. The full instruction of installing `esp-idf` toolchain can be found [here](https://docs.esp-rs.org/book/installation/index.html) and [here](https://docs.esp-rs.org/std-training/02_2_software.html) +To run this example, you should have latest Rust in **esp** channel installed. The full instruction of installing esp Rust toolchain can be found [here](https://docs.esp-rs.org/book/installation/index.html). -To run the example, make sure that you have esp-idf environment, `ldproxy` and `espflash` installed correctly. Then, run +[`espflash`](https://github.com/esp-rs/espflash) should also be installed: + +``` +cargo install cargo-espflash espflash +``` + +After having everything installed, use the following command to run the example: ``` cd examples/use_rust/esp32s3_ble -cargo run --release +cargo +esp run --release ``` If everything is good, you'll see the log as the following: @@ -16,23 +22,36 @@ cargo run --release Compiling ... ... ... - Finished `release` profile [optimized + debuginfo] target(s) in 51.39s - Running `espflash flash --monitor --log-format defmt target/xtensa-esp32s3-espidf/release/rmk-esp32s3` -[2024-04-07T12:49:21Z INFO ] Detected 2 serial ports -[2024-04-07T12:49:21Z INFO ] Ports which match a known common dev board are highlighted -[2024-04-07T12:49:21Z INFO ] Please select a port -[2024-04-07T12:50:24Z INFO ] Serial port: '/dev/cu/xx' -[2024-04-07T12:50:24Z INFO ] Connecting... -[2024-04-07T12:50:24Z INFO ] Using flash stub -Chip type: esp32s3 (revision v0.4) + Finished `release` profile [optimized + debuginfo] target(s) in 11.70s + Running `espflash flash --monitor --port /dev/cu.usbmodem211401 target/xtensa-esp32s3-none-elf/release/rmk-esp32s3` +[2025-04-10T10:01:23Z INFO ] Serial port: '/dev/cu.usbmodem211401' +[2025-04-10T10:01:23Z INFO ] Connecting... +[2025-04-10T10:01:23Z INFO ] Using flash stub +Chip type: esp32s3 (revision v0.1) Crystal frequency: 40 MHz Flash size: 4MB -Features: WiFi, BLE -MAC address: aa:aa:aa:aa:aa:aa -App/part. size: 607,488/4,128,768 bytes, 14.71% -[2024-04-07T12:50:24Z INFO ] Segment at address '0x0' has not changed, skipping write -[2024-04-07T12:50:24Z INFO ] Segment at address '0x8000' has not changed, skipping write -[00:00:03] [========================================] 337/337 0x10000 [2024-04-07T12:50:28Z INFO ] Flashing has completed! +Features: WiFi 6, BT 5 +MAC address: 40:4c:ca:5b:c7:dc +App/part. size: 768,944/4,128,768 bytes, 18.62% +[2025-04-10T10:01:23Z INFO ] Segment at address '0x0' has not changed, skipping write +[2025-04-10T10:01:23Z INFO ] Segment at address '0x8000' has not changed, skipping write +[00:00:06] [========================================] 411/411 0x10000 [2025-04-10T10:01:31Z INFO ] Flashing has completed! +``` + +If espflash reports the following error: + +``` +Error: espflash::connection_failed + + × Error while connecting to device + ╰─▶ Serial port not found +``` + +You should to identify which serial port are connected to your esp board, and use `--port` to specify the used serial port: + +``` +# Suppose that the esp board are connected to /dev/cu.usbmodem211401 +cargo run --release -- --port /dev/cu.usbmodem211401 ``` If you want to get some insight of segments of your binary, [`espsegs`](https://github.com/bjoernQ/espsegs) would help: @@ -42,5 +61,5 @@ If you want to get some insight of segments of your binary, [`espsegs`](https:// cargo install --git https://github.com/bjoernQ/espsegs # Check all segments -espsegs target/xtensa-esp32s3-espidf/release/rmk-esp32s3 --chip esp32s3 +espsegs target/xtensa-esp32s3-none-elf/release/rmk-esp32s3 --chip esp32s3 ``` \ No newline at end of file diff --git a/examples/use_rust/esp32s3_ble/build.rs b/examples/use_rust/esp32s3_ble/build.rs index 7678c3b7b..bcb8df0a9 100644 --- a/examples/use_rust/esp32s3_ble/build.rs +++ b/examples/use_rust/esp32s3_ble/build.rs @@ -1,8 +1,9 @@ -use const_gen::*; use std::fs::File; use std::io::Read; use std::path::Path; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -10,11 +11,10 @@ fn main() { println!("cargo:rerun-if-changed=vial.json"); generate_vial_config(); - // ESP IDE system env - embuild::espidf::sysenv::output(); + println!("cargo:rustc-link-arg-bins=-Tlinkall.x"); // Set the extra linker script from defmt - println!("cargo:rustc-link-arg=-Tdefmt.x"); + // println!("cargo:rustc-link-arg=-Tdefmt.x"); } fn generate_vial_config() { @@ -25,8 +25,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -42,6 +41,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/esp32s3_ble/espflash.toml b/examples/use_rust/esp32s3_ble/espflash.toml deleted file mode 100644 index d22b92e77..000000000 --- a/examples/use_rust/esp32s3_ble/espflash.toml +++ /dev/null @@ -1 +0,0 @@ -partition_table = "partitions.csv" diff --git a/examples/use_rust/esp32s3_ble/rust-toolchain.toml b/examples/use_rust/esp32s3_ble/rust-toolchain.toml deleted file mode 100644 index 2e2757849..000000000 --- a/examples/use_rust/esp32s3_ble/rust-toolchain.toml +++ /dev/null @@ -1,2 +0,0 @@ -[toolchain] -channel = "esp" \ No newline at end of file diff --git a/examples/use_rust/esp32s3_ble/sdkconfig.defaults b/examples/use_rust/esp32s3_ble/sdkconfig.defaults deleted file mode 100644 index 3aff089f7..000000000 --- a/examples/use_rust/esp32s3_ble/sdkconfig.defaults +++ /dev/null @@ -1,28 +0,0 @@ -# Rust often needs a bit of an extra main task stack size compared to C (the default is 3K) -CONFIG_ESP_MAIN_TASK_STACK_SIZE=64000 - -# Use this to set FreeRTOS kernel tick frequency to 1000 Hz (100 Hz by default). -# This allows to use 1 ms granuality for thread sleeps (10 ms by default). -CONFIG_FREERTOS_HZ=1000 - -# Workaround for https://github.com/espressif/esp-idf/issues/7631 -#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=n -#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=n - -CONFIG_LOG_DEFAULT_LEVEL=5 - -# Disable watchdog -CONFIG_INT_WDT=n -CONFIG_ESP_TASK_WDT=n - -# esp-nimble config -CONFIG_BT_ENABLED=y -CONFIG_BT_BLE_ENABLED=y -CONFIG_BT_BLUEDROID_ENABLED=n -CONFIG_BT_NIMBLE_ENABLED=y -CONFIG_BT_NIMBLE_NVS_PERSIST=y -# CONFIG_BT_NIMBLE_EXT_ADV=y - -CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y -CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n -CONFIG_BTDM_CTRL_MODE_BTDM=n \ No newline at end of file diff --git a/examples/use_rust/esp32s3_ble/src/keymap.rs b/examples/use_rust/esp32s3_ble/src/keymap.rs index 141d40467..89c143ea5 100644 --- a/examples/use_rust/esp32s3_ble/src/keymap.rs +++ b/examples/use_rust/esp32s3_ble/src/keymap.rs @@ -8,15 +8,15 @@ pub(crate) const NUM_LAYER: usize = 2; pub const fn get_default_keymap() -> [[[KeyAction; COL]; ROW]; NUM_LAYER] { [ layer!([ - [k!(AudioVolUp), k!(B), k!(AudioVolDown)], - [k!(Kp4), k!(LShift), k!(Kp6)], - [mo!(1), k!(Kp2), k!(Kp3)], + [k!(Kp7), k!(Kp8), k!(Kp9)], + [k!(Kp4), k!(Kp5), k!(Kp6)], + [k!(Kp1), k!(Kp2), k!(Kp3)], [mo!(1), a!(No), k!(Kp0)] ]), layer!([ [k!(Kp7), k!(Kp8), k!(Kp9)], - [k!(Kp4), k!(LCtrl), k!(Kp6)], - [mo!(1), k!(Kp2), k!(Kp3)], + [k!(Kp4), k!(Kp5), k!(Kp6)], + [k!(Kp1), k!(Kp2), k!(Kp3)], [mo!(1), a!(No), k!(Kp0)] ]), ] diff --git a/examples/use_rust/esp32s3_ble/src/macros.rs b/examples/use_rust/esp32s3_ble/src/macros.rs index e3aac56c7..5501345c6 100644 --- a/examples/use_rust/esp32s3_ble/src/macros.rs +++ b/examples/use_rust/esp32s3_ble/src/macros.rs @@ -1,8 +1,8 @@ macro_rules! config_matrix_pins_esp { (peripherals: $p:ident, input: [$($in_pin:ident), *], output: [$($out_pin:ident), +]) => { { - let mut output_pins = [$(PinDriver::output($p.pins.$out_pin.downgrade_output()).unwrap()), +]; - let input_pins = [$(PinDriver::input($p.pins.$in_pin.downgrade_input()).unwrap()), +]; + let mut output_pins = [$(Output::new($p.$out_pin, Level::Low, OutputConfig::default())), +]; + let input_pins = [$(Input::new($p.$in_pin, InputConfig::default().with_pull(Pull::Down))), +]; output_pins.iter_mut().for_each(|p| { let _ = p.set_low(); }); diff --git a/examples/use_rust/esp32s3_ble/src/main.rs b/examples/use_rust/esp32s3_ble/src/main.rs index 89c51a665..85110724a 100644 --- a/examples/use_rust/esp32s3_ble/src/main.rs +++ b/examples/use_rust/esp32s3_ble/src/main.rs @@ -1,83 +1,116 @@ -#![feature(type_alias_impl_trait)] +#![no_std] +#![no_main] +mod keymap; #[macro_use] mod macros; -mod keymap; mod vial; +use core::ptr::addr_of_mut; + +use bt_hci::controller::ExternalController; +use embassy_executor::Spawner; +use esp_hal::clock::CpuClock; +use esp_hal::gpio::{Input, InputConfig, Level, Output, OutputConfig, Pull}; +use esp_hal::otg_fs::asynch::{Config, Driver}; +use esp_hal::otg_fs::Usb; +use esp_hal::timer::timg::TimerGroup; +use esp_storage::FlashStorage; +use esp_wifi::ble::controller::BleConnector; +use rmk::ble::trouble::build_ble_stack; +use rmk::channel::EVENT_CHANNEL; +use rmk::config::{ControllerConfig, RmkConfig, StorageConfig, VialConfig}; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::futures::future::join3; +use rmk::input_device::Runnable; +use rmk::keyboard::Keyboard; +use rmk::light::LightController; +use rmk::matrix::Matrix; +use rmk::storage::async_flash_wrapper; +use rmk::{initialize_keymap_and_storage, run_devices, run_rmk, HostResources}; +use {esp_alloc as _, esp_backtrace as _}; + +use crate::keymap::*; use crate::vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; -use defmt::info; -use esp_idf_svc::{ - hal::{gpio::*, peripherals::Peripherals, task::block_on}, - partition::EspPartition, -}; -use esp_println as _; -use keymap::{COL, ROW}; -use rmk::{ - channel::EVENT_CHANNEL, - config::{ControllerConfig, RmkConfig, VialConfig}, - debounce::default_debouncer::DefaultDebouncer, - futures::future::join3, - initialize_keymap_and_storage, - input_device::Runnable, - keyboard::Keyboard, - light::LightController, - matrix::Matrix, - run_devices, run_rmk, - storage::async_flash_wrapper, -}; -fn main() { - esp_idf_svc::sys::link_patches(); +#[esp_hal_embassy::main] +async fn main(_s: Spawner) { + // Initialize the peripherals and bluetooth controller + esp_println::logger::init_logger_from_env(); + let peripherals = esp_hal::init(esp_hal::Config::default().with_cpu_clock(CpuClock::max())); + esp_alloc::heap_allocator!(size: 72 * 1024); + let timg0 = TimerGroup::new(peripherals.TIMG0); + let mut rng = esp_hal::rng::Trng::new(peripherals.RNG, peripherals.ADC1); + let init = esp_wifi::init(timg0.timer0, rng.rng.clone(), peripherals.RADIO_CLK).unwrap(); + let systimer = esp_hal::timer::systimer::SystemTimer::new(peripherals.SYSTIMER); + esp_hal_embassy::init(systimer.alarm0); + let bluetooth = peripherals.BT; + let connector = BleConnector::new(&init, bluetooth); + let controller: ExternalController<_, 20> = ExternalController::new(connector); + let central_addr = [0x18, 0xe2, 0x21, 0x80, 0xc0, 0xc7]; + let mut host_resources = HostResources::new(); + let stack = build_ble_stack(controller, central_addr, &mut rng, &mut host_resources).await; - // Bind the log crate to the ESP Logging facilities - esp_idf_svc::log::EspLogger::initialize_default(); + // Initialize USB + static mut EP_MEMORY: [u8; 1024] = [0; 1024]; + let usb = Usb::new(peripherals.USB0, peripherals.GPIO20, peripherals.GPIO19); + // Create the driver, from the HAL. + let config = Config::default(); + let usb_driver = Driver::new(usb, unsafe { &mut *addr_of_mut!(EP_MEMORY) }, config); - info!("Hello ESP BLE!"); - let peripherals = Peripherals::take().unwrap(); + // Initialize the flash + let flash = FlashStorage::new(); + let flash = async_flash_wrapper(flash); - // Pin config - // WARNING: Some gpio pins shouldn't be used, the initial state is error. - // reference: table 2-3 in https://www.espressif.com.cn/sites/default/files/documentation/esp32-s3_datasheet_en.pdf - let (input_pins, output_pins) = config_matrix_pins_esp!(peripherals: peripherals , input: [gpio4, gpio5, gpio6, gpio7], output: [gpio1, gpio2, gpio8]); + // Initialize the IO pins + let (input_pins, output_pins) = config_matrix_pins_esp!(peripherals: peripherals, input: [GPIO6, GPIO7, GPIO21, GPIO35], output: [GPIO3, GPIO4, GPIO5]); - // Keyboard config + // RMK config let vial_config = VialConfig::new(VIAL_KEYBOARD_ID, VIAL_KEYBOARD_DEF); + let storage_config = StorageConfig { + start_addr: 0x3f0000, + num_sectors: 16, + ..Default::default() + }; let rmk_config = RmkConfig { vial_config, + storage_config, ..Default::default() }; - let flash = async_flash_wrapper(unsafe { - EspPartition::new("rmk") - .expect("Create storage partition error") - .expect("Empty partition") - }); - + // Initialze keyboard stuffs // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let (keymap, storage) = block_on(initialize_keymap_and_storage( + let (keymap, mut storage) = initialize_keymap_and_storage( &mut default_keymap, flash, rmk_config.storage_config, rmk_config.behavior_config.clone(), - )); + ) + .await; - // Initialize the matrix + keyboard + // Initialize the matrix and keyboard let debouncer = DefaultDebouncer::::new(); let mut matrix = Matrix::<_, _, _, ROW, COL>::new(input_pins, output_pins, debouncer); - let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); + // let mut matrix = rmk::matrix::TestMatrix::::new(); + let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); // Initialize the light controller // Initialize the light controller - let light_controller: LightController> = - LightController::new(ControllerConfig::default().light_config); + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); - // Start - block_on(join3( + join3( run_devices! ( (matrix) => EVENT_CHANNEL, ), - keyboard.run(), - run_rmk(&keymap, storage, light_controller, rmk_config), - )); + keyboard.run(), // Keyboard is special + run_rmk( + &keymap, + usb_driver, + &stack, + &mut storage, + &mut light_controller, + rmk_config, + ), + ) + .await; } diff --git a/examples/use_rust/esp32s3_ble/vial.json b/examples/use_rust/esp32s3_ble/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_rust/esp32s3_ble/vial.json +++ b/examples/use_rust/esp32s3_ble/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/hpm5300/Cargo.toml b/examples/use_rust/hpm5300/Cargo.toml index 0f7b8c0e8..b836dfa3e 100644 --- a/examples/use_rust/hpm5300/Cargo.toml +++ b/examples/use_rust/hpm5300/Cargo.toml @@ -25,12 +25,16 @@ riscv = { version = "0.11.1", features = ["critical-section-single-hart"] } embassy-executor = { version = "0.7", features = [ "defmt", "nightly", - "task-arena-size-32768", "executor-thread", "arch-riscv32", ] } -defmt = "0.3" -defmt-rtt = "0.4" +defmt = "1.0" +defmt-rtt = "1.0" + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_rust/hpm5300/build.rs b/examples/use_rust/hpm5300/build.rs index abbba8da8..516c53b83 100644 --- a/examples/use_rust/hpm5300/build.rs +++ b/examples/use_rust/hpm5300/build.rs @@ -1,8 +1,9 @@ -use const_gen::*; use std::fs::File; use std::io::Read; use std::path::Path; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -22,8 +23,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -39,6 +39,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/hpm5300/src/main.rs b/examples/use_rust/hpm5300/src/main.rs index 2aacc5c7d..804d01496 100644 --- a/examples/use_rust/hpm5300/src/main.rs +++ b/examples/use_rust/hpm5300/src/main.rs @@ -11,16 +11,13 @@ mod macros; mod dummy_flash; mod vial; -use defmt_rtt as _; use embassy_executor::Spawner; use hpm_hal::flash::Flash; use hpm_hal::{bind_interrupts, peripherals}; -use riscv_rt as _; -use rmk::{ - config::{KeyboardConfig, KeyboardUsbConfig, RmkConfig, VialConfig}, - run_rmk, -}; +use rmk::config::{KeyboardConfig, KeyboardUsbConfig, RmkConfig, VialConfig}; +use rmk::run_rmk; use vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; +use {defmt_rtt as _, riscv_rt as _}; bind_interrupts!(struct Irqs { USB0 => hpm_hal::usb::InterruptHandler; @@ -38,7 +35,8 @@ async fn main(spawner: Spawner) { let flash: Flash<_, FLASH_SIZE> = Flash::new(p.XPI0, flash_config).unwrap(); // Pin config - let (input_pins, output_pins) = config_matrix_pins_hpm!(peripherals: p, input: [PA31, PA28, PA29, PA27], output: [PB10, PB11, PA09]); + let (input_pins, output_pins) = + config_matrix_pins_hpm!(peripherals: p, input: [PA31, PA28, PA29, PA27], output: [PB10, PB11, PA09]); let keyboard_usb_config = KeyboardUsbConfig { vid: 0x4c4b, diff --git a/examples/use_rust/hpm5300/src/vial.rs b/examples/use_rust/hpm5300/src/vial.rs index a6fde2d4a..7e9b5ab12 100644 --- a/examples/use_rust/hpm5300/src/vial.rs +++ b/examples/use_rust/hpm5300/src/vial.rs @@ -1,28 +1,3 @@ // Vial config is automatically generated by `build.rs`, according to `vial.json` // Please put `vial.json` at your project's root include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); - -// Or you can manually generate vial config then put here -// pub const VIAL_KEYBOARD_ID: &[u8; 8] = &[0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; -// pub const VIAL_KEYBOARD_DEF: &[u8; 308] = &[ -// 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, -// 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, -// 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, -// 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, -// 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, 0x16, 0x4E, 0xEA, 0x09, -// 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, 0xA2, -// 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, -// 0xEE, 0x5C, 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, -// 0x43, 0x9A, 0x38, 0x26, 0x8C, 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, -// 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, -// 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, 0x61, 0x96, 0xFE, 0x27, 0x7B, -// 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, 0xA9, 0x09, -// 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, -// 0x1F, 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, -// 0xFE, 0xE7, 0x80, 0xCA, 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, -// 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, -// 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, -// 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, 0x01, 0x8D, 0x02, -// 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, -// 0x00, 0x04, 0x59, 0x5A, -// ]; diff --git a/examples/use_rust/hpm5300/vial.json b/examples/use_rust/hpm5300/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_rust/hpm5300/vial.json +++ b/examples/use_rust/hpm5300/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/nrf52832_ble/.cargo/config.toml b/examples/use_rust/nrf52832_ble/.cargo/config.toml index b77647ad7..361f3c739 100644 --- a/examples/use_rust/nrf52832_ble/.cargo/config.toml +++ b/examples/use_rust/nrf52832_ble/.cargo/config.toml @@ -1,34 +1,9 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -# Have to use simmsb's elf2uf2 fork to flash https://github.com/simmsb/elf2uf2-rs -# runner = "elf2uf2-rs -d" runner = "probe-run --chip nRF52832_xxAA" linker = "flip-link" -rustflags = [ - # Previously, the linker arguments --nmagic and -Tlink.x were set here. - # They are now set by build.rs instead. The linker argument can still - # only be set here, if a custom linker is needed. - - # By default, the LLD linker is used, which is shipped with the Rust - # toolchain. If you run into problems with LLD, you can switch to the - # GNU linker by uncommenting this line: - # "-C", "linker=arm-none-eabi-ld", - - # If you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by uncommenting the three lines below: - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] [build] -# Pick ONE of these default compilation targets -# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ -# target = "thumbv7m-none-eabi" # Cortex-M3 -# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) -# target = "thumbv8m.base-none-eabi" # Cortex-M23 -# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) -# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) [env] -DEFMT_LOG = "trace" +DEFMT_LOG = "error" diff --git a/examples/use_rust/nrf52832_ble/Cargo.lock b/examples/use_rust/nrf52832_ble/Cargo.lock index 4f16965d3..76e0a67af 100644 --- a/examples/use_rust/nrf52832_ble/Cargo.lock +++ b/examples/use_rust/nrf52832_ble/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -78,6 +89,32 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "bindgen" +version = "0.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" +dependencies = [ + "bitflags 2.6.0", + "cexpr", + "clang-sys", + "itertools", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.95", +] + [[package]] name = "bitfield" version = "0.13.2" @@ -113,6 +150,31 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -150,6 +212,15 @@ dependencies = [ "shlex", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -170,6 +241,38 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -196,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -234,6 +343,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -256,13 +374,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", ] [[package]] @@ -271,65 +401,58 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", + "strsim", + "syn 2.0.95", ] [[package]] -name = "darling_core" +name = "darling_macro" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", + "darling_core", "quote", - "strsim 0.11.1", "syn 2.0.95", ] [[package]] -name = "darling_macro" -version = "0.13.4" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.13.4", - "quote", - "syn 1.0.109", + "generic-array", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "defmt" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.95", + "defmt 1.0.1", ] [[package]] name = "defmt" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -337,9 +460,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -350,21 +473,42 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", ] [[package]] @@ -376,14 +520,48 @@ dependencies = [ "litrs", ] +[[package]] +name = "doxygen-rs" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "415b6ec780d34dcf624666747194393603d0373b7141eef01d12ee58881507d9" +dependencies = [ + "phf", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e)", "embassy-sync", "embassy-time", "embedded-hal 0.2.7", @@ -397,12 +575,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -410,10 +587,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.95", @@ -422,10 +598,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -433,24 +608,30 @@ name = "embassy-hal-internal" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" +dependencies = [ + "num-traits", +] + +[[package]] +name = "embassy-hal-internal" +version = "0.2.0" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] [[package]] name = "embassy-net-driver" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" [[package]] name = "embassy-net-driver-channel" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4818c32afec43e3cae234f324bad9a976c9aa7501022d26ff60a4017a1a006b7" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "embassy-futures", "embassy-net-driver", @@ -460,18 +641,17 @@ dependencies = [ [[package]] name = "embassy-nrf" version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7494efe1e0183568327c7e681d4b77ed5241921dcb5976426d9a65b65a0c81" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "bitflags 2.6.0", "cfg-if", "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", - "embassy-hal-internal", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e)", "embassy-sync", "embassy-time", "embassy-time-driver", @@ -491,13 +671,12 @@ dependencies = [ [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -507,12 +686,11 @@ dependencies = [ [[package]] name = "embassy-time" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -524,8 +702,7 @@ dependencies = [ [[package]] name = "embassy-time-driver" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "document-features", ] @@ -533,8 +710,7 @@ dependencies = [ [[package]] name = "embassy-time-queue-utils" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "embassy-executor", "heapless 0.8.0", @@ -543,10 +719,9 @@ dependencies = [ [[package]] name = "embassy-usb" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -559,10 +734,9 @@ dependencies = [ [[package]] name = "embassy-usb-driver" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -581,7 +755,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -590,7 +764,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -600,7 +774,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -609,7 +783,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -640,6 +814,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -688,6 +872,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -731,6 +925,34 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" version = "2.4.1" @@ -794,10 +1016,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -837,6 +1078,24 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -865,6 +1124,16 @@ version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +[[package]] +name = "libloading" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +dependencies = [ + "cfg-if", + "windows-targets", +] + [[package]] name = "litrs" version = "0.4.1" @@ -904,6 +1173,12 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "nb" version = "0.1.3" @@ -920,52 +1195,78 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" [[package]] -name = "nrf-pac" -version = "0.1.0" +name = "nom" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ - "cortex-m", - "cortex-m-rt", + "memchr", + "minimal-lexical", ] [[package]] -name = "nrf-softdevice" +name = "nrf-mpsl" version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" dependencies = [ "cortex-m", "critical-section", - "defmt", - "embassy-futures", + "defmt 0.3.100", + "embassy-nrf", "embassy-sync", + "embedded-io", "embedded-storage", "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "nrf-softdevice-s132", - "num_enum", + "nrf-mpsl-sys", ] [[package]] -name = "nrf-softdevice-macro" +name = "nrf-mpsl-sys" version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", + "bindgen", + "doxygen-rs", ] [[package]] -name = "nrf-softdevice-s132" -version = "0.1.2" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +name = "nrf-pac" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" +dependencies = [ + "cortex-m", + "cortex-m-rt", +] + +[[package]] +name = "nrf-sdc" +version = "0.1.0" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" +dependencies = [ + "bt-hci", + "critical-section", + "defmt 0.3.100", + "embassy-hal-internal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "embassy-nrf", + "embassy-sync", + "embedded-io", + "embedded-io-async", + "nrf-mpsl", + "nrf-sdc-sys", + "rand_core", +] + +[[package]] +name = "nrf-sdc-sys" +version = "0.1.0" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" +dependencies = [ + "bindgen", + "doxygen-rs", + "nrf-mpsl-sys", + "winnow", +] [[package]] name = "num-traits" @@ -1006,14 +1307,24 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1022,6 +1333,93 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -1053,7 +1451,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1070,6 +1468,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" version = "0.2.27" @@ -1080,6 +1487,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1120,6 +1536,25 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1164,7 +1599,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1180,16 +1615,16 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", - "once_cell", "paste", "postcard", + "rand_core", "rmk-macro", "sequential-storage", "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1198,8 +1633,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1210,23 +1647,37 @@ dependencies = [ ] [[package]] -name = "rmk-nrf52832-ble" +name = "rmk-nrf52832" version = "0.2.0" dependencies = [ + "bt-hci", "const-gen", "cortex-m", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-nrf", "embassy-time", "json", + "nrf-mpsl", + "nrf-sdc", + "once_cell", "panic-probe", + "rand", + "rand_chacha", + "rand_core", "rmk", + "static_cell", "xz2", ] +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1257,6 +1708,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1280,11 +1744,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1317,12 +1781,29 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "spin" version = "0.9.8" @@ -1359,15 +1840,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1445,12 +1926,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.95", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1463,7 +1986,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1474,7 +1997,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -1694,7 +2217,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -1707,3 +2239,20 @@ dependencies = [ "quote", "syn 2.0.95", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/nrf52832_ble/Cargo.toml b/examples/use_rust/nrf52832_ble/Cargo.toml index f8260017f..37e57e250 100644 --- a/examples/use_rust/nrf52832_ble/Cargo.toml +++ b/examples/use_rust/nrf52832_ble/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "rmk-nrf52832-ble" +name = "rmk-nrf52832" version = "0.2.0" authors = ["Haobo Gu "] description = "Keyboard firmware written in Rust" @@ -10,7 +10,19 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk", features = ["nrf52832_ble", "col2row"] } +rmk = { path = "../../../rmk", features = ["async_matrix", "nrf52832_ble"] } +nrf-sdc = { version = "0.1.0", default-features = false, features = [ + "defmt", + "peripheral", + "nrf52832", +] } +nrf-mpsl = { version = "0.1.0", default-features = false, features = [ + "defmt", + "critical-section-impl", + "nrf52832", +] } +bt-hci = { version = "0.3.0", default-features = false, features = ["defmt"] } + cortex-m = "0.7.7" cortex-m-rt = "0.7.5" embassy-time = { version = "0.4", features = ["tick-hz-32_768", "defmt"] } @@ -24,13 +36,31 @@ embassy-nrf = { version = "0.3.1", features = [ ] } embassy-executor = { version = "0.7", features = [ "defmt", - "task-arena-size-16384", "arch-cortex-m", "executor-thread", ] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } +static_cell = "2" + +once_cell = { version = "1.19", features = [ + "atomic-polyfill", +], default-features = false } +rand = { version = "0.8.4", default-features = false } +rand_core = { version = "0.6" } +rand_chacha = { version = "0.3", default-features = false } + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-usb = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +nrf-sdc = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "4f2af99b87ae07c0b5634d32e4a62e26876e5be3" } +nrf-mpsl = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "4f2af99b87ae07c0b5634d32e4a62e26876e5be3" } [build-dependencies] xz2 = "0.1.7" @@ -38,7 +68,7 @@ json = "0.12" const-gen = "1.6" [[bin]] -name = "rmk-nrf52832-ble" +name = "rmk-nrf52832" test = false bench = false diff --git a/examples/use_rust/nrf52832_ble/README.md b/examples/use_rust/nrf52832_ble/README.md index e62e4027f..a6e2ffe15 100644 --- a/examples/use_rust/nrf52832_ble/README.md +++ b/examples/use_rust/nrf52832_ble/README.md @@ -1,22 +1,12 @@ # nrf52832 BLE example -To use this example, you should have [nrf s132 softdevice 7.3.0](https://www.nordicsemi.com/Products/Development-software/s132/download) flashed to nrf52832 first. - -The following are the detailed steps: +To use this example, you should have debug proble connected to your board's SWD. Then use `cargo run` to flash the firmware to your board. 1. Enter example folder: ```shell cd examples/use_rust/nrf52832_ble ``` -2. Erase the flash: - ```shell - probe-rs erase --chip nrf52832_xxAA - ``` -3. Flash softdevice firmware to flash: - ```shell - probe-rs download --verify --format hex --chip nRF52832_xxAA s132_nrf52_7.3.0_softdevice.hex - ``` -4. Compile, flash and run the example +2. Compile, flash and run the example ```shell cargo run --release ``` diff --git a/examples/use_rust/nrf52832_ble/build.rs b/examples/use_rust/nrf52832_ble/build.rs index 90ab55a4f..941ff7006 100644 --- a/examples/use_rust/nrf52832_ble/build.rs +++ b/examples/use_rust/nrf52832_ble/build.rs @@ -10,16 +10,16 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { // Generate vial config at the root of project - println!("cargo:rerun-if-changed=vial.json"); generate_vial_config(); // Put `memory.x` in our output directory and ensure it's @@ -56,14 +56,14 @@ fn main() { fn generate_vial_config() { // Generated vial config file + println!("cargo:rerun-if-changed=vial.json"); let out_file = Path::new(&env::var_os("OUT_DIR").unwrap()).join("config_generated.rs"); let p = Path::new("vial.json"); let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -79,6 +79,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/nrf52832_ble/memory.x b/examples/use_rust/nrf52832_ble/memory.x index 52e45692a..c5e07270f 100644 --- a/examples/use_rust/nrf52832_ble/memory.x +++ b/examples/use_rust/nrf52832_ble/memory.x @@ -1,6 +1,9 @@ MEMORY { - /* nRF52832 s132 7.3.0 */ - FLASH : ORIGIN = 0x26000, LENGTH = 360K - RAM : ORIGIN = 0x20007af8, LENGTH = 64K - 30K + FLASH : ORIGIN = 0x00000000, LENGTH = 512K + RAM : ORIGIN = 0x20000000, LENGTH = 64K + + /* These values correspond to the nRF52832 WITH Adafruit nRF52 bootloader */ + /* FLASH : ORIGIN = 0x00001000, LENGTH = 508K */ + /* RAM : ORIGIN = 0x20000008, LENGTH = 63K */ } \ No newline at end of file diff --git a/examples/use_rust/nrf52832_ble/src/keymap.rs b/examples/use_rust/nrf52832_ble/src/keymap.rs index 141d40467..89c143ea5 100644 --- a/examples/use_rust/nrf52832_ble/src/keymap.rs +++ b/examples/use_rust/nrf52832_ble/src/keymap.rs @@ -8,15 +8,15 @@ pub(crate) const NUM_LAYER: usize = 2; pub const fn get_default_keymap() -> [[[KeyAction; COL]; ROW]; NUM_LAYER] { [ layer!([ - [k!(AudioVolUp), k!(B), k!(AudioVolDown)], - [k!(Kp4), k!(LShift), k!(Kp6)], - [mo!(1), k!(Kp2), k!(Kp3)], + [k!(Kp7), k!(Kp8), k!(Kp9)], + [k!(Kp4), k!(Kp5), k!(Kp6)], + [k!(Kp1), k!(Kp2), k!(Kp3)], [mo!(1), a!(No), k!(Kp0)] ]), layer!([ [k!(Kp7), k!(Kp8), k!(Kp9)], - [k!(Kp4), k!(LCtrl), k!(Kp6)], - [mo!(1), k!(Kp2), k!(Kp3)], + [k!(Kp4), k!(Kp5), k!(Kp6)], + [k!(Kp1), k!(Kp2), k!(Kp3)], [mo!(1), a!(No), k!(Kp0)] ]), ] diff --git a/examples/use_rust/nrf52832_ble/src/macros.rs b/examples/use_rust/nrf52832_ble/src/macros.rs index ed5640ce3..441e3e2dc 100644 --- a/examples/use_rust/nrf52832_ble/src/macros.rs +++ b/examples/use_rust/nrf52832_ble/src/macros.rs @@ -1,8 +1,8 @@ macro_rules! config_matrix_pins_nrf { (peripherals: $p:ident, input: [$($in_pin:ident), *], output: [$($out_pin:ident), +]) => { { - let mut output_pins = [$(Output::new(AnyPin::from($p.$out_pin), embassy_nrf::gpio::Level::Low, embassy_nrf::gpio::OutputDrive::Standard)), +]; - let input_pins = [$(Input::new(AnyPin::from($p.$in_pin), embassy_nrf::gpio::Pull::Down)), +]; + let mut output_pins = [$(Output::new($p.$out_pin, embassy_nrf::gpio::Level::Low, embassy_nrf::gpio::OutputDrive::Standard)), +]; + let input_pins = [$(Input::new($p.$in_pin, embassy_nrf::gpio::Pull::Down)), +]; output_pins.iter_mut().for_each(|p| { p.set_low(); }); diff --git a/examples/use_rust/nrf52832_ble/src/main.rs b/examples/use_rust/nrf52832_ble/src/main.rs index fe6ea4805..0ca884bcc 100644 --- a/examples/use_rust/nrf52832_ble/src/main.rs +++ b/examples/use_rust/nrf52832_ble/src/main.rs @@ -1,48 +1,123 @@ #![no_std] #![no_main] +mod vial; #[macro_use] mod macros; mod keymap; -mod vial; -use defmt::info; -use defmt_rtt as _; +use defmt::{info, unwrap}; use embassy_executor::Spawner; -use embassy_nrf::{ - self as _, - gpio::{AnyPin, Input, Output}, - interrupt::Priority, -}; +use embassy_nrf::gpio::{Input, Output}; +use embassy_nrf::peripherals::RNG; +use embassy_nrf::{bind_interrupts, rng}; use keymap::{COL, ROW}; -use panic_probe as _; -use rmk::{ - channel::EVENT_CHANNEL, - config::{ControllerConfig, KeyboardUsbConfig, RmkConfig, StorageConfig, VialConfig}, - debounce::default_debouncer::DefaultDebouncer, - futures::future::join3, - initialize_keymap_and_storage, initialize_nrf_sd_and_flash, - input_device::Runnable, - keyboard::Keyboard, - light::LightController, - matrix::Matrix, - run_devices, run_rmk, -}; - +use nrf_mpsl::Flash; +use nrf_sdc::mpsl::MultiprotocolServiceLayer; +use nrf_sdc::{self as sdc, mpsl}; +use rand_chacha::ChaCha12Rng; +use rand_core::SeedableRng; +use rmk::ble::trouble::build_ble_stack; +use rmk::channel::EVENT_CHANNEL; +use rmk::config::{ControllerConfig, KeyboardUsbConfig, RmkConfig, StorageConfig, VialConfig}; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::futures::future::join3; +use rmk::input_device::Runnable as _; +use rmk::keyboard::Keyboard; +use rmk::light::LightController; +use rmk::matrix::Matrix; +use rmk::{initialize_keymap_and_storage, run_devices, run_rmk, HostResources}; +use static_cell::StaticCell; use vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; +use {defmt_rtt as _, panic_probe as _}; + +bind_interrupts!(struct Irqs { + RNG => rng::InterruptHandler; + EGU0_SWI0 => nrf_sdc::mpsl::LowPrioInterruptHandler; + CLOCK_POWER => nrf_sdc::mpsl::ClockInterruptHandler; + RADIO => nrf_sdc::mpsl::HighPrioInterruptHandler; + TIMER0 => nrf_sdc::mpsl::HighPrioInterruptHandler; + RTC0 => nrf_sdc::mpsl::HighPrioInterruptHandler; +}); + +#[embassy_executor::task] +async fn mpsl_task(mpsl: &'static MultiprotocolServiceLayer<'static>) -> ! { + mpsl.run().await +} + +/// How many outgoing L2CAP buffers per link +const L2CAP_TXQ: u8 = 3; + +/// How many incoming L2CAP buffers per link +const L2CAP_RXQ: u8 = 3; + +/// Size of L2CAP packets +const L2CAP_MTU: usize = 72; + +fn build_sdc<'d, const N: usize>( + p: nrf_sdc::Peripherals<'d>, + rng: &'d mut rng::Rng, + mpsl: &'d MultiprotocolServiceLayer, + mem: &'d mut sdc::Mem, +) -> Result, nrf_sdc::Error> { + sdc::Builder::new()? + .support_adv()? + .support_peripheral()? + .peripheral_count(1)? + .buffer_cfg(L2CAP_MTU as u8, L2CAP_MTU as u8, L2CAP_TXQ, L2CAP_RXQ)? + .build(p, rng, mpsl, mem) +} + +fn ble_addr() -> [u8; 6] { + let ficr = embassy_nrf::pac::FICR; + let high = u64::from(ficr.deviceid(1).read()); + let addr = high << 32 | u64::from(ficr.deviceid(0).read()); + let addr = addr | 0x0000_c000_0000_0000; + unwrap!(addr.to_le_bytes()[..6].try_into()) +} #[embassy_executor::main] async fn main(spawner: Spawner) { - info!("Hello NRF BLE!"); + info!("Hello RMK BLE!"); + // Initialize the peripherals and nrf-sdc controller + let p = embassy_nrf::init(Default::default()); + let mpsl_p = mpsl::Peripherals::new(p.RTC0, p.TIMER0, p.TEMP, p.PPI_CH19, p.PPI_CH30, p.PPI_CH31); + let lfclk_cfg = mpsl::raw::mpsl_clock_lfclk_cfg_t { + source: mpsl::raw::MPSL_CLOCK_LF_SRC_RC as u8, + rc_ctiv: mpsl::raw::MPSL_RECOMMENDED_RC_CTIV as u8, + rc_temp_ctiv: mpsl::raw::MPSL_RECOMMENDED_RC_TEMP_CTIV as u8, + accuracy_ppm: mpsl::raw::MPSL_DEFAULT_CLOCK_ACCURACY_PPM as u16, + skip_wait_lfclk_started: mpsl::raw::MPSL_DEFAULT_SKIP_WAIT_LFCLK_STARTED != 0, + }; + static MPSL: StaticCell = StaticCell::new(); + static SESSION_MEM: StaticCell> = StaticCell::new(); + let mpsl = MPSL.init(unwrap!(mpsl::MultiprotocolServiceLayer::with_timeslots( + mpsl_p, + Irqs, + lfclk_cfg, + SESSION_MEM.init(mpsl::SessionMem::new()) + ))); + spawner.must_spawn(mpsl_task(&*mpsl)); + let sdc_p = sdc::Peripherals::new( + p.PPI_CH17, p.PPI_CH18, p.PPI_CH20, p.PPI_CH21, p.PPI_CH22, p.PPI_CH23, p.PPI_CH24, p.PPI_CH25, p.PPI_CH26, + p.PPI_CH27, p.PPI_CH28, p.PPI_CH29, + ); + let mut rng = rng::Rng::new(p.RNG, Irqs); + let mut rng_gen = ChaCha12Rng::from_rng(&mut rng).unwrap(); + let mut sdc_mem = sdc::Mem::<3072>::new(); + let sdc = unwrap!(build_sdc(sdc_p, &mut rng, mpsl, &mut sdc_mem)); + let central_addr = ble_addr(); + let mut host_resources = HostResources::new(); + let stack = build_ble_stack(sdc, central_addr, &mut rng_gen, &mut host_resources).await; - let mut nrf_config = embassy_nrf::config::Config::default(); - nrf_config.gpiote_interrupt_priority = Priority::P2; - nrf_config.time_interrupt_priority = Priority::P2; - let p = embassy_nrf::init(nrf_config); + // Initialize flash + let flash = Flash::take(mpsl, p.NVMC); - // Pin config - let (input_pins, output_pins) = config_matrix_pins_nrf!(peripherals: p, input: [P0_03, P0_04, P0_28, P0_29], output: [P0_07, P0_11, P0_27]); + // Initialize IO Pins + let (input_pins, output_pins) = + config_matrix_pins_nrf!(peripherals: p, input: [P0_30, P0_31, P0_29, P0_27], output: [P0_28, P0_03, P0_11]); + // Keyboard config let keyboard_usb_config = KeyboardUsbConfig { vid: 0x4c4b, pid: 0x4643, @@ -51,11 +126,9 @@ async fn main(spawner: Spawner) { serial_number: "vial:f64c2b3c:000001", }; let vial_config = VialConfig::new(VIAL_KEYBOARD_ID, VIAL_KEYBOARD_DEF); - // Current default storage config of nRF52832 is not correct, check this issue: https://github.com/embassy-rs/nrf-softdevice/issues/246. - // So we set the storage config manually let storage_config = StorageConfig { start_addr: 0x70000, - num_sectors: 2, + num_sectors: 6, ..Default::default() }; let rmk_config = RmkConfig { @@ -65,13 +138,10 @@ async fn main(spawner: Spawner) { ..Default::default() }; - // Initialize the Softdevice and flash - let (sd, flash) = - initialize_nrf_sd_and_flash(rmk_config.usb_config.product_name, spawner, None); - + // Initialze keyboard stuffs // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let (keymap, storage) = initialize_keymap_and_storage( + let (keymap, mut storage) = initialize_keymap_and_storage( &mut default_keymap, flash, rmk_config.storage_config, @@ -79,23 +149,21 @@ async fn main(spawner: Spawner) { ) .await; - // Initialize the matrix + keyboard - let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); + // Initialize the matrix and keyboard let debouncer = DefaultDebouncer::::new(); let mut matrix = Matrix::<_, _, _, ROW, COL>::new(input_pins, output_pins, debouncer); // let mut matrix = TestMatrix::::new(); + let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); // Initialize the light controller - let light_controller: LightController = - LightController::new(ControllerConfig::default().light_config); + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); - // Start join3( run_devices! ( (matrix) => EVENT_CHANNEL, ), - keyboard.run(), - run_rmk(&keymap, storage, light_controller, rmk_config, sd), + keyboard.run(), // Keyboard is special + run_rmk(&keymap, &stack, &mut storage, &mut light_controller, rmk_config), ) .await; } diff --git a/examples/use_rust/nrf52832_ble/src/vial.rs b/examples/use_rust/nrf52832_ble/src/vial.rs index a6fde2d4a..7e9b5ab12 100644 --- a/examples/use_rust/nrf52832_ble/src/vial.rs +++ b/examples/use_rust/nrf52832_ble/src/vial.rs @@ -1,28 +1,3 @@ // Vial config is automatically generated by `build.rs`, according to `vial.json` // Please put `vial.json` at your project's root include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); - -// Or you can manually generate vial config then put here -// pub const VIAL_KEYBOARD_ID: &[u8; 8] = &[0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; -// pub const VIAL_KEYBOARD_DEF: &[u8; 308] = &[ -// 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, -// 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, -// 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, -// 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, -// 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, 0x16, 0x4E, 0xEA, 0x09, -// 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, 0xA2, -// 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, -// 0xEE, 0x5C, 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, -// 0x43, 0x9A, 0x38, 0x26, 0x8C, 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, -// 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, -// 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, 0x61, 0x96, 0xFE, 0x27, 0x7B, -// 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, 0xA9, 0x09, -// 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, -// 0x1F, 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, -// 0xFE, 0xE7, 0x80, 0xCA, 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, -// 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, -// 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, -// 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, 0x01, 0x8D, 0x02, -// 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, -// 0x00, 0x04, 0x59, 0x5A, -// ]; diff --git a/examples/use_rust/nrf52832_ble/vial.json b/examples/use_rust/nrf52832_ble/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_rust/nrf52832_ble/vial.json +++ b/examples/use_rust/nrf52832_ble/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/nrf52840/.cargo/config.toml b/examples/use_rust/nrf52840/.cargo/config.toml index 44b567b56..35b36cb90 100644 --- a/examples/use_rust/nrf52840/.cargo/config.toml +++ b/examples/use_rust/nrf52840/.cargo/config.toml @@ -1,34 +1,9 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -# Have to use simmsb's elf2uf2 fork to flash https://github.com/simmsb/elf2uf2-rs -# runner = "elf2uf2-rs -d" runner = "probe-rs run --chip nRF52840_xxAA" linker = "flip-link" -rustflags = [ - # Previously, the linker arguments --nmagic and -Tlink.x were set here. - # They are now set by build.rs instead. The linker argument can still - # only be set here, if a custom linker is needed. - - # By default, the LLD linker is used, which is shipped with the Rust - # toolchain. If you run into problems with LLD, you can switch to the - # GNU linker by uncommenting this line: - # "-C", "linker=arm-none-eabi-ld", - - # If you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by uncommenting the three lines below: - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] [build] -# Pick ONE of these default compilation targets -# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ -# target = "thumbv7m-none-eabi" # Cortex-M3 -# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) -# target = "thumbv8m.base-none-eabi" # Cortex-M23 -# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) -# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) [env] DEFMT_LOG = "trace" \ No newline at end of file diff --git a/examples/use_rust/nrf52840/Cargo.lock b/examples/use_rust/nrf52840/Cargo.lock index 1ae8ef85d..029eb4859 100644 --- a/examples/use_rust/nrf52840/Cargo.lock +++ b/examples/use_rust/nrf52840/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -78,6 +89,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bitfield" version = "0.13.2" @@ -113,6 +130,31 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -170,6 +212,27 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -196,6 +259,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -235,6 +304,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -257,13 +335,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", ] [[package]] @@ -272,65 +362,58 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", + "strsim", + "syn 2.0.95", ] [[package]] -name = "darling_core" +name = "darling_macro" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", + "darling_core", "quote", - "strsim 0.11.1", "syn 2.0.95", ] [[package]] -name = "darling_macro" -version = "0.13.4" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.13.4", - "quote", - "syn 1.0.109", + "generic-array", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "defmt" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.95", + "defmt 1.0.1", ] [[package]] name = "defmt" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -338,9 +421,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -351,21 +434,42 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", ] [[package]] @@ -377,13 +481,32 @@ dependencies = [ "litrs", ] +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -398,12 +521,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -411,10 +533,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.95", @@ -423,10 +544,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -437,7 +557,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -469,7 +589,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -492,13 +612,12 @@ dependencies = [ [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -513,7 +632,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -547,7 +666,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -563,7 +682,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -582,7 +701,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -591,7 +710,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -601,7 +720,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -610,7 +729,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -641,6 +760,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -689,6 +818,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -732,6 +871,28 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" version = "2.4.1" @@ -795,10 +956,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -838,6 +1018,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -930,38 +1119,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -997,14 +1154,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1013,6 +1180,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -1044,7 +1256,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1061,6 +1273,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" version = "0.2.27" @@ -1071,6 +1292,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1111,6 +1341,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1155,7 +1395,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1171,7 +1411,6 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "postcard", @@ -1180,6 +1419,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1188,8 +1428,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1206,7 +1448,7 @@ dependencies = [ "const-gen", "cortex-m", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-nrf", @@ -1247,6 +1489,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1270,11 +1525,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1307,6 +1562,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1349,15 +1615,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1435,12 +1701,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.95", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1453,7 +1761,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1464,7 +1772,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -1684,7 +1992,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -1697,3 +2014,20 @@ dependencies = [ "quote", "syn 2.0.95", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/nrf52840/Cargo.toml b/examples/use_rust/nrf52840/Cargo.toml index 5d1e0509b..5a67e6127 100644 --- a/examples/use_rust/nrf52840/Cargo.toml +++ b/examples/use_rust/nrf52840/Cargo.toml @@ -26,11 +26,15 @@ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", "executor-thread", - "task-arena-size-32768", ] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_rust/nrf52840/build.rs b/examples/use_rust/nrf52840/build.rs index 90ab55a4f..a62dc4c24 100644 --- a/examples/use_rust/nrf52840/build.rs +++ b/examples/use_rust/nrf52840/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -62,8 +63,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -79,6 +79,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/nrf52840/memory.x b/examples/use_rust/nrf52840/memory.x index ed12371f1..cf660fcc8 100644 --- a/examples/use_rust/nrf52840/memory.x +++ b/examples/use_rust/nrf52840/memory.x @@ -1,10 +1,6 @@ MEMORY { - /* NOTE 1 K = 1 KiBi = 1024 bytes */ + /* NOTE 1 K = 1 KiB = 1024 bytes */ FLASH : ORIGIN = 0x00000000, LENGTH = 1024K RAM : ORIGIN = 0x20000000, LENGTH = 256K - - /* These values correspond to the NRF52840 with Softdevices S140 7.3.0 */ - /* FLASH : ORIGIN = 0x00027000, LENGTH = 820K - RAM : ORIGIN = 0x20020000, LENGTH = 128K */ } \ No newline at end of file diff --git a/examples/use_rust/nrf52840/src/keymap.rs b/examples/use_rust/nrf52840/src/keymap.rs index 141d40467..89c143ea5 100644 --- a/examples/use_rust/nrf52840/src/keymap.rs +++ b/examples/use_rust/nrf52840/src/keymap.rs @@ -8,15 +8,15 @@ pub(crate) const NUM_LAYER: usize = 2; pub const fn get_default_keymap() -> [[[KeyAction; COL]; ROW]; NUM_LAYER] { [ layer!([ - [k!(AudioVolUp), k!(B), k!(AudioVolDown)], - [k!(Kp4), k!(LShift), k!(Kp6)], - [mo!(1), k!(Kp2), k!(Kp3)], + [k!(Kp7), k!(Kp8), k!(Kp9)], + [k!(Kp4), k!(Kp5), k!(Kp6)], + [k!(Kp1), k!(Kp2), k!(Kp3)], [mo!(1), a!(No), k!(Kp0)] ]), layer!([ [k!(Kp7), k!(Kp8), k!(Kp9)], - [k!(Kp4), k!(LCtrl), k!(Kp6)], - [mo!(1), k!(Kp2), k!(Kp3)], + [k!(Kp4), k!(Kp5), k!(Kp6)], + [k!(Kp1), k!(Kp2), k!(Kp3)], [mo!(1), a!(No), k!(Kp0)] ]), ] diff --git a/examples/use_rust/nrf52840/src/macros.rs b/examples/use_rust/nrf52840/src/macros.rs index ed5640ce3..441e3e2dc 100644 --- a/examples/use_rust/nrf52840/src/macros.rs +++ b/examples/use_rust/nrf52840/src/macros.rs @@ -1,8 +1,8 @@ macro_rules! config_matrix_pins_nrf { (peripherals: $p:ident, input: [$($in_pin:ident), *], output: [$($out_pin:ident), +]) => { { - let mut output_pins = [$(Output::new(AnyPin::from($p.$out_pin), embassy_nrf::gpio::Level::Low, embassy_nrf::gpio::OutputDrive::Standard)), +]; - let input_pins = [$(Input::new(AnyPin::from($p.$in_pin), embassy_nrf::gpio::Pull::Down)), +]; + let mut output_pins = [$(Output::new($p.$out_pin, embassy_nrf::gpio::Level::Low, embassy_nrf::gpio::OutputDrive::Standard)), +]; + let input_pins = [$(Input::new($p.$in_pin, embassy_nrf::gpio::Pull::Down)), +]; output_pins.iter_mut().for_each(|p| { p.set_low(); }); diff --git a/examples/use_rust/nrf52840/src/main.rs b/examples/use_rust/nrf52840/src/main.rs index 0148d9431..cd2f50b64 100644 --- a/examples/use_rust/nrf52840/src/main.rs +++ b/examples/use_rust/nrf52840/src/main.rs @@ -7,32 +7,26 @@ mod keymap; mod vial; use defmt::info; -use defmt_rtt as _; use embassy_executor::Spawner; -use embassy_nrf::{ - bind_interrupts, - gpio::{AnyPin, Input, Output}, - interrupt::InterruptExt, - nvmc::Nvmc, - peripherals, - usb::{self, vbus_detect::HardwareVbusDetect, Driver}, -}; +use embassy_nrf::gpio::{Input, Output}; +use embassy_nrf::interrupt::InterruptExt; +use embassy_nrf::nvmc::Nvmc; +use embassy_nrf::usb::vbus_detect::HardwareVbusDetect; +use embassy_nrf::usb::{self, Driver}; +use embassy_nrf::{bind_interrupts, peripherals}; use keymap::{COL, ROW}; -use panic_probe as _; -use rmk::{ - channel::EVENT_CHANNEL, - config::{ControllerConfig, RmkConfig, VialConfig}, - debounce::default_debouncer::DefaultDebouncer, - futures::future::join3, - initialize_keymap_and_storage, - input_device::Runnable, - keyboard::Keyboard, - light::LightController, - matrix::Matrix, - run_devices, run_rmk, - storage::async_flash_wrapper, -}; +use rmk::channel::EVENT_CHANNEL; +use rmk::config::{ControllerConfig, RmkConfig, VialConfig}; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::futures::future::join3; +use rmk::input_device::Runnable; +use rmk::keyboard::Keyboard; +use rmk::light::LightController; +use rmk::matrix::Matrix; +use rmk::storage::async_flash_wrapper; +use rmk::{initialize_keymap_and_storage, run_devices, run_rmk}; use vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; +use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { USBD => usb::InterruptHandler; @@ -57,7 +51,8 @@ async fn main(_spawner: Spawner) { let driver = Driver::new(p.USBD, Irqs, HardwareVbusDetect::new(Irqs)); // Pin config - let (input_pins, output_pins) = config_matrix_pins_nrf!(peripherals: p, input: [P0_07, P0_08, P0_11, P0_12], output: [P0_13, P0_14, P0_15]); + let (input_pins, output_pins) = + config_matrix_pins_nrf!(peripherals: p, input: [P0_07, P0_08, P0_11, P0_12], output: [P0_13, P0_14, P0_15]); // Use internal flash to emulate eeprom let flash = async_flash_wrapper(Nvmc::new(p.NVMC)); @@ -70,7 +65,7 @@ async fn main(_spawner: Spawner) { // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let (keymap, storage) = initialize_keymap_and_storage( + let (keymap, mut storage) = initialize_keymap_and_storage( &mut default_keymap, flash, rmk_config.storage_config, @@ -84,8 +79,7 @@ async fn main(_spawner: Spawner) { let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); // Initialize the light controller - let light_controller: LightController = - LightController::new(ControllerConfig::default().light_config); + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); // Start join3( @@ -93,7 +87,7 @@ async fn main(_spawner: Spawner) { (matrix) => EVENT_CHANNEL, ), keyboard.run(), - run_rmk(&keymap, driver, storage, light_controller, rmk_config), + run_rmk(&keymap, driver, &mut storage, &mut light_controller, rmk_config), ) .await; } diff --git a/examples/use_rust/nrf52840/src/vial.rs b/examples/use_rust/nrf52840/src/vial.rs index a6fde2d4a..7e9b5ab12 100644 --- a/examples/use_rust/nrf52840/src/vial.rs +++ b/examples/use_rust/nrf52840/src/vial.rs @@ -1,28 +1,3 @@ // Vial config is automatically generated by `build.rs`, according to `vial.json` // Please put `vial.json` at your project's root include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); - -// Or you can manually generate vial config then put here -// pub const VIAL_KEYBOARD_ID: &[u8; 8] = &[0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; -// pub const VIAL_KEYBOARD_DEF: &[u8; 308] = &[ -// 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, -// 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, -// 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, -// 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, -// 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, 0x16, 0x4E, 0xEA, 0x09, -// 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, 0xA2, -// 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, -// 0xEE, 0x5C, 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, -// 0x43, 0x9A, 0x38, 0x26, 0x8C, 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, -// 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, -// 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, 0x61, 0x96, 0xFE, 0x27, 0x7B, -// 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, 0xA9, 0x09, -// 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, -// 0x1F, 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, -// 0xFE, 0xE7, 0x80, 0xCA, 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, -// 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, -// 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, -// 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, 0x01, 0x8D, 0x02, -// 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, -// 0x00, 0x04, 0x59, 0x5A, -// ]; diff --git a/examples/use_rust/nrf52840/vial.json b/examples/use_rust/nrf52840/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_rust/nrf52840/vial.json +++ b/examples/use_rust/nrf52840/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/nrf52840_ble/.cargo/config.toml b/examples/use_rust/nrf52840_ble/.cargo/config.toml index 784fa95f7..04f50ba00 100644 --- a/examples/use_rust/nrf52840_ble/.cargo/config.toml +++ b/examples/use_rust/nrf52840_ble/.cargo/config.toml @@ -1,38 +1,8 @@ -[target.thumbv7m-none-eabi] -# uncomment this to make `cargo run` execute programs on QEMU -# runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" - [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -# Have to use simmsb's elf2uf2 fork to flash https://github.com/simmsb/elf2uf2-rs -# runner = "elf2uf2-rs -d" runner = "probe-rs run --chip nRF52840_xxAA" -linker = "flip-link" -rustflags = [ - # Previously, the linker arguments --nmagic and -Tlink.x were set here. - # They are now set by build.rs instead. The linker argument can still - # only be set here, if a custom linker is needed. - - # By default, the LLD linker is used, which is shipped with the Rust - # toolchain. If you run into problems with LLD, you can switch to the - # GNU linker by uncommenting this line: - # "-C", "linker=arm-none-eabi-ld", - - # If you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by uncommenting the three lines below: - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] [build] -# Pick ONE of these default compilation targets -# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ -# target = "thumbv7m-none-eabi" # Cortex-M3 -# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) -# target = "thumbv8m.base-none-eabi" # Cortex-M23 -# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) -# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) [env] DEFMT_LOG = "debug" \ No newline at end of file diff --git a/examples/use_rust/nrf52840_ble/Cargo.lock b/examples/use_rust/nrf52840_ble/Cargo.lock index 753c6b209..6901e3462 100644 --- a/examples/use_rust/nrf52840_ble/Cargo.lock +++ b/examples/use_rust/nrf52840_ble/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -78,6 +89,32 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "bindgen" +version = "0.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" +dependencies = [ + "bitflags 2.9.0", + "cexpr", + "clang-sys", + "itertools", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.100", +] + [[package]] name = "bitfield" version = "0.13.2" @@ -92,13 +129,13 @@ checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" [[package]] name = "bitfield-struct" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bedc5f4fa33bdc993f9b8ba7369d1b74fcdafa958924a0a54de6707e360de692" +checksum = "2be5a46ba01b60005ae2c51a36a29cfe134bcacae2dd5cedcd4615fbaad1494b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] @@ -109,9 +146,34 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bt-hci" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] [[package]] name = "bumpalo" @@ -121,9 +183,9 @@ checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "bytemuck" -version = "1.21.0" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" +checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" [[package]] name = "byteorder" @@ -143,13 +205,22 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.7" +version = "1.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7" +checksum = "525046617d8376e3db1deffb079e91cef90a89fc3ca5c185bbf8c9ecdd15cd5c" dependencies = [ "shlex", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -158,16 +229,48 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets", + "windows-link", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", ] [[package]] @@ -178,9 +281,9 @@ checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" [[package]] name = "const-gen" -version = "1.6.5" +version = "1.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb4caa28784488578a9aa32e0a33f0543d961345fc25efc3f04243be3fa6299" +checksum = "6d7617801a02ebd66905a39f5a15390bfb7d6ab90316fdbf7dc36a1161ffb56b" dependencies = [ "const-gen-derive", ] @@ -196,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -231,7 +340,16 @@ checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", ] [[package]] @@ -251,85 +369,90 @@ checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] name = "crunchy" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "rand_core", + "subtle", + "zeroize", ] [[package]] -name = "darling" -version = "0.20.10" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "generic-array", + "typenum", ] [[package]] -name = "darling_core" -version = "0.13.4" +name = "darling" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.20.10" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", - "syn 2.0.95", + "strsim", + "syn 2.0.100", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.95", + "generic-array", +] + +[[package]] +name = "defmt" +version = "0.3.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" +dependencies = [ + "defmt 1.0.1", ] [[package]] name = "defmt" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -337,53 +460,108 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", ] [[package]] name = "document-features" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" dependencies = [ "litrs", ] +[[package]] +name = "doxygen-rs" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "415b6ec780d34dcf624666747194393603d0373b7141eef01d12ee58881507d9" +dependencies = [ + "phf", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e)", "embassy-sync", "embassy-time", "embedded-hal 0.2.7", @@ -397,12 +575,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -410,22 +587,20 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -433,24 +608,30 @@ name = "embassy-hal-internal" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" +dependencies = [ + "num-traits", +] + +[[package]] +name = "embassy-hal-internal" +version = "0.2.0" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] [[package]] name = "embassy-net-driver" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" [[package]] name = "embassy-net-driver-channel" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4818c32afec43e3cae234f324bad9a976c9aa7501022d26ff60a4017a1a006b7" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "embassy-futures", "embassy-net-driver", @@ -460,18 +641,17 @@ dependencies = [ [[package]] name = "embassy-nrf" version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7494efe1e0183568327c7e681d4b77ed5241921dcb5976426d9a65b65a0c81" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "cfg-if", "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", - "embassy-hal-internal", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e)", "embassy-sync", "embassy-time", "embassy-time-driver", @@ -491,13 +671,12 @@ dependencies = [ [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -507,12 +686,11 @@ dependencies = [ [[package]] name = "embassy-time" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -524,8 +702,7 @@ dependencies = [ [[package]] name = "embassy-time-driver" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "document-features", ] @@ -533,8 +710,7 @@ dependencies = [ [[package]] name = "embassy-time-queue-utils" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "embassy-executor", "heapless 0.8.0", @@ -543,10 +719,9 @@ dependencies = [ [[package]] name = "embassy-usb" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -559,10 +734,9 @@ dependencies = [ [[package]] name = "embassy-usb-driver" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -581,7 +755,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -590,7 +764,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -600,7 +774,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -609,7 +783,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -636,15 +810,25 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "ff" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] [[package]] name = "fixed" -version = "1.28.0" +version = "1.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a" +checksum = "707070ccf8c4173548210893a0186e29c266901b71ed20cd9e2ca0193dfe95c3" dependencies = [ "az", "bytemuck", @@ -688,6 +872,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -702,7 +896,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] @@ -731,11 +925,39 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" -version = "2.4.1" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" dependencies = [ "cfg-if", "crunchy", @@ -794,20 +1016,40 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "iana-time-zone" -version = "0.1.61" +version = "0.1.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", "windows-core", ] @@ -829,14 +1071,32 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "indexmap" -version = "2.7.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -861,9 +1121,19 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.169" +version = "0.2.171" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" + +[[package]] +name = "libloading" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +dependencies = [ + "cfg-if", + "windows-targets", +] [[package]] name = "litrs" @@ -883,9 +1153,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "lzma-sys" @@ -904,6 +1174,12 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "nb" version = "0.1.3" @@ -920,52 +1196,78 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" [[package]] -name = "nrf-pac" -version = "0.1.0" +name = "nom" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ - "cortex-m", - "cortex-m-rt", + "memchr", + "minimal-lexical", ] [[package]] -name = "nrf-softdevice" +name = "nrf-mpsl" version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" dependencies = [ "cortex-m", "critical-section", - "defmt", - "embassy-futures", + "defmt 0.3.100", + "embassy-nrf", "embassy-sync", + "embedded-io", "embedded-storage", "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "nrf-softdevice-s140", - "num_enum", + "nrf-mpsl-sys", ] [[package]] -name = "nrf-softdevice-macro" +name = "nrf-mpsl-sys" version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", + "bindgen", + "doxygen-rs", ] [[package]] -name = "nrf-softdevice-s140" -version = "0.1.2" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +name = "nrf-pac" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" +dependencies = [ + "cortex-m", + "cortex-m-rt", +] + +[[package]] +name = "nrf-sdc" +version = "0.1.0" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" +dependencies = [ + "bt-hci", + "critical-section", + "defmt 0.3.100", + "embassy-hal-internal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "embassy-nrf", + "embassy-sync", + "embedded-io", + "embedded-io-async", + "nrf-mpsl", + "nrf-sdc-sys", + "rand_core", +] + +[[package]] +name = "nrf-sdc-sys" +version = "0.1.0" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" +dependencies = [ + "bindgen", + "doxygen-rs", + "nrf-mpsl-sys", + "winnow 0.6.26", +] [[package]] name = "num-traits" @@ -993,27 +1295,33 @@ checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] name = "once_cell" -version = "1.20.2" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "p256" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" dependencies = [ - "critical-section", - "portable-atomic", + "elliptic-curve", + "primeorder", ] [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1022,6 +1330,93 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -1036,15 +1431,15 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" [[package]] name = "postcard" @@ -1053,7 +1448,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1070,14 +1465,32 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" -version = "0.2.27" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "483f8c21f64f3ea09fe0f30f5d48c3e8eefe5dac9129f0075f76593b4c1da705" +checksum = "664ec5419c51e34154eec046ebcba56312d5a2fc3b09a06da188e1ad21afadf6" dependencies = [ "proc-macro2", - "syn 2.0.95", + "syn 2.0.100", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", ] [[package]] @@ -1099,27 +1512,46 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1164,7 +1596,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1180,16 +1612,16 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", - "once_cell", "paste", "postcard", + "rand_core", "rmk-macro", "sequential-storage", "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1198,14 +1630,16 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", "serde", "serde_derive", - "syn 2.0.95", + "syn 2.0.100", "toml", ] @@ -1213,21 +1647,33 @@ dependencies = [ name = "rmk-nrf52840" version = "0.2.0" dependencies = [ + "bt-hci", "const-gen", "cortex-m", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", - "embassy-futures", "embassy-nrf", "embassy-time", "json", + "nrf-mpsl", + "nrf-sdc", "panic-probe", + "rand", + "rand_chacha", + "rand_core", "rmk", + "static_cell", "xz2", ] +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1243,14 +1689,14 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.24", + "semver 1.0.26", ] [[package]] name = "rustversion" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] name = "scopeguard" @@ -1258,6 +1704,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1269,9 +1728,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" [[package]] name = "semver-parser" @@ -1281,32 +1740,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] [[package]] name = "serde" -version = "1.0.217" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.217" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] @@ -1318,12 +1777,29 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "spin" version = "0.9.8" @@ -1360,15 +1836,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1383,9 +1859,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.95" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", @@ -1394,29 +1870,29 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.9" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.9" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] name = "toml" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" dependencies = [ "serde", "serde_spanned", @@ -1435,28 +1911,70 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.22" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.7.6", +] + +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", + "uuid", ] [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "ucd-trie" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "unicode-ident" -version = "1.0.14" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "usb-device" @@ -1464,7 +1982,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1475,7 +1993,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -1509,9 +2027,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.11.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" [[package]] name = "vcell" @@ -1562,7 +2080,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", "wasm-bindgen-shared", ] @@ -1584,7 +2102,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1600,11 +2118,61 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.52.0" +version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980" dependencies = [ - "windows-targets", + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "windows-link" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" + +[[package]] +name = "windows-result" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97" +dependencies = [ + "windows-link", ] [[package]] @@ -1673,9 +2241,18 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.22" +version = "0.6.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e90edd2ac1aa278a5c4599b1d89cf03074b610800f866d4026dc199d7929a28" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39281189af81c07ec09db316b302a3e67bf9bd7cbf6c820b50e35fee9c2fa980" +checksum = "63d3fcd9bba44b03821e7d699eeee959f3126dcc4aa8e4ae18ec617c2a5cea10" dependencies = [ "memchr", ] @@ -1695,7 +2272,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -1706,5 +2292,22 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", ] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/nrf52840_ble/Cargo.toml b/examples/use_rust/nrf52840_ble/Cargo.toml index b59c77693..a750fc457 100644 --- a/examples/use_rust/nrf52840_ble/Cargo.toml +++ b/examples/use_rust/nrf52840_ble/Cargo.toml @@ -10,11 +10,19 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk", features = [ - "nrf52840_ble", - "col2row", - "async_matrix", +rmk = { path = "../../../rmk", features = ["async_matrix", "nrf52840_ble", "adafruit_bl"] } +nrf-sdc = { version = "0.1.0", default-features = false, features = [ + "defmt", + "peripheral", + "nrf52840", ] } +nrf-mpsl = { version = "0.1.0", default-features = false, features = [ + "defmt", + "critical-section-impl", + "nrf52840", +] } +bt-hci = { version = "0.3.0", default-features = false, features = ["defmt"] } + cortex-m = "0.7.7" cortex-m-rt = "0.7.5" embassy-time = { version = "0.4", features = ["tick-hz-32_768", "defmt"] } @@ -29,15 +37,29 @@ embassy-nrf = { version = "0.3.1", features = [ ] } embassy-executor = { version = "0.7", features = [ "defmt", - "task-arena-size-32768", "arch-cortex-m", "executor-thread", ] } -embassy-futures = { version = "0.1", features = ["defmt"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } +static_cell = "2" + +rand = { version = "0.8.4", default-features = false } +rand_core = { version = "0.6" } +rand_chacha = { version = "0.3", default-features = false } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-usb = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +nrf-sdc = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "4f2af99b87ae07c0b5634d32e4a62e26876e5be3" } +nrf-mpsl = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "4f2af99b87ae07c0b5634d32e4a62e26876e5be3" } +# bt-hci = { git = "https://github.com/embassy-rs/bt-hci.git", rev = "3755da87d0ef8660c5f9d4694b928ad7f679299a" } [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_rust/nrf52840_ble/README.md b/examples/use_rust/nrf52840_ble/README.md index 2d70977d7..c1689e48c 100644 --- a/examples/use_rust/nrf52840_ble/README.md +++ b/examples/use_rust/nrf52840_ble/README.md @@ -1,10 +1,10 @@ # nrf52840 BLE example -RMK supports [nice!nano](https://nicekeyboards.com/) as well as any custom nrf52840 board you have. +RMK supports [nice!nano](https://nicekeyboards.com/nice-nano) as well as any custom nrf52840 board you have. ## Nice!nano support -nice!nano has a bootloader built-in, which supports .uf2 firmware format. That means you don't need any debugging probe to flash your firmware. RMK uses `cargo-make` tool to generate .uf2 firmware, then generation processing is defined in `Makefile.toml` +nice!nano has the [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader) built-in, which supports .uf2 firmware format. That means you don't need any debugging probe to flash your firmware. RMK uses `cargo-make` tool to generate .uf2 firmware, then generation processing is defined in `Makefile.toml` The following are steps of how to get .uf2 firmware work in RMK: @@ -24,24 +24,39 @@ Note that RMK will switch to USB mode if an USB cable is connected. Remember to You can also check the instruction [here](https://nicekeyboards.com/docs/nice-nano/) for more info about nice!nano. -## With debug probe -With a debug probe, you can have the full control of you hardware. To use RMK you should have [nrf s140 softdevice 7.3.0](https://www.nordicsemi.com/Products/Development-software/s140/download) flashed to nrf52840 first. +## With debugging probe -The following are the detailed steps for flashing both nrf's softdevice and RMK firmware: +With a debugging probe, you can have the full control of you hardware. To use RMK you should check whether the bootloader is flashed to your board first. To use RMK with existing bootloader such as [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader), check `memory.x` in the project root, ensure that the flash starts from 0x00001000 + +``` +MEMORY +{ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 WITH Adafruit nRF52 bootloader */ + FLASH : ORIGIN = 0x00001000, LENGTH = 1020K + RAM : ORIGIN = 0x20000008, LENGTH = 255K +} +``` + +Or you can use RMK without bootloader: + +``` +MEMORY +{ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 */ + FLASH : ORIGIN = 0x00000000, LENGTH = 1024K + RAM : ORIGIN = 0x20000000, LENGTH = 256K +} +``` + +After you have `memory.x` set, use `cargo run --release` to flash the RMK firmware to your board: 1. Enter example folder: ```shell cd examples/use_rust/nrf52840_ble ``` -2. Erase the flash: - ```shell - probe-rs erase --chip nrf52840_xxAA - ``` -3. Flash softdevice firmware to flash: - ```shell - probe-rs download --verify --format hex --chip nRF52840_xxAA s140_nrf52_7.3.0_softdevice.hex - ``` -4. Compile, flash and run the example +2. Compile, flash and run the example ```shell cargo run --release ``` diff --git a/examples/use_rust/nrf52840_ble/build.rs b/examples/use_rust/nrf52840_ble/build.rs index 90ab55a4f..941ff7006 100644 --- a/examples/use_rust/nrf52840_ble/build.rs +++ b/examples/use_rust/nrf52840_ble/build.rs @@ -10,16 +10,16 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { // Generate vial config at the root of project - println!("cargo:rerun-if-changed=vial.json"); generate_vial_config(); // Put `memory.x` in our output directory and ensure it's @@ -56,14 +56,14 @@ fn main() { fn generate_vial_config() { // Generated vial config file + println!("cargo:rerun-if-changed=vial.json"); let out_file = Path::new(&env::var_os("OUT_DIR").unwrap()).join("config_generated.rs"); let p = Path::new("vial.json"); let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -79,6 +79,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/nrf52840_ble/memory.x b/examples/use_rust/nrf52840_ble/memory.x index 591f06f6f..3f9d5d2ec 100644 --- a/examples/use_rust/nrf52840_ble/memory.x +++ b/examples/use_rust/nrf52840_ble/memory.x @@ -1,13 +1,11 @@ MEMORY { - /* NOTE 1 K = 1 KiBi = 1024 bytes */ - /* FLASH : ORIGIN = 0x00000000, LENGTH = 1024K */ - /*RAM : ORIGIN = 0x20000000, LENGTH = 256K */ - - /* These values correspond to the NRF52840 with Softdevices S140 6.1.1 */ - /* FLASH : ORIGIN = 0x00026000, LENGTH = 824K */ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 WITH Adafruit nRF52 bootloader */ + FLASH : ORIGIN = 0x00001000, LENGTH = 1020K + RAM : ORIGIN = 0x20000008, LENGTH = 255K - /* These values correspond to the NRF52840 with Softdevices S140 7.3.0 */ - FLASH : ORIGIN = 0x00027000, LENGTH = 820K - RAM : ORIGIN = 0x20020000, LENGTH = 128K + /* These values correspond to the nRF52840 */ + /* FLASH : ORIGIN = 0x00000000, LENGTH = 1024K */ + /* RAM : ORIGIN = 0x20000000, LENGTH = 256K */ } \ No newline at end of file diff --git a/examples/use_rust/nrf52840_ble/src/macros.rs b/examples/use_rust/nrf52840_ble/src/macros.rs index ed5640ce3..441e3e2dc 100644 --- a/examples/use_rust/nrf52840_ble/src/macros.rs +++ b/examples/use_rust/nrf52840_ble/src/macros.rs @@ -1,8 +1,8 @@ macro_rules! config_matrix_pins_nrf { (peripherals: $p:ident, input: [$($in_pin:ident), *], output: [$($out_pin:ident), +]) => { { - let mut output_pins = [$(Output::new(AnyPin::from($p.$out_pin), embassy_nrf::gpio::Level::Low, embassy_nrf::gpio::OutputDrive::Standard)), +]; - let input_pins = [$(Input::new(AnyPin::from($p.$in_pin), embassy_nrf::gpio::Pull::Down)), +]; + let mut output_pins = [$(Output::new($p.$out_pin, embassy_nrf::gpio::Level::Low, embassy_nrf::gpio::OutputDrive::Standard)), +]; + let input_pins = [$(Input::new($p.$in_pin, embassy_nrf::gpio::Pull::Down)), +]; output_pins.iter_mut().for_each(|p| { p.set_low(); }); diff --git a/examples/use_rust/nrf52840_ble/src/main.rs b/examples/use_rust/nrf52840_ble/src/main.rs index 1f8199dd6..7a48d776b 100644 --- a/examples/use_rust/nrf52840_ble/src/main.rs +++ b/examples/use_rust/nrf52840_ble/src/main.rs @@ -1,53 +1,84 @@ #![no_std] #![no_main] +mod vial; #[macro_use] mod macros; mod keymap; -mod vial; -use defmt::info; -use defmt_rtt as _; +use defmt::{info, unwrap}; use embassy_executor::Spawner; -use embassy_nrf::{ - self as _, bind_interrupts, - gpio::{AnyPin, Input, Output}, - interrupt::{self, InterruptExt, Priority}, - peripherals::{self, SAADC}, - saadc::{self, AnyInput, Input as _, Saadc}, - usb::{self, vbus_detect::SoftwareVbusDetect, Driver}, -}; -use keymap::{COL, NUM_ENCODER, NUM_LAYER, ROW}; -use panic_probe as _; -use rmk::{ - ble::SOFTWARE_VBUS, - channel::EVENT_CHANNEL, - config::{ - BleBatteryConfig, ControllerConfig, KeyboardUsbConfig, RmkConfig, StorageConfig, VialConfig, - }, - debounce::default_debouncer::DefaultDebouncer, - futures::future::join4, - initialize_encoder_keymap_and_storage, initialize_nrf_sd_and_flash, - input_device::{ - adc::{AnalogEventType, NrfAdc}, - battery::BatteryProcessor, - rotary_encoder::{DefaultPhase, RotaryEncoder, RotaryEncoderProcessor}, - Runnable, - }, - keyboard::Keyboard, - light::LightController, - matrix::Matrix, - run_devices, run_processor_chain, run_rmk, -}; +use embassy_nrf::gpio::{Input, Output}; +use embassy_nrf::interrupt::{self, InterruptExt}; +use embassy_nrf::peripherals::{RNG, SAADC, USBD}; +use embassy_nrf::saadc::{self, AnyInput, Input as _, Saadc}; +use embassy_nrf::usb::vbus_detect::HardwareVbusDetect; +use embassy_nrf::usb::Driver; +use embassy_nrf::{bind_interrupts, pac, rng, usb, Peri}; +use keymap::{COL, ROW}; +use nrf_mpsl::Flash; +use nrf_sdc::mpsl::MultiprotocolServiceLayer; +use nrf_sdc::{self as sdc, mpsl}; +use rand_chacha::ChaCha12Rng; +use rand_core::SeedableRng; +use rmk::ble::trouble::build_ble_stack; +use rmk::channel::EVENT_CHANNEL; +use rmk::config::{BleBatteryConfig, ControllerConfig, KeyboardUsbConfig, RmkConfig, StorageConfig, VialConfig}; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::futures::future::join4; +use rmk::input_device::adc::{AnalogEventType, NrfAdc}; +use rmk::input_device::battery::BatteryProcessor; +use rmk::input_device::rotary_encoder::{DefaultPhase, RotaryEncoder, RotaryEncoderProcessor}; +use rmk::input_device::Runnable; +use rmk::keyboard::Keyboard; +use rmk::light::LightController; +use rmk::matrix::Matrix; +use rmk::{initialize_encoder_keymap_and_storage, run_devices, run_processor_chain, run_rmk, HostResources}; +use static_cell::StaticCell; use vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; +use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { - USBD => usb::InterruptHandler; + USBD => usb::InterruptHandler; SAADC => saadc::InterruptHandler; + RNG => rng::InterruptHandler; + EGU0_SWI0 => nrf_sdc::mpsl::LowPrioInterruptHandler; + CLOCK_POWER => nrf_sdc::mpsl::ClockInterruptHandler, usb::vbus_detect::InterruptHandler; + RADIO => nrf_sdc::mpsl::HighPrioInterruptHandler; + TIMER0 => nrf_sdc::mpsl::HighPrioInterruptHandler; + RTC0 => nrf_sdc::mpsl::HighPrioInterruptHandler; }); +#[embassy_executor::task] +async fn mpsl_task(mpsl: &'static MultiprotocolServiceLayer<'static>) -> ! { + mpsl.run().await +} + +/// How many outgoing L2CAP buffers per link +const L2CAP_TXQ: u8 = 3; + +/// How many incoming L2CAP buffers per link +const L2CAP_RXQ: u8 = 3; + +/// Size of L2CAP packets +const L2CAP_MTU: usize = 72; + +fn build_sdc<'d, const N: usize>( + p: nrf_sdc::Peripherals<'d>, + rng: &'d mut rng::Rng, + mpsl: &'d MultiprotocolServiceLayer, + mem: &'d mut sdc::Mem, +) -> Result, nrf_sdc::Error> { + sdc::Builder::new()? + .support_adv()? + .support_peripheral()? + .peripheral_count(1)? + .buffer_cfg(L2CAP_MTU as u8, L2CAP_MTU as u8, L2CAP_TXQ, L2CAP_RXQ)? + .build(p, rng, mpsl, mem) +} + /// Initializes the SAADC peripheral in single-ended mode on the given pin. -fn init_adc(adc_pin: AnyInput, adc: SAADC) -> Saadc<'static, 1> { +fn init_adc(adc_pin: AnyInput, adc: Peri<'static, SAADC>) -> Saadc<'static, 1> { // Then we initialize the ADC. We are only using one channel in this example. let config = saadc::Config::default(); let channel_cfg = saadc::ChannelConfig::single_ended(adc_pin.degrade_saadc()); @@ -56,35 +87,66 @@ fn init_adc(adc_pin: AnyInput, adc: SAADC) -> Saadc<'static, 1> { saadc } +fn ble_addr() -> [u8; 6] { + let ficr = pac::FICR; + let high = u64::from(ficr.deviceid(1).read()); + let addr = high << 32 | u64::from(ficr.deviceid(0).read()); + let addr = addr | 0x0000_c000_0000_0000; + unwrap!(addr.to_le_bytes()[..6].try_into()) +} + #[embassy_executor::main] async fn main(spawner: Spawner) { - info!("Hello NRF BLE!"); + info!("Hello RMK BLE!"); + // Initialize the peripherals and nrf-sdc controller let mut nrf_config = embassy_nrf::config::Config::default(); - nrf_config.gpiote_interrupt_priority = Priority::P3; - nrf_config.time_interrupt_priority = Priority::P3; - interrupt::USBD.set_priority(interrupt::Priority::P2); - interrupt::CLOCK_POWER.set_priority(interrupt::Priority::P2); + nrf_config.dcdc.reg0_voltage = Some(embassy_nrf::config::Reg0Voltage::_3v3); + nrf_config.dcdc.reg0 = true; + nrf_config.dcdc.reg1 = true; let p = embassy_nrf::init(nrf_config); - // Disable external HF clock by default, reduce power consumption - // info!("Enabling ext hfosc..."); - // ::embassy_nrf::pac::CLOCK.tasks_hfclkstart().write_value(1); - // while ::embassy_nrf::pac::CLOCK.events_hfclkstarted().read() != 1 {} - - // Pin config - let (input_pins, output_pins) = config_matrix_pins_nrf!(peripherals: p, input: [P1_11, P1_10, P0_03, P0_28, P1_13], output: [P0_30, P0_31, P0_29, P0_02, P0_05, P1_09, P0_13, P0_24, P0_09, P0_10, P1_00, P1_02, P1_03, P1_05]); - - // Usb config - let software_vbus = SOFTWARE_VBUS.get_or_init(|| SoftwareVbusDetect::new(true, false)); - let driver = Driver::new(p.USBD, Irqs, software_vbus); - - // Initialize the ADC. We are only using one channel for detecting battery level - let adc_pin = p.P0_04.degrade_saadc(); - let is_charging_pin = Input::new(AnyPin::from(p.P0_07), embassy_nrf::gpio::Pull::Up); - let charging_led = Output::new( - AnyPin::from(p.P0_08), - embassy_nrf::gpio::Level::Low, - embassy_nrf::gpio::OutputDrive::Standard, + let mpsl_p = mpsl::Peripherals::new(p.RTC0, p.TIMER0, p.TEMP, p.PPI_CH19, p.PPI_CH30, p.PPI_CH31); + let lfclk_cfg = mpsl::raw::mpsl_clock_lfclk_cfg_t { + source: mpsl::raw::MPSL_CLOCK_LF_SRC_RC as u8, + rc_ctiv: mpsl::raw::MPSL_RECOMMENDED_RC_CTIV as u8, + rc_temp_ctiv: mpsl::raw::MPSL_RECOMMENDED_RC_TEMP_CTIV as u8, + accuracy_ppm: mpsl::raw::MPSL_DEFAULT_CLOCK_ACCURACY_PPM as u16, + skip_wait_lfclk_started: mpsl::raw::MPSL_DEFAULT_SKIP_WAIT_LFCLK_STARTED != 0, + }; + static MPSL: StaticCell = StaticCell::new(); + static SESSION_MEM: StaticCell> = StaticCell::new(); + let mpsl = MPSL.init(unwrap!(mpsl::MultiprotocolServiceLayer::with_timeslots( + mpsl_p, + Irqs, + lfclk_cfg, + SESSION_MEM.init(mpsl::SessionMem::new()) + ))); + spawner.must_spawn(mpsl_task(&*mpsl)); + let sdc_p = sdc::Peripherals::new( + p.PPI_CH17, p.PPI_CH18, p.PPI_CH20, p.PPI_CH21, p.PPI_CH22, p.PPI_CH23, p.PPI_CH24, p.PPI_CH25, p.PPI_CH26, + p.PPI_CH27, p.PPI_CH28, p.PPI_CH29, ); + let mut rng = rng::Rng::new(p.RNG, Irqs); + let mut rng_gen = ChaCha12Rng::from_rng(&mut rng).unwrap(); + let mut sdc_mem = sdc::Mem::<4096>::new(); + let sdc = unwrap!(build_sdc(sdc_p, &mut rng, mpsl, &mut sdc_mem)); + let central_addr = ble_addr(); + info!("Local address: {:x}", central_addr); + let mut host_resources = HostResources::new(); + let stack = build_ble_stack(sdc, central_addr, &mut rng_gen, &mut host_resources).await; + + // Initialize usb driver + let driver = Driver::new(p.USBD, Irqs, HardwareVbusDetect::new(Irqs)); + + // Initialize flash + let flash = Flash::take(mpsl, p.NVMC); + + // Initialize IO Pins + let (input_pins, output_pins) = config_matrix_pins_nrf!(peripherals: p, input: [P0_30, P0_31, P0_29, P0_27, P1_13], output: [P0_28, P0_03, P1_10, P0_02, P0_06, P1_11, P0_13, P0_24, P0_09, P0_10, P1_00, P1_02, P1_03, P1_05]); + + // Initialize the ADC. + // We are only using one channel for detecting battery level + let adc_pin = p.P0_05.degrade_saadc(); + let is_charging_pin = Input::new(p.P1_09, embassy_nrf::gpio::Pull::Up); let saadc = init_adc(adc_pin, p.SAADC); // Wait for ADC calibration. saadc.calibrate().await; @@ -98,10 +160,9 @@ async fn main(spawner: Spawner) { serial_number: "vial:f64c2b3c:000001", }; let vial_config = VialConfig::new(VIAL_KEYBOARD_ID, VIAL_KEYBOARD_DEF); - let ble_battery_config = - BleBatteryConfig::new(Some(is_charging_pin), true, Some(charging_led), false); + let ble_battery_config = BleBatteryConfig::new(Some(is_charging_pin), true, None, false); let storage_config = StorageConfig { - start_addr: 0, + start_addr: 0xA0000, // FIXME: use 0x70000 after we can build without softdevice controller num_sectors: 6, ..Default::default() }; @@ -113,43 +174,43 @@ async fn main(spawner: Spawner) { ..Default::default() }; - // Initialize the Softdevice and flash - let (sd, flash) = - initialize_nrf_sd_and_flash(rmk_config.usb_config.product_name, spawner, None); - + // Initialze keyboard stuffs // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let mut default_encoder_map = keymap::get_default_encoder_map(); - let (keymap, storage) = initialize_encoder_keymap_and_storage( + let mut encoder_map = keymap::get_default_encoder_map(); + let (keymap, mut storage) = initialize_encoder_keymap_and_storage( &mut default_keymap, - &mut default_encoder_map, + &mut encoder_map, flash, rmk_config.storage_config, rmk_config.behavior_config.clone(), ) .await; - // Initialize the matrix + keyboard - let mut keyboard: Keyboard<'_, ROW, COL, NUM_LAYER, NUM_ENCODER> = - Keyboard::new(&keymap, rmk_config.behavior_config.clone()); + // Initialize the matrix and keyboard let debouncer = DefaultDebouncer::::new(); let mut matrix = Matrix::<_, _, _, ROW, COL>::new(input_pins, output_pins, debouncer); - // let mut matrix = rmk::matrix::TestMatrix::::new(); - - // Initialize the light controller - let light_controller: LightController = - LightController::new(ControllerConfig::default().light_config); + // let mut matrix = TestMatrix::::new(); + let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); - let pin_a = Input::new(AnyPin::from(p.P1_06), embassy_nrf::gpio::Pull::None); - let pin_b = Input::new(AnyPin::from(p.P1_04), embassy_nrf::gpio::Pull::None); + // Initialize the encoder + let pin_a = Input::new(p.P1_06, embassy_nrf::gpio::Pull::None); + let pin_b = Input::new(p.P1_04, embassy_nrf::gpio::Pull::None); let mut encoder = RotaryEncoder::with_phase(pin_a, pin_b, DefaultPhase, 0); - let mut adc_device = NrfAdc::new(saadc, [AnalogEventType::Battery], 12000, None); + let mut adc_device = NrfAdc::new( + saadc, + [AnalogEventType::Battery], + embassy_time::Duration::from_secs(12), + None, + ); let mut batt_proc = BatteryProcessor::new(2000, 2806, &keymap); let mut encoder_processor = RotaryEncoderProcessor::new(&keymap); - // Start + // Initialize the light controller + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); + join4( run_devices! ( (matrix, encoder, adc_device) => EVENT_CHANNEL, @@ -158,7 +219,7 @@ async fn main(spawner: Spawner) { EVENT_CHANNEL => [encoder_processor, batt_proc], }, keyboard.run(), // Keyboard is special - run_rmk(&keymap, driver, storage, light_controller, rmk_config, sd), + run_rmk(&keymap, driver, &stack, &mut storage, &mut light_controller, rmk_config), ) .await; } diff --git a/examples/use_rust/nrf52840_ble/src/vial.rs b/examples/use_rust/nrf52840_ble/src/vial.rs index a6fde2d4a..43538049a 100644 --- a/examples/use_rust/nrf52840_ble/src/vial.rs +++ b/examples/use_rust/nrf52840_ble/src/vial.rs @@ -1,28 +1,3 @@ -// Vial config is automatically generated by `build.rs`, according to `vial.json` +// Use `build.rs` automatically generate vial config, according to `vial.json` // Please put `vial.json` at your project's root include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); - -// Or you can manually generate vial config then put here -// pub const VIAL_KEYBOARD_ID: &[u8; 8] = &[0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; -// pub const VIAL_KEYBOARD_DEF: &[u8; 308] = &[ -// 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, -// 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, -// 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, -// 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, -// 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, 0x16, 0x4E, 0xEA, 0x09, -// 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, 0xA2, -// 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, -// 0xEE, 0x5C, 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, -// 0x43, 0x9A, 0x38, 0x26, 0x8C, 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, -// 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, -// 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, 0x61, 0x96, 0xFE, 0x27, 0x7B, -// 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, 0xA9, 0x09, -// 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, -// 0x1F, 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, -// 0xFE, 0xE7, 0x80, 0xCA, 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, -// 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, -// 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, -// 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, 0x01, 0x8D, 0x02, -// 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, -// 0x00, 0x04, 0x59, 0x5A, -// ]; diff --git a/examples/use_rust/nrf52840_ble/vial.json b/examples/use_rust/nrf52840_ble/vial.json index e1e82c617..bf6d7b7c0 100644 --- a/examples/use_rust/nrf52840_ble/vial.json +++ b/examples/use_rust/nrf52840_ble/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", @@ -134,9 +134,7 @@ { "w": 2.25 }, - "2,13", - {"x":0.75}, - "2,12" + "2,13" ], [ { diff --git a/examples/use_rust/nrf52840_ble_split/.cargo/config.toml b/examples/use_rust/nrf52840_ble_split/.cargo/config.toml index 62e1ed482..ec9a13c53 100644 --- a/examples/use_rust/nrf52840_ble_split/.cargo/config.toml +++ b/examples/use_rust/nrf52840_ble_split/.cargo/config.toml @@ -1,36 +1,9 @@ -[target.thumbv7m-none-eabi] -# uncomment this to make `cargo run` execute programs on QEMU -# runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" - [target.'cfg(all(target_arch = "arm", target_os = "none"))'] runner = ["probe-rs", "run", "--chip", "nRF52840_xxAA", "--log-format", "{L:severity} {t} {s}"] linker = "flip-link" -rustflags = [ - # Previously, the linker arguments --nmagic and -Tlink.x were set here. - # They are now set by build.rs instead. The linker argument can still - # only be set here, if a custom linker is needed. - - # By default, the LLD linker is used, which is shipped with the Rust - # toolchain. If you run into problems with LLD, you can switch to the - # GNU linker by uncommenting this line: - # "-C", "linker=arm-none-eabi-ld", - - # If you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by uncommenting the three lines below: - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] [build] -# Pick ONE of these default compilation targets -# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ -# target = "thumbv7m-none-eabi" # Cortex-M3 -# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) -# target = "thumbv8m.base-none-eabi" # Cortex-M23 -# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) -# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) [env] DEFMT_LOG = "debug" \ No newline at end of file diff --git a/examples/use_rust/nrf52840_ble_split/Cargo.lock b/examples/use_rust/nrf52840_ble_split/Cargo.lock index c53c25546..3f02c8783 100644 --- a/examples/use_rust/nrf52840_ble_split/Cargo.lock +++ b/examples/use_rust/nrf52840_ble_split/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -78,6 +89,32 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "bindgen" +version = "0.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" +dependencies = [ + "bitflags 2.9.0", + "cexpr", + "clang-sys", + "itertools", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.99", +] + [[package]] name = "bitfield" version = "0.13.2" @@ -113,6 +150,31 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -150,6 +212,15 @@ dependencies = [ "shlex", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -170,6 +241,38 @@ dependencies = [ "windows-link", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -196,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -234,6 +343,15 @@ dependencies = [ "syn 2.0.99", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -256,13 +374,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", ] [[package]] @@ -271,65 +401,58 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", + "strsim", + "syn 2.0.99", ] [[package]] -name = "darling_core" +name = "darling_macro" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", + "darling_core", "quote", - "strsim 0.11.1", "syn 2.0.99", ] [[package]] -name = "darling_macro" -version = "0.13.4" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.13.4", - "quote", - "syn 1.0.109", + "generic-array", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "defmt" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.99", + "defmt 1.0.1", ] [[package]] name = "defmt" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -337,9 +460,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -350,21 +473,42 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", ] [[package]] @@ -376,14 +520,48 @@ dependencies = [ "litrs", ] +[[package]] +name = "doxygen-rs" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "415b6ec780d34dcf624666747194393603d0373b7141eef01d12ee58881507d9" +dependencies = [ + "phf", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e)", "embassy-sync", "embassy-time", "embedded-hal 0.2.7", @@ -397,12 +575,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -410,10 +587,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.99", @@ -422,10 +598,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -433,24 +608,30 @@ name = "embassy-hal-internal" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" +dependencies = [ + "num-traits", +] + +[[package]] +name = "embassy-hal-internal" +version = "0.2.0" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] [[package]] name = "embassy-net-driver" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" [[package]] name = "embassy-net-driver-channel" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4818c32afec43e3cae234f324bad9a976c9aa7501022d26ff60a4017a1a006b7" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "embassy-futures", "embassy-net-driver", @@ -460,18 +641,17 @@ dependencies = [ [[package]] name = "embassy-nrf" version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7494efe1e0183568327c7e681d4b77ed5241921dcb5976426d9a65b65a0c81" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "bitflags 2.9.0", "cfg-if", "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", - "embassy-hal-internal", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e)", "embassy-sync", "embassy-time", "embassy-time-driver", @@ -492,12 +672,11 @@ dependencies = [ [[package]] name = "embassy-sync" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -507,12 +686,11 @@ dependencies = [ [[package]] name = "embassy-time" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -524,8 +702,7 @@ dependencies = [ [[package]] name = "embassy-time-driver" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "document-features", ] @@ -533,8 +710,7 @@ dependencies = [ [[package]] name = "embassy-time-queue-utils" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "embassy-executor", "heapless 0.8.0", @@ -543,10 +719,9 @@ dependencies = [ [[package]] name = "embassy-usb" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -559,10 +734,9 @@ dependencies = [ [[package]] name = "embassy-usb-driver" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -581,7 +755,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -590,7 +764,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -600,7 +774,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -609,7 +783,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -640,6 +814,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.29.0" @@ -688,6 +872,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -731,6 +925,34 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" version = "2.4.1" @@ -794,10 +1016,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -837,6 +1078,24 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -865,6 +1124,16 @@ version = "0.2.170" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828" +[[package]] +name = "libloading" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +dependencies = [ + "cfg-if", + "windows-targets", +] + [[package]] name = "litrs" version = "0.4.1" @@ -904,6 +1173,12 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "nb" version = "0.1.3" @@ -920,52 +1195,78 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" [[package]] -name = "nrf-pac" -version = "0.1.0" +name = "nom" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ - "cortex-m", - "cortex-m-rt", + "memchr", + "minimal-lexical", ] [[package]] -name = "nrf-softdevice" +name = "nrf-mpsl" version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" dependencies = [ "cortex-m", "critical-section", - "defmt", - "embassy-futures", + "defmt 0.3.100", + "embassy-nrf", "embassy-sync", + "embedded-io", "embedded-storage", "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "nrf-softdevice-s140", - "num_enum", + "nrf-mpsl-sys", ] [[package]] -name = "nrf-softdevice-macro" +name = "nrf-mpsl-sys" version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", + "bindgen", + "doxygen-rs", ] [[package]] -name = "nrf-softdevice-s140" -version = "0.1.2" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" +name = "nrf-pac" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" +dependencies = [ + "cortex-m", + "cortex-m-rt", +] + +[[package]] +name = "nrf-sdc" +version = "0.1.0" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" +dependencies = [ + "bt-hci", + "critical-section", + "defmt 0.3.100", + "embassy-hal-internal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "embassy-nrf", + "embassy-sync", + "embedded-io", + "embedded-io-async", + "nrf-mpsl", + "nrf-sdc-sys", + "rand_core", +] + +[[package]] +name = "nrf-sdc-sys" +version = "0.1.0" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=4f2af99b87ae07c0b5634d32e4a62e26876e5be3#4f2af99b87ae07c0b5634d32e4a62e26876e5be3" +dependencies = [ + "bindgen", + "doxygen-rs", + "nrf-mpsl-sys", + "winnow 0.6.26", +] [[package]] name = "num-traits" @@ -1001,19 +1302,25 @@ name = "once_cell" version = "1.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" dependencies = [ - "critical-section", - "portable-atomic", + "elliptic-curve", + "primeorder", ] [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1022,6 +1329,93 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.99", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.99", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -1053,7 +1447,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1070,6 +1464,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" version = "0.2.29" @@ -1080,6 +1483,15 @@ dependencies = [ "syn 2.0.99", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1120,6 +1532,25 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1164,7 +1595,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1180,16 +1611,16 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", - "once_cell", "paste", "postcard", + "rand_core", "rmk-macro", "sequential-storage", "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1198,8 +1629,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1213,21 +1646,33 @@ dependencies = [ name = "rmk-nrf52840" version = "0.2.0" dependencies = [ + "bt-hci", "const-gen", "cortex-m", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", - "embassy-futures", "embassy-nrf", "embassy-time", "json", + "nrf-mpsl", + "nrf-sdc", "panic-probe", + "rand", + "rand_chacha", + "rand_core", "rmk", + "static_cell", "xz2", ] +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1258,6 +1703,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1285,7 +1743,7 @@ version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1318,12 +1776,29 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "spin" version = "0.9.8" @@ -1360,15 +1835,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1443,7 +1918,43 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.7.3", +] + +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.99", + "uuid", ] [[package]] @@ -1452,6 +1963,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.17" @@ -1464,7 +1981,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1475,7 +1992,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -1677,6 +2194,15 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winnow" +version = "0.6.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e90edd2ac1aa278a5c4599b1d89cf03074b610800f866d4026dc199d7929a28" +dependencies = [ + "memchr", +] + [[package]] name = "winnow" version = "0.7.3" @@ -1701,7 +2227,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -1714,3 +2249,20 @@ dependencies = [ "quote", "syn 2.0.99", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.99", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/nrf52840_ble_split/Cargo.toml b/examples/use_rust/nrf52840_ble_split/Cargo.toml index ca10032d2..1120e3dfc 100644 --- a/examples/use_rust/nrf52840_ble_split/Cargo.toml +++ b/examples/use_rust/nrf52840_ble_split/Cargo.toml @@ -12,10 +12,23 @@ license = "MIT OR Apache-2.0" [dependencies] rmk = { path = "../../../rmk", features = [ "nrf52840_ble", - "col2row", "split", "async_matrix", + "adafruit_bl", ] } +nrf-sdc = { version = "0.1.0", default-features = false, features = [ + "defmt", + "peripheral", + "central", + "nrf52840", +] } +nrf-mpsl = { version = "0.1.0", default-features = false, features = [ + "defmt", + "critical-section-impl", + "nrf52840", +] } +bt-hci = { version = "0.3.0", default-features = false, features = ["defmt"] } + cortex-m = "0.7.7" cortex-m-rt = "0.7.5" embassy-time = { version = "0.4", features = ["tick-hz-32_768", "defmt", "defmt-timestamp-uptime"] } @@ -30,14 +43,30 @@ embassy-nrf = { version = "0.3.1", features = [ ] } embassy-executor = { version = "0.7", features = [ "defmt", - "task-arena-size-32768", "arch-cortex-m", "executor-thread", ] } -embassy-futures = { version = "0.1", features = ["defmt"] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } +static_cell = "2" + +rand = { version = "0.8.4", default-features = false } +rand_core = { version = "0.6" } +rand_chacha = { version = "0.3", default-features = false } + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-usb = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +nrf-sdc = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "4f2af99b87ae07c0b5634d32e4a62e26876e5be3" } +nrf-mpsl = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "4f2af99b87ae07c0b5634d32e4a62e26876e5be3" } +# bt-hci = { git = "https://github.com/embassy-rs/bt-hci.git", rev = "3755da87d0ef8660c5f9d4694b928ad7f679299a" } + [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_rust/nrf52840_ble_split/README.md b/examples/use_rust/nrf52840_ble_split/README.md index b0d60ef35..e5a72f1d7 100644 --- a/examples/use_rust/nrf52840_ble_split/README.md +++ b/examples/use_rust/nrf52840_ble_split/README.md @@ -1,6 +1,6 @@ # nrf52840 BLE split example -RMK supports [nice!nano](https://nicekeyboards.com/) as well as any custom nrf52840 board you have. +RMK supports [nice!nano](https://nicekeyboards.com/nice-nano) as well as any custom nrf52840 board you have. ## Build firmware @@ -16,7 +16,7 @@ cargo build --release --bin peripheral ## Nice!nano support -nice!nano has a bootloader built-in, which supports .uf2 firmware format. That means you don't need any debugging probe to flash your firmware. RMK uses `cargo-make` tool to generate .uf2 firmware, then generation processing is defined in `Makefile.toml` +nice!nano has the [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader) built-in, which supports .uf2 firmware format. That means you don't need any debugging probe to flash your firmware. RMK uses `cargo-make` tool to generate .uf2 firmware, then generation processing is defined in `Makefile.toml` The following are steps of how to get .uf2 firmware work in RMK: @@ -36,24 +36,39 @@ Note that RMK will switch to USB mode if an USB cable is connected. Remember to You can also check the instruction [here](https://nicekeyboards.com/docs/nice-nano/) for more info about nice!nano. -## With debug probe -With a debug probe, you can have the full control of you hardware. To use RMK you should have [nrf s140 softdevice 7.3.0](https://www.nordicsemi.com/Products/Development-software/s140/download) flashed to nrf52840 first. +## With debugging probe -The following are the detailed steps for flashing both nrf's softdevice and RMK firmware: +With a debugging probe, you can have the full control of you hardware. To use RMK you should check whether the bootloader is flashed to your board first. To use RMK with existing bootloader such as [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader), check `memory.x` in the project root, ensure that the flash starts from 0x00001000 + +``` +MEMORY +{ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 WITH Adafruit nRF52 bootloader */ + FLASH : ORIGIN = 0x00001000, LENGTH = 1020K + RAM : ORIGIN = 0x20000008, LENGTH = 255K +} +``` + +Or you can use RMK without bootloader: + +``` +MEMORY +{ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 */ + FLASH : ORIGIN = 0x00000000, LENGTH = 1024K + RAM : ORIGIN = 0x20000000, LENGTH = 256K +} +``` + +After you have `memory.x` set, use `cargo run --release` to flash the RMK firmware to your board: 1. Enter example folder: ```shell - cd examples/use_rust/nrf52840_ble - ``` -2. Erase the flash: - ```shell - probe-rs erase --chip nrf52840_xxAA - ``` -3. Flash softdevice firmware to flash: - ```shell - probe-rs download --verify --format hex --chip nRF52840_xxAA s140_nrf52_7.3.0_softdevice.hex + cd examples/use_rust/nrf52840_ble_split ``` -4. Compile, flash and run the example +2. Compile, flash and run the example ```shell # Run central firmware cargo run --release --bin central diff --git a/examples/use_rust/nrf52840_ble_split/build.rs b/examples/use_rust/nrf52840_ble_split/build.rs index 90ab55a4f..a62dc4c24 100644 --- a/examples/use_rust/nrf52840_ble_split/build.rs +++ b/examples/use_rust/nrf52840_ble_split/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -62,8 +63,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -79,6 +79,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/nrf52840_ble_split/memory.x b/examples/use_rust/nrf52840_ble_split/memory.x index 591f06f6f..3f9d5d2ec 100644 --- a/examples/use_rust/nrf52840_ble_split/memory.x +++ b/examples/use_rust/nrf52840_ble_split/memory.x @@ -1,13 +1,11 @@ MEMORY { - /* NOTE 1 K = 1 KiBi = 1024 bytes */ - /* FLASH : ORIGIN = 0x00000000, LENGTH = 1024K */ - /*RAM : ORIGIN = 0x20000000, LENGTH = 256K */ - - /* These values correspond to the NRF52840 with Softdevices S140 6.1.1 */ - /* FLASH : ORIGIN = 0x00026000, LENGTH = 824K */ + /* NOTE 1 K = 1 KiB = 1024 bytes */ + /* These values correspond to the nRF52840 WITH Adafruit nRF52 bootloader */ + FLASH : ORIGIN = 0x00001000, LENGTH = 1020K + RAM : ORIGIN = 0x20000008, LENGTH = 255K - /* These values correspond to the NRF52840 with Softdevices S140 7.3.0 */ - FLASH : ORIGIN = 0x00027000, LENGTH = 820K - RAM : ORIGIN = 0x20020000, LENGTH = 128K + /* These values correspond to the nRF52840 */ + /* FLASH : ORIGIN = 0x00000000, LENGTH = 1024K */ + /* RAM : ORIGIN = 0x20000000, LENGTH = 256K */ } \ No newline at end of file diff --git a/examples/use_rust/nrf52840_ble_split/src/central.rs b/examples/use_rust/nrf52840_ble_split/src/central.rs index fa0a77c19..43528ad92 100644 --- a/examples/use_rust/nrf52840_ble_split/src/central.rs +++ b/examples/use_rust/nrf52840_ble_split/src/central.rs @@ -1,53 +1,86 @@ #![no_std] #![no_main] +mod vial; #[macro_use] mod macros; mod keymap; -mod vial; -use defmt::info; -use defmt_rtt as _; +use defmt::{info, unwrap}; use embassy_executor::Spawner; -use embassy_nrf::{ - self as _, bind_interrupts, - gpio::{AnyPin, Input, Output}, - interrupt::{self, InterruptExt, Priority}, - peripherals::{self, SAADC}, - saadc::{self, AnyInput, Input as _, Saadc}, - usb::{self, vbus_detect::SoftwareVbusDetect, Driver}, -}; -use panic_probe as _; -use rmk::{ - ble::SOFTWARE_VBUS, - channel::EVENT_CHANNEL, - config::{ - BleBatteryConfig, ControllerConfig, KeyboardUsbConfig, RmkConfig, StorageConfig, VialConfig, - }, - debounce::default_debouncer::DefaultDebouncer, - futures::future::{join, join4}, - initialize_keymap_and_storage, initialize_nrf_sd_and_flash, - input_device::{ - adc::{AnalogEventType, NrfAdc}, - battery::BatteryProcessor, - rotary_encoder::{DefaultPhase, RotaryEncoder, RotaryEncoderProcessor}, - Runnable, - }, - keyboard::Keyboard, - light::LightController, - run_devices, run_processor_chain, run_rmk, - split::central::{run_peripheral_manager, CentralMatrix}, -}; - +use embassy_nrf::gpio::{Input, Output}; +use embassy_nrf::interrupt::{self, InterruptExt}; +use embassy_nrf::peripherals::{RNG, SAADC, USBD}; +use embassy_nrf::saadc::{self, AnyInput, Input as _, Saadc}; +use embassy_nrf::usb::vbus_detect::HardwareVbusDetect; +use embassy_nrf::usb::Driver; +use embassy_nrf::{bind_interrupts, rng, usb, Peri}; +use nrf_mpsl::Flash; +use nrf_sdc::mpsl::MultiprotocolServiceLayer; +use nrf_sdc::{self as sdc, mpsl}; +use rand_chacha::ChaCha12Rng; +use rand_core::SeedableRng; +use rmk::ble::trouble::build_ble_stack; +use rmk::channel::EVENT_CHANNEL; +use rmk::config::{BleBatteryConfig, ControllerConfig, KeyboardUsbConfig, RmkConfig, StorageConfig, VialConfig}; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::futures::future::{join, join4}; +use rmk::input_device::adc::{AnalogEventType, NrfAdc}; +use rmk::input_device::battery::BatteryProcessor; +use rmk::input_device::rotary_encoder::{DefaultPhase, RotaryEncoder, RotaryEncoderProcessor}; +use rmk::input_device::Runnable; +use rmk::keyboard::Keyboard; +use rmk::light::LightController; +use rmk::split::central::{run_peripheral_manager, CentralMatrix}; +use rmk::{initialize_encoder_keymap_and_storage, run_devices, run_processor_chain, run_rmk, HostResources}; +use static_cell::StaticCell; use vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; +use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { - USBD => usb::InterruptHandler; + USBD => usb::InterruptHandler; SAADC => saadc::InterruptHandler; + RNG => rng::InterruptHandler; + EGU0_SWI0 => nrf_sdc::mpsl::LowPrioInterruptHandler; + CLOCK_POWER => nrf_sdc::mpsl::ClockInterruptHandler, usb::vbus_detect::InterruptHandler; + RADIO => nrf_sdc::mpsl::HighPrioInterruptHandler; + TIMER0 => nrf_sdc::mpsl::HighPrioInterruptHandler; + RTC0 => nrf_sdc::mpsl::HighPrioInterruptHandler; }); +#[embassy_executor::task] +async fn mpsl_task(mpsl: &'static MultiprotocolServiceLayer<'static>) -> ! { + mpsl.run().await +} + +/// How many outgoing L2CAP buffers per link +const L2CAP_TXQ: u8 = 4; + +/// How many incoming L2CAP buffers per link +const L2CAP_RXQ: u8 = 4; + +/// Size of L2CAP packets +const L2CAP_MTU: usize = 255; + +fn build_sdc<'d, const N: usize>( + p: nrf_sdc::Peripherals<'d>, + rng: &'d mut rng::Rng, + mpsl: &'d MultiprotocolServiceLayer, + mem: &'d mut sdc::Mem, +) -> Result, nrf_sdc::Error> { + sdc::Builder::new()? + .support_scan()? + .support_central()? + .support_adv()? + .support_peripheral()? + .central_count(1)? + .peripheral_count(1)? + .buffer_cfg(L2CAP_MTU as u8, L2CAP_MTU as u8, L2CAP_TXQ, L2CAP_RXQ)? + .build(p, rng, mpsl, mem) +} + /// Initializes the SAADC peripheral in single-ended mode on the given pin. -fn init_adc(adc_pin: AnyInput, adc: SAADC) -> Saadc<'static, 1> { +fn init_adc(adc_pin: AnyInput, adc: Peri<'static, SAADC>) -> Saadc<'static, 1> { // Then we initialize the ADC. We are only using one channel in this example. let config = saadc::Config::default(); let channel_cfg = saadc::ChannelConfig::single_ended(adc_pin.degrade_saadc()); @@ -58,30 +91,56 @@ fn init_adc(adc_pin: AnyInput, adc: SAADC) -> Saadc<'static, 1> { #[embassy_executor::main] async fn main(spawner: Spawner) { - info!("Hello NRF BLE!"); + info!("Hello RMK BLE!"); + // Initialize the peripherals and nrf-sdc controller let mut nrf_config = embassy_nrf::config::Config::default(); - nrf_config.gpiote_interrupt_priority = Priority::P3; - nrf_config.time_interrupt_priority = Priority::P3; - interrupt::USBD.set_priority(interrupt::Priority::P2); - interrupt::CLOCK_POWER.set_priority(interrupt::Priority::P2); + nrf_config.dcdc.reg0_voltage = Some(embassy_nrf::config::Reg0Voltage::_3v3); + nrf_config.dcdc.reg0 = true; + nrf_config.dcdc.reg1 = true; let p = embassy_nrf::init(nrf_config); - // Disable external HF clock by default, reduce power consumption - // info!("Enabling ext hfosc..."); - // ::embassy_nrf::pac::CLOCK.tasks_hfclkstart().write_value(1); - // while ::embassy_nrf::pac::CLOCK.events_hfclkstarted().read() != 1 {} + let mpsl_p = mpsl::Peripherals::new(p.RTC0, p.TIMER0, p.TEMP, p.PPI_CH19, p.PPI_CH30, p.PPI_CH31); + let lfclk_cfg = mpsl::raw::mpsl_clock_lfclk_cfg_t { + source: mpsl::raw::MPSL_CLOCK_LF_SRC_RC as u8, + rc_ctiv: mpsl::raw::MPSL_RECOMMENDED_RC_CTIV as u8, + rc_temp_ctiv: mpsl::raw::MPSL_RECOMMENDED_RC_TEMP_CTIV as u8, + accuracy_ppm: mpsl::raw::MPSL_DEFAULT_CLOCK_ACCURACY_PPM as u16, + skip_wait_lfclk_started: mpsl::raw::MPSL_DEFAULT_SKIP_WAIT_LFCLK_STARTED != 0, + }; + static MPSL: StaticCell = StaticCell::new(); + static SESSION_MEM: StaticCell> = StaticCell::new(); + let mpsl = MPSL.init(unwrap!(mpsl::MultiprotocolServiceLayer::with_timeslots( + mpsl_p, + Irqs, + lfclk_cfg, + SESSION_MEM.init(mpsl::SessionMem::new()) + ))); + spawner.must_spawn(mpsl_task(&*mpsl)); + let sdc_p = sdc::Peripherals::new( + p.PPI_CH17, p.PPI_CH18, p.PPI_CH20, p.PPI_CH21, p.PPI_CH22, p.PPI_CH23, p.PPI_CH24, p.PPI_CH25, p.PPI_CH26, + p.PPI_CH27, p.PPI_CH28, p.PPI_CH29, + ); + let mut rng = rng::Rng::new(p.RNG, Irqs); + let mut rng_gen = ChaCha12Rng::from_rng(&mut rng).unwrap(); + let mut sdc_mem = sdc::Mem::<8192>::new(); + let sdc = unwrap!(build_sdc(sdc_p, &mut rng, mpsl, &mut sdc_mem)); + let central_addr = [0x18, 0xe2, 0x21, 0x80, 0xc0, 0xc7]; + let peripheral_addr = [0x7e, 0xfe, 0x73, 0x9e, 0x66, 0xe3]; + let mut host_resources = HostResources::new(); + let stack = build_ble_stack(sdc, central_addr, &mut rng_gen, &mut host_resources).await; - // Usb config - let software_vbus = SOFTWARE_VBUS.get_or_init(|| SoftwareVbusDetect::new(true, false)); - let driver = Driver::new(p.USBD, Irqs, software_vbus); + // Initialize usb driver + let driver = Driver::new(p.USBD, Irqs, HardwareVbusDetect::new(Irqs)); - // Initialize the ADC. We are only using one channel for detecting battery level + // Initialize flash + let flash = Flash::take(mpsl, p.NVMC); + + // Initialize IO Pins + let (input_pins, output_pins) = config_matrix_pins_nrf!(peripherals: p, input: [P0_30, P0_31, P0_29, P0_02], output: [P0_28, P0_03, P1_10, P1_11, P1_13, P0_09, P0_10]); + + // Initialize the ADC. + // We are only using one channel for detecting battery level let adc_pin = p.P0_05.degrade_saadc(); - let is_charging_pin = Input::new(AnyPin::from(p.P0_07), embassy_nrf::gpio::Pull::Up); - let charging_led = Output::new( - AnyPin::from(p.P0_08), - embassy_nrf::gpio::Level::Low, - embassy_nrf::gpio::OutputDrive::Standard, - ); + let is_charging_pin = Input::new(p.P0_07, embassy_nrf::gpio::Pull::Up); let saadc = init_adc(adc_pin, p.SAADC); // Wait for ADC calibration. saadc.calibrate().await; @@ -95,10 +154,9 @@ async fn main(spawner: Spawner) { serial_number: "vial:f64c2b3c:000001", }; let vial_config = VialConfig::new(VIAL_KEYBOARD_ID, VIAL_KEYBOARD_DEF); - let ble_battery_config = - BleBatteryConfig::new(Some(is_charging_pin), true, Some(charging_led), false); + let ble_battery_config = BleBatteryConfig::new(Some(is_charging_pin), true, None, false); let storage_config = StorageConfig { - start_addr: 0, + start_addr: 0xA0000, // FIXME: use 0x70000 after we can build without softdevice controller num_sectors: 6, ..Default::default() }; @@ -110,43 +168,41 @@ async fn main(spawner: Spawner) { ..Default::default() }; - let (input_pins, output_pins) = config_matrix_pins_nrf!(peripherals: p, input: [P0_30, P0_31, P0_29, P0_02], output: [P0_28, P0_03, P1_10, P1_11, P1_13, P0_09, P0_10]); - - // Initialize the Softdevice and flash - let central_addr = [0x18, 0xe2, 0x21, 0x80, 0xc0, 0xc7]; - let peripheral_addr = [0x7e, 0xfe, 0x73, 0x9e, 0x66, 0xe3]; - let (sd, flash) = initialize_nrf_sd_and_flash( - rmk_config.usb_config.product_name, - spawner, - Some(central_addr), - ); - + // Initialze keyboard stuffs // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let (keymap, storage) = initialize_keymap_and_storage( + let mut encoder_map = keymap::get_default_encoder_map(); + let (keymap, mut storage) = initialize_encoder_keymap_and_storage( &mut default_keymap, + &mut encoder_map, flash, rmk_config.storage_config, rmk_config.behavior_config.clone(), ) .await; - let pin_a = Input::new(AnyPin::from(p.P1_06), embassy_nrf::gpio::Pull::None); - let pin_b = Input::new(AnyPin::from(p.P1_04), embassy_nrf::gpio::Pull::None); + let pin_a = Input::new(p.P1_06, embassy_nrf::gpio::Pull::None); + let pin_b = Input::new(p.P1_04, embassy_nrf::gpio::Pull::None); let mut encoder = RotaryEncoder::with_phase(pin_a, pin_b, DefaultPhase, 0); - // Initialize the matrix + keyboard + // Initialize the matrix and keyboard let debouncer = DefaultDebouncer::<4, 7>::new(); let mut matrix = CentralMatrix::<_, _, _, 0, 0, 4, 7>::new(input_pins, output_pins, debouncer); + // let mut matrix = TestMatrix::::new(); let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); // Initialize the light controller - let light_controller: LightController = - LightController::new(ControllerConfig::default().light_config); + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); + // Initialize the encoder processor let mut encoder_processor = RotaryEncoderProcessor::new(&keymap); - let mut adc_device = NrfAdc::new(saadc, [AnalogEventType::Battery], 12000, None); + let mut adc_device = NrfAdc::new( + saadc, + [AnalogEventType::Battery], + embassy_time::Duration::from_secs(12), + None, + ); let mut batt_proc = BatteryProcessor::new(2000, 2806, &keymap); // Start @@ -159,8 +215,8 @@ async fn main(spawner: Spawner) { }, keyboard.run(), join( - run_peripheral_manager::<4, 7, 4, 0>(0, peripheral_addr), - run_rmk(&keymap, driver, storage, light_controller, rmk_config, sd), + run_peripheral_manager::<4, 7, 4, 0, _>(0, peripheral_addr, &stack), + run_rmk(&keymap, driver, &stack, &mut storage, &mut light_controller, rmk_config), ), ) .await; diff --git a/examples/use_rust/nrf52840_ble_split/src/keymap.rs b/examples/use_rust/nrf52840_ble_split/src/keymap.rs index d5162f62c..9c87ed0bc 100644 --- a/examples/use_rust/nrf52840_ble_split/src/keymap.rs +++ b/examples/use_rust/nrf52840_ble_split/src/keymap.rs @@ -1,8 +1,9 @@ -use rmk::action::KeyAction; -use rmk::{a, k, mo}; +use rmk::action::{EncoderAction, KeyAction}; +use rmk::{a, encoder, k, mo}; pub(crate) const COL: usize = 7; pub(crate) const ROW: usize = 8; pub(crate) const NUM_LAYER: usize = 4; +pub(crate) const NUM_ENCODER: usize = 1; #[rustfmt::skip] pub const fn get_default_keymap() -> [[[KeyAction; COL]; ROW]; NUM_LAYER] { [ @@ -48,3 +49,12 @@ pub const fn get_default_keymap() -> [[[KeyAction; COL]; ROW]; NUM_LAYER] { ], ] } + +pub const fn get_default_encoder_map() -> [[EncoderAction; NUM_ENCODER]; NUM_LAYER] { + [ + [encoder!(k!(KbVolumeUp), k!(KbVolumeDown))], + [encoder!(k!(KbVolumeUp), k!(KbVolumeDown))], + [encoder!(k!(KbVolumeUp), k!(KbVolumeDown))], + [encoder!(k!(KbVolumeUp), k!(KbVolumeDown))], + ] +} diff --git a/examples/use_rust/nrf52840_ble_split/src/macros.rs b/examples/use_rust/nrf52840_ble_split/src/macros.rs index ed5640ce3..441e3e2dc 100644 --- a/examples/use_rust/nrf52840_ble_split/src/macros.rs +++ b/examples/use_rust/nrf52840_ble_split/src/macros.rs @@ -1,8 +1,8 @@ macro_rules! config_matrix_pins_nrf { (peripherals: $p:ident, input: [$($in_pin:ident), *], output: [$($out_pin:ident), +]) => { { - let mut output_pins = [$(Output::new(AnyPin::from($p.$out_pin), embassy_nrf::gpio::Level::Low, embassy_nrf::gpio::OutputDrive::Standard)), +]; - let input_pins = [$(Input::new(AnyPin::from($p.$in_pin), embassy_nrf::gpio::Pull::Down)), +]; + let mut output_pins = [$(Output::new($p.$out_pin, embassy_nrf::gpio::Level::Low, embassy_nrf::gpio::OutputDrive::Standard)), +]; + let input_pins = [$(Input::new($p.$in_pin, embassy_nrf::gpio::Pull::Down)), +]; output_pins.iter_mut().for_each(|p| { p.set_low(); }); diff --git a/examples/use_rust/nrf52840_ble_split/src/peripheral.rs b/examples/use_rust/nrf52840_ble_split/src/peripheral.rs index b5a463c96..e1e612fb0 100644 --- a/examples/use_rust/nrf52840_ble_split/src/peripheral.rs +++ b/examples/use_rust/nrf52840_ble_split/src/peripheral.rs @@ -4,28 +4,68 @@ #[macro_use] mod macros; -use defmt::*; -use defmt_rtt as _; +use defmt::{info, unwrap}; use embassy_executor::Spawner; -use embassy_nrf::{ - self as _, bind_interrupts, - gpio::{AnyPin, Input, Output}, - interrupt::{self, InterruptExt, Priority}, - peripherals::SAADC, - saadc::{self, AnyInput, Input as _, Saadc}, -}; -use panic_probe as _; -use rmk::{ - channel::EVENT_CHANNEL, debounce::default_debouncer::DefaultDebouncer, futures::future::join, - matrix::Matrix, run_devices, split::peripheral::run_rmk_split_peripheral, -}; +use embassy_nrf::gpio::{Input, Output}; +use embassy_nrf::interrupt::{self, InterruptExt}; +use embassy_nrf::peripherals::{RNG, SAADC, USBD}; +use embassy_nrf::saadc::{self, AnyInput, Input as _, Saadc}; +use embassy_nrf::{Peri, bind_interrupts, rng, usb}; +use nrf_sdc::mpsl::MultiprotocolServiceLayer; +use nrf_sdc::{self as sdc, mpsl}; +use rand_chacha::ChaCha12Rng; +use rand_core::SeedableRng; +use rmk::ble::trouble::build_ble_stack; +use rmk::channel::EVENT_CHANNEL; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::futures::future::join; +use rmk::matrix::Matrix; +use rmk::split::peripheral::run_rmk_split_peripheral; +use rmk::{HostResources, run_devices}; +use static_cell::StaticCell; +use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { + USBD => usb::InterruptHandler; SAADC => saadc::InterruptHandler; + RNG => rng::InterruptHandler; + EGU0_SWI0 => nrf_sdc::mpsl::LowPrioInterruptHandler; + CLOCK_POWER => nrf_sdc::mpsl::ClockInterruptHandler, usb::vbus_detect::InterruptHandler; + RADIO => nrf_sdc::mpsl::HighPrioInterruptHandler; + TIMER0 => nrf_sdc::mpsl::HighPrioInterruptHandler; + RTC0 => nrf_sdc::mpsl::HighPrioInterruptHandler; }); +#[embassy_executor::task] +async fn mpsl_task(mpsl: &'static MultiprotocolServiceLayer<'static>) -> ! { + mpsl.run().await +} + +/// How many outgoing L2CAP buffers per link +const L2CAP_TXQ: u8 = 3; + +/// How many incoming L2CAP buffers per link +const L2CAP_RXQ: u8 = 3; + +/// Size of L2CAP packets +const L2CAP_MTU: usize = 72; + +fn build_sdc<'d, const N: usize>( + p: nrf_sdc::Peripherals<'d>, + rng: &'d mut rng::Rng, + mpsl: &'d MultiprotocolServiceLayer, + mem: &'d mut sdc::Mem, +) -> Result, nrf_sdc::Error> { + sdc::Builder::new()? + .support_adv()? + .support_peripheral()? + .peripheral_count(1)? + .buffer_cfg(L2CAP_MTU as u8, L2CAP_MTU as u8, L2CAP_TXQ, L2CAP_RXQ)? + .build(p, rng, mpsl, mem) +} + /// Initializes the SAADC peripheral in single-ended mode on the given pin. -fn init_adc(adc_pin: AnyInput, adc: SAADC) -> Saadc<'static, 1> { +fn init_adc(adc_pin: AnyInput, adc: Peri<'static, SAADC>) -> Saadc<'static, 1> { // Then we initialize the ADC. We are only using one channel in this example. let config = saadc::Config::default(); let channel_cfg = saadc::ChannelConfig::single_ended(adc_pin.degrade_saadc()); @@ -36,16 +76,42 @@ fn init_adc(adc_pin: AnyInput, adc: SAADC) -> Saadc<'static, 1> { #[embassy_executor::main] async fn main(spawner: Spawner) { - info!("Hello NRF BLE!"); + info!("Hello RMK BLE!"); + // Initialize the peripherals and nrf-sdc controller let mut nrf_config = embassy_nrf::config::Config::default(); - nrf_config.gpiote_interrupt_priority = Priority::P3; - nrf_config.time_interrupt_priority = Priority::P3; - interrupt::CLOCK_POWER.set_priority(interrupt::Priority::P2); + nrf_config.dcdc.reg0_voltage = Some(embassy_nrf::config::Reg0Voltage::_3v3); + nrf_config.dcdc.reg0 = true; + nrf_config.dcdc.reg1 = true; let p = embassy_nrf::init(nrf_config); - // Disable external HF clock by default, reduce power consumption - // info!("Enabling ext hfosc..."); - // ::embassy_nrf::pac::CLOCK.tasks_hfclkstart().write_value(1); - // while ::embassy_nrf::pac::CLOCK.events_hfclkstarted().read() != 1 {} + let mpsl_p = mpsl::Peripherals::new(p.RTC0, p.TIMER0, p.TEMP, p.PPI_CH19, p.PPI_CH30, p.PPI_CH31); + let lfclk_cfg = mpsl::raw::mpsl_clock_lfclk_cfg_t { + source: mpsl::raw::MPSL_CLOCK_LF_SRC_RC as u8, + rc_ctiv: mpsl::raw::MPSL_RECOMMENDED_RC_CTIV as u8, + rc_temp_ctiv: mpsl::raw::MPSL_RECOMMENDED_RC_TEMP_CTIV as u8, + accuracy_ppm: mpsl::raw::MPSL_DEFAULT_CLOCK_ACCURACY_PPM as u16, + skip_wait_lfclk_started: mpsl::raw::MPSL_DEFAULT_SKIP_WAIT_LFCLK_STARTED != 0, + }; + static MPSL: StaticCell = StaticCell::new(); + static SESSION_MEM: StaticCell> = StaticCell::new(); + let mpsl = MPSL.init(unwrap!(mpsl::MultiprotocolServiceLayer::with_timeslots( + mpsl_p, + Irqs, + lfclk_cfg, + SESSION_MEM.init(mpsl::SessionMem::new()) + ))); + spawner.must_spawn(mpsl_task(&*mpsl)); + let sdc_p = sdc::Peripherals::new( + p.PPI_CH17, p.PPI_CH18, p.PPI_CH20, p.PPI_CH21, p.PPI_CH22, p.PPI_CH23, p.PPI_CH24, p.PPI_CH25, p.PPI_CH26, + p.PPI_CH27, p.PPI_CH28, p.PPI_CH29, + ); + let mut rng = rng::Rng::new(p.RNG, Irqs); + let mut rng_generator = ChaCha12Rng::from_rng(&mut rng).unwrap(); + let mut sdc_mem = sdc::Mem::<4096>::new(); + let sdc = unwrap!(build_sdc(sdc_p, &mut rng, mpsl, &mut sdc_mem)); + + let peripheral_addr = [0x7e, 0xfe, 0x73, 0x9e, 0x66, 0xe3]; + let mut resources = HostResources::new(); + let stack = build_ble_stack(sdc, peripheral_addr, &mut rng_generator, &mut resources).await; // Initialize the ADC. We are only using one channel for detecting battery level let adc_pin = p.P0_05.degrade_saadc(); @@ -56,7 +122,6 @@ async fn main(spawner: Spawner) { let (input_pins, output_pins) = config_matrix_pins_nrf!(peripherals: p, input: [P1_09, P0_28, P0_03, P1_10], output: [P0_30, P0_31, P0_29, P0_02, P1_13, P0_10, P0_09]); let central_addr = [0x18, 0xe2, 0x21, 0x80, 0xc0, 0xc7]; - let peripheral_addr = [0x7e, 0xfe, 0x73, 0x9e, 0x66, 0xe3]; // Initialize the peripheral matrix let debouncer = DefaultDebouncer::<4, 7>::new(); @@ -68,7 +133,7 @@ async fn main(spawner: Spawner) { run_devices! ( (matrix) => EVENT_CHANNEL, // Peripheral uses EVENT_CHANNEL to send events to central ), - run_rmk_split_peripheral(central_addr, peripheral_addr, spawner), + run_rmk_split_peripheral(central_addr, &stack), ) .await; } diff --git a/examples/use_rust/nrf52840_ble_split/src/vial.rs b/examples/use_rust/nrf52840_ble_split/src/vial.rs index a6fde2d4a..7e9b5ab12 100644 --- a/examples/use_rust/nrf52840_ble_split/src/vial.rs +++ b/examples/use_rust/nrf52840_ble_split/src/vial.rs @@ -1,28 +1,3 @@ // Vial config is automatically generated by `build.rs`, according to `vial.json` // Please put `vial.json` at your project's root include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); - -// Or you can manually generate vial config then put here -// pub const VIAL_KEYBOARD_ID: &[u8; 8] = &[0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; -// pub const VIAL_KEYBOARD_DEF: &[u8; 308] = &[ -// 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, -// 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, -// 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, -// 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, -// 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, 0x16, 0x4E, 0xEA, 0x09, -// 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, 0xA2, -// 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, -// 0xEE, 0x5C, 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, -// 0x43, 0x9A, 0x38, 0x26, 0x8C, 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, -// 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, -// 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, 0x61, 0x96, 0xFE, 0x27, 0x7B, -// 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, 0xA9, 0x09, -// 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, -// 0x1F, 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, -// 0xFE, 0xE7, 0x80, 0xCA, 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, -// 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, -// 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, -// 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, 0x01, 0x8D, 0x02, -// 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, -// 0x00, 0x04, 0x59, 0x5A, -// ]; diff --git a/examples/use_rust/nrf52840_ble_split/vial.json b/examples/use_rust/nrf52840_ble_split/vial.json index 2dbc68a08..ec641fa3f 100644 --- a/examples/use_rust/nrf52840_ble_split/vial.json +++ b/examples/use_rust/nrf52840_ble_split/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/py32f07x/Cargo.lock b/examples/use_rust/py32f07x/Cargo.lock index 728e8ef3a..164423eb8 100644 --- a/examples/use_rust/py32f07x/Cargo.lock +++ b/examples/use_rust/py32f07x/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -78,6 +89,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bitfield" version = "0.13.2" @@ -113,6 +130,31 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bt-hci" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f377753756ec12e76b52d2dd657437be0448cc9736402ffadd0b8b8b9602c8a1" +dependencies = [ + "defmt", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -173,6 +215,27 @@ dependencies = [ "windows-link", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -199,6 +262,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -238,6 +307,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -260,37 +338,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "rand_core", + "subtle", + "zeroize", ] [[package]] -name = "darling" -version = "0.20.10" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "generic-array", + "typenum", ] [[package]] -name = "darling_core" -version = "0.13.4" +name = "darling" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -303,30 +379,28 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.90", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.90", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.90", + "generic-array", ] [[package]] @@ -371,6 +445,27 @@ dependencies = [ "defmt", ] +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + [[package]] name = "document-features" version = "0.2.10" @@ -380,6 +475,25 @@ dependencies = [ "litrs", ] +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" @@ -417,7 +531,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.90", @@ -661,6 +775,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.29.0" @@ -709,6 +833,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -752,6 +886,28 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" version = "2.4.1" @@ -815,10 +971,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -858,6 +1033,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itoa" version = "1.0.15" @@ -970,38 +1154,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1037,6 +1189,16 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" version = "0.3.2" @@ -1104,6 +1266,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" version = "0.2.25" @@ -1114,6 +1285,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1198,6 +1378,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1258,7 +1448,6 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "postcard", @@ -1267,6 +1456,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1275,7 +1465,7 @@ name = "rmk-macro" version = "0.5.0" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", "prettyplease", "proc-macro2", @@ -1346,6 +1536,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1369,9 +1572,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ "defmt", "embedded-storage-async", @@ -1461,15 +1664,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1547,6 +1750,40 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.90", + "uuid", +] + [[package]] name = "typenum" version = "1.18.0" @@ -1808,7 +2045,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -1821,3 +2067,20 @@ dependencies = [ "quote", "syn 2.0.90", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/py32f07x/Cargo.toml b/examples/use_rust/py32f07x/Cargo.toml index 1c1b0f77f..b9fe49a38 100644 --- a/examples/use_rust/py32f07x/Cargo.toml +++ b/examples/use_rust/py32f07x/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk", features = ["_no_external_storage"] } +rmk = { path = "../../../rmk", default-features = false, features = ["col2row", "defmt", "storage"] } embassy-time = { version = "0.4", features = ["defmt"] } py32-hal = { git = "https://github.com/py32-rs/py32-hal", rev = "7260371", features = [ "py32f072c1b", @@ -23,13 +23,17 @@ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", "executor-thread", - "task-arena-size-12288", # py32f072 has only 16K RAM ] } cortex-m-rt = "0.7.5" -portable-atomic = { version = "1.10", features = ["critical-section"] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +portable-atomic = { version = "1.11", features = ["critical-section"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_rust/py32f07x/build.rs b/examples/use_rust/py32f07x/build.rs index e0ad0ac39..2aeac0bb5 100644 --- a/examples/use_rust/py32f07x/build.rs +++ b/examples/use_rust/py32f07x/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::Read; use std::path::Path; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -46,8 +47,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -63,6 +63,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/py32f07x/src/macros.rs b/examples/use_rust/py32f07x/src/macros.rs index a65ee8fa7..47ad53ac5 100644 --- a/examples/use_rust/py32f07x/src/macros.rs +++ b/examples/use_rust/py32f07x/src/macros.rs @@ -1,8 +1,8 @@ macro_rules! config_matrix_pins_py { (peripherals: $p:ident, input: [$($in_pin:ident), *], output: [$($out_pin:ident), +]) => { { - let mut output_pins = [$(Output::new(AnyPin::from($p.$out_pin), py32_hal::gpio::Level::Low, py32_hal::gpio::Speed::VeryHigh)), +]; - let input_pins = [$(Input::new(AnyPin::from($p.$in_pin), py32_hal::gpio::Pull::Down)), +]; + let mut output_pins = [$(Output::new($p.$out_pin, py32_hal::gpio::Level::Low, py32_hal::gpio::Speed::VeryHigh)), +]; + let input_pins = [$(Input::new($p.$in_pin, py32_hal::gpio::Pull::Down)), +]; output_pins.iter_mut().for_each(|p| { p.set_low(); }); diff --git a/examples/use_rust/py32f07x/src/main.rs b/examples/use_rust/py32f07x/src/main.rs index cdfb1bcf2..631cfd3e2 100644 --- a/examples/use_rust/py32f07x/src/main.rs +++ b/examples/use_rust/py32f07x/src/main.rs @@ -8,31 +8,25 @@ mod keymap; mod macros; mod vial; -use defmt_rtt as _; use embassy_executor::Spawner; use keymap::{COL, ROW}; -use panic_probe as _; +use py32_hal::bind_interrupts; use py32_hal::flash::Flash; -use py32_hal::{ - bind_interrupts, - gpio::{AnyPin, Input, Output}, - rcc::{HsiFs, Pll, PllMul, PllSource, Sysclk}, - usb::{Driver, InterruptHandler}, -}; -use rmk::{ - channel::EVENT_CHANNEL, - config::{ControllerConfig, KeyboardUsbConfig, RmkConfig, VialConfig}, - debounce::default_debouncer::DefaultDebouncer, - futures::future::join3, - initialize_keymap_and_storage, - input_device::Runnable, - keyboard::Keyboard, - light::LightController, - matrix::Matrix, - run_devices, run_rmk, - storage::async_flash_wrapper, -}; +use py32_hal::gpio::{Input, Output}; +use py32_hal::rcc::{HsiFs, Pll, PllMul, PllSource, Sysclk}; +use py32_hal::usb::{Driver, InterruptHandler}; +use rmk::channel::EVENT_CHANNEL; +use rmk::config::{ControllerConfig, KeyboardUsbConfig, RmkConfig, VialConfig}; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::futures::future::join3; +use rmk::input_device::Runnable; +use rmk::keyboard::Keyboard; +use rmk::light::LightController; +use rmk::matrix::Matrix; +use rmk::storage::async_flash_wrapper; +use rmk::{initialize_keymap_and_storage, run_devices, run_rmk}; use vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; +use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { USB => InterruptHandler; @@ -55,7 +49,8 @@ async fn main(_spawner: Spawner) { let driver = Driver::new(p.USB, Irqs, p.PA12, p.PA11); // Pin config - let (input_pins, output_pins) = config_matrix_pins_py!(peripherals: p, input: [PA0, PA1, PA2, PA3], output: [PA4, PA5, PA6]); + let (input_pins, output_pins) = + config_matrix_pins_py!(peripherals: p, input: [PA0, PA1, PA2, PA3], output: [PA4, PA5, PA6]); let keyboard_usb_config = KeyboardUsbConfig { vid: 0x4c4b, @@ -77,7 +72,7 @@ async fn main(_spawner: Spawner) { // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let (keymap, storage) = initialize_keymap_and_storage( + let (keymap, mut storage) = initialize_keymap_and_storage( &mut default_keymap, async_flash_wrapper(f), rmk_config.storage_config, @@ -91,14 +86,13 @@ async fn main(_spawner: Spawner) { let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); // Initialize the light controller - let light_controller: LightController = - LightController::new(ControllerConfig::default().light_config); + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); // Start join3( run_devices!((matrix) => EVENT_CHANNEL), keyboard.run(), - run_rmk(&keymap, driver, storage, light_controller, rmk_config), + run_rmk(&keymap, driver, &mut storage, &mut light_controller, rmk_config), ) .await; } diff --git a/examples/use_rust/py32f07x/src/vial.rs b/examples/use_rust/py32f07x/src/vial.rs index a6fde2d4a..7e9b5ab12 100644 --- a/examples/use_rust/py32f07x/src/vial.rs +++ b/examples/use_rust/py32f07x/src/vial.rs @@ -1,28 +1,3 @@ // Vial config is automatically generated by `build.rs`, according to `vial.json` // Please put `vial.json` at your project's root include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); - -// Or you can manually generate vial config then put here -// pub const VIAL_KEYBOARD_ID: &[u8; 8] = &[0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; -// pub const VIAL_KEYBOARD_DEF: &[u8; 308] = &[ -// 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, -// 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, -// 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, -// 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, -// 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, 0x16, 0x4E, 0xEA, 0x09, -// 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, 0xA2, -// 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, -// 0xEE, 0x5C, 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, -// 0x43, 0x9A, 0x38, 0x26, 0x8C, 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, -// 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, -// 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, 0x61, 0x96, 0xFE, 0x27, 0x7B, -// 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, 0xA9, 0x09, -// 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, -// 0x1F, 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, -// 0xFE, 0xE7, 0x80, 0xCA, 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, -// 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, -// 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, -// 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, 0x01, 0x8D, 0x02, -// 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, -// 0x00, 0x04, 0x59, 0x5A, -// ]; diff --git a/examples/use_rust/py32f07x/vial.json b/examples/use_rust/py32f07x/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_rust/py32f07x/vial.json +++ b/examples/use_rust/py32f07x/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/rp2040/Cargo.lock b/examples/use_rust/rp2040/Cargo.lock index 01239047a..670645d44 100644 --- a/examples/use_rust/rp2040/Cargo.lock +++ b/examples/use_rust/rp2040/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -93,6 +104,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bit-set" version = "0.8.0" @@ -152,6 +169,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -209,6 +242,27 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -245,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -323,23 +383,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "crypto-common" -version = "0.1.6" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "typenum", + "rand_core", + "subtle", + "zeroize", ] [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "typenum", ] [[package]] @@ -348,22 +410,8 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -376,30 +424,28 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.95", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.95", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.95", + "generic-array", ] [[package]] @@ -410,9 +456,18 @@ checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" [[package]] name = "defmt" -version = "0.3.10" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" +dependencies = [ + "defmt 1.0.1", +] + +[[package]] +name = "defmt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -420,9 +475,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -433,21 +488,31 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", ] [[package]] @@ -458,6 +523,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -475,13 +541,32 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -496,12 +581,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -509,10 +593,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.95", @@ -521,10 +604,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -535,7 +617,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -567,7 +649,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -597,7 +679,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -628,12 +710,11 @@ dependencies = [ [[package]] name = "embassy-sync" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -648,7 +729,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -682,7 +763,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -698,7 +779,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -717,7 +798,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -726,7 +807,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -746,7 +827,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -755,7 +836,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -795,6 +876,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -849,6 +940,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -900,6 +1001,18 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", ] [[package]] @@ -965,10 +1078,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "home" version = "0.5.11" @@ -1017,6 +1149,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -1165,38 +1306,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1232,14 +1341,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1271,6 +1390,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "petgraph" version = "0.7.1" @@ -1364,9 +1528,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" dependencies = [ "critical-section", ] @@ -1378,7 +1542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1395,6 +1559,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -1411,6 +1584,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1451,6 +1633,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1513,12 +1705,13 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", "embassy-futures", "embassy-nrf", + "embassy-rp", "embassy-sync", "embassy-time", "embassy-usb", @@ -1529,7 +1722,6 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "postcard", @@ -1538,6 +1730,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1546,8 +1739,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1563,7 +1758,7 @@ version = "0.2.0" dependencies = [ "const-gen", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-rp", @@ -1633,6 +1828,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1656,11 +1864,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1693,6 +1901,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2-const-stable" version = "0.1.0" @@ -1794,15 +2013,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1899,12 +2118,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.95", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1929,7 +2190,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1940,7 +2201,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -2197,7 +2458,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -2210,3 +2480,20 @@ dependencies = [ "quote", "syn 2.0.95", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/rp2040/Cargo.toml b/examples/use_rust/rp2040/Cargo.toml index 14a87c4d3..c61f3703d 100644 --- a/examples/use_rust/rp2040/Cargo.toml +++ b/examples/use_rust/rp2040/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk" } +rmk = { path = "../../../rmk", features = ["rp2040_bl"] } embassy-time = { version = "0.4", features = ["defmt"] } embassy-rp = { version = "0.4", features = [ "rp2040", @@ -22,13 +22,17 @@ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", "executor-thread", - "task-arena-size-32768", ] } cortex-m-rt = "0.7.5" -portable-atomic = { version = "1.10", features = ["critical-section"] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +portable-atomic = { version = "1.11", features = ["critical-section"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } # [features] # avoid having to use --allow-multiple-definition linker flag diff --git a/examples/use_rust/rp2040/build.rs b/examples/use_rust/rp2040/build.rs index 9456a7f91..12eb796e3 100644 --- a/examples/use_rust/rp2040/build.rs +++ b/examples/use_rust/rp2040/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -61,8 +62,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -78,6 +78,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/rp2040/src/macros.rs b/examples/use_rust/rp2040/src/macros.rs index 249b878ac..fb2652993 100644 --- a/examples/use_rust/rp2040/src/macros.rs +++ b/examples/use_rust/rp2040/src/macros.rs @@ -1,8 +1,8 @@ macro_rules! config_matrix_pins_rp { (peripherals: $p:ident, input: [$($in_pin:ident), *], output: [$($out_pin:ident), +]) => { { - let mut output_pins = [$(Output::new(AnyPin::from($p.$out_pin), embassy_rp::gpio::Level::Low)), +]; - let input_pins = [$(Input::new(AnyPin::from($p.$in_pin), embassy_rp::gpio::Pull::Down)), +]; + let mut output_pins = [$(Output::new($p.$out_pin, embassy_rp::gpio::Level::Low)), +]; + let input_pins = [$(Input::new($p.$in_pin, embassy_rp::gpio::Pull::Down)), +]; output_pins.iter_mut().for_each(|p| { p.set_low(); }); diff --git a/examples/use_rust/rp2040/src/main.rs b/examples/use_rust/rp2040/src/main.rs index b31ff15f0..22f9a80be 100644 --- a/examples/use_rust/rp2040/src/main.rs +++ b/examples/use_rust/rp2040/src/main.rs @@ -8,30 +8,24 @@ mod macros; mod vial; use defmt::info; -use defmt_rtt as _; use embassy_executor::Spawner; -use embassy_rp::{ - bind_interrupts, - flash::{Async, Flash}, - gpio::{AnyPin, Input, Output}, - peripherals::USB, - usb::{Driver, InterruptHandler}, -}; +use embassy_rp::bind_interrupts; +use embassy_rp::flash::{Async, Flash}; +use embassy_rp::gpio::{Input, Output}; +use embassy_rp::peripherals::USB; +use embassy_rp::usb::{Driver, InterruptHandler}; use keymap::{COL, ROW}; -use panic_probe as _; -use rmk::{ - channel::EVENT_CHANNEL, - config::{ControllerConfig, KeyboardUsbConfig, RmkConfig, VialConfig}, - debounce::default_debouncer::DefaultDebouncer, - futures::future::join3, - initialize_keymap_and_storage, - input_device::Runnable, - keyboard::Keyboard, - light::LightController, - matrix::Matrix, - run_devices, run_rmk, -}; +use rmk::channel::EVENT_CHANNEL; +use rmk::config::{ControllerConfig, KeyboardUsbConfig, RmkConfig, VialConfig}; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::futures::future::join3; +use rmk::input_device::Runnable; +use rmk::keyboard::Keyboard; +use rmk::light::LightController; +use rmk::matrix::Matrix; +use rmk::{initialize_keymap_and_storage, run_devices, run_rmk}; use vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; +use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { USBCTRL_IRQ => InterruptHandler; @@ -49,7 +43,8 @@ async fn main(_spawner: Spawner) { let driver = Driver::new(p.USB, Irqs); // Pin config - let (input_pins, output_pins) = config_matrix_pins_rp!(peripherals: p, input: [PIN_6, PIN_7, PIN_8, PIN_9], output: [PIN_19, PIN_20, PIN_21]); + let (input_pins, output_pins) = + config_matrix_pins_rp!(peripherals: p, input: [PIN_6, PIN_7, PIN_8, PIN_9], output: [PIN_19, PIN_20, PIN_21]); // Use internal flash to emulate eeprom // Both blocking and async flash are support, use different API @@ -74,7 +69,7 @@ async fn main(_spawner: Spawner) { // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let (keymap, storage) = initialize_keymap_and_storage( + let (keymap, mut storage) = initialize_keymap_and_storage( &mut default_keymap, flash, rmk_config.storage_config, @@ -88,8 +83,7 @@ async fn main(_spawner: Spawner) { let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); // Initialize the light controller - let light_controller: LightController = - LightController::new(ControllerConfig::default().light_config); + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); // Start join3( @@ -97,7 +91,7 @@ async fn main(_spawner: Spawner) { (matrix) => EVENT_CHANNEL, ), keyboard.run(), - run_rmk(&keymap, driver, storage, light_controller, rmk_config), + run_rmk(&keymap, driver, &mut storage, &mut light_controller, rmk_config), ) .await; } diff --git a/examples/use_rust/rp2040/src/vial.rs b/examples/use_rust/rp2040/src/vial.rs index a6fde2d4a..7e9b5ab12 100644 --- a/examples/use_rust/rp2040/src/vial.rs +++ b/examples/use_rust/rp2040/src/vial.rs @@ -1,28 +1,3 @@ // Vial config is automatically generated by `build.rs`, according to `vial.json` // Please put `vial.json` at your project's root include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); - -// Or you can manually generate vial config then put here -// pub const VIAL_KEYBOARD_ID: &[u8; 8] = &[0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; -// pub const VIAL_KEYBOARD_DEF: &[u8; 308] = &[ -// 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, -// 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, -// 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, -// 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, -// 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, 0x16, 0x4E, 0xEA, 0x09, -// 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, 0xA2, -// 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, -// 0xEE, 0x5C, 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, -// 0x43, 0x9A, 0x38, 0x26, 0x8C, 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, -// 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, -// 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, 0x61, 0x96, 0xFE, 0x27, 0x7B, -// 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, 0xA9, 0x09, -// 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, -// 0x1F, 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, -// 0xFE, 0xE7, 0x80, 0xCA, 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, -// 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, -// 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, -// 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, 0x01, 0x8D, 0x02, -// 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, -// 0x00, 0x04, 0x59, 0x5A, -// ]; diff --git a/examples/use_rust/rp2040/vial.json b/examples/use_rust/rp2040/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_rust/rp2040/vial.json +++ b/examples/use_rust/rp2040/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/rp2040_direct_pin/.cargo/config.toml b/examples/use_rust/rp2040_direct_pin/.cargo/config.toml index 769dab248..2206af20c 100644 --- a/examples/use_rust/rp2040_direct_pin/.cargo/config.toml +++ b/examples/use_rust/rp2040_direct_pin/.cargo/config.toml @@ -1,6 +1,5 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -#runner = "probe-rs run --chip RP2040" -runner = "probe-rs run --probe 0d28:0204:000100011A5A5CC60000000000051D66A5A5A5A597969908 --chip rp2040" +runner = "probe-rs run --chip RP2040" # runner = "elf2uf2-rs -d" [build] diff --git a/examples/use_rust/rp2040_direct_pin/Cargo.lock b/examples/use_rust/rp2040_direct_pin/Cargo.lock index 01239047a..b9b8b580f 100644 --- a/examples/use_rust/rp2040_direct_pin/Cargo.lock +++ b/examples/use_rust/rp2040_direct_pin/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -93,6 +104,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bit-set" version = "0.8.0" @@ -122,13 +139,13 @@ checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" [[package]] name = "bitfield-struct" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bedc5f4fa33bdc993f9b8ba7369d1b74fcdafa958924a0a54de6707e360de692" +checksum = "2be5a46ba01b60005ae2c51a36a29cfe134bcacae2dd5cedcd4615fbaad1494b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] @@ -139,9 +156,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "block-buffer" @@ -152,6 +169,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -160,9 +193,9 @@ checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "bytemuck" -version = "1.21.0" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" +checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" [[package]] name = "byteorder" @@ -182,9 +215,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.7" +version = "1.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7" +checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" dependencies = [ "shlex", ] @@ -197,16 +230,37 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets", + "windows-link", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", ] [[package]] @@ -227,9 +281,9 @@ dependencies = [ [[package]] name = "const-gen" -version = "1.6.5" +version = "1.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb4caa28784488578a9aa32e0a33f0543d961345fc25efc3f04243be3fa6299" +checksum = "6d7617801a02ebd66905a39f5a15390bfb7d6ab90316fdbf7dc36a1161ffb56b" dependencies = [ "const-gen-derive", ] @@ -245,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -280,7 +340,7 @@ checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] @@ -318,88 +378,74 @@ checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] name = "crunchy" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" [[package]] -name = "crypto-common" -version = "0.1.6" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "typenum", + "rand_core", + "subtle", + "zeroize", ] [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "typenum", ] [[package]] name = "darling" -version = "0.20.10" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", -] - -[[package]] -name = "darling_core" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.11.1", - "syn 2.0.95", + "strsim", + "syn 2.0.100", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.95", + "generic-array", ] [[package]] @@ -410,9 +456,18 @@ checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" [[package]] name = "defmt" -version = "0.3.10" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" +dependencies = [ + "defmt 1.0.1", +] + +[[package]] +name = "defmt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -420,34 +475,44 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", ] [[package]] @@ -458,22 +523,42 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] name = "document-features" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" dependencies = [ "litrs", ] [[package]] name = "either" -version = "1.13.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] [[package]] name = "embassy-embedded-hal" @@ -481,7 +566,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -496,12 +581,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -509,22 +593,20 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -535,7 +617,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -562,12 +644,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d7494efe1e0183568327c7e681d4b77ed5241921dcb5976426d9a65b65a0c81" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "cfg-if", "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -597,7 +679,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -628,12 +710,11 @@ dependencies = [ [[package]] name = "embassy-sync" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -648,7 +729,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -682,7 +763,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -698,7 +779,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -717,7 +798,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -726,7 +807,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -746,7 +827,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -755,7 +836,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -791,15 +872,25 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "ff" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] [[package]] name = "fixed" -version = "1.28.0" +version = "1.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a" +checksum = "707070ccf8c4173548210893a0186e29c266901b71ed20cd9e2ca0193dfe95c3" dependencies = [ "az", "bytemuck", @@ -849,6 +940,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -863,7 +964,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] @@ -900,13 +1001,25 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", ] [[package]] name = "half" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +checksum = "7db2ff139bba50379da6aa0766b52fdcb62cb5b263009b09ed58ba604e14bbd1" dependencies = [ "cfg-if", "crunchy", @@ -965,10 +1078,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "home" version = "0.5.11" @@ -980,14 +1112,15 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.61" +version = "0.1.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +checksum = "b2fd658b06e56721792c5df4475705b6cda790e9298d19d2f8af083457bcd127" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", "windows-core", ] @@ -1009,14 +1142,23 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "indexmap" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ "equivalent", "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -1091,9 +1233,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.169" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "litrs" @@ -1113,9 +1255,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "lzma-sys" @@ -1165,38 +1307,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1223,23 +1333,33 @@ checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] name = "once_cell" -version = "1.20.2" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1271,6 +1391,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "petgraph" version = "0.7.1" @@ -1283,9 +1448,9 @@ dependencies = [ [[package]] name = "phf_shared" -version = "0.10.0" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ "siphasher", ] @@ -1353,20 +1518,20 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" dependencies = [ "critical-section", ] @@ -1378,7 +1543,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1395,6 +1560,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -1403,12 +1577,21 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "prettyplease" -version = "0.2.27" +version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "483f8c21f64f3ea09fe0f30f5d48c3e8eefe5dac9129f0075f76593b4c1da705" +checksum = "5316f57387668042f561aae71480de936257848f9c43ce528e311d89a07cadeb" dependencies = [ "proc-macro2", - "syn 2.0.95", + "syn 2.0.100", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", ] [[package]] @@ -1430,27 +1613,37 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1459,11 +1652,11 @@ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] name = "redox_syscall" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" +checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", ] [[package]] @@ -1513,12 +1706,13 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", "embassy-futures", "embassy-nrf", + "embassy-rp", "embassy-sync", "embassy-time", "embassy-usb", @@ -1529,7 +1723,6 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "postcard", @@ -1538,6 +1731,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1546,14 +1740,16 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", "serde", "serde_derive", - "syn 2.0.95", + "syn 2.0.100", "toml", ] @@ -1563,7 +1759,7 @@ version = "0.2.0" dependencies = [ "const-gen", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-rp", @@ -1609,14 +1805,14 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.24", + "semver 1.0.26", ] [[package]] name = "rustversion" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] name = "same-file" @@ -1633,6 +1829,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1644,9 +1853,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" [[package]] name = "semver-parser" @@ -1656,32 +1865,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] [[package]] name = "serde" -version = "1.0.217" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.217" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] @@ -1693,6 +1902,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2-const-stable" version = "0.1.0" @@ -1717,15 +1937,15 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "siphasher" -version = "0.3.11" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "smallvec" -version = "1.13.2" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" [[package]] name = "smart-leds" @@ -1738,9 +1958,9 @@ dependencies = [ [[package]] name = "smart-leds-trait" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bc64ee02bbbf469603016df746c0ed224f263280b6ebb49b7ebadbff375c572" +checksum = "edeb89c73244414bb0568611690dd095b2358b3fda5bae65ad784806cca00157" dependencies = [ "rgb", ] @@ -1781,12 +2001,11 @@ dependencies = [ [[package]] name = "string_cache" -version = "0.8.7" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" dependencies = [ "new_debug_unreachable", - "once_cell", "parking_lot", "phf_shared", "precomputed-hash", @@ -1794,15 +2013,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1817,9 +2036,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.95" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", @@ -1847,29 +2066,29 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.9" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.9" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", ] [[package]] name = "toml" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" dependencies = [ "serde", "serde_spanned", @@ -1888,9 +2107,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.22" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", "serde", @@ -1899,17 +2118,59 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", + "uuid", +] + [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "ucd-trie" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "unicode-ident" -version = "1.0.14" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "unicode-width" @@ -1929,7 +2190,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1940,7 +2201,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -1974,9 +2235,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.11.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" [[package]] name = "vcell" @@ -2037,7 +2298,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", "wasm-bindgen-shared", ] @@ -2059,7 +2320,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2091,6 +2352,12 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-link" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" + [[package]] name = "windows-sys" version = "0.52.0" @@ -2175,9 +2442,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.22" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39281189af81c07ec09db316b302a3e67bf9bd7cbf6c820b50e35fee9c2fa980" +checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" dependencies = [ "memchr", ] @@ -2197,7 +2464,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -2208,5 +2484,22 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.100", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", ] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/rp2040_direct_pin/Cargo.toml b/examples/use_rust/rp2040_direct_pin/Cargo.toml index 14a87c4d3..c61f3703d 100644 --- a/examples/use_rust/rp2040_direct_pin/Cargo.toml +++ b/examples/use_rust/rp2040_direct_pin/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk" } +rmk = { path = "../../../rmk", features = ["rp2040_bl"] } embassy-time = { version = "0.4", features = ["defmt"] } embassy-rp = { version = "0.4", features = [ "rp2040", @@ -22,13 +22,17 @@ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", "executor-thread", - "task-arena-size-32768", ] } cortex-m-rt = "0.7.5" -portable-atomic = { version = "1.10", features = ["critical-section"] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +portable-atomic = { version = "1.11", features = ["critical-section"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } # [features] # avoid having to use --allow-multiple-definition linker flag diff --git a/examples/use_rust/rp2040_direct_pin/build.rs b/examples/use_rust/rp2040_direct_pin/build.rs index 9456a7f91..12eb796e3 100644 --- a/examples/use_rust/rp2040_direct_pin/build.rs +++ b/examples/use_rust/rp2040_direct_pin/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -61,8 +62,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -78,6 +78,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/rp2040_direct_pin/src/macros.rs b/examples/use_rust/rp2040_direct_pin/src/macros.rs index 71cf07349..042b64cd3 100644 --- a/examples/use_rust/rp2040_direct_pin/src/macros.rs +++ b/examples/use_rust/rp2040_direct_pin/src/macros.rs @@ -22,9 +22,6 @@ macro_rules! config_matrix_pin_rp { }; (@pin $p:ident, $pin:ident) => { - Some(Input::new( - AnyPin::from($p.$pin), - embassy_rp::gpio::Pull::Up, - )) + Some(Input::new($p.$pin, embassy_rp::gpio::Pull::Up)) }; } diff --git a/examples/use_rust/rp2040_direct_pin/src/main.rs b/examples/use_rust/rp2040_direct_pin/src/main.rs index 687bf6b8c..4fc77ab6d 100644 --- a/examples/use_rust/rp2040_direct_pin/src/main.rs +++ b/examples/use_rust/rp2040_direct_pin/src/main.rs @@ -8,30 +8,24 @@ mod macros; mod vial; use defmt::info; -use defmt_rtt as _; use embassy_executor::Spawner; -use embassy_rp::{ - bind_interrupts, - flash::{Async, Flash}, - gpio::{AnyPin, Input, Output}, - peripherals::USB, - usb::{Driver, InterruptHandler}, -}; +use embassy_rp::bind_interrupts; +use embassy_rp::flash::{Async, Flash}; +use embassy_rp::gpio::{Input, Output}; +use embassy_rp::peripherals::USB; +use embassy_rp::usb::{Driver, InterruptHandler}; use keymap::{COL, ROW, SIZE}; -use panic_probe as _; -use rmk::{ - channel::EVENT_CHANNEL, - config::{ControllerConfig, KeyboardUsbConfig, RmkConfig, VialConfig}, - debounce::default_debouncer::DefaultDebouncer, - direct_pin::DirectPinMatrix, - futures::future::join3, - initialize_keymap_and_storage, - input_device::Runnable, - keyboard::Keyboard, - light::LightController, - run_devices, run_rmk, -}; +use rmk::channel::EVENT_CHANNEL; +use rmk::config::{ControllerConfig, KeyboardUsbConfig, RmkConfig, VialConfig}; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::direct_pin::DirectPinMatrix; +use rmk::futures::future::join3; +use rmk::input_device::Runnable; +use rmk::keyboard::Keyboard; +use rmk::light::LightController; +use rmk::{initialize_keymap_and_storage, run_devices, run_rmk}; use vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; +use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { USBCTRL_IRQ => InterruptHandler; @@ -83,7 +77,7 @@ async fn main(_spawner: Spawner) { // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let (keymap, storage) = initialize_keymap_and_storage( + let (keymap, mut storage) = initialize_keymap_and_storage( &mut default_keymap, flash, rmk_config.storage_config, @@ -97,8 +91,7 @@ async fn main(_spawner: Spawner) { let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); // Initialize the light controller - let light_controller: LightController = - LightController::new(ControllerConfig::default().light_config); + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); // Start join3( @@ -106,7 +99,7 @@ async fn main(_spawner: Spawner) { (matrix) => EVENT_CHANNEL, ), keyboard.run(), - run_rmk(&keymap, driver, storage, light_controller, rmk_config), + run_rmk(&keymap, driver, &mut storage, &mut light_controller, rmk_config), ) .await; } diff --git a/examples/use_rust/rp2040_direct_pin/src/vial.rs b/examples/use_rust/rp2040_direct_pin/src/vial.rs index a6fde2d4a..7e9b5ab12 100644 --- a/examples/use_rust/rp2040_direct_pin/src/vial.rs +++ b/examples/use_rust/rp2040_direct_pin/src/vial.rs @@ -1,28 +1,3 @@ // Vial config is automatically generated by `build.rs`, according to `vial.json` // Please put `vial.json` at your project's root include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); - -// Or you can manually generate vial config then put here -// pub const VIAL_KEYBOARD_ID: &[u8; 8] = &[0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; -// pub const VIAL_KEYBOARD_DEF: &[u8; 308] = &[ -// 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, -// 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, -// 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, -// 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, -// 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, 0x16, 0x4E, 0xEA, 0x09, -// 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, 0xA2, -// 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, -// 0xEE, 0x5C, 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, -// 0x43, 0x9A, 0x38, 0x26, 0x8C, 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, -// 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, -// 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, 0x61, 0x96, 0xFE, 0x27, 0x7B, -// 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, 0xA9, 0x09, -// 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, -// 0x1F, 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, -// 0xFE, 0xE7, 0x80, 0xCA, 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, -// 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, -// 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, -// 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, 0x01, 0x8D, 0x02, -// 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, -// 0x00, 0x04, 0x59, 0x5A, -// ]; diff --git a/examples/use_rust/rp2040_direct_pin/vial.json b/examples/use_rust/rp2040_direct_pin/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_rust/rp2040_direct_pin/vial.json +++ b/examples/use_rust/rp2040_direct_pin/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/rp2040_split/Cargo.lock b/examples/use_rust/rp2040_split/Cargo.lock index baf95c68a..6df51c5f2 100644 --- a/examples/use_rust/rp2040_split/Cargo.lock +++ b/examples/use_rust/rp2040_split/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -93,6 +104,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bit-set" version = "0.8.0" @@ -152,6 +169,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -209,6 +242,27 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -245,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -323,23 +383,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "crypto-common" -version = "0.1.6" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "typenum", + "rand_core", + "subtle", + "zeroize", ] [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "typenum", ] [[package]] @@ -348,22 +410,8 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -376,30 +424,28 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.95", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.95", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.95", + "generic-array", ] [[package]] @@ -410,9 +456,18 @@ checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" [[package]] name = "defmt" -version = "0.3.10" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" +dependencies = [ + "defmt 1.0.1", +] + +[[package]] +name = "defmt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -420,9 +475,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -433,21 +488,31 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", ] [[package]] @@ -458,6 +523,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -475,13 +541,32 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -496,12 +581,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -509,10 +593,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.95", @@ -521,10 +604,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -535,7 +617,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -567,7 +649,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -597,7 +679,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -628,12 +710,11 @@ dependencies = [ [[package]] name = "embassy-sync" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -648,7 +729,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -682,7 +763,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -698,7 +779,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -717,7 +798,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -726,7 +807,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -746,7 +827,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -755,7 +836,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -795,6 +876,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -849,6 +940,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -900,6 +1001,18 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", ] [[package]] @@ -965,10 +1078,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "home" version = "0.5.11" @@ -1017,6 +1149,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -1165,38 +1306,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1232,14 +1341,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1271,6 +1390,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "petgraph" version = "0.7.1" @@ -1364,9 +1528,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" dependencies = [ "critical-section", ] @@ -1378,7 +1542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1395,6 +1559,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -1411,6 +1584,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1451,6 +1633,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1513,12 +1705,13 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", "embassy-futures", "embassy-nrf", + "embassy-rp", "embassy-sync", "embassy-time", "embassy-usb", @@ -1529,7 +1722,6 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "postcard", @@ -1538,6 +1730,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1546,8 +1739,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1563,7 +1758,7 @@ version = "0.2.0" dependencies = [ "const-gen", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-futures", @@ -1635,6 +1830,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1658,11 +1866,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1695,6 +1903,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2-const-stable" version = "0.1.0" @@ -1796,15 +2015,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1901,12 +2120,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.95", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1931,7 +2192,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1942,7 +2203,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -2199,7 +2460,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -2212,3 +2482,20 @@ dependencies = [ "quote", "syn 2.0.95", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/rp2040_split/Cargo.toml b/examples/use_rust/rp2040_split/Cargo.toml index 2436d4c25..155356341 100644 --- a/examples/use_rust/rp2040_split/Cargo.toml +++ b/examples/use_rust/rp2040_split/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk", features = ["split"] } +rmk = { path = "../../../rmk", features = ["split", "rp2040_bl"] } embassy-time = { version = "0.4", features = ["defmt"] } embassy-rp = { version = "0.4", features = [ "rp2040", @@ -22,16 +22,20 @@ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", "executor-thread", - "task-arena-size-32768", ] } embassy-futures = { version = "0.1", features = ["defmt"] } cortex-m-rt = "0.7.5" -portable-atomic = { version = "1.10", features = ["critical-section"] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +portable-atomic = { version = "1.11", features = ["critical-section"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } static_cell = "2" +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } + # [features] # avoid having to use --allow-multiple-definition linker flag # on macOS with Apple Silicon at least diff --git a/examples/use_rust/rp2040_split/build.rs b/examples/use_rust/rp2040_split/build.rs index 9456a7f91..12eb796e3 100644 --- a/examples/use_rust/rp2040_split/build.rs +++ b/examples/use_rust/rp2040_split/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -61,8 +62,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -78,6 +78,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/rp2040_split/src/central.rs b/examples/use_rust/rp2040_split/src/central.rs index ef4bd0a37..361cef832 100644 --- a/examples/use_rust/rp2040_split/src/central.rs +++ b/examples/use_rust/rp2040_split/src/central.rs @@ -8,34 +8,26 @@ mod macros; mod vial; use defmt::info; -use defmt_rtt as _; use embassy_executor::Spawner; -use embassy_rp::{ - bind_interrupts, - flash::{Async, Flash}, - gpio::{AnyPin, Input, Output}, - peripherals::{UART0, USB}, - uart::{self, BufferedUart}, - usb::{Driver, InterruptHandler}, -}; -use panic_probe as _; -use rmk::{ - channel::EVENT_CHANNEL, - config::{ControllerConfig, KeyboardUsbConfig, RmkConfig, VialConfig}, - debounce::default_debouncer::DefaultDebouncer, - futures::future::join4, - initialize_keymap_and_storage, - input_device::Runnable, - keyboard::Keyboard, - light::LightController, - run_devices, run_rmk, - split::{ - central::{run_peripheral_manager, CentralMatrix}, - SPLIT_MESSAGE_MAX_SIZE, - }, -}; +use embassy_rp::bind_interrupts; +use embassy_rp::flash::{Async, Flash}; +use embassy_rp::gpio::{Input, Output}; +use embassy_rp::peripherals::{UART0, USB}; +use embassy_rp::uart::{self, BufferedUart}; +use embassy_rp::usb::{Driver, InterruptHandler}; +use rmk::channel::EVENT_CHANNEL; +use rmk::config::{ControllerConfig, KeyboardUsbConfig, RmkConfig, VialConfig}; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::futures::future::join4; +use rmk::input_device::Runnable; +use rmk::keyboard::Keyboard; +use rmk::light::LightController; +use rmk::split::central::{run_peripheral_manager, CentralMatrix}; +use rmk::split::SPLIT_MESSAGE_MAX_SIZE; +use rmk::{initialize_keymap_and_storage, run_devices, run_rmk}; use static_cell::StaticCell; use vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; +use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { USBCTRL_IRQ => InterruptHandler; @@ -82,19 +74,11 @@ async fn main(_spawner: Spawner) { let tx_buf = &mut TX_BUF.init([0; SPLIT_MESSAGE_MAX_SIZE])[..]; static RX_BUF: StaticCell<[u8; SPLIT_MESSAGE_MAX_SIZE]> = StaticCell::new(); let rx_buf = &mut RX_BUF.init([0; SPLIT_MESSAGE_MAX_SIZE])[..]; - let uart_receiver = BufferedUart::new( - p.UART0, - Irqs, - p.PIN_0, - p.PIN_1, - tx_buf, - rx_buf, - uart::Config::default(), - ); + let uart_receiver = BufferedUart::new(p.UART0, Irqs, p.PIN_0, p.PIN_1, tx_buf, rx_buf, uart::Config::default()); // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let (keymap, storage) = initialize_keymap_and_storage( + let (keymap, mut storage) = initialize_keymap_and_storage( &mut default_keymap, flash, rmk_config.storage_config, @@ -108,8 +92,7 @@ async fn main(_spawner: Spawner) { let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); // Initialize the light controller - let light_controller: LightController = - LightController::new(ControllerConfig::default().light_config); + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); // Start join4( @@ -118,7 +101,7 @@ async fn main(_spawner: Spawner) { ), keyboard.run(), run_peripheral_manager::<2, 1, 2, 2, _>(0, uart_receiver), - run_rmk(&keymap, driver, storage, light_controller, rmk_config), + run_rmk(&keymap, driver, &mut storage, &mut light_controller, rmk_config), ) .await; } diff --git a/examples/use_rust/rp2040_split/src/macros.rs b/examples/use_rust/rp2040_split/src/macros.rs index 249b878ac..fb2652993 100644 --- a/examples/use_rust/rp2040_split/src/macros.rs +++ b/examples/use_rust/rp2040_split/src/macros.rs @@ -1,8 +1,8 @@ macro_rules! config_matrix_pins_rp { (peripherals: $p:ident, input: [$($in_pin:ident), *], output: [$($out_pin:ident), +]) => { { - let mut output_pins = [$(Output::new(AnyPin::from($p.$out_pin), embassy_rp::gpio::Level::Low)), +]; - let input_pins = [$(Input::new(AnyPin::from($p.$in_pin), embassy_rp::gpio::Pull::Down)), +]; + let mut output_pins = [$(Output::new($p.$out_pin, embassy_rp::gpio::Level::Low)), +]; + let input_pins = [$(Input::new($p.$in_pin, embassy_rp::gpio::Pull::Down)), +]; output_pins.iter_mut().for_each(|p| { p.set_low(); }); diff --git a/examples/use_rust/rp2040_split/src/peripheral.rs b/examples/use_rust/rp2040_split/src/peripheral.rs index 77198f221..fe8d819bf 100644 --- a/examples/use_rust/rp2040_split/src/peripheral.rs +++ b/examples/use_rust/rp2040_split/src/peripheral.rs @@ -5,25 +5,21 @@ mod macros; use defmt::*; -use defmt_rtt as _; use embassy_executor::Spawner; -use embassy_rp::{ - bind_interrupts, - gpio::{AnyPin, Input, Output}, - peripherals::{UART0, USB}, - uart::{self, BufferedUart}, - usb::InterruptHandler, -}; -use panic_probe as _; -use rmk::{ - channel::EVENT_CHANNEL, - debounce::default_debouncer::DefaultDebouncer, - futures::future::join, - matrix::Matrix, - run_devices, - split::{peripheral::run_rmk_split_peripheral, SPLIT_MESSAGE_MAX_SIZE}, -}; +use embassy_rp::bind_interrupts; +use embassy_rp::gpio::{Input, Output}; +use embassy_rp::peripherals::{UART0, USB}; +use embassy_rp::uart::{self, BufferedUart}; +use embassy_rp::usb::InterruptHandler; +use rmk::channel::EVENT_CHANNEL; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::futures::future::join; +use rmk::matrix::Matrix; +use rmk::run_devices; +use rmk::split::peripheral::run_rmk_split_peripheral; +use rmk::split::SPLIT_MESSAGE_MAX_SIZE; use static_cell::StaticCell; +use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { USBCTRL_IRQ => InterruptHandler; @@ -44,15 +40,7 @@ async fn main(_spawner: Spawner) { let tx_buf = &mut TX_BUF.init([0; SPLIT_MESSAGE_MAX_SIZE])[..]; static RX_BUF: StaticCell<[u8; SPLIT_MESSAGE_MAX_SIZE]> = StaticCell::new(); let rx_buf = &mut RX_BUF.init([0; SPLIT_MESSAGE_MAX_SIZE])[..]; - let uart_instance = BufferedUart::new( - p.UART0, - Irqs, - p.PIN_0, - p.PIN_1, - tx_buf, - rx_buf, - uart::Config::default(), - ); + let uart_instance = BufferedUart::new(p.UART0, Irqs, p.PIN_0, p.PIN_1, tx_buf, rx_buf, uart::Config::default()); // Define the matrix let debouncer = DefaultDebouncer::<2, 2>::new(); diff --git a/examples/use_rust/rp2040_split/src/vial.rs b/examples/use_rust/rp2040_split/src/vial.rs index a6fde2d4a..7e9b5ab12 100644 --- a/examples/use_rust/rp2040_split/src/vial.rs +++ b/examples/use_rust/rp2040_split/src/vial.rs @@ -1,28 +1,3 @@ // Vial config is automatically generated by `build.rs`, according to `vial.json` // Please put `vial.json` at your project's root include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); - -// Or you can manually generate vial config then put here -// pub const VIAL_KEYBOARD_ID: &[u8; 8] = &[0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; -// pub const VIAL_KEYBOARD_DEF: &[u8; 308] = &[ -// 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, -// 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, -// 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, -// 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, -// 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, 0x16, 0x4E, 0xEA, 0x09, -// 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, 0xA2, -// 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, -// 0xEE, 0x5C, 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, -// 0x43, 0x9A, 0x38, 0x26, 0x8C, 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, -// 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, -// 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, 0x61, 0x96, 0xFE, 0x27, 0x7B, -// 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, 0xA9, 0x09, -// 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, -// 0x1F, 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, -// 0xFE, 0xE7, 0x80, 0xCA, 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, -// 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, -// 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, -// 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, 0x01, 0x8D, 0x02, -// 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, -// 0x00, 0x04, 0x59, 0x5A, -// ]; diff --git a/examples/use_rust/rp2040_split/vial.json b/examples/use_rust/rp2040_split/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_rust/rp2040_split/vial.json +++ b/examples/use_rust/rp2040_split/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/rp2040_split_pio/Cargo.lock b/examples/use_rust/rp2040_split_pio/Cargo.lock index 35a964359..8bafa3661 100644 --- a/examples/use_rust/rp2040_split_pio/Cargo.lock +++ b/examples/use_rust/rp2040_split_pio/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -93,6 +104,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bit-set" version = "0.8.0" @@ -152,6 +169,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -209,6 +242,27 @@ dependencies = [ "windows-link", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -245,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -323,23 +383,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "crypto-common" -version = "0.1.6" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "typenum", + "rand_core", + "subtle", + "zeroize", ] [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "typenum", ] [[package]] @@ -348,22 +410,8 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -376,30 +424,28 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.90", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.90", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.90", + "generic-array", ] [[package]] @@ -410,9 +456,18 @@ checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" [[package]] name = "defmt" -version = "0.3.10" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" +dependencies = [ + "defmt 1.0.1", +] + +[[package]] +name = "defmt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -420,9 +475,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -433,21 +488,31 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", ] [[package]] @@ -458,6 +523,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -475,13 +541,32 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -496,12 +581,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -509,10 +593,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.90", @@ -521,10 +604,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -535,7 +617,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -567,7 +649,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -597,7 +679,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -628,12 +710,11 @@ dependencies = [ [[package]] name = "embassy-sync" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -648,7 +729,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -682,7 +763,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -698,7 +779,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -717,7 +798,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -726,7 +807,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -746,7 +827,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -755,7 +836,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -795,6 +876,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -849,6 +940,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -900,6 +1001,18 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", ] [[package]] @@ -965,10 +1078,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "home" version = "0.5.11" @@ -1017,6 +1149,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -1165,38 +1306,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1232,14 +1341,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1271,6 +1390,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "petgraph" version = "0.7.1" @@ -1364,9 +1528,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" dependencies = [ "critical-section", ] @@ -1378,7 +1542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1395,6 +1559,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -1411,6 +1584,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1451,6 +1633,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1513,7 +1705,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1532,7 +1724,6 @@ dependencies = [ "fixed", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "pio", @@ -1543,6 +1734,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1551,8 +1743,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1568,7 +1762,7 @@ version = "0.2.0" dependencies = [ "const-gen", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-futures", @@ -1640,6 +1834,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1663,11 +1870,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1700,6 +1907,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2-const-stable" version = "0.1.0" @@ -1801,15 +2019,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1906,12 +2124,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.90", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1936,7 +2196,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1947,7 +2207,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -2210,7 +2470,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -2223,3 +2492,20 @@ dependencies = [ "quote", "syn 2.0.90", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/rp2040_split_pio/Cargo.toml b/examples/use_rust/rp2040_split_pio/Cargo.toml index b5e87f2ce..646947b1d 100644 --- a/examples/use_rust/rp2040_split_pio/Cargo.toml +++ b/examples/use_rust/rp2040_split_pio/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -rmk = { path = "../../../rmk", features = ["split", "rp2040_pio"] } +rmk = { path = "../../../rmk", features = ["split", "rp2040_pio", "rp2040_bl"] } embassy-time = { version = "0.4", features = ["defmt"] } embassy-rp = { version = "0.4", features = [ "rp2040", @@ -22,16 +22,20 @@ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", "executor-thread", - "task-arena-size-32768", ] } embassy-futures = { version = "0.1", features = ["defmt"] } cortex-m-rt = "0.7.5" -portable-atomic = { version = "1.10", features = ["critical-section"] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +portable-atomic = { version = "1.11", features = ["critical-section"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } static_cell = "2" +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } + # [features] # avoid having to use --allow-multiple-definition linker flag # on macOS with Apple Silicon at least diff --git a/examples/use_rust/rp2040_split_pio/build.rs b/examples/use_rust/rp2040_split_pio/build.rs index 9456a7f91..5b152bee0 100644 --- a/examples/use_rust/rp2040_split_pio/build.rs +++ b/examples/use_rust/rp2040_split_pio/build.rs @@ -78,6 +78,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/rp2040_split_pio/src/central.rs b/examples/use_rust/rp2040_split_pio/src/central.rs index df259769c..ded3f5d79 100644 --- a/examples/use_rust/rp2040_split_pio/src/central.rs +++ b/examples/use_rust/rp2040_split_pio/src/central.rs @@ -13,7 +13,7 @@ use embassy_executor::Spawner; use embassy_rp::{ bind_interrupts, flash::{Async, Flash}, - gpio::{AnyPin, Input, Output}, + gpio::{Input, Output}, peripherals::{PIO0, USB}, usb::{Driver, InterruptHandler}, }; @@ -29,9 +29,9 @@ use rmk::{ light::LightController, run_devices, run_rmk, split::{ - central::{run_peripheral_manager, CentralMatrix}, - rp::uart::{BufferedUart, UartInterruptHandler}, SPLIT_MESSAGE_MAX_SIZE, + central::{CentralMatrix, run_peripheral_manager}, + rp::uart::{BufferedUart, UartInterruptHandler}, }, }; use static_cell::StaticCell; @@ -82,7 +82,7 @@ async fn main(_spawner: Spawner) { // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let (keymap, storage) = initialize_keymap_and_storage( + let (keymap, mut storage) = initialize_keymap_and_storage( &mut default_keymap, flash, rmk_config.storage_config, @@ -96,8 +96,7 @@ async fn main(_spawner: Spawner) { let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); // Initialize the light controller - let light_controller: LightController = - LightController::new(ControllerConfig::default().light_config); + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); // Start join4( @@ -106,7 +105,7 @@ async fn main(_spawner: Spawner) { ), keyboard.run(), run_peripheral_manager::<2, 1, 2, 2, _>(0, uart_receiver), - run_rmk(&keymap, driver, storage, light_controller, rmk_config), + run_rmk(&keymap, driver, &mut storage, &mut light_controller, rmk_config), ) .await; } diff --git a/examples/use_rust/rp2040_split_pio/src/macros.rs b/examples/use_rust/rp2040_split_pio/src/macros.rs index 249b878ac..fb2652993 100644 --- a/examples/use_rust/rp2040_split_pio/src/macros.rs +++ b/examples/use_rust/rp2040_split_pio/src/macros.rs @@ -1,8 +1,8 @@ macro_rules! config_matrix_pins_rp { (peripherals: $p:ident, input: [$($in_pin:ident), *], output: [$($out_pin:ident), +]) => { { - let mut output_pins = [$(Output::new(AnyPin::from($p.$out_pin), embassy_rp::gpio::Level::Low)), +]; - let input_pins = [$(Input::new(AnyPin::from($p.$in_pin), embassy_rp::gpio::Pull::Down)), +]; + let mut output_pins = [$(Output::new($p.$out_pin, embassy_rp::gpio::Level::Low)), +]; + let input_pins = [$(Input::new($p.$in_pin, embassy_rp::gpio::Pull::Down)), +]; output_pins.iter_mut().for_each(|p| { p.set_low(); }); diff --git a/examples/use_rust/rp2040_split_pio/src/peripheral.rs b/examples/use_rust/rp2040_split_pio/src/peripheral.rs index d0a641271..d1b594f0b 100644 --- a/examples/use_rust/rp2040_split_pio/src/peripheral.rs +++ b/examples/use_rust/rp2040_split_pio/src/peripheral.rs @@ -9,7 +9,7 @@ use defmt_rtt as _; use embassy_executor::Spawner; use embassy_rp::{ bind_interrupts, - gpio::{AnyPin, Input, Output}, + gpio::{Input, Output}, peripherals::{PIO0, USB}, usb::InterruptHandler, }; @@ -21,9 +21,9 @@ use rmk::{ matrix::Matrix, run_devices, split::{ - peripheral::{run_rmk_split_peripheral}, - rp::uart::{BufferedUart, UartInterruptHandler}, SPLIT_MESSAGE_MAX_SIZE, + peripheral::run_rmk_split_peripheral, + rp::uart::{BufferedUart, UartInterruptHandler}, }, }; use static_cell::StaticCell; diff --git a/examples/use_rust/rp2040_split_pio/src/vial.rs b/examples/use_rust/rp2040_split_pio/src/vial.rs index a6fde2d4a..2aa93bc6e 100644 --- a/examples/use_rust/rp2040_split_pio/src/vial.rs +++ b/examples/use_rust/rp2040_split_pio/src/vial.rs @@ -2,27 +2,3 @@ // Please put `vial.json` at your project's root include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); -// Or you can manually generate vial config then put here -// pub const VIAL_KEYBOARD_ID: &[u8; 8] = &[0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; -// pub const VIAL_KEYBOARD_DEF: &[u8; 308] = &[ -// 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, -// 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, -// 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, -// 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, -// 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, 0x16, 0x4E, 0xEA, 0x09, -// 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, 0xA2, -// 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, -// 0xEE, 0x5C, 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, -// 0x43, 0x9A, 0x38, 0x26, 0x8C, 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, -// 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, -// 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, 0x61, 0x96, 0xFE, 0x27, 0x7B, -// 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, 0xA9, 0x09, -// 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, -// 0x1F, 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, -// 0xFE, 0xE7, 0x80, 0xCA, 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, -// 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, -// 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, -// 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, 0x01, 0x8D, 0x02, -// 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, -// 0x00, 0x04, 0x59, 0x5A, -// ]; diff --git a/examples/use_rust/rp2040_split_pio/vial.json b/examples/use_rust/rp2040_split_pio/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_rust/rp2040_split_pio/vial.json +++ b/examples/use_rust/rp2040_split_pio/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/rp2350/Cargo.lock b/examples/use_rust/rp2350/Cargo.lock index e01cfc413..ed01981e2 100644 --- a/examples/use_rust/rp2350/Cargo.lock +++ b/examples/use_rust/rp2350/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -93,6 +104,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bit-set" version = "0.8.0" @@ -152,6 +169,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -209,6 +242,27 @@ dependencies = [ "windows-link", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -245,6 +299,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -323,23 +383,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "crypto-common" -version = "0.1.6" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "typenum", + "rand_core", + "subtle", + "zeroize", ] [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "typenum", ] [[package]] @@ -348,22 +410,8 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -376,30 +424,28 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.95", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", - "syn 1.0.109", + "syn 2.0.95", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.95", + "generic-array", ] [[package]] @@ -410,9 +456,18 @@ checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" [[package]] name = "defmt" -version = "0.3.10" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" +dependencies = [ + "defmt 1.0.1", +] + +[[package]] +name = "defmt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -420,9 +475,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -433,21 +488,31 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", ] [[package]] @@ -458,6 +523,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -475,13 +541,32 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -496,12 +581,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -509,10 +593,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.95", @@ -521,10 +604,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -535,7 +617,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -567,7 +649,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -597,7 +679,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -629,12 +711,11 @@ dependencies = [ [[package]] name = "embassy-sync" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -649,7 +730,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -683,7 +764,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -699,7 +780,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -718,7 +799,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -727,7 +808,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -747,7 +828,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -756,7 +837,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -796,6 +877,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -850,6 +941,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -901,6 +1002,18 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", ] [[package]] @@ -966,10 +1079,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "home" version = "0.5.11" @@ -1018,6 +1150,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -1166,38 +1307,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1233,14 +1342,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1272,6 +1391,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "petgraph" version = "0.7.1" @@ -1365,9 +1529,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" dependencies = [ "critical-section", ] @@ -1379,7 +1543,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1396,6 +1560,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -1412,6 +1585,15 @@ dependencies = [ "syn 2.0.95", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1452,6 +1634,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1514,7 +1706,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1530,7 +1722,6 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "postcard", @@ -1539,6 +1730,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1547,8 +1739,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1564,7 +1758,7 @@ version = "0.2.0" dependencies = [ "const-gen", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-rp", @@ -1640,6 +1834,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1663,11 +1870,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1700,6 +1907,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2-const-stable" version = "0.1.0" @@ -1801,15 +2019,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1906,12 +2124,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.95", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1936,7 +2196,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1947,7 +2207,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -2210,7 +2470,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -2223,3 +2492,20 @@ dependencies = [ "quote", "syn 2.0.95", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/rp2350/Cargo.toml b/examples/use_rust/rp2350/Cargo.toml index a93716a66..34ad250bc 100644 --- a/examples/use_rust/rp2350/Cargo.toml +++ b/examples/use_rust/rp2350/Cargo.toml @@ -23,13 +23,17 @@ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", "executor-thread", - "task-arena-size-32768", ] } cortex-m-rt = "0.7.5" -portable-atomic = { version = "1.10", features = ["critical-section"] } -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +portable-atomic = { version = "1.11", features = ["critical-section"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } # [features] # avoid having to use --allow-multiple-definition linker flag diff --git a/examples/use_rust/rp2350/build.rs b/examples/use_rust/rp2350/build.rs index 9456a7f91..5b152bee0 100644 --- a/examples/use_rust/rp2350/build.rs +++ b/examples/use_rust/rp2350/build.rs @@ -78,6 +78,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/rp2350/src/macros.rs b/examples/use_rust/rp2350/src/macros.rs index 249b878ac..fb2652993 100644 --- a/examples/use_rust/rp2350/src/macros.rs +++ b/examples/use_rust/rp2350/src/macros.rs @@ -1,8 +1,8 @@ macro_rules! config_matrix_pins_rp { (peripherals: $p:ident, input: [$($in_pin:ident), *], output: [$($out_pin:ident), +]) => { { - let mut output_pins = [$(Output::new(AnyPin::from($p.$out_pin), embassy_rp::gpio::Level::Low)), +]; - let input_pins = [$(Input::new(AnyPin::from($p.$in_pin), embassy_rp::gpio::Pull::Down)), +]; + let mut output_pins = [$(Output::new($p.$out_pin, embassy_rp::gpio::Level::Low)), +]; + let input_pins = [$(Input::new($p.$in_pin, embassy_rp::gpio::Pull::Down)), +]; output_pins.iter_mut().for_each(|p| { p.set_low(); }); diff --git a/examples/use_rust/rp2350/src/main.rs b/examples/use_rust/rp2350/src/main.rs index b4e5da7e5..7c2fad6ff 100644 --- a/examples/use_rust/rp2350/src/main.rs +++ b/examples/use_rust/rp2350/src/main.rs @@ -14,7 +14,7 @@ use embassy_rp::{ bind_interrupts, block::ImageDef, flash::{Async, Flash}, - gpio::{AnyPin, Input, Output}, + gpio::{Input, Output}, peripherals::USB, usb::{Driver, InterruptHandler}, }; @@ -48,9 +48,7 @@ pub static IMAGE_DEF: ImageDef = ImageDef::secure_exe(); #[used] pub static PICOTOOL_ENTRIES: [embassy_rp::binary_info::EntryAddr; 4] = [ embassy_rp::binary_info::rp_program_name!(c"RMK Example"), - embassy_rp::binary_info::rp_program_description!( - c"This example tests the RMK for RP Pico board" - ), + embassy_rp::binary_info::rp_program_description!(c"This example tests the RMK for RP Pico board"), embassy_rp::binary_info::rp_cargo_version!(), embassy_rp::binary_info::rp_program_build_attribute!(), ]; @@ -67,7 +65,8 @@ async fn main(_spawner: Spawner) { let driver = Driver::new(p.USB, Irqs); // Pin config - let (input_pins, output_pins) = config_matrix_pins_rp!(peripherals: p, input: [PIN_6, PIN_7, PIN_8, PIN_9], output: [PIN_19, PIN_20, PIN_21]); + let (input_pins, output_pins) = + config_matrix_pins_rp!(peripherals: p, input: [PIN_6, PIN_7, PIN_8, PIN_9], output: [PIN_19, PIN_20, PIN_21]); // Use internal flash to emulate eeprom let flash = Flash::<_, Async, FLASH_SIZE>::new(p.FLASH, p.DMA_CH0); @@ -90,7 +89,7 @@ async fn main(_spawner: Spawner) { // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let (keymap, storage) = initialize_keymap_and_storage( + let (keymap, mut storage) = initialize_keymap_and_storage( &mut default_keymap, flash, rmk_config.storage_config, @@ -104,8 +103,7 @@ async fn main(_spawner: Spawner) { let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); // Initialize the light controller - let light_controller: LightController = - LightController::new(ControllerConfig::default().light_config); + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); // Start join3( @@ -113,7 +111,7 @@ async fn main(_spawner: Spawner) { (matrix) => EVENT_CHANNEL, ), keyboard.run(), - run_rmk(&keymap, driver, storage, light_controller, rmk_config), + run_rmk(&keymap, driver, &mut storage, &mut light_controller, rmk_config), ) .await; } diff --git a/examples/use_rust/rp2350/src/vial.rs b/examples/use_rust/rp2350/src/vial.rs index a6fde2d4a..2aa93bc6e 100644 --- a/examples/use_rust/rp2350/src/vial.rs +++ b/examples/use_rust/rp2350/src/vial.rs @@ -2,27 +2,3 @@ // Please put `vial.json` at your project's root include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); -// Or you can manually generate vial config then put here -// pub const VIAL_KEYBOARD_ID: &[u8; 8] = &[0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; -// pub const VIAL_KEYBOARD_DEF: &[u8; 308] = &[ -// 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, -// 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, -// 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, -// 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, -// 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, 0x16, 0x4E, 0xEA, 0x09, -// 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, 0xA2, -// 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, -// 0xEE, 0x5C, 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, -// 0x43, 0x9A, 0x38, 0x26, 0x8C, 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, -// 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, -// 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, 0x61, 0x96, 0xFE, 0x27, 0x7B, -// 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, 0xA9, 0x09, -// 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, -// 0x1F, 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, -// 0xFE, 0xE7, 0x80, 0xCA, 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, -// 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, -// 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, -// 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, 0x01, 0x8D, 0x02, -// 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, -// 0x00, 0x04, 0x59, 0x5A, -// ]; diff --git a/examples/use_rust/rp2350/vial.json b/examples/use_rust/rp2350/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_rust/rp2350/vial.json +++ b/examples/use_rust/rp2350/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/stm32f1/.cargo/config.toml b/examples/use_rust/stm32f1/.cargo/config.toml index f19add5d1..4d55cc5ad 100644 --- a/examples/use_rust/stm32f1/.cargo/config.toml +++ b/examples/use_rust/stm32f1/.cargo/config.toml @@ -1,36 +1,9 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -# uncomment ONE of these three option to make `cargo run` start a GDB session -# which option to pick depends on your system runner = "probe-rs run --chip STM32F103CB" -# runner = "gdb-multiarch -q -x openocd.gdb" -# runner = "gdb -q -x openocd.gdb" linker = "flip-link" -rustflags = [ - # Previously, the linker arguments --nmagic and -Tlink.x were set here. - # They are now set by build.rs instead. The linker argument can still - # only be set here, if a custom linker is needed. - - # By default, the LLD linker is used, which is shipped with the Rust - # toolchain. If you run into problems with LLD, you can switch to the - # GNU linker by uncommenting this line: - # "-C", "linker=arm-none-eabi-ld", - - # If you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by uncommenting the three lines below: - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] [build] -# Pick ONE of these default compilation targets -# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ target = "thumbv7m-none-eabi" # Cortex-M3 -# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) -# target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) -# target = "thumbv8m.base-none-eabi" # Cortex-M23 -# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) -# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) [env] DEFMT_LOG = "error" \ No newline at end of file diff --git a/examples/use_rust/stm32f1/Cargo.lock b/examples/use_rust/stm32f1/Cargo.lock index 21a152d42..1ff83029f 100644 --- a/examples/use_rust/stm32f1/Cargo.lock +++ b/examples/use_rust/stm32f1/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -96,6 +107,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bit_field" version = "0.10.2" @@ -137,6 +154,15 @@ version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "block-device-driver" version = "0.2.0" @@ -146,6 +172,22 @@ dependencies = [ "aligned", ] +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -203,6 +245,27 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -229,6 +292,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -268,6 +337,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -290,13 +368,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", ] [[package]] @@ -305,65 +395,58 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", + "strsim", + "syn 2.0.90", ] [[package]] -name = "darling_core" +name = "darling_macro" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", + "darling_core", "quote", - "strsim 0.11.1", "syn 2.0.90", ] [[package]] -name = "darling_macro" -version = "0.13.4" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.13.4", - "quote", - "syn 1.0.109", + "generic-array", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "defmt" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.90", + "defmt 1.0.1", ] [[package]] name = "defmt" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -371,9 +454,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -384,13 +467,34 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + [[package]] name = "document-features" version = "0.2.10" @@ -400,13 +504,32 @@ dependencies = [ "litrs", ] +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -421,12 +544,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -434,10 +556,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.90", @@ -446,10 +567,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -460,7 +580,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -470,7 +590,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -495,7 +615,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -528,7 +648,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -564,13 +684,12 @@ dependencies = [ [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -585,7 +704,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -619,7 +738,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -635,7 +754,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -645,7 +764,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08e753b23799329780c7ac434264026d0422044d6649ed70a73441b14a6436d7" dependencies = [ "critical-section", - "defmt", + "defmt 0.3.100", "embassy-sync", "embassy-usb-driver", ] @@ -675,7 +794,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -684,7 +803,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -704,7 +823,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -713,7 +832,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -744,6 +863,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -792,6 +921,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -835,6 +974,28 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" version = "2.4.1" @@ -898,10 +1059,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -941,6 +1121,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -1033,38 +1222,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1100,6 +1257,16 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-halt" version = "1.0.0" @@ -1112,6 +1279,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "pin-project-lite" version = "0.2.15" @@ -1143,7 +1355,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1160,6 +1372,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" version = "0.2.25" @@ -1170,6 +1391,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1210,6 +1440,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1254,7 +1494,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1270,7 +1510,6 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "postcard", @@ -1279,6 +1518,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1287,8 +1527,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1305,7 +1547,7 @@ dependencies = [ "const-gen", "cortex-m", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "embassy-executor", "embassy-stm32", "embassy-time", @@ -1351,6 +1593,19 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93c025f9cfe4c388c328ece47d11a54a823da3b5ad0370b22d95ad47137f85a" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1374,11 +1629,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1411,6 +1666,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1478,15 +1744,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1564,12 +1830,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.90", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1582,7 +1890,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1593,7 +1901,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -1813,7 +2121,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -1826,3 +2143,20 @@ dependencies = [ "quote", "syn 2.0.90", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/stm32f1/Cargo.toml b/examples/use_rust/stm32f1/Cargo.toml index bb2b7613c..51e744d0c 100644 --- a/examples/use_rust/stm32f1/Cargo.toml +++ b/examples/use_rust/stm32f1/Cargo.toml @@ -24,11 +24,14 @@ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", "executor-thread", - "task-arena-size-16384", ] } -defmt = "0.3" +defmt = "1.0" panic-halt = "1.0" +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_rust/stm32f1/build.rs b/examples/use_rust/stm32f1/build.rs index 4b1aaf983..86da9ce94 100644 --- a/examples/use_rust/stm32f1/build.rs +++ b/examples/use_rust/stm32f1/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::Read; use std::path::Path; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -47,8 +48,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -64,6 +64,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/stm32f1/src/main.rs b/examples/use_rust/stm32f1/src/main.rs index c7e922f4b..1a13873d5 100644 --- a/examples/use_rust/stm32f1/src/main.rs +++ b/examples/use_rust/stm32f1/src/main.rs @@ -8,29 +8,23 @@ mod vial; use defmt::info; use embassy_executor::Spawner; -use embassy_stm32::{ - bind_interrupts, - flash::Flash, - gpio::{Input, Output}, - peripherals::USB, - usb::{Driver, InterruptHandler}, - Config, -}; +use embassy_stm32::flash::Flash; +use embassy_stm32::gpio::{Input, Output}; +use embassy_stm32::peripherals::USB; +use embassy_stm32::usb::{Driver, InterruptHandler}; +use embassy_stm32::{bind_interrupts, Config}; use keymap::{COL, ROW}; use panic_halt as _; -use rmk::{ - channel::EVENT_CHANNEL, - config::{ControllerConfig, RmkConfig, VialConfig}, - debounce::default_debouncer::DefaultDebouncer, - futures::future::join3, - initialize_keymap_and_storage, - input_device::Runnable, - keyboard::Keyboard, - light::LightController, - matrix::Matrix, - run_devices, run_rmk, - storage::async_flash_wrapper, -}; +use rmk::channel::EVENT_CHANNEL; +use rmk::config::{ControllerConfig, RmkConfig, VialConfig}; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::futures::future::join3; +use rmk::input_device::Runnable; +use rmk::keyboard::Keyboard; +use rmk::light::LightController; +use rmk::matrix::Matrix; +use rmk::storage::async_flash_wrapper; +use rmk::{initialize_keymap_and_storage, run_devices, run_rmk}; use vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; #[defmt::global_logger] @@ -60,7 +54,8 @@ async fn main(_spawner: Spawner) { let driver = Driver::new(p.USB, Irqs, p.PA12, p.PA11); // Pin config - let (input_pins, output_pins) = config_matrix_pins_stm32!(peripherals: p, input: [PA9, PB8, PB13, PB12], output: [PA13, PA14, PA15]); + let (input_pins, output_pins) = + config_matrix_pins_stm32!(peripherals: p, input: [PA9, PB8, PB13, PB12], output: [PA13, PA14, PA15]); // Use internal flash to emulate eeprom let flash = async_flash_wrapper(Flash::new_blocking(p.FLASH)); @@ -73,7 +68,7 @@ async fn main(_spawner: Spawner) { // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let (keymap, storage) = initialize_keymap_and_storage( + let (keymap, mut storage) = initialize_keymap_and_storage( &mut default_keymap, flash, rmk_config.storage_config, @@ -87,8 +82,7 @@ async fn main(_spawner: Spawner) { let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); // Initialize the light controller - let light_controller: LightController = - LightController::new(ControllerConfig::default().light_config); + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); // Start join3( @@ -96,7 +90,7 @@ async fn main(_spawner: Spawner) { (matrix) => EVENT_CHANNEL, ), keyboard.run(), - run_rmk(&keymap, driver, storage, light_controller, rmk_config), + run_rmk(&keymap, driver, &mut storage, &mut light_controller, rmk_config), ) .await; } diff --git a/examples/use_rust/stm32f1/src/vial.rs b/examples/use_rust/stm32f1/src/vial.rs index e6b7e9df7..a1c615e3e 100644 --- a/examples/use_rust/stm32f1/src/vial.rs +++ b/examples/use_rust/stm32f1/src/vial.rs @@ -1,23 +1,20 @@ pub const VIAL_KEYBOARD_ID: &[u8; 8] = &[0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; pub const VIAL_KEYBOARD_DEF: &[u8; 308] = &[ - 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, - 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, - 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, - 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, - 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, 0x16, 0x4E, 0xEA, 0x09, - 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, 0xA2, - 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, - 0xEE, 0x5C, 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, - 0x43, 0x9A, 0x38, 0x26, 0x8C, 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, - 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, - 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, 0x61, 0x96, 0xFE, 0x27, 0x7B, - 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, 0xA9, 0x09, - 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, - 0x1F, 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, - 0xFE, 0xE7, 0x80, 0xCA, 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, - 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, - 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, - 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, 0x01, 0x8D, 0x02, - 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, + 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, 0x16, 0x00, 0x00, + 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, + 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, + 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, + 0x16, 0x4E, 0xEA, 0x09, 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, + 0xA2, 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, 0xEE, 0x5C, + 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, 0x43, 0x9A, 0x38, 0x26, 0x8C, + 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, + 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, + 0x61, 0x96, 0xFE, 0x27, 0x7B, 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, + 0xA9, 0x09, 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, 0x1F, + 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, 0xFE, 0xE7, 0x80, 0xCA, + 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, + 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, + 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, + 0x01, 0x8D, 0x02, 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x59, 0x5A, ]; diff --git a/examples/use_rust/stm32f1/vial.json b/examples/use_rust/stm32f1/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_rust/stm32f1/vial.json +++ b/examples/use_rust/stm32f1/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/stm32f4/.cargo/config.toml b/examples/use_rust/stm32f4/.cargo/config.toml index 64f86a711..ae07be7bd 100644 --- a/examples/use_rust/stm32f4/.cargo/config.toml +++ b/examples/use_rust/stm32f4/.cargo/config.toml @@ -1,37 +1,10 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -# uncomment ONE of these three option to make `cargo run` start a GDB session -# which option to pick depends on your system runner = "probe-rs run --chip STM32F411CEUx" # runner = "probe-rs run --chip STM32F407VETx" -# runner = "gdb-multiarch -q -x openocd.gdb" -# runner = "gdb -q -x openocd.gdb" linker = "flip-link" -rustflags = [ - # Previously, the linker arguments --nmagic and -Tlink.x were set here. - # They are now set by build.rs instead. The linker argument can still - # only be set here, if a custom linker is needed. - - # By default, the LLD linker is used, which is shipped with the Rust - # toolchain. If you run into problems with LLD, you can switch to the - # GNU linker by uncommenting this line: - # "-C", "linker=arm-none-eabi-ld", - - # If you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by uncommenting the three lines below: - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] [build] -# Pick ONE of these default compilation targets -# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ -# target = "thumbv7m-none-eabi" # Cortex-M3 -# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) -# target = "thumbv8m.base-none-eabi" # Cortex-M23 -# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) -# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) [env] DEFMT_LOG = "debug" \ No newline at end of file diff --git a/examples/use_rust/stm32f4/Cargo.lock b/examples/use_rust/stm32f4/Cargo.lock index a549db8cd..340fa1c36 100644 --- a/examples/use_rust/stm32f4/Cargo.lock +++ b/examples/use_rust/stm32f4/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -96,6 +107,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bit_field" version = "0.10.2" @@ -137,6 +154,15 @@ version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "block-device-driver" version = "0.2.0" @@ -146,6 +172,22 @@ dependencies = [ "aligned", ] +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -203,6 +245,27 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -229,6 +292,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -268,6 +337,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -290,13 +368,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", ] [[package]] @@ -305,65 +395,58 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", + "strsim", + "syn 2.0.90", ] [[package]] -name = "darling_core" +name = "darling_macro" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", + "darling_core", "quote", - "strsim 0.11.1", "syn 2.0.90", ] [[package]] -name = "darling_macro" -version = "0.13.4" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.13.4", - "quote", - "syn 1.0.109", + "generic-array", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "defmt" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.90", + "defmt 1.0.1", ] [[package]] name = "defmt" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -371,9 +454,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -384,21 +467,42 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", ] [[package]] @@ -410,13 +514,32 @@ dependencies = [ "litrs", ] +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -431,12 +554,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -444,10 +566,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.90", @@ -456,10 +577,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -470,7 +590,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -480,7 +600,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -505,7 +625,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -538,7 +658,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -574,13 +694,12 @@ dependencies = [ [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -595,7 +714,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -629,7 +748,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -645,7 +764,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -655,7 +774,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08e753b23799329780c7ac434264026d0422044d6649ed70a73441b14a6436d7" dependencies = [ "critical-section", - "defmt", + "defmt 0.3.100", "embassy-sync", "embassy-usb-driver", ] @@ -685,7 +804,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -694,7 +813,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -714,7 +833,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -723,7 +842,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -754,6 +873,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -802,6 +931,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -845,6 +984,28 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" version = "2.4.1" @@ -908,10 +1069,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -951,6 +1131,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -1043,38 +1232,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1110,14 +1267,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1126,6 +1293,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "pin-project-lite" version = "0.2.15" @@ -1157,7 +1369,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1174,6 +1386,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" version = "0.2.25" @@ -1184,6 +1405,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1224,6 +1454,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1268,7 +1508,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1284,7 +1524,6 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "postcard", @@ -1293,6 +1532,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1301,8 +1541,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1319,7 +1561,7 @@ dependencies = [ "const-gen", "cortex-m", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-stm32", @@ -1367,6 +1609,19 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93c025f9cfe4c388c328ece47d11a54a823da3b5ad0370b22d95ad47137f85a" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1390,11 +1645,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1427,6 +1682,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1494,15 +1760,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1580,12 +1846,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.90", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1598,7 +1906,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1609,7 +1917,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -1829,7 +2137,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -1842,3 +2159,20 @@ dependencies = [ "quote", "syn 2.0.90", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/stm32f4/Cargo.toml b/examples/use_rust/stm32f4/Cargo.toml index 0cb6d8f40..6eb0aadff 100644 --- a/examples/use_rust/stm32f4/Cargo.toml +++ b/examples/use_rust/stm32f4/Cargo.toml @@ -25,13 +25,16 @@ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", "executor-thread", - "task-arena-size-32768", ] } static_cell = "2" -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_rust/stm32f4/build.rs b/examples/use_rust/stm32f4/build.rs index 4b1aaf983..86da9ce94 100644 --- a/examples/use_rust/stm32f4/build.rs +++ b/examples/use_rust/stm32f4/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::Read; use std::path::Path; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -47,8 +48,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -64,6 +64,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/stm32f4/src/main.rs b/examples/use_rust/stm32f4/src/main.rs index e38506a55..aab7828ec 100644 --- a/examples/use_rust/stm32f4/src/main.rs +++ b/examples/use_rust/stm32f4/src/main.rs @@ -7,33 +7,26 @@ mod keymap; mod vial; use defmt::info; -use defmt_rtt as _; use embassy_executor::Spawner; -use embassy_stm32::{ - bind_interrupts, - flash::Flash, - gpio::{Input, Output}, - peripherals::USB_OTG_FS, - usb::{Driver, InterruptHandler}, - Config, -}; +use embassy_stm32::flash::Flash; +use embassy_stm32::gpio::{Input, Output}; +use embassy_stm32::peripherals::USB_OTG_FS; +use embassy_stm32::usb::{Driver, InterruptHandler}; +use embassy_stm32::{bind_interrupts, Config}; use keymap::{COL, ROW}; -use panic_probe as _; -use rmk::{ - channel::EVENT_CHANNEL, - config::{ControllerConfig, RmkConfig, VialConfig}, - debounce::default_debouncer::DefaultDebouncer, - futures::future::join3, - initialize_keymap_and_storage, - input_device::Runnable, - keyboard::Keyboard, - light::LightController, - matrix::Matrix, - run_devices, run_rmk, - storage::async_flash_wrapper, -}; +use rmk::channel::EVENT_CHANNEL; +use rmk::config::{ControllerConfig, RmkConfig, VialConfig}; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::futures::future::join3; +use rmk::input_device::Runnable; +use rmk::keyboard::Keyboard; +use rmk::light::LightController; +use rmk::matrix::Matrix; +use rmk::storage::async_flash_wrapper; +use rmk::{initialize_keymap_and_storage, run_devices, run_rmk}; use static_cell::StaticCell; use vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; +use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { OTG_FS => InterruptHandler; @@ -62,7 +55,8 @@ async fn main(_spawner: Spawner) { ); // Pin config - let (input_pins, output_pins) = config_matrix_pins_stm32!(peripherals: p, input: [PA9, PB8, PB13, PB12], output: [PA13, PA14, PA15]); + let (input_pins, output_pins) = + config_matrix_pins_stm32!(peripherals: p, input: [PA9, PB8, PB13, PB12], output: [PA13, PA14, PA15]); // Use internal flash to emulate eeprom let flash = async_flash_wrapper(Flash::new_blocking(p.FLASH)); @@ -75,7 +69,7 @@ async fn main(_spawner: Spawner) { // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let (keymap, storage) = initialize_keymap_and_storage( + let (keymap, mut storage) = initialize_keymap_and_storage( &mut default_keymap, flash, rmk_config.storage_config, @@ -89,8 +83,7 @@ async fn main(_spawner: Spawner) { let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); // Initialize the light controller - let light_controller: LightController = - LightController::new(ControllerConfig::default().light_config); + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); // Start join3( @@ -98,7 +91,7 @@ async fn main(_spawner: Spawner) { (matrix) => EVENT_CHANNEL, ), keyboard.run(), - run_rmk(&keymap, driver, storage, light_controller, rmk_config), + run_rmk(&keymap, driver, &mut storage, &mut light_controller, rmk_config), ) .await; } diff --git a/examples/use_rust/stm32f4/src/vial.rs b/examples/use_rust/stm32f4/src/vial.rs index e6b7e9df7..a1c615e3e 100644 --- a/examples/use_rust/stm32f4/src/vial.rs +++ b/examples/use_rust/stm32f4/src/vial.rs @@ -1,23 +1,20 @@ pub const VIAL_KEYBOARD_ID: &[u8; 8] = &[0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; pub const VIAL_KEYBOARD_DEF: &[u8; 308] = &[ - 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, - 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, - 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, - 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, - 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, 0x16, 0x4E, 0xEA, 0x09, - 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, 0xA2, - 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, - 0xEE, 0x5C, 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, - 0x43, 0x9A, 0x38, 0x26, 0x8C, 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, - 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, - 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, 0x61, 0x96, 0xFE, 0x27, 0x7B, - 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, 0xA9, 0x09, - 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, - 0x1F, 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, - 0xFE, 0xE7, 0x80, 0xCA, 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, - 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, - 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, - 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, 0x01, 0x8D, 0x02, - 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, + 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, 0x16, 0x00, 0x00, + 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, + 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, + 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, + 0x16, 0x4E, 0xEA, 0x09, 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, + 0xA2, 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, 0xEE, 0x5C, + 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, 0x43, 0x9A, 0x38, 0x26, 0x8C, + 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, + 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, + 0x61, 0x96, 0xFE, 0x27, 0x7B, 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, + 0xA9, 0x09, 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, 0x1F, + 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, 0xFE, 0xE7, 0x80, 0xCA, + 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, + 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, + 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, + 0x01, 0x8D, 0x02, 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x59, 0x5A, ]; diff --git a/examples/use_rust/stm32f4/vial.json b/examples/use_rust/stm32f4/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_rust/stm32f4/vial.json +++ b/examples/use_rust/stm32f4/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/examples/use_rust/stm32g4/Cargo.toml b/examples/use_rust/stm32g4/Cargo.toml index 403b6ec16..660e9ff40 100644 --- a/examples/use_rust/stm32g4/Cargo.toml +++ b/examples/use_rust/stm32g4/Cargo.toml @@ -26,8 +26,8 @@ embassy-executor = { version = "0.7", features = [ "executor-thread", "task-arena-size-16384", ] } -defmt = "0.3" -defmt-rtt = "0.4" +defmt = "1.0" +defmt-rtt = "1.0" panic-halt = "1.0" diff --git a/examples/use_rust/stm32g4/build.rs b/examples/use_rust/stm32g4/build.rs index 4b1aaf983..6d372b1bd 100644 --- a/examples/use_rust/stm32g4/build.rs +++ b/examples/use_rust/stm32g4/build.rs @@ -64,6 +64,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/stm32h7/.cargo/config.toml b/examples/use_rust/stm32h7/.cargo/config.toml index caf481758..06f836fae 100644 --- a/examples/use_rust/stm32h7/.cargo/config.toml +++ b/examples/use_rust/stm32h7/.cargo/config.toml @@ -1,40 +1,9 @@ -[target.thumbv7m-none-eabi] -# uncomment this to make `cargo run` execute programs on QEMU -# runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" - [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -# uncomment ONE of these three option to make `cargo run` start a GDB session -# which option to pick depends on your system runner = "probe-rs run --chip STM32H7B0VBTx" -# runner = "gdb-multiarch -q -x openocd.gdb" -# runner = "gdb -q -x openocd.gdb" linker = "flip-link" -rustflags = [ - # Previously, the linker arguments --nmagic and -Tlink.x were set here. - # They are now set by build.rs instead. The linker argument can still - # only be set here, if a custom linker is needed. - - # By default, the LLD linker is used, which is shipped with the Rust - # toolchain. If you run into problems with LLD, you can switch to the - # GNU linker by uncommenting this line: - # "-C", "linker=arm-none-eabi-ld", - - # If you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by uncommenting the three lines below: - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] [build] -# Pick ONE of these default compilation targets -# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ -# target = "thumbv7m-none-eabi" # Cortex-M3 -# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) -# target = "thumbv8m.base-none-eabi" # Cortex-M23 -# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) -# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) [env] DEFMT_LOG = "debug" \ No newline at end of file diff --git a/examples/use_rust/stm32h7/Cargo.lock b/examples/use_rust/stm32h7/Cargo.lock index 17196aaae..9b7a04577 100644 --- a/examples/use_rust/stm32h7/Cargo.lock +++ b/examples/use_rust/stm32h7/Cargo.lock @@ -12,6 +12,17 @@ dependencies = [ "regex", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -21,7 +32,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -96,6 +107,12 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "bit_field" version = "0.10.2" @@ -137,6 +154,15 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "block-device-driver" version = "0.2.0" @@ -146,6 +172,22 @@ dependencies = [ "aligned", ] +[[package]] +name = "bt-hci" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f7f1f43de0439ca5d300a85848235db843d6386dd56c066469423d440f4872" +dependencies = [ + "defmt 0.3.100", + "embassy-sync", + "embassy-time", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless 0.8.0", + "uuid", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -203,6 +245,27 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmac" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" +dependencies = [ + "cipher", + "dbl", + "digest", +] + [[package]] name = "cobs" version = "0.2.3" @@ -229,6 +292,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -268,6 +337,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -290,13 +368,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "darling" -version = "0.13.4" +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", ] [[package]] @@ -305,65 +395,58 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core", + "darling_macro", ] [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", + "strsim", + "syn 2.0.90", ] [[package]] -name = "darling_core" +name = "darling_macro" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", + "darling_core", "quote", - "strsim 0.11.1", "syn 2.0.90", ] [[package]] -name = "darling_macro" -version = "0.13.4" +name = "dbl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "darling_core 0.13.4", - "quote", - "syn 1.0.109", + "generic-array", ] [[package]] -name = "darling_macro" -version = "0.20.10" +name = "defmt" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" dependencies = [ - "darling_core 0.20.10", - "quote", - "syn 2.0.90", + "defmt 1.0.1", ] [[package]] name = "defmt" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -371,9 +454,9 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", @@ -384,21 +467,42 @@ dependencies = [ [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", ] [[package]] @@ -410,13 +514,32 @@ dependencies = [ "litrs", ] +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embassy-embedded-hal" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-sync", "embassy-time", @@ -431,12 +554,11 @@ dependencies = [ [[package]] name = "embassy-executor" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-executor-macros", ] @@ -444,10 +566,9 @@ dependencies = [ [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "darling 0.20.10", + "darling", "proc-macro2", "quote", "syn 2.0.90", @@ -456,10 +577,9 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -470,7 +590,7 @@ checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" dependencies = [ "cortex-m", "critical-section", - "defmt", + "defmt 0.3.100", "num-traits", ] @@ -480,7 +600,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -505,7 +625,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -538,7 +658,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -574,13 +694,12 @@ dependencies = [ [[package]] name = "embassy-sync" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=cb4d8c74c2b07de7c32be588140512bdd4d3f47e#cb4d8c74c2b07de7c32be588140512bdd4d3f47e" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "embedded-io-async", "futures-sink", "futures-util", @@ -595,7 +714,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" dependencies = [ "cfg-if", "critical-section", - "defmt", + "defmt 0.3.100", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -629,7 +748,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" dependencies = [ - "defmt", + "defmt 0.3.100", "embassy-futures", "embassy-net-driver-channel", "embassy-sync", @@ -645,7 +764,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -655,7 +774,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08e753b23799329780c7ac434264026d0422044d6649ed70a73441b14a6436d7" dependencies = [ "critical-section", - "defmt", + "defmt 0.3.100", "embassy-sync", "embassy-usb-driver", ] @@ -685,7 +804,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -694,7 +813,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-hal 1.0.0", ] @@ -714,7 +833,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" dependencies = [ - "defmt", + "defmt 0.3.100", ] [[package]] @@ -723,7 +842,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-io", ] @@ -754,6 +873,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed" version = "1.28.0" @@ -802,6 +931,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -845,6 +984,28 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" version = "2.4.1" @@ -908,10 +1069,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt 0.3.100", "hash32 0.3.1", "stable_deref_trait", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -951,6 +1131,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -1043,38 +1232,6 @@ dependencies = [ "cortex-m-rt", ] -[[package]] -name = "nrf-softdevice" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "embassy-futures", - "embassy-sync", - "embedded-storage", - "embedded-storage-async", - "fixed", - "futures", - "heapless 0.8.0", - "nrf-softdevice-macro", - "num_enum", -] - -[[package]] -name = "nrf-softdevice-macro" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-softdevice?rev=b53991e#b53991e36da9361f7c53262092f3bd61e4676cb1" -dependencies = [ - "Inflector", - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", - "uuid", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1110,14 +1267,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] @@ -1126,6 +1293,51 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "pest_meta" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "pin-project-lite" version = "0.2.15" @@ -1157,7 +1369,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", - "defmt", + "defmt 0.3.100", "heapless 0.7.17", "postcard-derive", "serde", @@ -1174,6 +1386,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] + [[package]] name = "prettyplease" version = "0.2.25" @@ -1184,6 +1405,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -1224,6 +1454,16 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1268,7 +1508,7 @@ dependencies = [ "chrono", "cortex-m", "crc32fast", - "defmt", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-executor", @@ -1284,7 +1524,6 @@ dependencies = [ "embedded-storage-async", "futures", "heapless 0.8.0", - "nrf-softdevice", "num_enum", "paste", "postcard", @@ -1293,6 +1532,7 @@ dependencies = [ "serde", "ssmarshal", "static_cell", + "trouble-host", "usbd-hid", ] @@ -1301,8 +1541,10 @@ name = "rmk-macro" version = "0.5.1" dependencies = [ "cargo_toml", - "darling 0.20.10", + "darling", "once_cell", + "pest", + "pest_derive", "prettyplease", "proc-macro2", "quote", @@ -1319,7 +1561,7 @@ dependencies = [ "const-gen", "cortex-m", "cortex-m-rt", - "defmt", + "defmt 1.0.1", "defmt-rtt", "embassy-executor", "embassy-stm32", @@ -1367,6 +1609,19 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93c025f9cfe4c388c328ece47d11a54a823da3b5ad0370b22d95ad47137f85a" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1390,11 +1645,11 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sequential-storage" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d7d094ec15a8c127c5116dbee5eb6ce39f849dc2216fd8cee3ad149b3c374b" +checksum = "8d8e933f534642c25b7341338c10e2250187c8cd198c3957ef6894265eefda86" dependencies = [ - "defmt", + "defmt 0.3.100", "embedded-storage-async", ] @@ -1427,6 +1682,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1494,15 +1760,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "strsim" -version = "0.11.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1580,12 +1846,54 @@ dependencies = [ "winnow", ] +[[package]] +name = "trouble-host" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "aes", + "bt-hci", + "cmac", + "defmt 0.3.100", + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-io", + "futures", + "heapless 0.8.0", + "p256", + "rand_chacha", + "rand_core", + "static_cell", + "trouble-host-macros", + "zerocopy 0.8.24", +] + +[[package]] +name = "trouble-host-macros" +version = "0.1.0" +source = "git+https://github.com/embassy-rs/trouble?rev=3d77c0b#3d77c0bad07aa278f72754119320169688614328" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.90", + "uuid", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1598,7 +1906,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" dependencies = [ - "defmt", + "defmt 0.3.100", "heapless 0.8.0", "portable-atomic", ] @@ -1609,7 +1917,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ - "defmt", + "defmt 0.3.100", "serde", "ssmarshal", "usb-device", @@ -1829,7 +2137,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -1842,3 +2159,20 @@ dependencies = [ "quote", "syn 2.0.90", ] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/use_rust/stm32h7/Cargo.toml b/examples/use_rust/stm32h7/Cargo.toml index 77feb6917..b703368af 100644 --- a/examples/use_rust/stm32h7/Cargo.toml +++ b/examples/use_rust/stm32h7/Cargo.toml @@ -23,14 +23,17 @@ embassy-stm32 = { version = "0.2", features = [ embassy-executor = { version = "0.7", features = [ "defmt", "arch-cortex-m", - "task-arena-size-32768", "executor-thread", ] } static_cell = "2" -defmt = "0.3" -defmt-rtt = "0.4" -panic-probe = { version = "0.3", features = ["print-defmt"] } +defmt = "1.0" +defmt-rtt = "1.0" +panic-probe = { version = "1.0", features = ["print-defmt"] } +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "cb4d8c74c2b07de7c32be588140512bdd4d3f47e" } [build-dependencies] xz2 = "0.1.7" diff --git a/examples/use_rust/stm32h7/build.rs b/examples/use_rust/stm32h7/build.rs index 4b1aaf983..86da9ce94 100644 --- a/examples/use_rust/stm32h7/build.rs +++ b/examples/use_rust/stm32h7/build.rs @@ -10,11 +10,12 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use const_gen::*; use std::fs::File; use std::io::Read; use std::path::Path; use std::{env, fs}; + +use const_gen::*; use xz2::read::XzEncoder; fn main() { @@ -47,8 +48,7 @@ fn generate_vial_config() { let mut content = String::new(); match File::open(p) { Ok(mut file) => { - file.read_to_string(&mut content) - .expect("Cannot read vial.json"); + file.read_to_string(&mut content).expect("Cannot read vial.json"); } Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), }; @@ -64,6 +64,7 @@ fn generate_vial_config() { const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), ] + .map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_owned() + s.as_str()) .join("\n"); fs::write(out_file, const_declarations).unwrap(); } diff --git a/examples/use_rust/stm32h7/src/main.rs b/examples/use_rust/stm32h7/src/main.rs index 3b6aa7081..753515f53 100644 --- a/examples/use_rust/stm32h7/src/main.rs +++ b/examples/use_rust/stm32h7/src/main.rs @@ -9,34 +9,27 @@ mod keymap; mod vial; use defmt::info; -use defmt_rtt as _; use embassy_executor::Spawner; -use embassy_stm32::{ - bind_interrupts, - flash::Flash, - gpio::{Input, Output}, - peripherals::USB_OTG_HS, - time::Hertz, - usb::{Driver, InterruptHandler}, - Config, -}; +use embassy_stm32::flash::Flash; +use embassy_stm32::gpio::{Input, Output}; +use embassy_stm32::peripherals::USB_OTG_HS; +use embassy_stm32::time::Hertz; +use embassy_stm32::usb::{Driver, InterruptHandler}; +use embassy_stm32::{bind_interrupts, Config}; use keymap::{COL, ROW}; -use panic_probe as _; -use rmk::{ - channel::EVENT_CHANNEL, - config::{ControllerConfig, RmkConfig, VialConfig}, - debounce::default_debouncer::DefaultDebouncer, - futures::future::join3, - initialize_keymap_and_storage, - input_device::Runnable, - keyboard::Keyboard, - light::LightController, - matrix::Matrix, - run_devices, run_rmk, - storage::async_flash_wrapper, -}; +use rmk::channel::EVENT_CHANNEL; +use rmk::config::{ControllerConfig, RmkConfig, VialConfig}; +use rmk::debounce::default_debouncer::DefaultDebouncer; +use rmk::futures::future::join3; +use rmk::input_device::Runnable; +use rmk::keyboard::Keyboard; +use rmk::light::LightController; +use rmk::matrix::Matrix; +use rmk::storage::async_flash_wrapper; +use rmk::{initialize_keymap_and_storage, run_devices, run_rmk}; use static_cell::StaticCell; use vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; +use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { OTG_HS => InterruptHandler; @@ -52,9 +45,7 @@ async fn main(_spawner: Spawner) { config.rcc.hsi = Some(HSIPrescaler::DIV1); config.rcc.csi = true; // Needed for USB - config.rcc.hsi48 = Some(Hsi48Config { - sync_from_usb: true, - }); + config.rcc.hsi48 = Some(Hsi48Config { sync_from_usb: true }); // External oscillator 25MHZ config.rcc.hse = Some(Hse { freq: Hertz(25_000_000), @@ -94,7 +85,8 @@ async fn main(_spawner: Spawner) { ); // Pin config - let (input_pins, output_pins) = config_matrix_pins_stm32!(peripherals: p, input: [PD9, PD8, PB13, PB12], output: [PE13, PE14, PE15]); + let (input_pins, output_pins) = + config_matrix_pins_stm32!(peripherals: p, input: [PD9, PD8, PB13, PB12], output: [PE13, PE14, PE15]); // Pin config when using async_matrix feature // let output_pins = config_output_pins_stm32!(peripherals: p, output: [PE13, PE14, PE15]); @@ -116,7 +108,7 @@ async fn main(_spawner: Spawner) { // Initialize the storage and keymap let mut default_keymap = keymap::get_default_keymap(); - let (keymap, storage) = initialize_keymap_and_storage( + let (keymap, mut storage) = initialize_keymap_and_storage( &mut default_keymap, flash, rmk_config.storage_config, @@ -130,8 +122,7 @@ async fn main(_spawner: Spawner) { let mut keyboard = Keyboard::new(&keymap, rmk_config.behavior_config.clone()); // Initialize the light controller - let light_controller: LightController = - LightController::new(ControllerConfig::default().light_config); + let mut light_controller: LightController = LightController::new(ControllerConfig::default().light_config); // Start join3( @@ -139,7 +130,7 @@ async fn main(_spawner: Spawner) { (matrix) => EVENT_CHANNEL, ), keyboard.run(), - run_rmk(&keymap, driver, storage, light_controller, rmk_config), + run_rmk(&keymap, driver, &mut storage, &mut light_controller, rmk_config), ) .await; } diff --git a/examples/use_rust/stm32h7/src/vial.rs b/examples/use_rust/stm32h7/src/vial.rs index a6fde2d4a..7e9b5ab12 100644 --- a/examples/use_rust/stm32h7/src/vial.rs +++ b/examples/use_rust/stm32h7/src/vial.rs @@ -1,28 +1,3 @@ // Vial config is automatically generated by `build.rs`, according to `vial.json` // Please put `vial.json` at your project's root include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); - -// Or you can manually generate vial config then put here -// pub const VIAL_KEYBOARD_ID: &[u8; 8] = &[0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; -// pub const VIAL_KEYBOARD_DEF: &[u8; 308] = &[ -// 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, -// 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, -// 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, -// 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, -// 0xBD, 0x04, 0x61, 0xF7, 0xDE, 0x2F, 0xD2, 0xFB, 0x8E, 0xAD, 0x8E, 0xE5, 0x16, 0x4E, 0xEA, 0x09, -// 0xC7, 0x59, 0xDC, 0x04, 0x50, 0xB5, 0x7A, 0x56, 0x03, 0xA4, 0x7C, 0xE2, 0xFE, 0x87, 0x69, 0xA2, -// 0xA1, 0xF1, 0xFC, 0xBB, 0xF8, 0x7D, 0xD8, 0x5F, 0x6A, 0x39, 0xB4, 0xC9, 0x00, 0xE8, 0x52, 0xD3, -// 0xEE, 0x5C, 0x59, 0x88, 0x1E, 0x19, 0x66, 0x17, 0x5D, 0xF6, 0xD2, 0x28, 0x0B, 0xC9, 0xB8, 0x38, -// 0x43, 0x9A, 0x38, 0x26, 0x8C, 0x45, 0xB1, 0x9C, 0xE5, 0x1B, 0x50, 0xF5, 0x71, 0x7F, 0x3A, 0xB4, -// 0xE9, 0xB5, 0x2F, 0xA9, 0xEA, 0xE3, 0xC8, 0xAC, 0x3F, 0x77, 0x37, 0x28, 0xA3, 0x4E, 0xC7, 0x14, -// 0xE4, 0xCF, 0x31, 0xCB, 0x33, 0x11, 0x3F, 0x27, 0x9D, 0xFB, 0x5C, 0x61, 0x96, 0xFE, 0x27, 0x7B, -// 0x04, 0x13, 0x1F, 0xEC, 0xD6, 0x57, 0xD2, 0x32, 0xB8, 0x00, 0x4E, 0x21, 0x32, 0x79, 0xA9, 0x09, -// 0x45, 0xCD, 0x11, 0x6F, 0xF9, 0x37, 0xFB, 0x57, 0xF7, 0x28, 0xC3, 0xAF, 0x00, 0x0F, 0xF3, 0xB2, -// 0x1F, 0xC3, 0x7C, 0x84, 0xA0, 0xF0, 0x09, 0xEE, 0x49, 0x99, 0x39, 0xC2, 0x69, 0x4A, 0xFE, 0x38, -// 0xFE, 0xE7, 0x80, 0xCA, 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, -// 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, -// 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, -// 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, 0x01, 0x8D, 0x02, -// 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, -// 0x00, 0x04, 0x59, 0x5A, -// ]; diff --git a/examples/use_rust/stm32h7/vial.json b/examples/use_rust/stm32h7/vial.json index 040fcabef..eba77b1c5 100644 --- a/examples/use_rust/stm32h7/vial.json +++ b/examples/use_rust/stm32h7/vial.json @@ -1,5 +1,5 @@ { - "name": "HID Keyboard", + "name": "RMK Keyboard", "vendorId": "0x4C4B", "productId": "0x4643", "lighting": "none", diff --git a/rmk-macro/CHANGELOG.md b/rmk-macro/CHANGELOG.md index ebf4634fb..9bb1ef2f2 100644 --- a/rmk-macro/CHANGELOG.md +++ b/rmk-macro/CHANGELOG.md @@ -151,7 +151,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Support more nRF chips: nRF52833, nRF52810, nRF52811 -- Set default GPIO level according to `keybaord.toml` +- Set default GPIO level according to `keyboard.toml` ## [0.1.5] - 2024-06-08 diff --git a/rmk-macro/src/behavior.rs b/rmk-macro/src/behavior.rs index c0bfd0f0d..37e5d0011 100644 --- a/rmk-macro/src/behavior.rs +++ b/rmk-macro/src/behavior.rs @@ -1,11 +1,11 @@ //! Initialize behavior config boilerplate of RMK //! +use quote::quote; + use crate::config::{CombosConfig, ForksConfig, OneShotConfig, TapHoldConfig, TriLayerConfig}; use crate::keyboard_config::KeyboardConfig; use crate::layout::parse_key; -use proc_macro2::TokenStream as TokenStream2; -use quote::quote; fn expand_tri_layer(tri_layer: &Option) -> proc_macro2::TokenStream { match tri_layer { @@ -200,7 +200,7 @@ impl StateBitsMacro { } // Allows to use `#modifiers` in the quote impl quote::ToTokens for StateBitsMacro { - fn to_tokens(&self, tokens: &mut TokenStream2) { + fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { let left_ctrl = self.modifiers_left_ctrl; let left_shift = self.modifiers_left_shift; let left_alt = self.modifiers_left_alt; diff --git a/rmk-macro/src/bind_interrupt.rs b/rmk-macro/src/bind_interrupt.rs index 8ef2654b6..633215f8c 100644 --- a/rmk-macro/src/bind_interrupt.rs +++ b/rmk-macro/src/bind_interrupt.rs @@ -9,10 +9,7 @@ use crate::config::BleConfig; use crate::keyboard_config::KeyboardConfig; // Expand `bind_interrupt!` stuffs -pub(crate) fn expand_bind_interrupt( - keyboard_config: &KeyboardConfig, - item_mod: &ItemMod, -) -> TokenStream2 { +pub(crate) fn expand_bind_interrupt(keyboard_config: &KeyboardConfig, item_mod: &ItemMod) -> TokenStream2 { // If there is a function with `#[Overwritten(bind_interrupt)]`, override it if let Some((_, items)) = &item_mod.content { items @@ -39,65 +36,95 @@ pub(crate) fn expand_bind_interrupt( } pub(crate) fn bind_interrupt_default(keyboard_config: &KeyboardConfig) -> TokenStream2 { - if let Some(usb_info) = keyboard_config.communication.get_usb_info() { - let interrupt_name = format_ident!("{}", usb_info.interrupt_name); - let peripheral_name = format_ident!("{}", usb_info.peripheral_name); - match keyboard_config.chip.series { - crate::ChipSeries::Stm32 => { - if !keyboard_config.chip.has_usb() { - return quote! {}; - } - + match keyboard_config.chip.series { + crate::ChipSeries::Stm32 => { + if let Some(usb_info) = keyboard_config.communication.get_usb_info() { + let interrupt_name = format_ident!("{}", usb_info.interrupt_name); + let peripheral_name = format_ident!("{}", usb_info.peripheral_name); quote! { use ::embassy_stm32::bind_interrupts; bind_interrupts!(struct Irqs { #interrupt_name => ::embassy_stm32::usb::InterruptHandler<::embassy_stm32::peripherals::#peripheral_name>; }); } + } else { + quote! {} } - crate::ChipSeries::Nrf52 => { - let saadc_interrupt = if let Some(BleConfig { - enabled: true, - battery_adc_pin: Some(_adc_pin), - charge_state: _, - charge_led: _, - adc_divider_measured: _, - adc_divider_total: _, - }) = keyboard_config.communication.get_ble_config() - { - Some(quote! { - SAADC => ::embassy_nrf::saadc::InterruptHandler; - }) - } else { - None - }; - let interrupt_binding = if keyboard_config.chip.has_usb() { - quote! { - #interrupt_name => ::embassy_nrf::usb::InterruptHandler<::embassy_nrf::peripherals::#peripheral_name>; - #saadc_interrupt - CLOCK_POWER => ::embassy_nrf::usb::vbus_detect::InterruptHandler; - } - } else { - quote! { #saadc_interrupt } - }; + } + crate::ChipSeries::Nrf52 => { + let saadc_interrupt = if let Some(BleConfig { + enabled: true, + battery_adc_pin: Some(_adc_pin), + charge_state: _, + charge_led: _, + adc_divider_measured: _, + adc_divider_total: _, + }) = keyboard_config.communication.get_ble_config() + { + quote! { SAADC => ::embassy_nrf::saadc::InterruptHandler; } + } else { + quote! {} + }; + let usb_and_clock_interrupt = if let Some(usb_info) = keyboard_config.communication.get_usb_info() { + let interrupt_name = format_ident!("{}", usb_info.interrupt_name); + let peripheral_name = format_ident!("{}", usb_info.peripheral_name); quote! { - use ::embassy_nrf::bind_interrupts; - bind_interrupts!(struct Irqs { - #interrupt_binding - }); + #interrupt_name => ::embassy_nrf::usb::InterruptHandler<::embassy_nrf::peripherals::#peripheral_name>; + CLOCK_POWER => ::nrf_sdc::mpsl::ClockInterruptHandler, ::embassy_nrf::usb::vbus_detect::InterruptHandler; } - } - crate::ChipSeries::Rp2040 => { - quote! { - use ::embassy_rp::bind_interrupts; - bind_interrupts!(struct Irqs { - #interrupt_name => ::embassy_rp::usb::InterruptHandler<::embassy_rp::peripherals::#peripheral_name>; - }); + } else { + quote! { CLOCK_POWER => ::nrf_sdc::mpsl::ClockInterruptHandler; } + }; + quote! { + use ::embassy_nrf::bind_interrupts; + bind_interrupts!(struct Irqs { + #saadc_interrupt + #usb_and_clock_interrupt + RNG => ::embassy_nrf::rng::InterruptHandler<::embassy_nrf::peripherals::RNG>; + EGU0_SWI0 => ::nrf_sdc::mpsl::LowPrioInterruptHandler; + RADIO => ::nrf_sdc::mpsl::HighPrioInterruptHandler; + TIMER0 => ::nrf_sdc::mpsl::HighPrioInterruptHandler; + RTC0 => ::nrf_sdc::mpsl::HighPrioInterruptHandler; + }); + + #[::embassy_executor::task] + async fn mpsl_task(mpsl: &'static ::nrf_sdc::mpsl::MultiprotocolServiceLayer<'static>) -> ! { + mpsl.run().await + } + /// How many outgoing L2CAP buffers per link + const L2CAP_TXQ: u8 = 3; + + /// How many incoming L2CAP buffers per link + const L2CAP_RXQ: u8 = 3; + + /// Size of L2CAP packets + const L2CAP_MTU: usize = 72; + fn build_sdc<'d, const N: usize>( + p: ::nrf_sdc::Peripherals<'d>, + rng: &'d mut ::embassy_nrf::rng::Rng<::embassy_nrf::peripherals::RNG>, + mpsl: &'d ::nrf_sdc::mpsl::MultiprotocolServiceLayer, + mem: &'d mut ::nrf_sdc::Mem, + ) -> Result<::nrf_sdc::SoftdeviceController<'d>, ::nrf_sdc::Error> { + ::nrf_sdc::Builder::new()? + .support_adv()? + .support_peripheral()? + .peripheral_count(1)? + .buffer_cfg(L2CAP_MTU as u8, L2CAP_MTU as u8, L2CAP_TXQ, L2CAP_RXQ)? + .build(p, rng, mpsl, mem) } } - crate::ChipSeries::Esp32 => quote! {}, } - } else { - quote! {} + crate::ChipSeries::Rp2040 => { + let usb_info = keyboard_config.communication.get_usb_info().unwrap(); + let interrupt_name = format_ident!("{}", usb_info.interrupt_name); + let peripheral_name = format_ident!("{}", usb_info.peripheral_name); + quote! { + use ::embassy_rp::bind_interrupts; + bind_interrupts!(struct Irqs { + #interrupt_name => ::embassy_rp::usb::InterruptHandler<::embassy_rp::peripherals::#peripheral_name>; + }); + } + } + crate::ChipSeries::Esp32 => quote! {}, } } diff --git a/rmk-macro/src/ble.rs b/rmk-macro/src/ble.rs index 940e6c67c..8bb2ba6d9 100644 --- a/rmk-macro/src/ble.rs +++ b/rmk-macro/src/ble.rs @@ -1,10 +1,8 @@ use proc_macro2::TokenStream as TokenStream2; use quote::{format_ident, quote}; -use crate::{ - keyboard_config::{CommunicationConfig, KeyboardConfig}, - ChipSeries, -}; +use crate::keyboard_config::{CommunicationConfig, KeyboardConfig}; +use crate::ChipSeries; // Default implementations of ble configuration. // Because ble configuration in `config` is enabled by a feature gate, so this function returns two TokenStreams. @@ -32,61 +30,6 @@ pub(crate) fn expand_ble_config(keyboard_config: &KeyboardConfig) -> (TokenStrea CommunicationConfig::Ble(ble) | CommunicationConfig::Both(_, ble) => { if ble.enabled { let mut ble_config_tokens = TokenStream2::new(); - // Adc config - /* - if let Some(adc_pin) = ble.battery_adc_pin.clone() { - // Tokens for adc pin - let adc_pin_def = if adc_pin == "vddh" { - quote! { ::embassy_nrf::saadc::VddhDiv5Input } - } else { - let adc_pin_ident = format_ident!("{}", adc_pin); - quote! {p.#adc_pin_ident.degrade_saadc()} - }; - - // Adc divider - if adc_pin == "vddh" { - ble_config_tokens.extend(quote! { - let adc_divider_measured = 1; - let adc_divider_total = 5; - }); - } else { - match (ble.adc_divider_measured, ble.adc_divider_total) { - (Some(measured), Some(total)) => { - ble_config_tokens.extend(quote! { - let adc_divider_measured = #measured; - let adc_divider_total = #total; - }); - } - _ => { - // If any of measured or total is not provided, we set both to 1, aka no divider. - ble_config_tokens.extend(quote! { - let adc_divider_measured = 1; - let adc_divider_total = 1; - }); - } - } - }; - - ble_config_tokens.extend(quote! { - use ::embassy_nrf::saadc::Input as _; - // Then we initialize the ADC. We are only using one channel in this example. - let config = ::embassy_nrf::saadc::Config::default(); - let channel_cfg = ::embassy_nrf::saadc::ChannelConfig::single_ended(#adc_pin_def); - ::embassy_nrf::interrupt::SAADC.set_priority(::embassy_nrf::interrupt::Priority::P3); - let saadc = ::embassy_nrf::saadc::Saadc::new(p.SAADC, Irqs, config, [channel_cfg]); - // Wait for ADC calibration. - saadc.calibrate().await; - let saadc_option = Some(saadc); - }); - } else { - ble_config_tokens.extend(quote! { - let saadc_option: ::core::option::Option<::embassy_nrf::saadc::Saadc<'_, 1>> = None; - let adc_divider_measured = 1; - let adc_divider_total = 1; - }); - }; - */ - if let Some(charging_state_config) = ble.charge_state.clone() { let charging_state_pin = format_ident!("{}", charging_state_config.pin); let low_active = charging_state_config.low_active; @@ -96,16 +39,14 @@ pub(crate) fn expand_ble_config(keyboard_config: &KeyboardConfig) -> (TokenStrea quote! { ::embassy_nrf::gpio::Pull::Down } }; ble_config_tokens.extend(quote! { - let is_charging_pin = Some(::embassy_nrf::gpio::Input::new(::embassy_nrf::gpio::AnyPin::from(p.#charging_state_pin), #pull)); + let is_charging_pin = Some(::embassy_nrf::gpio::Input::new(p.#charging_state_pin, #pull)); let charging_state_low_active = #low_active; }); } else { - ble_config_tokens.extend( - quote! { - let charging_state_low_active = false; - let is_charging_pin: ::core::option::Option<::embassy_nrf::gpio::Input<'_>> = None; - } - ) + ble_config_tokens.extend(quote! { + let charging_state_low_active = false; + let is_charging_pin: ::core::option::Option<::embassy_nrf::gpio::Input<'_>> = None; + }) } if let Some(charging_led_config) = ble.charge_led.clone() { @@ -117,16 +58,14 @@ pub(crate) fn expand_ble_config(keyboard_config: &KeyboardConfig) -> (TokenStrea quote! { ::embassy_nrf::gpio::Level::Low } }; ble_config_tokens.extend(quote! { - let charge_led_pin = Some(::embassy_nrf::gpio::Output::new(::embassy_nrf::gpio::AnyPin::from(p.#charging_led_pin), #default_level, ::embassy_nrf::gpio::OutputDrive::Standard)); + let charge_led_pin = Some(::embassy_nrf::gpio::Output::new(p.#charging_led_pin, #default_level, ::embassy_nrf::gpio::OutputDrive::Standard)); let charge_led_low_active = #charging_led_low_active; }); } else { - ble_config_tokens.extend( - quote! { - let charge_led_low_active = false; - let charge_led_pin: ::core::option::Option<::embassy_nrf::gpio::Output<'_>> = None; - } - ) + ble_config_tokens.extend(quote! { + let charge_led_low_active = false; + let charge_led_pin: ::core::option::Option<::embassy_nrf::gpio::Output<'_>> = None; + }) } ble_config_tokens.extend( diff --git a/rmk-macro/src/chip_init.rs b/rmk-macro/src/chip_init.rs index bb9ac2bb5..dabd3728c 100644 --- a/rmk-macro/src/chip_init.rs +++ b/rmk-macro/src/chip_init.rs @@ -3,37 +3,74 @@ use proc_macro2::TokenStream as TokenStream2; use quote::{quote, ToTokens}; use syn::{ItemFn, ItemMod}; -use crate::{keyboard::Overwritten, keyboard_config::KeyboardConfig, ChipModel, ChipSeries}; +use crate::keyboard::Overwritten; +use crate::keyboard_config::{BoardConfig, CommunicationConfig, KeyboardConfig}; +use crate::{ChipModel, ChipSeries}; // Default implementations of chip initialization -pub(crate) fn chip_init_default(chip: &ChipModel) -> TokenStream2 { - match chip.series { +pub(crate) fn chip_init_default(keyboard_config: &KeyboardConfig) -> TokenStream2 { + match keyboard_config.chip.series { ChipSeries::Stm32 => quote! { let config = ::embassy_stm32::Config::default(); let mut p = ::embassy_stm32::init(config); }, ChipSeries::Nrf52 => { - let usb_related_config = if chip.has_usb() { + let dcdc_config = if keyboard_config.chip.chip == "nrf52840" { + quote! { + config.dcdc.reg0_voltage = Some(::embassy_nrf::config::Reg0Voltage::_3v3); + config.dcdc.reg0 = true; + config.dcdc.reg1 = true; + } + } else if keyboard_config.chip.chip == "nrf52833" { quote! { - ::embassy_nrf::interrupt::USBD.set_priority(::embassy_nrf::interrupt::Priority::P2); + config.dcdc.reg0_voltage = Some(::embassy_nrf::config::Reg0Voltage::_3v3); + config.dcdc.reg1 = true; } } else { quote! {} }; + let ble_addr = get_ble_addr(keyboard_config); + let ble_init = match &keyboard_config.communication { + CommunicationConfig::Usb(_) => quote! {}, + CommunicationConfig::Ble(_) | CommunicationConfig::Both(_, _) => quote! { + let mpsl_p = ::nrf_sdc::mpsl::Peripherals::new(p.RTC0, p.TIMER0, p.TEMP, p.PPI_CH19, p.PPI_CH30, p.PPI_CH31); + let lfclk_cfg = ::nrf_sdc::mpsl::raw::mpsl_clock_lfclk_cfg_t { + source: ::nrf_sdc::mpsl::raw::MPSL_CLOCK_LF_SRC_RC as u8, + rc_ctiv: ::nrf_sdc::mpsl::raw::MPSL_RECOMMENDED_RC_CTIV as u8, + rc_temp_ctiv: ::nrf_sdc::mpsl::raw::MPSL_RECOMMENDED_RC_TEMP_CTIV as u8, + accuracy_ppm: ::nrf_sdc::mpsl::raw::MPSL_DEFAULT_CLOCK_ACCURACY_PPM as u16, + skip_wait_lfclk_started: ::nrf_sdc::mpsl::raw::MPSL_DEFAULT_SKIP_WAIT_LFCLK_STARTED != 0, + }; + static MPSL: ::static_cell::StaticCell<::nrf_sdc::mpsl::MultiprotocolServiceLayer> = ::static_cell::StaticCell::new(); + static SESSION_MEM: ::static_cell::StaticCell<::nrf_sdc::mpsl::SessionMem<1>> = ::static_cell::StaticCell::new(); + let mpsl = MPSL.init(::defmt::unwrap!(::nrf_sdc::mpsl::MultiprotocolServiceLayer::with_timeslots( + mpsl_p, + Irqs, + lfclk_cfg, + SESSION_MEM.init(::nrf_sdc::mpsl::SessionMem::new()) + ))); + spawner.must_spawn(mpsl_task(&*mpsl)); + let sdc_p = ::nrf_sdc::Peripherals::new( + p.PPI_CH17, p.PPI_CH18, p.PPI_CH20, p.PPI_CH21, p.PPI_CH22, p.PPI_CH23, p.PPI_CH24, p.PPI_CH25, p.PPI_CH26, + p.PPI_CH27, p.PPI_CH28, p.PPI_CH29, + ); + let mut rng = ::embassy_nrf::rng::Rng::new(p.RNG, Irqs); + use rand_core::SeedableRng; + let mut rng_gen = ::rand_chacha::ChaCha12Rng::from_rng(&mut rng).unwrap(); + let mut sdc_mem = ::nrf_sdc::Mem::<4096>::new(); + let sdc = ::defmt::unwrap!(build_sdc(sdc_p, &mut rng, &*mpsl, &mut sdc_mem)); + let central_addr = #ble_addr; + let mut host_resources = ::rmk::HostResources::new(); + let stack = ::rmk::ble::trouble::build_ble_stack(sdc, central_addr, &mut rng_gen, &mut host_resources).await; + }, + CommunicationConfig::None => quote! {}, + }; quote! { use embassy_nrf::interrupt::InterruptExt; let mut config = ::embassy_nrf::config::Config::default(); - // config.hfclk_source = ::embassy_nrf::config::HfclkSource::ExternalXtal; - // config.lfclk_source = ::embassy_nrf::config::LfclkSource::ExternalXtal; - config.gpiote_interrupt_priority = ::embassy_nrf::interrupt::Priority::P3; - config.time_interrupt_priority = ::embassy_nrf::interrupt::Priority::P3; - #usb_related_config - ::embassy_nrf::interrupt::CLOCK_POWER.set_priority(::embassy_nrf::interrupt::Priority::P2); + #dcdc_config let p = ::embassy_nrf::init(config); - // Disable external HF clock by default, reduce power consumption - // info!("Enabling ext hfosc..."); - // ::embassy_nrf::pac::CLOCK.tasks_hfclkstart().write_value(1); - // while ::embassy_nrf::pac::CLOCK.events_hfclkstarted().read() != 1 {} + #ble_init } } ChipSeries::Rp2040 => { @@ -42,18 +79,29 @@ pub(crate) fn chip_init_default(chip: &ChipModel) -> TokenStream2 { let p = ::embassy_rp::init(config); } } - ChipSeries::Esp32 => quote! { - ::esp_idf_svc::sys::link_patches(); - ::esp_idf_svc::log::EspLogger::initialize_default(); - let p = ::esp_idf_svc::hal::peripherals::Peripherals::take().unwrap(); - }, + ChipSeries::Esp32 => { + let ble_addr = get_ble_addr(keyboard_config); + quote! { + ::esp_println::logger::init_logger_from_env(); + let p = ::esp_hal::init(::esp_hal::Config::default().with_cpu_clock(::esp_hal::clock::CpuClock::max())); + ::esp_alloc::heap_allocator!(size: 72 * 1024); + let timg0 = ::esp_hal::timer::timg::TimerGroup::new(p.TIMG0); + let mut rng = ::esp_hal::rng::Trng::new(p.RNG, p.ADC1); + let init = ::esp_wifi::init(timg0.timer0, rng.rng.clone(), p.RADIO_CLK).unwrap(); + let systimer = ::esp_hal::timer::systimer::SystemTimer::new(p.SYSTIMER); + ::esp_hal_embassy::init(systimer.alarm0); + let bluetooth = p.BT; + let connector = ::esp_wifi::ble::controller::BleConnector::new(&init, bluetooth); + let controller: ::bt_hci::controller::ExternalController<_, 64> = ::bt_hci::controller::ExternalController::new(connector); + let central_addr = #ble_addr; + let mut host_resources = ::rmk::HostResources::new(); + let stack = ::rmk::ble::trouble::build_ble_stack(controller, central_addr, &mut rng, &mut host_resources).await; + } + } } } -pub(crate) fn expand_chip_init( - keyboard_config: &KeyboardConfig, - item_mod: &ItemMod, -) -> TokenStream2 { +pub(crate) fn expand_chip_init(keyboard_config: &KeyboardConfig, item_mod: &ItemMod) -> TokenStream2 { // If there is a function with `#[Overwritten(usb)]`, override the chip initialization if let Some((_, items)) = &item_mod.content { items @@ -61,18 +109,16 @@ pub(crate) fn expand_chip_init( .find_map(|item| { if let syn::Item::Fn(item_fn) = &item { if item_fn.attrs.len() == 1 { - if let Ok(Overwritten::ChipConfig) = - Overwritten::from_meta(&item_fn.attrs[0].meta) - { + if let Ok(Overwritten::ChipConfig) = Overwritten::from_meta(&item_fn.attrs[0].meta) { return Some(override_chip_init(&keyboard_config.chip, item_fn)); } } } None }) - .unwrap_or(chip_init_default(&keyboard_config.chip)) + .unwrap_or(chip_init_default(&keyboard_config)) } else { - chip_init_default(&keyboard_config.chip) + chip_init_default(&keyboard_config) } } @@ -92,9 +138,37 @@ fn override_chip_init(chip: &ChipModel, item_fn: &ItemFn) -> TokenStream2 { let mut p = ::embassy_rp::init(config); }), ChipSeries::Esp32 => initialization_tokens.extend(quote! { - let p = ::esp_idf_svc::hal::peripherals::Peripherals::take().unwrap(); + let p = ::esp_hal::init(::esp_hal::Config::default().with_cpu_clock(::esp_hal::clock::CpuClock::max())); }), } initialization_tokens } + +fn get_ble_addr(keyboard_config: &KeyboardConfig) -> TokenStream2 { + if let BoardConfig::Split(split_config) = &keyboard_config.board { + let addr = split_config + .central + .ble_addr + .expect("No BLE address defined for BLE split keyboard"); + quote! { + [#(#addr), *] + } + } else if keyboard_config.chip.series == ChipSeries::Nrf52 { + quote! { + { + let ficr = ::embassy_nrf::pac::FICR; + let high = u64::from(ficr.deviceid(1).read()); + let addr = high << 32 | u64::from(ficr.deviceid(0).read()); + let addr = addr | 0x0000_c000_0000_0000; + let ble_addr = addr.to_le_bytes()[..6].try_into().expect("Failed to read BLE address from FICR"); + ble_addr + } + } + } else { + // Default BLE random static address + quote! { + [0x18, 0xe2, 0x21, 0x80, 0xc0, 0xc7] + } + } +} diff --git a/rmk-macro/src/comm.rs b/rmk-macro/src/comm.rs index dd08c091d..f4ca1f582 100644 --- a/rmk-macro/src/comm.rs +++ b/rmk-macro/src/comm.rs @@ -6,12 +6,11 @@ use proc_macro2::TokenStream as TokenStream2; use quote::{format_ident, quote, ToTokens}; use syn::{ItemFn, ItemMod}; -use crate::{keyboard::Overwritten, keyboard_config::KeyboardConfig, ChipSeries}; +use crate::keyboard::Overwritten; +use crate::keyboard_config::KeyboardConfig; +use crate::ChipSeries; -pub(crate) fn expand_usb_init( - keyboard_config: &KeyboardConfig, - item_mod: &ItemMod, -) -> TokenStream2 { +pub(crate) fn expand_usb_init(keyboard_config: &KeyboardConfig, item_mod: &ItemMod) -> TokenStream2 { // If there is a function with `#[Overwritten(usb)]`, override the chip initialization if let Some((_, items)) = &item_mod.content { items @@ -19,8 +18,7 @@ pub(crate) fn expand_usb_init( .find_map(|item| { if let syn::Item::Fn(item_fn) = &item { if item_fn.attrs.len() == 1 { - if let Ok(Overwritten::Usb) = Overwritten::from_meta(&item_fn.attrs[0].meta) - { + if let Ok(Overwritten::Usb) = Overwritten::from_meta(&item_fn.attrs[0].meta) { return Some(override_usb_init(item_fn)); } } @@ -66,20 +64,10 @@ pub(crate) fn usb_config_default(keyboard_config: &KeyboardConfig) -> TokenStrea } } } - ChipSeries::Nrf52 => { - if keyboard_config.communication.ble_enabled() { - // Both BLE + USB, software vbus is used - quote! { - let software_vbus = ::rmk::ble::SOFTWARE_VBUS.get_or_init(|| ::embassy_nrf::usb::vbus_detect::SoftwareVbusDetect::new(true, false)); - let driver = ::embassy_nrf::usb::Driver::new(p.#peripheral_name, Irqs, software_vbus); - } - } else { - // USB only, use hardware vbus - quote! { - let driver = ::embassy_nrf::usb::Driver::new(p.#peripheral_name, Irqs, ::embassy_nrf::usb::vbus_detect::HardwareVbusDetect::new(Irqs)); - } - } - } + ChipSeries::Nrf52 => quote! { + // use hardware vbus + let driver = ::embassy_nrf::usb::Driver::new(p.#peripheral_name, Irqs, ::embassy_nrf::usb::vbus_detect::HardwareVbusDetect::new(Irqs)); + }, ChipSeries::Rp2040 => quote! { let driver = ::embassy_rp::usb::Driver::new(p.#peripheral_name, Irqs); }, diff --git a/rmk-macro/src/default_config/esp32.rs b/rmk-macro/src/default_config/esp32.rs index 4b35154b4..ad378dd89 100644 --- a/rmk-macro/src/default_config/esp32.rs +++ b/rmk-macro/src/default_config/esp32.rs @@ -1,9 +1,6 @@ use crate::config::{BleConfig, StorageConfig}; - -use crate::{ - keyboard_config::{CommunicationConfig, KeyboardConfig}, - ChipModel, -}; +use crate::keyboard_config::{CommunicationConfig, KeyboardConfig}; +use crate::ChipModel; // Default config for esp32 pub(crate) fn default_esp32(chip: ChipModel) -> KeyboardConfig { diff --git a/rmk-macro/src/default_config/nrf52810.rs b/rmk-macro/src/default_config/nrf52810.rs index 593de49cf..514471993 100644 --- a/rmk-macro/src/default_config/nrf52810.rs +++ b/rmk-macro/src/default_config/nrf52810.rs @@ -1,9 +1,6 @@ use crate::config::{BleConfig, StorageConfig}; - -use crate::{ - keyboard_config::{CommunicationConfig, KeyboardConfig}, - ChipModel, -}; +use crate::keyboard_config::{CommunicationConfig, KeyboardConfig}; +use crate::ChipModel; // Default config for nRF52810 pub(crate) fn default_nrf52810(chip: ChipModel) -> KeyboardConfig { diff --git a/rmk-macro/src/default_config/nrf52832.rs b/rmk-macro/src/default_config/nrf52832.rs index 9dc631c94..882562808 100644 --- a/rmk-macro/src/default_config/nrf52832.rs +++ b/rmk-macro/src/default_config/nrf52832.rs @@ -1,8 +1,6 @@ use crate::config::{BleConfig, StorageConfig}; -use crate::{ - keyboard_config::{CommunicationConfig, KeyboardConfig}, - ChipModel, -}; +use crate::keyboard_config::{CommunicationConfig, KeyboardConfig}; +use crate::ChipModel; // Default config for nRF52832 pub(crate) fn default_nrf52832(chip: ChipModel) -> KeyboardConfig { diff --git a/rmk-macro/src/default_config/nrf52840.rs b/rmk-macro/src/default_config/nrf52840.rs index 1250ed126..6265e50d0 100644 --- a/rmk-macro/src/default_config/nrf52840.rs +++ b/rmk-macro/src/default_config/nrf52840.rs @@ -1,10 +1,7 @@ use crate::config::{BleConfig, StorageConfig}; - -use crate::{ - keyboard_config::{CommunicationConfig, KeyboardConfig}, - usb_interrupt_map::get_usb_info, - ChipModel, -}; +use crate::keyboard_config::{CommunicationConfig, KeyboardConfig}; +use crate::usb_interrupt_map::get_usb_info; +use crate::ChipModel; // Default config for nRF52840 pub(crate) fn default_nrf52840(chip: ChipModel) -> KeyboardConfig { diff --git a/rmk-macro/src/default_config/rp2040.rs b/rmk-macro/src/default_config/rp2040.rs index a414c948a..087c1977a 100644 --- a/rmk-macro/src/default_config/rp2040.rs +++ b/rmk-macro/src/default_config/rp2040.rs @@ -1,10 +1,7 @@ use crate::config::StorageConfig; - -use crate::{ - keyboard_config::{CommunicationConfig, KeyboardConfig}, - usb_interrupt_map::get_usb_info, - ChipModel, -}; +use crate::keyboard_config::{CommunicationConfig, KeyboardConfig}; +use crate::usb_interrupt_map::get_usb_info; +use crate::ChipModel; // Default config for rp2040 pub(crate) fn default_rp2040(chip: ChipModel) -> KeyboardConfig { diff --git a/rmk-macro/src/default_config/stm32.rs b/rmk-macro/src/default_config/stm32.rs index 325d2de0d..2c9bc0434 100644 --- a/rmk-macro/src/default_config/stm32.rs +++ b/rmk-macro/src/default_config/stm32.rs @@ -1,10 +1,7 @@ use crate::config::StorageConfig; - -use crate::{ - keyboard_config::{CommunicationConfig, KeyboardConfig}, - usb_interrupt_map::get_usb_info, - ChipModel, -}; +use crate::keyboard_config::{CommunicationConfig, KeyboardConfig}; +use crate::usb_interrupt_map::get_usb_info; +use crate::ChipModel; // Default config for stm32 pub(crate) fn default_stm32(chip: ChipModel) -> KeyboardConfig { let chip_name = chip.chip.clone(); diff --git a/rmk-macro/src/entry.rs b/rmk-macro/src/entry.rs index 35b863ba2..47b565cf4 100644 --- a/rmk-macro/src/entry.rs +++ b/rmk-macro/src/entry.rs @@ -3,11 +3,9 @@ use proc_macro2::TokenStream as TokenStream2; use quote::{format_ident, quote}; use syn::{ItemFn, ItemMod}; -use crate::{ - keyboard::Overwritten, - keyboard_config::{BoardConfig, CommunicationConfig, KeyboardConfig}, - ChipSeries, -}; +use crate::keyboard::Overwritten; +use crate::keyboard_config::{BoardConfig, CommunicationConfig, KeyboardConfig}; +use crate::ChipSeries; pub(crate) fn expand_rmk_entry( keyboard_config: &KeyboardConfig, @@ -22,9 +20,7 @@ pub(crate) fn expand_rmk_entry( .find_map(|item| { if let syn::Item::Fn(item_fn) = &item { if item_fn.attrs.len() == 1 { - if let Ok(Overwritten::Entry) = - Overwritten::from_meta(&item_fn.attrs[0].meta) - { + if let Ok(Overwritten::Entry) = Overwritten::from_meta(&item_fn.attrs[0].meta) { return Some(override_rmk_entry(item_fn)); } } @@ -75,7 +71,7 @@ pub(crate) fn rmk_entry_select( match keyboard_config.chip.series { ChipSeries::Stm32 | ChipSeries::Rp2040 => { let rmk_task = quote! { - ::rmk::run_rmk(&keymap, driver, storage, light_controller, rmk_config), + ::rmk::run_rmk(&keymap, driver, &mut storage, &mut light_controller, rmk_config), }; let mut tasks = vec![devices_task, rmk_task, keyboard_task]; if !processors.is_empty() { @@ -86,43 +82,47 @@ pub(crate) fn rmk_entry_select( .serial .clone() .expect("No serial defined for central"); - split_config - .peripheral - .iter() - .enumerate() - .for_each(|(idx, p)| { - let row = p.rows; - let col = p.cols; - let row_offset = p.row_offset; - let col_offset = p.col_offset; - let uart_instance = format_ident!("{}", central_serials.get(idx).expect("No or not enough serial defined for peripheral in central").instance.to_lowercase()); - tasks.push(quote! { - ::rmk::split::central::run_peripheral_manager::<#row, #col, #row_offset, #col_offset, _>( - #idx, - #uart_instance, - ) - }); + split_config.peripheral.iter().enumerate().for_each(|(idx, p)| { + let row = p.rows; + let col = p.cols; + let row_offset = p.row_offset; + let col_offset = p.col_offset; + let uart_instance = format_ident!( + "{}", + central_serials + .get(idx) + .expect("No or not enough serial defined for peripheral in central") + .instance + .to_lowercase() + ); + tasks.push(quote! { + ::rmk::split::central::run_peripheral_manager::<#row, #col, #row_offset, #col_offset, _>( + #idx, + #uart_instance, + ) }); + }); join_all_tasks(tasks) } ChipSeries::Nrf52 => { let rmk_task = quote! { - ::rmk::run_rmk(&keymap, driver, storage, light_controller, rmk_config, sd), + ::rmk::run_rmk(&keymap, driver, &stack, &mut storage, &mut light_controller, rmk_config), }; let mut tasks = vec![devices_task, rmk_task, keyboard_task]; if !processors.is_empty() { tasks.push(processors_task); }; split_config.peripheral.iter().enumerate().for_each(|(idx, p)| { - let row = p.rows ; - let col = p.cols ; - let row_offset = p.row_offset ; - let col_offset = p.col_offset ; + let row = p.rows; + let col = p.cols; + let row_offset = p.row_offset; + let col_offset = p.col_offset; let peripheral_ble_addr = p.ble_addr.expect("No ble_addr defined for peripheral"); tasks.push(quote! { - ::rmk::split::central::run_peripheral_manager::<#row, #col, #row_offset, #col_offset>( + ::rmk::split::central::run_peripheral_manager::<#row, #col, #row_offset, #col_offset, _>( #idx, [#(#peripheral_ble_addr), *], + &stack, ) }); }); @@ -131,9 +131,7 @@ pub(crate) fn rmk_entry_select( ChipSeries::Esp32 => panic!("Split for esp32 isn't implemented yet"), } } - BoardConfig::UniBody(_) => { - rmk_entry_default(keyboard_config, devices_task, processors_task) - } + BoardConfig::UniBody(_) => rmk_entry_default(keyboard_config, devices_task, processors_task), }; quote! { use ::rmk::input_device::Runnable; @@ -158,21 +156,21 @@ pub(crate) fn rmk_entry_default( ChipSeries::Nrf52 => match keyboard_config.communication { CommunicationConfig::Usb(_) => { let rmk_task = quote! { - ::rmk::run_rmk(&keymap, driver, storage, light_controller, rmk_config) + ::rmk::run_rmk(&keymap, driver, &mut storage, &mut light_controller, rmk_config) }; tasks.push(rmk_task); join_all_tasks(tasks) } CommunicationConfig::Ble(_) => { let rmk_task = quote! { - ::rmk::run_rmk(&keymap, storage, light_controller, rmk_config, sd) + ::rmk::run_rmk(&keymap, &stack, &mut storage, &mut light_controller, rmk_config) }; tasks.push(rmk_task); join_all_tasks(tasks) } CommunicationConfig::Both(_, _) => { let rmk_task = quote! { - ::rmk::run_rmk(&keymap, driver, storage, light_controller, rmk_config, sd) + ::rmk::run_rmk(&keymap, driver, &stack, &mut storage, &mut light_controller, rmk_config) }; tasks.push(rmk_task); join_all_tasks(tasks) @@ -181,19 +179,14 @@ pub(crate) fn rmk_entry_default( }, ChipSeries::Esp32 => { let rmk_task = quote! { - ::rmk::run_rmk(&keymap, storage, light_controller, rmk_config), + ::rmk::run_rmk(&keymap, &stack, &mut storage, &mut light_controller, rmk_config), }; tasks.push(rmk_task); - let all_tasks = expand_tasks(tasks); - quote! { - ::esp_idf_svc::hal::task::block_on( - #all_tasks - ); - } + join_all_tasks(tasks) } _ => { let rmk_task = quote! { - ::rmk::run_rmk(&keymap, driver, storage, light_controller, rmk_config) + ::rmk::run_rmk(&keymap, driver, &mut storage, &mut light_controller, rmk_config) }; tasks.push(rmk_task); join_all_tasks(tasks) diff --git a/rmk-macro/src/flash.rs b/rmk-macro/src/flash.rs index 8aaf47634..e1336bac3 100644 --- a/rmk-macro/src/flash.rs +++ b/rmk-macro/src/flash.rs @@ -1,18 +1,14 @@ //! Initialize flash boilerplate of RMK, including USB or BLE //! -use crate::config::StorageConfig; -use crate::keyboard_config::BoardConfig; -use crate::{keyboard_config::KeyboardConfig, ChipSeries}; use proc_macro2::TokenStream as TokenStream2; use quote::quote; +use crate::config::StorageConfig; +use crate::keyboard_config::KeyboardConfig; +use crate::ChipSeries; + pub(crate) fn expand_flash_init(keyboard_config: &KeyboardConfig) -> TokenStream2 { - let sd_addr = if let BoardConfig::Split(_split_config) = &keyboard_config.board { - quote! { Some(central_addr) } - } else { - quote! { None } - }; if !keyboard_config.storage.enabled { // This config actually does nothing if storage is disabled return quote! { @@ -29,16 +25,8 @@ pub(crate) fn expand_flash_init(keyboard_config: &KeyboardConfig) -> TokenStream } } ChipSeries::Nrf52 => { - if !keyboard_config.communication.ble_enabled() { - // Usb only - quote! { - let flash = ::rmk::storage::async_flash_wrapper(::embassy_nrf::nvmc::Nvmc::new(p.NVMC)); - } - } else { - // If BLE enables, initialize both sd and flash - quote! { - let (sd, flash) = ::rmk::initialize_nrf_sd_and_flash("rmk", spawner, #sd_addr); - } + quote! { + let flash = ::nrf_mpsl::Flash::take(mpsl, p.NVMC); } } ChipSeries::Rp2040 => quote! { @@ -46,11 +34,7 @@ pub(crate) fn expand_flash_init(keyboard_config: &KeyboardConfig) -> TokenStream let flash = ::embassy_rp::flash::Flash::<_, ::embassy_rp::flash::Async, FLASH_SIZE>::new(p.FLASH, p.DMA_CH0); }, ChipSeries::Esp32 => quote! { - let flash = ::rmk::storage::async_flash_wrapper(unsafe { - ::esp_idf_svc::partition::EspPartition::new("rmk") - .expect("Create storage partition error") - .expect("Empty partition") - }); + let flash = ::rmk::storage::async_flash_wrapper(::esp_storage::FlashStorage::new()); }, } ); diff --git a/rmk-macro/src/gpio_config.rs b/rmk-macro/src/gpio_config.rs index 3708a6d15..a0817281c 100644 --- a/rmk-macro/src/gpio_config.rs +++ b/rmk-macro/src/gpio_config.rs @@ -1,10 +1,8 @@ -use crate::{ChipModel, ChipSeries}; use quote::{format_ident, quote}; -pub(crate) fn convert_output_pins_to_initializers( - chip: &ChipModel, - pins: Vec, -) -> proc_macro2::TokenStream { +use crate::{ChipModel, ChipSeries}; + +pub(crate) fn convert_output_pins_to_initializers(chip: &ChipModel, pins: Vec) -> proc_macro2::TokenStream { let mut initializers = proc_macro2::TokenStream::new(); let mut idents = vec![]; let pin_initializers = pins @@ -59,11 +57,9 @@ pub(crate) fn get_input_pin_type(chip: &ChipModel, async_matrix: bool) -> proc_m quote! {::embassy_stm32::gpio::Input} } } - ChipSeries::Nrf52 => quote! {::embassy_nrf::gpio::Input}, - ChipSeries::Rp2040 => quote! {::embassy_rp::gpio::Input}, - ChipSeries::Esp32 => { - quote! {::esp_idf_svc::hal::gpio::PinDriver<::esp_idf_svc::hal::gpio::AnyIOPin, ::esp_idf_svc::hal::gpio::Input>} - } + ChipSeries::Nrf52 => quote! { ::embassy_nrf::gpio::Input }, + ChipSeries::Rp2040 => quote! { ::embassy_rp::gpio::Input }, + ChipSeries::Esp32 => quote! { ::esp_hal::gpio::Input }, } } @@ -72,9 +68,7 @@ pub(crate) fn get_output_pin_type(chip: &ChipModel) -> proc_macro2::TokenStream ChipSeries::Stm32 => quote! {::embassy_stm32::gpio::Output}, ChipSeries::Nrf52 => quote! {::embassy_nrf::gpio::Output}, ChipSeries::Rp2040 => quote! {::embassy_rp::gpio::Output}, - ChipSeries::Esp32 => { - quote! {::esp_idf_svc::hal::gpio::PinDriver<::esp_idf_svc::hal::gpio::AnyOutputPin, ::esp_idf_svc::hal::gpio::Output>} - } + ChipSeries::Esp32 => quote! { ::esp_hal::gpio::Output }, } } @@ -136,17 +130,17 @@ pub(crate) fn convert_gpio_str_to_output_pin( } ChipSeries::Nrf52 => { quote! { - ::embassy_nrf::gpio::Output::new(::embassy_nrf::gpio::AnyPin::from(p.#gpio_ident), ::embassy_nrf::gpio::Level::#default_level_ident, ::embassy_nrf::gpio::OutputDrive::Standard) + ::embassy_nrf::gpio::Output::new(p.#gpio_ident, ::embassy_nrf::gpio::Level::#default_level_ident, ::embassy_nrf::gpio::OutputDrive::Standard) } } ChipSeries::Rp2040 => { quote! { - ::embassy_rp::gpio::Output::new(::embassy_rp::gpio::AnyPin::from(p.#gpio_ident), ::embassy_rp::gpio::Level::#default_level_ident) + ::embassy_rp::gpio::Output::new(p.#gpio_ident, ::embassy_rp::gpio::Level::#default_level_ident) } } ChipSeries::Esp32 => { quote! { - ::esp_idf_svc::hal::gpio::PinDriver::output(p.pins.#gpio_ident.downgrade_output()).unwrap() + ::esp_hal::gpio::Output::new(p.#gpio_ident, ::esp_hal::gpio::Level::#default_level_ident, ::esp_hal::gpio::OutputConfig::default()) } } } @@ -188,19 +182,18 @@ pub(crate) fn convert_gpio_str_to_input_pin( } ChipSeries::Nrf52 => { quote! { - ::embassy_nrf::gpio::Input::new(::embassy_nrf::gpio::AnyPin::from(p.#gpio_ident), ::embassy_nrf::gpio::Pull::#default_pull_ident) + ::embassy_nrf::gpio::Input::new(p.#gpio_ident, ::embassy_nrf::gpio::Pull::#default_pull_ident) } } ChipSeries::Rp2040 => { quote! { - ::embassy_rp::gpio::Input::new(::embassy_rp::gpio::AnyPin::from(p.#gpio_ident), ::embassy_rp::gpio::Pull::#default_pull_ident) + ::embassy_rp::gpio::Input::new(p.#gpio_ident, ::embassy_rp::gpio::Pull::#default_pull_ident) } } ChipSeries::Esp32 => { quote! { { - let mut pin = ::esp_idf_svc::hal::gpio::PinDriver::input(p.pins.#gpio_ident.downgrade()).unwrap(); - pin.set_pull(::esp_idf_svc::hal::gpio::Pull::#default_pull_ident).unwrap(); + let mut pin = ::esp_hal::gpio::Input::new(p.#gpio_ident, ::esp_hal::gpio::InputConfig::default().with_pull(::esp_hal::gpio::Pull::#default_pull_ident)); pin } } diff --git a/rmk-macro/src/input_device/adc.rs b/rmk-macro/src/input_device/adc.rs index 01d603dc5..848808a83 100644 --- a/rmk-macro/src/input_device/adc.rs +++ b/rmk-macro/src/input_device/adc.rs @@ -1,10 +1,9 @@ -use crate::{ - config::{BleConfig, JoystickConfig}, - ChipSeries, -}; use proc_macro2::TokenStream; use quote::{format_ident, quote}; +use crate::config::{BleConfig, JoystickConfig}; +use crate::ChipSeries; + pub(crate) fn expand_adc_device( joystick_config: Vec, ble_config: Option, @@ -85,13 +84,14 @@ pub(crate) fn expand_adc_device( } if !processor_name.is_empty() { - let light_sleep_param = if let Some(light_sleep_interval) = light_sleep { - quote! {Some(#light_sleep_interval)} + let light_sleep_option = if let Some(light_sleep_interval) = light_sleep { + quote! {Some(Duration::from_millis(#light_sleep_interval as u64))} } else { quote! {None} }; config.extend(quote! { let mut adc_device = { + use embassy_time::Duration; use embassy_nrf::saadc::{self, Input as _}; let saadc_config = saadc::Config::default(); embassy_nrf::interrupt::SAADC.set_priority(embassy_nrf::interrupt::Priority::P3); @@ -102,8 +102,8 @@ pub(crate) fn expand_adc_device( rmk::input_device::adc::NrfAdc::new( adc, [#(#adc_type),*], - #default_polling_interval, - #light_sleep_param, + Duration::from_millis(#default_polling_interval as u64), + #light_sleep_option, )}; }); (config, processor_name) diff --git a/rmk-macro/src/input_device/encoder.rs b/rmk-macro/src/input_device/encoder.rs index 6f650c9a3..3759817f4 100644 --- a/rmk-macro/src/input_device/encoder.rs +++ b/rmk-macro/src/input_device/encoder.rs @@ -1,9 +1,9 @@ +use proc_macro2::{Ident, TokenStream}; +use quote::{format_ident, quote}; + use crate::config::EncoderConfig; use crate::gpio_config::convert_gpio_str_to_input_pin; use crate::ChipModel; -use proc_macro2::Ident; -use proc_macro2::TokenStream; -use quote::{format_ident, quote}; pub(crate) fn expand_encoder_device( encoder_config: Vec, @@ -28,11 +28,7 @@ pub(crate) fn expand_encoder_device( for (idx, encoder) in encoder_config.iter().enumerate() { let encoder_id = idx as u8; - let pull = if encoder.internal_pullup { - Some(true) - } else { - None - }; + let pull = if encoder.internal_pullup { Some(true) } else { None }; // Initialize pins let pin_a = convert_gpio_str_to_input_pin(&chip, encoder.pin_a.clone(), false, pull); diff --git a/rmk-macro/src/input_device/mod.rs b/rmk-macro/src/input_device/mod.rs index 6cbb41c1c..8fde8f570 100644 --- a/rmk-macro/src/input_device/mod.rs +++ b/rmk-macro/src/input_device/mod.rs @@ -1,13 +1,11 @@ -use crate::{ - config::InputDeviceConfig, - keyboard_config::{BoardConfig, KeyboardConfig}, - keyboard_config::{CommunicationConfig, UniBodyConfig}, -}; use adc::expand_adc_device; use encoder::expand_encoder_device; use proc_macro2::TokenStream; use quote::quote; +use crate::config::InputDeviceConfig; +use crate::keyboard_config::{BoardConfig, CommunicationConfig, KeyboardConfig, UniBodyConfig}; + mod adc; mod encoder; @@ -20,9 +18,7 @@ pub(crate) fn expand_input_device_config( // generate ADC configuration let ble_config = match &keyboard_config.communication { - CommunicationConfig::Ble(ble_config) | CommunicationConfig::Both(_, ble_config) => { - Some(ble_config.clone()) - } + CommunicationConfig::Ble(ble_config) | CommunicationConfig::Both(_, ble_config) => Some(ble_config.clone()), _ => None, }; let (adc_config, adc_processors) = match &keyboard_config.board { diff --git a/rmk-macro/src/keyboard.rs b/rmk-macro/src/keyboard.rs index d49547ff9..a8a500b9b 100644 --- a/rmk-macro/src/keyboard.rs +++ b/rmk-macro/src/keyboard.rs @@ -3,28 +3,25 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; use syn::ItemMod; -use crate::{ - behavior::expand_behavior_config, - bind_interrupt::expand_bind_interrupt, - ble::expand_ble_config, - chip_init::expand_chip_init, - comm::expand_usb_init, - config::MatrixType, - entry::expand_rmk_entry, - feature::{get_rmk_features, is_feature_enabled}, - flash::expand_flash_init, - import::expand_imports, - input_device::expand_input_device_config, - keyboard_config::{ - expand_keyboard_info, expand_vial_config, read_keyboard_toml_config, BoardConfig, - KeyboardConfig, UniBodyConfig, - }, - layout::expand_default_keymap, - light::expand_light_config, - matrix::expand_matrix_config, - split::central::expand_split_central_config, - ChipSeries, +use crate::behavior::expand_behavior_config; +use crate::bind_interrupt::expand_bind_interrupt; +use crate::ble::expand_ble_config; +use crate::chip_init::expand_chip_init; +use crate::comm::expand_usb_init; +use crate::config::MatrixType; +use crate::entry::expand_rmk_entry; +use crate::feature::{get_rmk_features, is_feature_enabled}; +use crate::flash::expand_flash_init; +use crate::import::expand_imports; +use crate::input_device::expand_input_device_config; +use crate::keyboard_config::{ + expand_keyboard_info, expand_vial_config, read_keyboard_toml_config, BoardConfig, KeyboardConfig, UniBodyConfig, }; +use crate::layout::expand_default_keymap; +use crate::light::expand_light_config; +use crate::matrix::expand_matrix_config; +use crate::split::central::expand_split_central_config; +use crate::ChipSeries; /// List of functions that can be overwritten #[derive(Debug, Clone, Copy, FromMeta)] @@ -136,9 +133,9 @@ fn expand_main( let main_function_sig = if keyboard_config.chip.series == ChipSeries::Esp32 { quote! { - use ::esp_idf_svc::hal::gpio::*; - use esp_println as _; - fn main() + use {esp_alloc as _, esp_backtrace as _}; + #[esp_hal_embassy::main] + async fn main(_s: ::embassy_executor::Spawner) } } else { quote! { @@ -153,7 +150,7 @@ fn expand_main( #bind_interrupt #main_function_sig { - ::defmt::info!("RMK start!"); + // ::defmt::info!("RMK start!"); // Initialize peripherals as `p` #chip_init @@ -208,7 +205,8 @@ fn expand_main( } } -pub(crate) fn expand_keymap_and_storage(keyboard_config: &KeyboardConfig) -> TokenStream2 { +pub(crate) fn expand_keymap_and_storage(_keyboard_config: &KeyboardConfig) -> TokenStream2 { + // TODO: Add encoder support let keymap_storage_init = quote! { ::rmk::initialize_keymap_and_storage( &mut default_keymap, @@ -217,17 +215,9 @@ pub(crate) fn expand_keymap_and_storage(keyboard_config: &KeyboardConfig) -> Tok rmk_config.behavior_config.clone(), ) }; - match keyboard_config.chip.series { - ChipSeries::Esp32 => { - quote! { - let mut default_keymap = get_default_keymap(); - let (keymap, storage) = ::esp_idf_svc::hal::task::block_on(#keymap_storage_init); - } - } - _ => quote! { - let mut default_keymap = get_default_keymap(); - let (keymap, storage) = #keymap_storage_init.await; - }, + quote! { + let mut default_keymap = get_default_keymap(); + let (keymap, mut storage) = #keymap_storage_init.await; } } @@ -256,11 +246,9 @@ pub(crate) fn expand_matrix_and_keyboard_init( }) => match matrix_config.matrix_type { MatrixType::normal => { quote! { - let debouncer = #debouncer_type::<#input_output_num>::new(); - let mut matrix = ::rmk::matrix::Matrix::<_, _, _, #input_output_num>::new(input_pins, output_pins, debouncer); - - - } + let debouncer = #debouncer_type::<#input_output_num>::new(); + let mut matrix = ::rmk::matrix::Matrix::<_, _, _, #input_output_num>::new(input_pins, output_pins, debouncer); + } } MatrixType::direct_pin => { let low_active = matrix_config.direct_pin_low_active; @@ -288,8 +276,7 @@ pub(crate) fn expand_matrix_and_keyboard_init( }, MatrixType::direct_pin => { let low_active = split_config.central.matrix.direct_pin_low_active; - let size = - split_config.central.rows as usize * split_config.central.cols as usize; + let size = split_config.central.rows as usize * split_config.central.cols as usize; quote! { let debouncer = #debouncer_type::::new(); let mut matrix = ::rmk::split::central::CentralDirectPinMatrix::<_, _, #central_row_offset, #central_col_offset, #central_row, #central_col, #size>::new(direct_pins, debouncer, #low_active); @@ -307,18 +294,10 @@ pub(crate) fn expand_matrix_and_keyboard_init( fn expand_controller_init(keyboard_config: &KeyboardConfig) -> TokenStream2 { // TODO: Initialization for other controllers let output_pin_type = match keyboard_config.chip.series { - ChipSeries::Esp32 => quote! { - ::esp_idf_svc::hal::gpio::PinDriver<::esp_idf_svc::hal::gpio::AnyOutputPin, ::esp_idf_svc::hal::gpio::Output> - }, - ChipSeries::Stm32 => quote! { - ::embassy_stm32::gpio::Output - }, - ChipSeries::Nrf52 => quote! { - ::embassy_nrf::gpio::Output - }, - ChipSeries::Rp2040 => quote! { - ::embassy_rp::gpio::Output - }, + ChipSeries::Esp32 => quote! { ::esp_hal::gpio::Output }, + ChipSeries::Stm32 => quote! { ::embassy_stm32::gpio::Output }, + ChipSeries::Nrf52 => quote! { ::embassy_nrf::gpio::Output }, + ChipSeries::Rp2040 => quote! { ::embassy_rp::gpio::Output }, }; quote! { diff --git a/rmk-macro/src/keyboard_config.rs b/rmk-macro/src/keyboard_config.rs index 0c971c70c..34d8121d6 100644 --- a/rmk-macro/src/keyboard_config.rs +++ b/rmk-macro/src/keyboard_config.rs @@ -8,18 +8,17 @@ use std::collections::HashMap; use std::fs; use crate::config::{ - BehaviorConfig, BleConfig, DependencyConfig, InputDeviceConfig, KeyboardInfo, - KeyboardTomlConfig, LayerTomlConfig, LayoutConfig, LayoutTomlConfig, LightConfig, MatrixConfig, - MatrixType, SplitConfig, StorageConfig, -}; -use crate::{ - default_config::{ - esp32::default_esp32, nrf52810::default_nrf52810, nrf52832::default_nrf52832, - nrf52840::default_nrf52840, rp2040::default_rp2040, stm32::default_stm32, - }, - usb_interrupt_map::{get_usb_info, UsbInfo}, - ChipModel, ChipSeries, + BehaviorConfig, BleConfig, DependencyConfig, InputDeviceConfig, KeyboardInfo, KeyboardTomlConfig, LayerTomlConfig, + LayoutConfig, LayoutTomlConfig, LightConfig, MatrixConfig, MatrixType, SplitConfig, StorageConfig, }; +use crate::default_config::esp32::default_esp32; +use crate::default_config::nrf52810::default_nrf52810; +use crate::default_config::nrf52832::default_nrf52832; +use crate::default_config::nrf52840::default_nrf52840; +use crate::default_config::rp2040::default_rp2040; +use crate::default_config::stm32::default_stm32; +use crate::usb_interrupt_map::{get_usb_info, UsbInfo}; +use crate::{ChipModel, ChipSeries}; // Pest parser using the grammar files #[derive(Parser)] @@ -150,18 +149,14 @@ impl CommunicationConfig { pub(crate) fn get_ble_config(&self) -> Option { match self { - CommunicationConfig::Ble(ble_config) | CommunicationConfig::Both(_, ble_config) => { - Some(ble_config.clone()) - } + CommunicationConfig::Ble(ble_config) | CommunicationConfig::Both(_, ble_config) => Some(ble_config.clone()), _ => None, } } pub(crate) fn get_usb_info(&self) -> Option { match self { - CommunicationConfig::Usb(usb_info) | CommunicationConfig::Both(usb_info, _) => { - Some(usb_info.clone()) - } + CommunicationConfig::Usb(usb_info) | CommunicationConfig::Both(usb_info, _) => Some(usb_info.clone()), _ => None, } } @@ -188,11 +183,7 @@ impl KeyboardConfig { config.basic = Self::get_basic_info(config.basic, toml_config.keyboard); // Board config - config.board = Self::get_board_config( - toml_config.matrix, - toml_config.split, - toml_config.input_device, - )?; + config.board = Self::get_board_config(toml_config.matrix, toml_config.split, toml_config.input_device)?; // Layout config config.layout = Self::get_layout_from_toml( @@ -202,8 +193,7 @@ impl KeyboardConfig { )?; // Behavior config - config.behavior = - Self::get_behavior_from_toml(config.behavior, toml_config.behavior, &config.layout)?; + config.behavior = Self::get_behavior_from_toml(config.behavior, toml_config.behavior, &config.layout)?; // Light config config.light = Self::get_light_from_toml(config.light, toml_config.light); @@ -222,9 +212,7 @@ impl KeyboardConfig { /// The chip model can be either configured to a board or a microcontroller chip. pub(crate) fn get_chip_model(config: &KeyboardTomlConfig) -> Result { if config.keyboard.board.is_none() == config.keyboard.chip.is_none() { - let message = format!( - "Either \"board\" or \"chip\" should be set in keyboard.toml, but not both" - ); + let message = format!("Either \"board\" or \"chip\" should be set in keyboard.toml, but not both"); return rmk_compile_error!(message); } @@ -298,7 +286,10 @@ impl KeyboardConfig { s if s.starts_with("stm32") => default_stm32(chip), s if s.starts_with("esp32") => default_esp32(chip), _ => { - let message = format!("No default chip config for {}, please report at https://github.com/HaoboGu/rmk/issues", chip.chip); + let message = format!( + "No default chip config for {}, please report at https://github.com/HaoboGu/rmk/issues", + chip.chip + ); return rmk_compile_error!(message); } }; @@ -325,24 +316,18 @@ impl KeyboardConfig { ) -> Result { // Get usb config let usb_enabled = { usb_enabled.unwrap_or(default_setting.usb_enabled()) }; - let usb_info = if usb_enabled { - get_usb_info(&chip.chip) - } else { - None - }; + let usb_info = if usb_enabled { get_usb_info(&chip.chip) } else { None }; // Get ble config let ble_config = match (default_setting, ble_config) { - (CommunicationConfig::Ble(default), None) - | (CommunicationConfig::Both(_, default), None) => Some(default), + (CommunicationConfig::Ble(default), None) | (CommunicationConfig::Both(_, default), None) => Some(default), (CommunicationConfig::Ble(default), Some(mut config)) | (CommunicationConfig::Both(_, default), Some(mut config)) => { // Use default setting if the corresponding field is not set config.battery_adc_pin = config.battery_adc_pin.or(default.battery_adc_pin); config.charge_state = config.charge_state.or(default.charge_state); config.charge_led = config.charge_led.or(default.charge_led); - config.adc_divider_measured = - config.adc_divider_measured.or(default.adc_divider_measured); + config.adc_divider_measured = config.adc_divider_measured.or(default.adc_divider_measured); config.adc_divider_total = config.adc_divider_total.or(default.adc_divider_total); Some(config) } @@ -417,21 +402,15 @@ impl KeyboardConfig { Rule::coordinate => { let mut coord_parts = inner_pair.into_inner(); // Should contain two 'number' pairs - let row_str = coord_parts - .next() - .ok_or("Missing row coordinate")? - .as_str(); - let col_str = coord_parts - .next() - .ok_or("Missing col coordinate")? - .as_str(); - - let row = row_str.parse::().map_err(|e| { - format!("Failed to parse row '{}': {}", row_str, e) - })?; - let col = col_str.parse::().map_err(|e| { - format!("Failed to parse col '{}': {}", col_str, e) - })?; + let row_str = coord_parts.next().ok_or("Missing row coordinate")?.as_str(); + let col_str = coord_parts.next().ok_or("Missing col coordinate")?.as_str(); + + let row = row_str + .parse::() + .map_err(|e| format!("Failed to parse row '{}': {}", row_str, e))?; + let col = col_str + .parse::() + .map_err(|e| format!("Failed to parse col '{}': {}", col_str, e))?; coordinates.push((row, col)); } @@ -517,7 +496,8 @@ impl KeyboardConfig { if iterations >= MAX_ALIAS_RESOLUTION_DEPTH { return Err(format!( "Alias resolution exceeded maximum depth ({}), potential infinite loop detected in '{}'", - MAX_ALIAS_RESOLUTION_DEPTH, keys)); // Show original keys for context + MAX_ALIAS_RESOLUTION_DEPTH, keys + )); // Show original keys for context } if !made_replacement { @@ -616,32 +596,17 @@ impl KeyboardConfig { //layer actions: Rule::df_action => { - key_action_sequence.push(Self::layer_name_resolver( - "DF", - inner_pair, - layer_names, - )?); + key_action_sequence.push(Self::layer_name_resolver("DF", inner_pair, layer_names)?); } Rule::mo_action => { - key_action_sequence.push(Self::layer_name_resolver( - "MO", - inner_pair, - layer_names, - )?); + key_action_sequence.push(Self::layer_name_resolver("MO", inner_pair, layer_names)?); } Rule::lm_action => { - key_action_sequence.push(Self::layer_name_resolver( - "LM", - inner_pair, - layer_names, - )?); + key_action_sequence.push(Self::layer_name_resolver("LM", inner_pair, layer_names)?); } Rule::lt_action => { - key_action_sequence.push(Self::layer_name_resolver( - "LT", - inner_pair, - layer_names, - )?); //"LT(".to_owned() + &Self::layer_name_resolver(inner_pair, layer_names)? + ")"); + key_action_sequence.push(Self::layer_name_resolver("LT", inner_pair, layer_names)?); + //"LT(".to_owned() + &Self::layer_name_resolver(inner_pair, layer_names)? + ")"); } Rule::osl_action => { key_action_sequence.push(Self::layer_name_resolver( @@ -651,25 +616,13 @@ impl KeyboardConfig { )?); } Rule::tt_action => { - key_action_sequence.push(Self::layer_name_resolver( - "TT", - inner_pair, - layer_names, - )?); + key_action_sequence.push(Self::layer_name_resolver("TT", inner_pair, layer_names)?); } Rule::tg_action => { - key_action_sequence.push(Self::layer_name_resolver( - "TG", - inner_pair, - layer_names, - )?); + key_action_sequence.push(Self::layer_name_resolver("TG", inner_pair, layer_names)?); } Rule::to_action => { - key_action_sequence.push(Self::layer_name_resolver( - "TO", - inner_pair, - layer_names, - )?); + key_action_sequence.push(Self::layer_name_resolver("TO", inner_pair, layer_names)?); } //tap-hold actions: @@ -759,16 +712,14 @@ impl KeyboardConfig { } Err(parse_err) => { // Pest error already includes details about the invalid format - let error_message = - format!("keyboard.toml: Error in `layout.matrix_map`: {}", parse_err); + let error_message = format!("keyboard.toml: Error in `layout.matrix_map`: {}", parse_err); return rmk_compile_error!(error_message); } } } else { if layers.len() > 0 { return rmk_compile_error!( - "layout.matrix_map is need to be defined to process [[layer]] based key maps" - .to_string() + "layout.matrix_map is need to be defined to process [[layer]] based key maps".to_string() ); } } @@ -790,10 +741,9 @@ impl KeyboardConfig { } layer_number += 1; } - if layer_names.len() >= layout.layers as usize { + if layers.len() > layout.layers as usize { return rmk_compile_error!( - "keyboard.toml: Number of [[layer]] entries is larger than layout.layers" - .to_string() + "keyboard.toml: Number of [[layer]] entries is larger than layout.layers".to_string() ); } @@ -807,10 +757,8 @@ impl KeyboardConfig { // their number and order should match the number and order of the above parsed matrix map match Self::keymap_parser(&layer.keys, &aliases, &layer_names) { Ok(key_action_sequence) => { - let mut legacy_keymap = vec![ - vec!["No".to_string(); layout.cols as usize]; - layout.rows as usize - ]; + let mut legacy_keymap = + vec![vec!["No".to_string(); layout.cols as usize]; layout.rows as usize]; let mut sequence_number: usize = 0; for key_action in key_action_sequence { @@ -829,8 +777,7 @@ impl KeyboardConfig { Err(parse_err) => { // Pest error already includes details about the invalid format - let error_message = - format!("keyboard.toml: Error in `layout.keymap`: {}", parse_err); + let error_message = format!("keyboard.toml: Error in `layout.keymap`: {}", parse_err); return rmk_compile_error!(error_message); } } @@ -848,23 +795,18 @@ impl KeyboardConfig { if final_layers.len() <= layout.layers as usize { for _ in final_layers.len()..layout.layers as usize { // Add 2D vector of empty keys - final_layers.push(vec![ - vec!["_".to_string(); layout.cols as usize]; - layout.rows as usize - ]); + final_layers.push(vec![vec!["_".to_string(); layout.cols as usize]; layout.rows as usize]); } } else { - return rmk_compile_error!( - "keyboard.toml: Layer number in keymap is larger than [layout.layers]".to_string() + let error_message = format!( + "keyboard.toml: The actual number of layers is larger than {} [layout.layers]: {} [[Layer]] entries + {} layers in layout.keymap", + layout.layers, layers.len(), layout.keymap.map(|keymap| keymap.len()).unwrap_or_default() ); + return rmk_compile_error!(error_message); } // Row - if let Some(_) = final_layers - .iter() - .map(|r| r.len()) - .find(|l| *l as u8 != layout.rows) - { + if let Some(_) = final_layers.iter().map(|r| r.len()).find(|l| *l as u8 != layout.rows) { return rmk_compile_error!( "keyboard.toml: Row number in keymap doesn't match with [layout.row]".to_string() ); @@ -900,13 +842,9 @@ impl KeyboardConfig { behavior.tri_layer = match behavior.tri_layer { Some(tri_layer) => { if tri_layer.upper >= layout.layers { - return rmk_compile_error!( - "keyboard.toml: Tri layer upper is larger than [layout.layers]" - ); + return rmk_compile_error!("keyboard.toml: Tri layer upper is larger than [layout.layers]"); } else if tri_layer.lower >= layout.layers { - return rmk_compile_error!( - "keyboard.toml: Tri layer lower is larger than [layout.layers]" - ); + return rmk_compile_error!("keyboard.toml: Tri layer lower is larger than [layout.layers]"); } else if tri_layer.adjust >= layout.layers { return rmk_compile_error!( "keyboard.toml: Tri layer adjust is larger than [layout.layers]" @@ -923,7 +861,9 @@ impl KeyboardConfig { behavior.combo = behavior.combo.or(default.combo); if let Some(combo) = &behavior.combo { if combo.combos.len() > COMBO_MAX_NUM { - return rmk_compile_error!(format!("keyboard.toml: number of combos is greater than [behavior.combo.max_num]")); + return rmk_compile_error!(format!( + "keyboard.toml: number of combos is greater than [behavior.combo.max_num]" + )); } for (i, c) in combo.combos.iter().enumerate() { @@ -933,7 +873,9 @@ impl KeyboardConfig { if let Some(layer) = c.layer { if layer >= layout.layers { - return rmk_compile_error!(format!("keyboard.toml: layer in combo #{i} is greater than [layout.layers]")); + return rmk_compile_error!(format!( + "keyboard.toml: layer in combo #{i} is greater than [layout.layers]" + )); } } } @@ -942,7 +884,9 @@ impl KeyboardConfig { behavior.fork = behavior.fork.or(default.fork); if let Some(fork) = &behavior.fork { if fork.forks.len() > FORK_MAX_NUM { - return rmk_compile_error!(format!("keyboard.toml: number of forks is greater than [behavior.fork.max_num]")); + return rmk_compile_error!(format!( + "keyboard.toml: number of forks is greater than [behavior.fork.max_num]" + )); } } diff --git a/rmk-macro/src/layout.rs b/rmk-macro/src/layout.rs index 2cf867927..2718c0a75 100644 --- a/rmk-macro/src/layout.rs +++ b/rmk-macro/src/layout.rs @@ -4,7 +4,8 @@ use proc_macro2::TokenStream as TokenStream2; use quote::{format_ident, quote}; -use crate::{keyboard_config::KeyboardConfig, keycode_alias::KEYCODE_ALIAS}; +use crate::keyboard_config::KeyboardConfig; +use crate::keycode_alias::KEYCODE_ALIAS; /// Read the default keymap setting in `keyboard.toml` and add as a `get_default_keymap` function pub(crate) fn expand_default_keymap(keyboard_config: &KeyboardConfig) -> TokenStream2 { diff --git a/rmk-macro/src/lib.rs b/rmk-macro/src/lib.rs index a6914051b..636e7cefe 100644 --- a/rmk-macro/src/lib.rs +++ b/rmk-macro/src/lib.rs @@ -21,12 +21,13 @@ mod split; #[rustfmt::skip] mod usb_interrupt_map; -use crate::keyboard::parse_keyboard_mod; -use darling::{ast::NestedMeta, FromMeta}; +use darling::ast::NestedMeta; +use darling::FromMeta; use proc_macro::TokenStream; use split::peripheral::parse_split_peripheral_mod; use syn::parse_macro_input; -use usb_interrupt_map::get_usb_info; + +use crate::keyboard::parse_keyboard_mod; #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub(crate) enum ChipSeries { @@ -45,26 +46,27 @@ pub(crate) struct ChipModel { } impl ChipModel { - pub(crate) fn has_usb(&self) -> bool { - match self.series { - ChipSeries::Stm32 => get_usb_info(&self.chip).is_some(), - ChipSeries::Nrf52 => { - if self.chip == "nrf52833" || self.chip == "nrf52840" || self.chip == "nrf52820" { - true - } else { - false - } - } - ChipSeries::Rp2040 => true, - ChipSeries::Esp32 => { - if self.chip == "esp32s3" || self.chip == "esp32s2" { - true - } else { - false - } - } - } - } + // pub(crate) fn has_usb(&self) -> bool { + // use usb_interrupt_map::get_usb_info; + // match self.series { + // ChipSeries::Stm32 => get_usb_info(&self.chip).is_some(), + // ChipSeries::Nrf52 => { + // if self.chip == "nrf52833" || self.chip == "nrf52840" || self.chip == "nrf52820" { + // true + // } else { + // false + // } + // } + // ChipSeries::Rp2040 => true, + // ChipSeries::Esp32 => { + // if self.chip == "esp32s3" || self.chip == "esp32s2" { + // true + // } else { + // false + // } + // } + // } + // } } #[proc_macro_attribute] diff --git a/rmk-macro/src/light.rs b/rmk-macro/src/light.rs index a2d05b935..927ddc30f 100644 --- a/rmk-macro/src/light.rs +++ b/rmk-macro/src/light.rs @@ -2,15 +2,12 @@ //! use quote::quote; -use crate::{ - config::PinConfig, gpio_config::convert_gpio_str_to_output_pin, - keyboard_config::KeyboardConfig, ChipModel, -}; +use crate::config::PinConfig; +use crate::gpio_config::convert_gpio_str_to_output_pin; +use crate::keyboard_config::KeyboardConfig; +use crate::ChipModel; -pub(crate) fn build_light_config( - chip: &ChipModel, - pin_config: &Option, -) -> proc_macro2::TokenStream { +pub(crate) fn build_light_config(chip: &ChipModel, pin_config: &Option) -> proc_macro2::TokenStream { match pin_config { Some(c) => { let p = convert_gpio_str_to_output_pin(chip, c.pin.clone(), c.low_active); diff --git a/rmk-macro/src/matrix.rs b/rmk-macro/src/matrix.rs index f8155edaa..bfb114733 100644 --- a/rmk-macro/src/matrix.rs +++ b/rmk-macro/src/matrix.rs @@ -2,16 +2,14 @@ //! use quote::quote; -use crate::{ - config::MatrixType, - feature::is_feature_enabled, - gpio_config::{ - convert_direct_pins_to_initializers, convert_input_pins_to_initializers, - convert_output_pins_to_initializers, get_input_pin_type, get_output_pin_type, - }, - keyboard_config::{BoardConfig, KeyboardConfig, UniBodyConfig}, - ChipModel, ChipSeries, +use crate::config::MatrixType; +use crate::feature::is_feature_enabled; +use crate::gpio_config::{ + convert_direct_pins_to_initializers, convert_input_pins_to_initializers, convert_output_pins_to_initializers, + get_input_pin_type, get_output_pin_type, }; +use crate::keyboard_config::{BoardConfig, KeyboardConfig, UniBodyConfig}; +use crate::{ChipModel, ChipSeries}; pub(crate) fn expand_matrix_config( keyboard_config: &KeyboardConfig, @@ -40,8 +38,7 @@ pub(crate) fn expand_matrix_config( // So we need to declaring them in advance. let rows = keyboard_config.layout.rows as usize; let cols = keyboard_config.layout.cols as usize; - let size = - keyboard_config.layout.rows as usize * keyboard_config.layout.cols as usize; + let size = keyboard_config.layout.rows as usize * keyboard_config.layout.cols as usize; let layers = keyboard_config.layout.layers as usize; let low_active = matrix.direct_pin_low_active; matrix_config.extend(quote! { @@ -129,11 +126,7 @@ pub(crate) fn expand_matrix_input_output_pins( let output_pin_type = get_output_pin_type(chip); // Initialize input pins - pin_initialization.extend(convert_input_pins_to_initializers( - &chip, - input_pins, - async_matrix, - )); + pin_initialization.extend(convert_input_pins_to_initializers(&chip, input_pins, async_matrix)); // Initialize output pins pin_initialization.extend(convert_output_pins_to_initializers(&chip, output_pins)); // Generate a macro that does pin matrix config diff --git a/rmk-macro/src/split/central.rs b/rmk-macro/src/split/central.rs index 2971cf671..c89ddce51 100644 --- a/rmk-macro/src/split/central.rs +++ b/rmk-macro/src/split/central.rs @@ -1,13 +1,12 @@ use core::panic; -use crate::{ - config::{SerialConfig, SplitConfig}, - keyboard_config::{BoardConfig, KeyboardConfig}, - ChipModel, ChipSeries, -}; use proc_macro2::TokenStream as TokenStream2; use quote::{format_ident, quote}; +use crate::config::{SerialConfig, SplitConfig}; +use crate::keyboard_config::{BoardConfig, KeyboardConfig}; +use crate::{ChipModel, ChipSeries}; + pub(crate) fn expand_split_central_config(config: &KeyboardConfig) -> proc_macro2::TokenStream { if let BoardConfig::Split(split_config) = &config.board { expand_split_communication_config(&config.chip, split_config) @@ -20,10 +19,7 @@ fn expand_split_communication_config(chip: &ChipModel, split_config: &SplitConfi match &split_config.connection[..] { "ble" => { // We need to create addrs for BLE - let central_addr = split_config - .central - .ble_addr - .expect("central.ble_addr is required"); + let central_addr = split_config.central.ble_addr.expect("central.ble_addr is required"); let mut peripheral_addrs = proc_macro2::TokenStream::new(); split_config .peripheral @@ -42,11 +38,8 @@ fn expand_split_communication_config(chip: &ChipModel, split_config: &SplitConfi } "serial" => { // We need to initialize serial instance for serial - let serial_config: Vec = split_config - .central - .serial - .clone() - .expect("central.serial is required"); + let serial_config: Vec = + split_config.central.serial.clone().expect("central.serial is required"); expand_serial_init(chip, serial_config) } _ => panic!("Invalid connection type for split"), diff --git a/rmk-macro/src/split/peripheral.rs b/rmk-macro/src/split/peripheral.rs index c01bfd092..64f7e29a4 100644 --- a/rmk-macro/src/split/peripheral.rs +++ b/rmk-macro/src/split/peripheral.rs @@ -2,24 +2,18 @@ use proc_macro2::TokenStream as TokenStream2; use quote::{format_ident, quote}; use syn::ItemMod; -use crate::{ - chip_init::expand_chip_init, - config::{MatrixType, SplitBoardConfig}, - entry::join_all_tasks, - feature::{get_rmk_features, is_feature_enabled}, - import::expand_imports, - keyboard_config::{read_keyboard_toml_config, BoardConfig, KeyboardConfig}, - matrix::{expand_matrix_direct_pins, expand_matrix_input_output_pins}, - split::central::expand_serial_init, - ChipModel, ChipSeries, -}; +use crate::chip_init::expand_chip_init; +use crate::config::{MatrixType, SplitBoardConfig}; +use crate::entry::join_all_tasks; +use crate::feature::{get_rmk_features, is_feature_enabled}; +use crate::import::expand_imports; +use crate::keyboard_config::{read_keyboard_toml_config, BoardConfig, KeyboardConfig}; +use crate::matrix::{expand_matrix_direct_pins, expand_matrix_input_output_pins}; +use crate::split::central::expand_serial_init; +use crate::{ChipModel, ChipSeries}; /// Parse split peripheral mod and generate a valid RMK main function with all needed code -pub(crate) fn parse_split_peripheral_mod( - id: usize, - _attr: proc_macro::TokenStream, - item_mod: ItemMod, -) -> TokenStream2 { +pub(crate) fn parse_split_peripheral_mod(id: usize, _attr: proc_macro::TokenStream, item_mod: ItemMod) -> TokenStream2 { let rmk_features = get_rmk_features(); if !is_feature_enabled(&rmk_features, "split") { return quote! { @@ -39,14 +33,57 @@ pub(crate) fn parse_split_peripheral_mod( let main_function = expand_split_peripheral(id, &keyboard_config, item_mod, &rmk_features); + let bind_interrupts = if keyboard_config.chip.series == ChipSeries::Nrf52 { + quote! { + use ::embassy_nrf::bind_interrupts; + bind_interrupts!(struct Irqs { + CLOCK_POWER => ::nrf_sdc::mpsl::ClockInterruptHandler; + RNG => ::embassy_nrf::rng::InterruptHandler<::embassy_nrf::peripherals::RNG>; + EGU0_SWI0 => ::nrf_sdc::mpsl::LowPrioInterruptHandler; + RADIO => ::nrf_sdc::mpsl::HighPrioInterruptHandler; + TIMER0 => ::nrf_sdc::mpsl::HighPrioInterruptHandler; + RTC0 => ::nrf_sdc::mpsl::HighPrioInterruptHandler; + }); + + #[::embassy_executor::task] + async fn mpsl_task(mpsl: &'static ::nrf_sdc::mpsl::MultiprotocolServiceLayer<'static>) -> ! { + mpsl.run().await + } + /// How many outgoing L2CAP buffers per link + const L2CAP_TXQ: u8 = 3; + + /// How many incoming L2CAP buffers per link + const L2CAP_RXQ: u8 = 3; + + /// Size of L2CAP packets + const L2CAP_MTU: usize = 72; + fn build_sdc<'d, const N: usize>( + p: ::nrf_sdc::Peripherals<'d>, + rng: &'d mut ::embassy_nrf::rng::Rng<::embassy_nrf::peripherals::RNG>, + mpsl: &'d ::nrf_sdc::mpsl::MultiprotocolServiceLayer, + mem: &'d mut ::nrf_sdc::Mem, + ) -> Result<::nrf_sdc::SoftdeviceController<'d>, ::nrf_sdc::Error> { + ::nrf_sdc::Builder::new()? + .support_adv()? + .support_peripheral()? + .peripheral_count(1)? + .buffer_cfg(L2CAP_MTU as u8, L2CAP_MTU as u8, L2CAP_TXQ, L2CAP_RXQ)? + .build(p, rng, mpsl, mem) + } + } + } else { + quote! {} + }; + let main_function_sig = if keyboard_config.chip.series == ChipSeries::Esp32 { quote! { - use ::esp_idf_svc::hal::gpio::*; - use esp_println as _; - fn main() + use {esp_alloc as _, esp_backtrace as _}; + #[esp_hal_embassy::main] + async fn main(_s: Spawner) } } else { quote! { + #bind_interrupts #[::embassy_executor::main] async fn main(spawner: ::embassy_executor::Spawner) } @@ -57,8 +94,7 @@ pub(crate) fn parse_split_peripheral_mod( use panic_probe as _; #main_function_sig { - ::defmt::info!("RMK start!"); - + // ::defmt::info!("RMK start!"); #main_function } } @@ -80,16 +116,17 @@ fn expand_split_peripheral( } }; - let peripheral_config = split_config - .peripheral - .get(id) - .expect("Missing peripheral config"); + let peripheral_config = split_config.peripheral.get(id).expect("Missing peripheral config"); let central_config = &split_config.central; let imports = expand_imports(&item_mod); let chip_init = expand_chip_init(keyboard_config, &item_mod); + // TODO: use same bind_interrupts for central and peripheral + // let peripheral_addr = peripheral_config + // .ble_addr + // .expect("Peripheral should have a ble address, please check the `ble_addr` field in `keyboard.toml`"); // Debouncer config let rapid_debouncer_enabled = is_feature_enabled(rmk_features, "rapid_debouncer"); let col2row_enabled = is_feature_enabled(rmk_features, "col2row"); @@ -155,8 +192,7 @@ fn expand_split_peripheral( } } - let run_rmk_peripheral = - expand_split_peripheral_entry(&keyboard_config.chip, peripheral_config, ¢ral_config); + let run_rmk_peripheral = expand_split_peripheral_entry(&keyboard_config.chip, peripheral_config, ¢ral_config); quote! { #imports @@ -165,6 +201,7 @@ fn expand_split_peripheral( #run_rmk_peripheral } } + fn expand_split_peripheral_entry( chip: &ChipModel, peripheral_config: &SplitBoardConfig, @@ -175,17 +212,12 @@ fn expand_split_peripheral_entry( }; match chip.series { ChipSeries::Nrf52 => { - let central_addr = central_config - .ble_addr - .expect("Missing central ble address"); - let peripheral_addr = peripheral_config.ble_addr.expect( - "Peripheral should have a ble address, please check the `ble_addr` field in `keyboard.toml`", - ); + let central_addr = central_config.ble_addr.expect("Missing central ble address"); + let peripheral_run = quote! { ::rmk::split::peripheral::run_rmk_split_peripheral( [#(#central_addr), *], - [#(#peripheral_addr), *], - spawner, + &stack, ) }; join_all_tasks(vec![peripheral_matrix_task, peripheral_run]) diff --git a/rmk/Cargo.toml b/rmk/Cargo.toml index 74e3a1043..24b06d6a9 100644 --- a/rmk/Cargo.toml +++ b/rmk/Cargo.toml @@ -17,6 +17,7 @@ embedded-hal-async = { version = "1.0.0", optional = true } embedded-io-async = { version = "0.6" } embedded-storage = { version = "0.3", optional = true } embedded-storage-async = { version = "0.4", optional = true } + embassy-embedded-hal = { version = "0.3" } embassy-time = { version = "0.4" } embassy-usb = { version = "0.4", features = [ @@ -24,24 +25,25 @@ embassy-usb = { version = "0.4", features = [ "max-interface-count-8", "max-handler-count-8", ] } -heapless = "0.8.0" embassy-sync = { version = "0.6" } embassy-futures = { version = "0.1" } embassy-executor = { version = "0.7" } -usbd-hid = { version = "0.8.2" } -ssmarshal = { version = "1.0", default-features = false } -defmt = { version = "0.3", optional = true } -log = { version = "0.4", optional = true } -static_cell = "2" -num_enum = { version = "0.7", default-features = false } -bitfield-struct = "0.10" -byteorder = { version = "1", default-features = false } futures = { version = "0.3", default-features = false, features = [ "async-await", ] } -sequential-storage = { version = "4.0.0" } +heapless = "0.8.0" +usbd-hid = "0.8.2" +bitfield-struct = "0.10" +static_cell = "2" +sequential-storage = "4.0.1" + +defmt = { version = "1.0", optional = true } +log = { version = "0.4", optional = true } +num_enum = { version = "0.7", default-features = false } +byteorder = { version = "1", default-features = false } +ssmarshal = { version = "1.0", default-features = false } serde = { version = "1", default-features = false, features = ["derive"] } postcard = { version = "1", features = ["experimental-derive"] } @@ -49,30 +51,21 @@ postcard = { version = "1", features = ["experimental-derive"] } paste = "1" # Optional dependencies -# nRF dependencies -once_cell = { version = "1.19", features = [ - "atomic-polyfill", -], default-features = false, optional = true } -nrf-softdevice = { version = "0.1.0", git = "https://github.com/embassy-rs/nrf-softdevice", rev = "b53991e", features = [ - "defmt", - "ble-peripheral", - "critical-section-impl", - "ble-gatt-server", - "ble-gatt-client", - "ble-sec", +# BLE dependencies +trouble-host = { version = "0.1.0", git = "https://github.com/embassy-rs/trouble", rev = "3d77c0b", features = [ + "gatt", + "scan", + "derive", + "security", ], optional = true } +rand_core = { version = "0.6", optional = true } + +# nRF dependencies embassy-nrf = { version = "0.3.1", features = [ "unstable-pac", "time", ], optional = true } -# Espressif dependencies -esp32-nimble = { version = "0.10", optional = true } -esp-idf-svc = { version = "0.51", default-features = false, features = [ - "embedded-storage", - "experimental", -], optional = true } - # RP2040 dependencies embassy-rp = { version = "0.4", optional = true } embassy-hal-internal = { version = "0.2.0", optional = true } @@ -80,9 +73,13 @@ rp-pac = { version = "7.0.0", optional = true } pio = { version = "0.3.0", optional = true } fixed = { version = "1.28.0", optional = true } +# ESP32 dependencies +esp-hal = { version = "1.0.0-beta.0", optional = true } + # Document feature document-features = "0.2" +# Used in testing critical-section = { version = "1.2", optional = true } [dev-dependencies] @@ -107,10 +104,7 @@ cortex-m = { version = "0.7" } default = ["col2row", "defmt", "storage"] ## the storage is optional to save memory -storage = [ - "embedded-storage", - "embedded-storage-async" -] +storage = ["dep:embedded-storage", "dep:embedded-storage-async"] ## If your PCB diode's direction is col2row, enable this feature. If it's row2col, disable this feature by `default-features = false`. col2row = [] @@ -129,10 +123,13 @@ defmt = [ "usbd-hid/defmt", "sequential-storage/defmt-03", "embassy-nrf?/defmt", - "nrf-softdevice?/defmt", "postcard/use-defmt", + "trouble-host?/defmt", + "heapless/defmt-03", ] +log = ["dep:log", "trouble-host?/log"] + ## Add std feature for testing std = [ "embassy-executor/arch-std", @@ -155,64 +152,31 @@ split = [] ## Internal feature that indicates no USB is used, this feature will be auto-activated for some chips _no_usb = [] -## Internal feature that indicates no storage available, or it's unnecessary to pass storage to the main RMK API -_no_external_storage = [] - #! ### BLE feature flags #! #! ⚠️ Due to the limitation of docs.rs, functions gated by BLE features won't show in docs.rs. You have to head to [`examples`](https://github.com/HaoboGu/rmk/tree/main/examples) folder of RMK repo for their usages. ## Enable feature if you want to use nRF52840 with BLE. -nrf52840_ble = [ - "_nrf_ble", - "nrf-softdevice/nrf52840", - "nrf-softdevice/s140", - "nrf-softdevice/ble-central", -] +nrf52840_ble = ["_nrf_ble"] ## Enable feature if you want to use nRF52833 with BLE. -nrf52833_ble = [ - "_nrf_ble", - "nrf-softdevice/nrf52833", - "nrf-softdevice/s140", - "nrf-softdevice/ble-central", -] +nrf52833_ble = ["_nrf_ble"] ## Enable feature if you want to use nRF52832 with BLE. -nrf52832_ble = [ - "_nrf_ble", - "_no_usb", - "nrf-softdevice/nrf52832", - "nrf-softdevice/ble-central", - "nrf-softdevice/s132", -] +nrf52832_ble = ["_nrf_ble", "_no_usb"] ## Enable feature if you want to use nRF52811 with BLE. -nrf52811_ble = [ - "_nrf_ble", - "_no_usb", - "nrf-softdevice/nrf52811", - "nrf-softdevice/s112", -] +nrf52811_ble = ["_nrf_ble", "_no_usb"] ## Enable feature if you want to use nRF52810 with BLE. -nrf52810_ble = [ - "_nrf_ble", - "_no_usb", - "nrf-softdevice/nrf52810", - "nrf-softdevice/s112", -] +nrf52810_ble = ["_nrf_ble", "_no_usb"] +_nrf_ble = ["_ble", "dep:embassy-nrf"] ## Enable feature if you want to use ESP32C3 with BLE. -esp32c3_ble = ["_esp_ble"] +esp32c3_ble = ["_esp_ble", "_no_usb"] ## Enable feature if you want to use ESP32C6 with BLE. -esp32c6_ble = ["_esp_ble"] +esp32c6_ble = ["_esp_ble", "_no_usb"] ## Enable feature if you want to use ESP32S3 with BLE. esp32s3_ble = ["_esp_ble"] -_esp_ble = [ - "_ble", - "_no_usb", # ESP doesn't have USB support right now - "ssmarshal/std", - "dep:esp32-nimble", - "dep:esp-idf-svc", -] -_nrf_ble = ["_ble", "dep:nrf-softdevice", "dep:embassy-nrf", "dep:once_cell"] -_ble = ["_no_external_storage"] +_esp_ble = ["_ble", "dep:esp-hal"] + +## Enable feature if you want to use trouble BLE stack +_ble = ["dep:trouble-host", "dep:rand_core"] ## Enable feature if you want to use RP2040 PIO UART rp2040_pio = [ diff --git a/rmk/build.rs b/rmk/build.rs index bf33d5b6e..a5cb5f4f6 100644 --- a/rmk/build.rs +++ b/rmk/build.rs @@ -1,10 +1,9 @@ #[path = "./build_common.rs"] mod common; -use std::env; -use std::fs; use std::path::Path; use std::process::Command; +use std::{env, fs}; fn main() { // Set the compilation config @@ -12,7 +11,6 @@ fn main() { common::set_target_cfgs(&mut cfgs); // Ensure build.rs is re-run if files change - // println!("cargo:rerun-if-changed=NEVER_EXISTS"); println!("cargo:rerun-if-changed=.git/HEAD"); println!("cargo:rerun-if-changed=build.rs"); diff --git a/rmk/src/action.rs b/rmk/src/action.rs index 6ca10cd5c..f552900a9 100644 --- a/rmk/src/action.rs +++ b/rmk/src/action.rs @@ -99,12 +99,8 @@ impl KeyAction { KeyAction::Single(a) => a.to_action_code(), KeyAction::Tap(a) => 0x0001 | a.to_action_code(), KeyAction::OneShot(a) => 0x0010 | a.to_action_code(), - KeyAction::WithModifier(a, m) => { - 0x4000 | ((m.into_bits() as u16) << 8) | a.to_basic_action_code() - } - KeyAction::ModifierTapHold(a, m) => { - 0x6000 | ((m.into_bits() as u16) << 8) | a.to_basic_action_code() - } + KeyAction::WithModifier(a, m) => 0x4000 | ((m.into_bits() as u16) << 8) | a.to_basic_action_code(), + KeyAction::ModifierTapHold(a, m) => 0x6000 | ((m.into_bits() as u16) << 8) | a.to_basic_action_code(), KeyAction::LayerTapHold(action, layer) => { if layer < 16 { 0x3000 | ((layer as u16) << 15) | action.to_basic_action_code() @@ -113,9 +109,7 @@ impl KeyAction { 0x0000 } } - KeyAction::TapHold(tap, hold) => { - 0x8000 | (hold.to_basic_action_code() << 15) | tap.to_basic_action_code() - } + KeyAction::TapHold(tap, hold) => 0x8000 | (hold.to_basic_action_code() << 15) | tap.to_basic_action_code(), } } } diff --git a/rmk/src/ble/descriptor.rs b/rmk/src/ble/descriptor.rs deleted file mode 100644 index 97c346c86..000000000 --- a/rmk/src/ble/descriptor.rs +++ /dev/null @@ -1,90 +0,0 @@ -use usbd_hid::descriptor::generator_prelude::*; - -///! HID Descriptor used in BLE keyboard, which might be different from USB HID device - -/// Predefined report ids for composite BLE hid report. The report id of BLE should start from 0x01 -/// Should be same with `#[gen_hid_descriptor]` -#[repr(u8)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] -pub(crate) enum BleCompositeReportType { - Keyboard = 0x01, - Mouse = 0x02, - Media = 0x03, - System = 0x04, - Vial = 0x05, -} - -/// KeyboardReport describes a report and its companion descriptor that can be -/// used to send keyboard button presses to a host and receive the status of the -/// keyboard LEDs. -#[gen_hid_descriptor( - (collection = APPLICATION, usage_page = GENERIC_DESKTOP, usage = KEYBOARD) = { - (report_id = 0x01,) = { - (usage_page = KEYBOARD, usage_min = 0xE0, usage_max = 0xE7) = { - #[packed_bits 8] #[item_settings data,variable,absolute] modifier=input; - }; - (logical_min = 0,) = { - #[item_settings constant,variable,absolute] reserved=input; - }; - (usage_page = LEDS, usage_min = 0x01, usage_max = 0x05) = { - #[packed_bits 5] #[item_settings data,variable,absolute] leds=output; - }; - (usage_page = KEYBOARD, usage_min = 0x00, usage_max = 0xDD) = { - #[item_settings data,array,absolute] keycodes=input; - }; - }; - }, - (collection = APPLICATION, usage_page = GENERIC_DESKTOP, usage = MOUSE) = { - (collection = PHYSICAL, usage = POINTER) = { - (report_id = 0x02,) = { - (usage_page = BUTTON, usage_min = BUTTON_1, usage_max = BUTTON_8) = { - #[packed_bits 8] #[item_settings data,variable,absolute] buttons=input; - }; - (usage_page = GENERIC_DESKTOP,) = { - (usage = X,) = { - #[item_settings data,variable,relative] x=input; - }; - (usage = Y,) = { - #[item_settings data,variable,relative] y=input; - }; - (usage = WHEEL,) = { - #[item_settings data,variable,relative] wheel=input; - }; - }; - (usage_page = CONSUMER,) = { - (usage = AC_PAN,) = { - #[item_settings data,variable,relative] pan=input; - }; - }; - }; - }; - }, - (collection = APPLICATION, usage_page = CONSUMER, usage = CONSUMER_CONTROL) = { - (report_id = 0x03,) = { - (usage_page = CONSUMER, usage_min = 0x00, usage_max = 0x514) = { - #[item_settings data,array,absolute,not_null] media_usage_id=input; - } - }; - }, - (collection = APPLICATION, usage_page = GENERIC_DESKTOP, usage = SYSTEM_CONTROL) = { - (report_id = 0x04,) = { - (usage_min = 0x81, usage_max = 0xB7, logical_min = 1) = { - #[item_settings data,array,absolute,not_null] system_usage_id=input; - }; - }; - } -)] -#[allow(dead_code)] -pub(crate) struct BleKeyboardReport { - pub(crate) modifier: u8, // HidModifiers - pub(crate) reserved: u8, - pub(crate) leds: u8, // LedIndicator - pub(crate) keycodes: [u8; 6], - pub(crate) buttons: u8, - pub(crate) x: i8, - pub(crate) y: i8, - pub(crate) wheel: i8, // Scroll down (negative) or up (positive) this many units - pub(crate) pan: i8, // Scroll left (negative) or right (positive) this many units - pub(crate) media_usage_id: u16, - pub(crate) system_usage_id: u8, -} diff --git a/rmk/src/ble/esp/mod.rs b/rmk/src/ble/esp/mod.rs deleted file mode 100644 index cc180f6d7..000000000 --- a/rmk/src/ble/esp/mod.rs +++ /dev/null @@ -1,76 +0,0 @@ -pub(crate) mod server; - -use self::server::BleServer; -use crate::channel::VIAL_READ_CHANNEL; -use crate::config::RmkConfig; -use crate::keymap::KeyMap; -use crate::light::LightController; -use crate::storage::Storage; -use crate::{run_keyboard, CONNECTION_STATE}; -use core::cell::RefCell; -use embedded_hal::digital::OutputPin; -use embedded_storage_async::nor_flash::NorFlash as AsyncNorFlash; - -/// Initialize and run the BLE keyboard service, with given keyboard usb config. -/// Can only be used on nrf52 series microcontrollers with `nrf-softdevice` crate. -/// This function never returns. -/// -/// # Arguments -/// -/// * `keymap` - default keymap definition -/// * `storage` - storage for saving keymap and other data -/// * `light_controller` - light controller for controlling the light -/// * `rmk_config` - other configurations of the keyboard, check [RmkConfig] struct for details -// TODO: add usb service for other chips of esp32 which have USB device -pub(crate) async fn run_esp_ble_keyboard< - 'a, - F: AsyncNorFlash, - Out: OutputPin, - const ROW: usize, - const COL: usize, - const NUM_LAYER: usize, - const NUM_ENCODER: usize, ->( - keymap: &'a RefCell>, - storage: &mut Storage, - light_controller: &mut LightController, - rmk_config: RmkConfig<'static>, -) -> ! { - // esp32c3 doesn't have USB device, so there is no usb here - loop { - CONNECTION_STATE.store(false, core::sync::atomic::Ordering::Release); - info!("Advertising.."); - let mut ble_server = BleServer::new(rmk_config.usb_config); - ble_server.output_keyboard.lock().on_write(|args| { - let data: &[u8] = args.recv_data(); - debug!("output_keyboard {}, {}", data.len(), data[0]); - }); - - info!("Waitting for connection.."); - ble_server.wait_for_connection().await; - - info!("BLE connected!"); - CONNECTION_STATE.store(true, core::sync::atomic::Ordering::Release); - - // Create BLE HID writers - let keyboard_writer = ble_server.get_keyboard_writer(); - let vial_reader_writer = ble_server.get_vial_reader_writer(); - let led_reader = ble_server.get_led_reader(); - - let disconnect = BleServer::wait_for_disconnection(ble_server.server); - - run_keyboard( - keymap, - storage, - disconnect, - light_controller, - led_reader, - vial_reader_writer, - keyboard_writer, - rmk_config.vial_config, - ) - .await; - - warn!("BLE disconnected!") - } -} diff --git a/rmk/src/ble/esp/server.rs b/rmk/src/ble/esp/server.rs deleted file mode 100644 index 87f957a93..000000000 --- a/rmk/src/ble/esp/server.rs +++ /dev/null @@ -1,291 +0,0 @@ -extern crate alloc; -use alloc::sync::Arc; -use embassy_futures::block_on; -use embassy_time::Timer; -use esp32_nimble::{ - enums::{AuthReq, SecurityIOCap}, - utilities::{mutex::Mutex, BleUuid}, - BLEAdvertisementData, BLECharacteristic, BLEDevice, BLEHIDDevice, BLEServer, NimbleProperties, -}; -use ssmarshal::serialize; -use usbd_hid::descriptor::SerializedDescriptor as _; - -use crate::{ - ble::{ - descriptor::{BleCompositeReportType, BleKeyboardReport}, - device_info::VidSource, - led::BleLedReader, - }, - channel::{KEYBOARD_REPORT_CHANNEL, LED_SIGNAL}, - config::KeyboardUsbConfig, - hid::{HidError, HidReaderTrait, HidWriterTrait, Report, RunnableHidWriter}, - light::LedIndicator, - usb::descriptor::ViaReport, - CONNECTION_STATE, -}; - -use super::VIAL_READ_CHANNEL; - -pub(crate) struct BleKeyboardWriter { - pub(crate) keyboard_handle: Arc>, - pub(crate) media_handle: Arc>, - pub(crate) system_control_handle: Arc>, - pub(crate) mouse_handle: Arc>, -} - -impl RunnableHidWriter for BleKeyboardWriter { - async fn get_report(&mut self) -> Self::ReportType { - KEYBOARD_REPORT_CHANNEL.receive().await - } -} - -impl HidWriterTrait for BleKeyboardWriter { - type ReportType = Report; - - async fn write_report(&mut self, report: Self::ReportType) -> Result { - match report { - Report::KeyboardReport(keyboard_report) => { - debug!("Writing keyboard report {}", keyboard_report); - let mut buf = [0u8; 8]; - let n = serialize(&mut buf, &keyboard_report) - .map_err(|_| HidError::ReportSerializeError)?; - self.write(&self.keyboard_handle, &buf).await?; - Ok(n) - } - Report::MouseReport(mouse_report) => { - let mut buf = [0u8; 5]; - let n = serialize(&mut buf, &mouse_report) - .map_err(|_| HidError::ReportSerializeError)?; - self.write(&self.mouse_handle, &buf).await?; - Ok(n) - } - Report::MediaKeyboardReport(media_keyboard_report) => { - let mut buf = [0u8; 2]; - let n = serialize(&mut buf, &media_keyboard_report) - .map_err(|_| HidError::ReportSerializeError)?; - self.write(&self.media_handle, &buf).await?; - Ok(n) - } - Report::SystemControlReport(system_control_report) => { - let mut buf = [0u8; 2]; - let n = serialize(&mut buf, &system_control_report) - .map_err(|_| HidError::ReportSerializeError)?; - self.write(&self.system_control_handle, &buf).await?; - Ok(n) - } - } - } -} - -impl BleKeyboardWriter { - async fn write( - &self, - handle: &Arc>, - report: &[u8], - ) -> Result<(), HidError> { - debug!("BLE notify {} {=[u8]:#X}", report.len(), report); - handle.lock().set_value(report).notify(); - Timer::after_millis(7).await; - Ok(()) - } -} - -pub(crate) struct BleVialReaderWriter { - // Read vial data from host via vial_output_handle - pub(crate) vial_output_handle: Arc>, - // Writer vial data to host via vial_input_handle - pub(crate) vial_input_handle: Arc>, -} - -impl HidReaderTrait for BleVialReaderWriter { - type ReportType = ViaReport; - - async fn read_report(&mut self) -> Result { - let v = VIAL_READ_CHANNEL.receive().await; - - // The output_data field is the input from host - Ok(ViaReport { - input_data: [0u8; 32], - output_data: v, - }) - } -} - -impl HidWriterTrait for BleVialReaderWriter { - type ReportType = ViaReport; - - async fn write_report(&mut self, report: Self::ReportType) -> Result { - let mut buf = [0u8; 32]; - let n = serialize(&mut buf, &report).map_err(|_| HidError::ReportSerializeError)?; - self.write(&buf).await?; - Ok(n) - } -} - -impl BleVialReaderWriter { - async fn write(&self, report: &[u8]) -> Result<(), HidError> { - self.vial_input_handle.lock().set_value(&report).notify(); - Timer::after_millis(7).await; - Ok(()) - } -} - -// BLE HID keyboard server -pub(crate) struct BleServer { - pub(crate) server: &'static mut BLEServer, - pub(crate) input_keyboard: Arc>, - pub(crate) output_keyboard: Arc>, - pub(crate) input_media_keys: Arc>, - pub(crate) input_system_keys: Arc>, - pub(crate) input_mouse_keys: Arc>, - pub(crate) input_vial: Arc>, - pub(crate) output_vial: Arc>, -} - -impl BleServer { - pub(crate) fn new(usb_config: KeyboardUsbConfig) -> Self { - let keyboard_name = usb_config.product_name; - let device = BLEDevice::take(); - BLEDevice::set_device_name(keyboard_name).ok(); - device - .security() - .set_auth(AuthReq::all()) - .set_io_cap(SecurityIOCap::NoInputNoOutput) - .resolve_rpa(); - let server = device.get_server(); - // Set disconnected callback - server.on_disconnect(|_, r| { - if let Err(e) = r { - warn!("BLE disconnected, error code: {}", e.code()); - } - info!("Disconnected!"); - }); - let mut hid = BLEHIDDevice::new(server); - hid.manufacturer(usb_config.manufacturer); - block_on(server.get_service(BleUuid::from_uuid16(0x180a))) - .unwrap() - .lock() - .create_characteristic(BleUuid::from_uuid16(0x2a25), NimbleProperties::READ) - .lock() - .set_value(usb_config.serial_number.as_bytes()); - - let input_keyboard = hid.input_report(BleCompositeReportType::Keyboard as u8); - let output_keyboard = hid.output_report(BleCompositeReportType::Keyboard as u8); - let input_media_keys = hid.input_report(BleCompositeReportType::Media as u8); - let input_system_keys = hid.input_report(BleCompositeReportType::System as u8); - let input_mouse_keys = hid.input_report(BleCompositeReportType::Mouse as u8); - - hid.pnp( - VidSource::UsbIF as u8, - usb_config.vid, - usb_config.pid, - 0x0000, - ); - hid.set_battery_level(80); - hid.hid_info(0x00, 0x03); - hid.report_map(BleKeyboardReport::desc()); - - let mut vial_hid = BLEHIDDevice::new(server); - vial_hid.manufacturer(usb_config.manufacturer); - block_on(server.get_service(BleUuid::from_uuid16(0x180a))) - .unwrap() - .lock() - .create_characteristic(BleUuid::from_uuid16(0x2a25), NimbleProperties::READ) - .lock() - .set_value(usb_config.serial_number.as_bytes()); - let input_vial = vial_hid.input_report(0); - let output_vial = vial_hid.output_report(0); - - vial_hid.pnp( - VidSource::UsbIF as u8, - usb_config.vid, - usb_config.pid, - 0x0000, - ); - vial_hid.hid_info(0x00, 0x03); - vial_hid.report_map(ViaReport::desc()); - - let ble_advertising = device.get_advertising(); - if let Err(e) = ble_advertising.lock().scan_response(false).set_data( - BLEAdvertisementData::new() - .name(keyboard_name) - .appearance(0x03C1) - .add_service_uuid(hid.hid_service().lock().uuid()) - .add_service_uuid(vial_hid.hid_service().lock().uuid()), - ) { - error!("BLE advertising error, error code: {}", e.code()); - } - - if let Err(e) = ble_advertising.lock().start() { - error!("BLE advertising start error: {}", e.code()); - } - - Self { - server, - input_keyboard, - output_keyboard, - input_media_keys, - input_system_keys, - input_mouse_keys, - input_vial, - output_vial, - } - } - - pub(crate) fn get_led_reader(&self) -> BleLedReader { - // Set vial output characteristic read callback - self.output_keyboard.lock().on_write(|args| { - let data: &[u8] = args.recv_data(); - debug!("BLE received LED, len: {} {=[u8]:#X}", data.len(), data); - if data.len() > 0 { - // Send the first byte to the LED_SIGNAL - LED_SIGNAL.signal(LedIndicator::from_bits(data[0])); - } - }); - BleLedReader {} - } - - pub(crate) fn get_keyboard_writer(&self) -> BleKeyboardWriter { - BleKeyboardWriter { - keyboard_handle: self.input_keyboard.clone(), - media_handle: self.input_media_keys.clone(), - system_control_handle: self.input_system_keys.clone(), - mouse_handle: self.input_mouse_keys.clone(), - } - } - - pub(crate) fn get_vial_reader_writer(&self) -> BleVialReaderWriter { - // Set vial output characteristic read callback - self.output_vial.lock().on_write(|args| { - let data: &[u8] = args.recv_data(); - debug!("BLE received vial, len: {} {=[u8]:#X}", data.len(), data); - block_on(VIAL_READ_CHANNEL.send(unsafe { *(data.as_ptr() as *const [u8; 32]) })); - }); - - BleVialReaderWriter { - vial_output_handle: self.output_vial.clone(), - vial_input_handle: self.input_vial.clone(), - } - } - - pub(crate) async fn wait_for_connection(&mut self) { - loop { - // Check connection status every 100 ms - Timer::after_millis(100).await; - if self.server.connected_count() > 0 { - break; - } - } - } - - pub(crate) async fn wait_for_disconnection(server: &'static mut BLEServer) { - CONNECTION_STATE.store(true, core::sync::atomic::Ordering::Release); - loop { - // Check connection status every 500 ms - Timer::after_millis(500).await; - if server.connected_count() == 0 { - break; - } - } - } -} diff --git a/rmk/src/ble/led.rs b/rmk/src/ble/led.rs index f22bb843b..fce836201 100644 --- a/rmk/src/ble/led.rs +++ b/rmk/src/ble/led.rs @@ -1,8 +1,6 @@ -use crate::{ - channel::LED_SIGNAL, - hid::{HidError, HidReaderTrait}, - light::LedIndicator, -}; +use crate::channel::LED_SIGNAL; +use crate::hid::{HidError, HidReaderTrait}; +use crate::light::LedIndicator; pub(crate) struct BleLedReader {} diff --git a/rmk/src/ble/mod.rs b/rmk/src/ble/mod.rs index 2bebdfcda..3ea881fa5 100644 --- a/rmk/src/ble/mod.rs +++ b/rmk/src/ble/mod.rs @@ -1,11 +1,4 @@ -pub(crate) mod descriptor; pub(crate) mod device_info; pub(crate) mod led; -#[cfg(feature = "_esp_ble")] -pub mod esp; -#[cfg(feature = "_nrf_ble")] -pub mod nrf; - -#[cfg(any(feature = "nrf52840_ble", feature = "nrf52833_ble"))] -pub use nrf::SOFTWARE_VBUS; +pub mod trouble; diff --git a/rmk/src/ble/nrf/advertise.rs b/rmk/src/ble/nrf/advertise.rs deleted file mode 100644 index f39eeedc3..000000000 --- a/rmk/src/ble/nrf/advertise.rs +++ /dev/null @@ -1,37 +0,0 @@ -use nrf_softdevice::ble::advertisement_builder::{ - AdvertisementDataType, Error, Flag, LegacyAdvertisementBuilder, LegacyAdvertisementPayload, - ServiceList, ServiceUuid16, -}; - -pub(crate) fn create_advertisement_data(keyboard_name: &str) -> LegacyAdvertisementPayload { - LegacyAdvertisementBuilder::new() - .flags(&[Flag::GeneralDiscovery, Flag::LE_Only]) - .services_16( - ServiceList::Incomplete, - &[ - ServiceUuid16::BATTERY, - ServiceUuid16::HUMAN_INTERFACE_DEVICE, - ], - ) - .full_name(keyboard_name) - // Change the appearance (icon of the bluetooth device) to a keyboard - .raw(AdvertisementDataType::APPEARANCE, &[0xC1, 0x03]) - .try_build() - .unwrap_or_else(|Error::Oversize { expected }| { - panic!( - "keyboard name is {} characters oversize", - expected - 31 /* for some reason LEGACY_PAYLOAD_LEN is private */ - ) - }) -} - -pub(crate) static SCAN_DATA: LegacyAdvertisementPayload = LegacyAdvertisementBuilder::new() - .services_16( - ServiceList::Complete, - &[ - ServiceUuid16::DEVICE_INFORMATION, - ServiceUuid16::BATTERY, - ServiceUuid16::HUMAN_INTERFACE_DEVICE, - ], - ) - .build(); diff --git a/rmk/src/ble/nrf/battery_service.rs b/rmk/src/ble/nrf/battery_service.rs deleted file mode 100644 index ec5ba454a..000000000 --- a/rmk/src/ble/nrf/battery_service.rs +++ /dev/null @@ -1,87 +0,0 @@ -use crate::config::BleBatteryConfig; -use core::sync::atomic::{AtomicU8, Ordering}; -use embassy_time::Timer; -use nrf_softdevice::ble::Connection; - -#[nrf_softdevice::gatt_service(uuid = "180f")] -#[derive(Debug, Clone, Copy)] -pub(crate) struct BatteryService { - #[characteristic(uuid = "2a19", read, notify)] - battery_level: u8, -} - -// Global static variable, store the current battery level -static CURRENT_BATTERY_LEVEL: AtomicU8 = AtomicU8::new(255); - -impl<'a> BatteryService { - pub(crate) async fn run( - &mut self, - battery_config: &mut BleBatteryConfig<'a>, - conn: &Connection, - ) { - // Wait 1 seconds, ensure that gatt server has been started - Timer::after_secs(1).await; - - let battery_led_control = async { - loop { - // Read the current battery level - let current_battery_level = CURRENT_BATTERY_LEVEL.load(Ordering::Relaxed); - - // Check if the device is charging - let is_charging = if let Some(ref is_charging_pin) = battery_config.charge_state_pin - { - is_charging_pin.is_low() == battery_config.charge_state_low_active - } else { - false - }; - - // Control the LED based on the charging state and battery level - if let Some(ref mut charge_led) = battery_config.charge_led_pin { - if is_charging { - // If the device is charging, the LED is always on - if battery_config.charge_led_low_active { - charge_led.set_low(); - } else { - charge_led.set_high(); - } - } else if current_battery_level < 50 { - // If the device is not charging and the battery level is less than 10%, the LED will blink - charge_led.toggle(); - Timer::after_millis(200).await; - } else { - // If the device is not charging and the battery level is greater than 10%, the LED is always off - if battery_config.charge_led_low_active { - charge_led.set_high(); - } else { - charge_led.set_low(); - } - } - } - - // If there is no blinking operation, wait for a while before checking again - if !(is_charging == false && current_battery_level < 10) { - Timer::after_secs(30).await; - } - } - }; - - let report_battery_level = async { - loop { - let val = crate::channel::BATTERY_LEVEL_SIGNAL.wait().await; - - // Update the battery level - CURRENT_BATTERY_LEVEL.store(val, Ordering::Relaxed); - - match self.battery_level_notify(conn, &val) { - Ok(_) => info!("Battery value: {}", val), - Err(e) => match self.battery_level_set(&val) { - Ok(_) => info!("Battery value set: {}", val), - Err(e2) => error!("Battery value notify error: {}, set error: {}", e, e2), - }, - } - } - }; - - embassy_futures::join::join(battery_led_control, report_battery_level).await; - } -} diff --git a/rmk/src/ble/nrf/bonder.rs b/rmk/src/ble/nrf/bonder.rs deleted file mode 100644 index 9ab1827ed..000000000 --- a/rmk/src/ble/nrf/bonder.rs +++ /dev/null @@ -1,408 +0,0 @@ -use super::BONDED_DEVICE_NUM; -use crate::channel::FLASH_CHANNEL; -use crate::{ble::nrf::ACTIVE_PROFILE, storage::FlashOperationMessage, CONNECTION_STATE}; -use core::{cell::RefCell, sync::atomic::Ordering}; -use heapless::FnvIndexMap; -use nrf_softdevice::ble::{ - gatt_server::{get_sys_attrs, set_sys_attrs}, - security::{IoCapabilities, SecurityHandler}, - Address, AddressType, Connection, EncryptionInfo, IdentityKey, IdentityResolutionKey, MasterId, - SecurityMode, -}; - -// Bond info which will be stored in flash -#[derive(Clone, Copy, Debug, Default)] -#[cfg_attr(feature = "defmt", derive(defmt::Format))] -pub(crate) struct BondInfo { - pub(crate) slot_num: u8, - pub(crate) peer: Peer, - sys_attr: SystemAttribute, - pub(crate) removed: bool, -} - -#[repr(C)] -#[derive(Clone, Copy, Debug)] -#[cfg_attr(feature = "defmt", derive(defmt::Format))] -pub(crate) struct Peer { - pub(crate) master_id: MasterId, - pub(crate) key: EncryptionInfo, - pub(crate) peer_id: IdentityKey, -} - -impl Default for Peer { - fn default() -> Self { - Self { - master_id: Default::default(), - key: Default::default(), - peer_id: IdentityKey { - addr: Address::new(AddressType::Public, [0; 6]), - irk: IdentityResolutionKey::default(), - }, - } - } -} - -#[repr(C)] -#[derive(Clone, Copy, Debug)] -#[cfg_attr(feature = "defmt", derive(defmt::Format))] -pub(crate) struct SystemAttribute { - pub(crate) length: usize, - pub(crate) data: [u8; 62], -} - -impl Default for SystemAttribute { - fn default() -> Self { - Self { - length: 0, - data: [0; 62], - } - } -} - -// Bonder that manages multiple profiles -pub(crate) struct MultiBonder { - // Info of all bonded devices - // `slot_num` is used as the key, because using peer as key will bring a lot more complexity - bond_info: RefCell>, -} - -impl MultiBonder { - pub(crate) fn new(bond_info: RefCell>) -> Self { - Self { bond_info } - } - - pub(crate) fn clear_bonded(&self, slot_num: u8) { - let mut bond_info = self.bond_info.borrow_mut(); - if let Some(info) = bond_info.get_mut(&slot_num) { - info.removed = true; - } - } -} - -impl SecurityHandler for MultiBonder { - fn io_capabilities(&self) -> IoCapabilities { - IoCapabilities::None - } - - fn can_bond(&self, _conn: &Connection) -> bool { - true - } - - fn display_passkey(&self, passkey: &[u8; 6]) { - info!("BLE passkey: {:?}", passkey); - } - - fn on_security_update(&self, _conn: &Connection, security_mode: SecurityMode) { - info!("on_security_update, new security mode: {:?}", security_mode); - // Security updated, indicating that the connection is established? - CONNECTION_STATE.store(true, Ordering::Release); - } - - fn on_bonded( - &self, - conn: &Connection, - master_id: MasterId, - key: EncryptionInfo, - peer_id: IdentityKey, - ) { - // First time - debug!("On bonded: storing bond for {:?}", master_id); - - // Get slot num, if the device has been bonded, reuse the slot num. Otherwise get a new slot num - let slot_num = ACTIVE_PROFILE.load(Ordering::Acquire); - - // Save bond info - let mut sys_attr_data: [u8; 62] = [0; 62]; - let sys_attr_length = get_sys_attrs(conn, &mut sys_attr_data).unwrap(); - - let new_bond_info = BondInfo { - sys_attr: SystemAttribute { - length: sys_attr_length, - data: sys_attr_data, - }, - peer: Peer { - master_id, - key, - peer_id, - }, - slot_num, - removed: false, - }; - - match FLASH_CHANNEL.try_send(FlashOperationMessage::BondInfo(new_bond_info)) { - Ok(_) => { - // Update self.bond_info as well - debug!("Sent bond info to flash channel"); - self.bond_info - .borrow_mut() - .insert(slot_num, new_bond_info) - .ok(); - } - Err(_) => error!("Send bond info to flash channel error"), - } - } - - fn get_key(&self, _conn: &Connection, master_id: MasterId) -> Option { - // Reconnecting with an existing bond - debug!("Getting bond for {:?}", master_id); - - self.bond_info - .borrow() - .iter() - .find(|(_, info)| { - // Reconnect to device on actived slot - let slot_num = ACTIVE_PROFILE.load(Ordering::Acquire); - info.slot_num == slot_num - && info.peer.master_id == master_id - && info.removed == false - }) - .and_then(|(_, d)| Some(d.peer.key)) - } - - fn save_sys_attrs(&self, conn: &Connection) { - // On disconnect usually - let addr = conn.peer_address(); - - let mut bond_info = self.bond_info.borrow_mut(); - - // Get bonded peer - let bonded = bond_info - .iter_mut() - .filter(|(_, b)| b.removed == false) - .find(|(_, info)| info.peer.peer_id.is_match(addr)); - - if let Some((_, info)) = bonded { - let mut buf = [0_u8; 64]; - - match get_sys_attrs(conn, &mut buf) { - Ok(sys_attr_len) => { - if sys_attr_len > 0 { - // Get sys_attrs correctly, check whether it's same with saved bond info. - // If not, update bond info - if !(info.sys_attr.length == sys_attr_len - && info.sys_attr.data[0..sys_attr_len] == buf[0..sys_attr_len]) - { - debug!( - "Updating sys_attr:\nnew: {:?},{:?}\nold: {:?},{:?}", - buf, sys_attr_len, info.sys_attr.data, info.sys_attr.length - ); - // Update bond info - info.sys_attr.data[0..sys_attr_len] - .copy_from_slice(&buf[0..sys_attr_len]); - info.sys_attr.length = sys_attr_len; - - // Save new bond info to flash - match FLASH_CHANNEL - .try_send(FlashOperationMessage::BondInfo(info.clone())) - { - Ok(_) => debug!("Sent bond info to flash channel"), - Err(_e) => error!("Send bond info to flash channel error"), - }; - } - } else { - error!("Got empty system attr"); - } - } - Err(e) => { - error!("Get system attr for {:?} erro: {:?}", info, e); - } - } - } else { - info!("Peer doesn't match: {:?}", conn.peer_address()); - } - } - - fn load_sys_attrs(&self, conn: &Connection) { - let addr = conn.peer_address(); - info!("Loading system attributes for {:?}", addr); - - let bond_info = self.bond_info.borrow(); - - let sys_attr = bond_info - .iter() - .filter(|(_, b)| b.sys_attr.length != 0 && b.removed == false) - .find(|(_, b)| b.peer.peer_id.is_match(addr)) - .map(|(_, b)| &b.sys_attr.data[0..b.sys_attr.length]); - - // info!("call set_sys_attrs in load_sys_attrs: {:?}", sys_attr); - if let Err(err) = set_sys_attrs(conn, sys_attr) { - warn!("SecurityHandler failed to set sys attrs: {:?}", err); - } - } -} - -// Bonder aka security handler used in advertising & pairing. -// This bonder impl automatically connects to new host when there's not a connected one. -pub(crate) struct Bonder { - // Info of all bonded devices - // `slot_num` is used as the key, because using peer as key will bring a lot more complexity - bond_info: RefCell>, -} - -#[deprecated = "It's different from current implementation that respects active profile number. Some code maybe useful in the future, so we keep it for now."] -impl Bonder { - pub(crate) fn new(bond_info: RefCell>) -> Self { - Self { bond_info } - } -} - -impl SecurityHandler for Bonder { - fn io_capabilities(&self) -> IoCapabilities { - IoCapabilities::None - } - - fn can_bond(&self, _conn: &Connection) -> bool { - true - } - - fn display_passkey(&self, passkey: &[u8; 6]) { - info!("BLE passkey: {:?}", passkey); - } - - fn on_security_update(&self, _conn: &Connection, security_mode: SecurityMode) { - info!("on_security_update, new security mode: {:?}", security_mode); - } - - fn on_bonded( - &self, - conn: &Connection, - master_id: MasterId, - key: EncryptionInfo, - peer_id: IdentityKey, - ) { - // First time - debug!("On bonded: storing bond for {:?}", master_id); - - // Get slot num, if the device has been bonded, reuse the slot num. Otherwise get a new slot num - let slot_num = self - .bond_info - .borrow() - .iter() - .find(|(_, b)| b.peer.peer_id.addr == peer_id.addr && b.removed == false) - .map(|(i, _)| *i) - .unwrap_or(self.bond_info.borrow().len() as u8); - - // Check whether all slots are full, if so randomly remove one - if (slot_num as usize) == self.bond_info.borrow().capacity() { - warn!("Reach maximum number of bonded devices, a device which is not lucky today will be removed:("); - // The unlucky number is 4 - let unlucky: u8 = 4; - match FLASH_CHANNEL.try_send(FlashOperationMessage::ClearSlot(unlucky)) { - Ok(_) => debug!("Sent clear to flash channel"), - Err(_e) => error!("Send clear to flash channel error"), - } - self.bond_info.borrow_mut().remove(&unlucky); - } else { - // Save bond info - let mut sys_attr_data: [u8; 62] = [0; 62]; - let sys_attr_length = get_sys_attrs(conn, &mut sys_attr_data).unwrap(); - - let new_bond_info = BondInfo { - sys_attr: SystemAttribute { - length: sys_attr_length, - data: sys_attr_data, - }, - peer: Peer { - master_id, - key, - peer_id, - }, - slot_num, - removed: false, - }; - - match FLASH_CHANNEL.try_send(FlashOperationMessage::BondInfo(new_bond_info)) { - Ok(_) => { - // Update self.bond_info as well - debug!("Sent bond info to flash channel"); - self.bond_info - .borrow_mut() - .insert(slot_num, new_bond_info) - .ok(); - } - Err(_) => error!("Send bond info to flash channel error"), - } - } - } - - fn get_key(&self, _conn: &Connection, master_id: MasterId) -> Option { - // Reconnecting with an existing bond - debug!("Getting bond for {:?}", master_id); - - self.bond_info - .borrow() - .iter() - .find(|(_, info)| info.peer.master_id == master_id && info.removed == false) - .and_then(|(_, d)| Some(d.peer.key)) - } - - fn save_sys_attrs(&self, conn: &Connection) { - // On disconnect usually - let addr = conn.peer_address(); - - let mut bond_info = self.bond_info.borrow_mut(); - - // Get bonded peer - let bonded = bond_info - .iter_mut() - .find(|(_, info)| info.peer.peer_id.is_match(addr)); - - if let Some((_, info)) = bonded { - let mut buf = [0_u8; 64]; - - match get_sys_attrs(conn, &mut buf) { - Ok(sys_attr_len) => { - if sys_attr_len > 0 { - // Get sys_attrs correctly, check whether it's same with saved bond info. - // If not, update bond info - if !(info.sys_attr.length == sys_attr_len - && info.sys_attr.data[0..sys_attr_len] == buf[0..sys_attr_len]) - { - debug!( - "Updating sys_attr:\nnew: {:?},{:?}\nold: {:?},{:?}", - buf, sys_attr_len, info.sys_attr.data, info.sys_attr.length - ); - // Update bond info - info.sys_attr.data[0..sys_attr_len] - .copy_from_slice(&buf[0..sys_attr_len]); - info.sys_attr.length = sys_attr_len; - - // Save new bond info to flash - match FLASH_CHANNEL - .try_send(FlashOperationMessage::BondInfo(info.clone())) - { - Ok(_) => debug!("Sent bond info to flash channel"), - Err(_e) => error!("Send bond info to flash channel error"), - }; - } - } else { - error!("Got empty system attr"); - } - } - Err(e) => { - error!("Get system attr for {:?} erro: {:?}", info, e); - } - } - } else { - info!("Peer doesn't match: {:?}", conn.peer_address()); - } - } - - fn load_sys_attrs(&self, conn: &Connection) { - let addr = conn.peer_address(); - info!("Loading system attributes for {:?}", addr); - - let bond_info = self.bond_info.borrow(); - - let sys_attr = bond_info - .iter() - .filter(|(_, b)| b.sys_attr.length != 0 && b.removed == false) - .find(|(_, b)| b.peer.peer_id.is_match(addr)) - .map(|(_, b)| &b.sys_attr.data[0..b.sys_attr.length]); - - // info!("call set_sys_attrs in load_sys_attrs: {:?}", sys_attr); - if let Err(err) = set_sys_attrs(conn, sys_attr) { - warn!("SecurityHandler failed to set sys attrs: {:?}", err); - } - } -} diff --git a/rmk/src/ble/nrf/device_information_service.rs b/rmk/src/ble/nrf/device_information_service.rs deleted file mode 100644 index 0cdcdf104..000000000 --- a/rmk/src/ble/nrf/device_information_service.rs +++ /dev/null @@ -1,94 +0,0 @@ -use super::spec::{BleCharacteristics, BleSpecification}; -use crate::ble::device_info::{DeviceInformation, PnPID}; -use nrf_softdevice::{ - ble::{ - gatt_server::{ - builder::ServiceBuilder, - characteristic::{Attribute, Metadata, Properties}, - CharacteristicHandles, RegisterError, - }, - Uuid, - }, - Softdevice, -}; - -pub(crate) struct DeviceInformationService {} - -impl DeviceInformationService { - pub(crate) fn new( - sd: &mut Softdevice, - pnp_id: &PnPID, - info: DeviceInformation, - ) -> Result { - let mut sb = ServiceBuilder::new(sd, BleSpecification::DeviceInformation.uuid())?; - - Self::add_pnp_characteristic(&mut sb, pnp_id)?; - Self::add_opt_str_characteristic( - &mut sb, - BleCharacteristics::ManufacturerName.uuid(), - info.manufacturer_name, - )?; - Self::add_opt_str_characteristic( - &mut sb, - BleCharacteristics::ModelNumber.uuid(), - info.model_number, - )?; - Self::add_opt_str_characteristic( - &mut sb, - BleCharacteristics::SerialNumber.uuid(), - info.serial_number, - )?; - Self::add_opt_str_characteristic( - &mut sb, - BleCharacteristics::HardwareRevision.uuid(), - info.hw_rev, - )?; - Self::add_opt_str_characteristic( - &mut sb, - BleCharacteristics::FirmwareRevision.uuid(), - info.fw_rev, - )?; - Self::add_opt_str_characteristic( - &mut sb, - BleCharacteristics::SoftwareRevision.uuid(), - info.sw_rev, - )?; - - let _service_handle = sb.build(); - - Ok(DeviceInformationService {}) - } - - fn add_opt_str_characteristic( - sb: &mut ServiceBuilder, - uuid: Uuid, - val: Option<&'static str>, - ) -> Result, RegisterError> { - if let Some(val) = val { - let attr = Attribute::new(val); - let md = Metadata::new(Properties::new().read()); - Ok(Some(sb.add_characteristic(uuid, attr, md)?.build())) - } else { - Ok(None) - } - } - - fn add_pnp_characteristic( - sb: &mut ServiceBuilder, - pnp_id: &PnPID, - ) -> Result { - // SAFETY: `PnPID` is `repr(C, packed)` so viewing it as an immutable slice of bytes is safe. - let val = unsafe { - core::slice::from_raw_parts( - pnp_id as *const _ as *const u8, - core::mem::size_of::(), - ) - }; - - let attr = Attribute::new(val); - let md = Metadata::new(Properties::new().read()); - Ok(sb - .add_characteristic(BleCharacteristics::PnpId.uuid(), attr, md)? - .build()) - } -} diff --git a/rmk/src/ble/nrf/hid_service.rs b/rmk/src/ble/nrf/hid_service.rs deleted file mode 100644 index 99f3eea30..000000000 --- a/rmk/src/ble/nrf/hid_service.rs +++ /dev/null @@ -1,287 +0,0 @@ -use super::spec::{BleCharacteristics, BleDescriptor, BLE_HID_SERVICE_UUID}; -use crate::{ - ble::descriptor::{BleCompositeReportType, BleKeyboardReport}, - channel::{KEYBOARD_REPORT_CHANNEL, LED_SIGNAL}, - hid::{HidError, HidWriterTrait, Report, RunnableHidWriter}, - light::LedIndicator, -}; -use nrf_softdevice::{ - ble::{ - gatt_server::{ - self, - builder::ServiceBuilder, - characteristic::{Attribute, Metadata, Properties}, - RegisterError, - }, - Connection, SecurityMode, - }, - Softdevice, -}; -use ssmarshal::serialize; -use usbd_hid::descriptor::SerializedDescriptor as _; - -#[allow(dead_code)] -#[derive(Debug, Clone, Copy)] -#[cfg_attr(feature = "defmt", derive(defmt::Format))] -pub(crate) struct HidService { - hid_info: u16, - report_map: u16, - hid_control: u16, - pub(crate) input_keyboard: u16, - input_keyboard_cccd: u16, - input_keyboard_descriptor: u16, - pub(crate) output_keyboard: u16, - output_keyboard_descriptor: u16, - pub(crate) input_media_keys: u16, - input_media_keys_cccd: u16, - input_media_keys_descriptor: u16, - pub(crate) input_mouse_keys: u16, - input_mouse_keys_cccd: u16, - input_mouse_keys_descriptor: u16, - pub(crate) input_system_keys: u16, - input_system_keys_cccd: u16, - input_system_keys_descriptor: u16, -} - -impl HidService { - pub(crate) fn new(sd: &mut Softdevice) -> Result { - let mut service_builder = ServiceBuilder::new(sd, BLE_HID_SERVICE_UUID)?; - - let hid_info_handle = service_builder - .add_characteristic( - BleCharacteristics::HidInfo.uuid(), - Attribute::new([ - 0x1u8, 0x1u8, // HID version: 1.1 - 0x00u8, // Country Code - 0x03u8, // Remote wake + Normally Connectable - ]) - .security(SecurityMode::JustWorks), - Metadata::new(Properties::new().read()), - )? - .build(); - - let report_map_handle = service_builder - .add_characteristic( - BleCharacteristics::ReportMap.uuid(), - Attribute::new(BleKeyboardReport::desc()).security(SecurityMode::JustWorks), - Metadata::new(Properties::new().read()), - )? - .build(); - - let hid_control_handle = service_builder - .add_characteristic( - BleCharacteristics::HidControlPoint.uuid(), - Attribute::new([0u8]).security(SecurityMode::JustWorks), - Metadata::new(Properties::new().write_without_response()), - )? - .build(); - - let mut input_keyboard = service_builder.add_characteristic( - BleCharacteristics::HidReport.uuid(), - Attribute::new([0u8; 8]).security(SecurityMode::JustWorks), - Metadata::new(Properties::new().read().notify()), - )?; - let input_keyboard_desc = input_keyboard.add_descriptor( - BleDescriptor::ReportReference.uuid(), - Attribute::new([BleCompositeReportType::Keyboard as u8, 1u8]) // First is report ID, second is in/out - .security(SecurityMode::JustWorks), - )?; - let input_keyboard_handle = input_keyboard.build(); - - let mut output_keyboard = service_builder.add_characteristic( - BleCharacteristics::HidReport.uuid(), - Attribute::new([0u8; 1]).security(SecurityMode::JustWorks), - Metadata::new(Properties::new().read().write().write_without_response()), - )?; - let output_keyboard_desc = output_keyboard.add_descriptor( - BleDescriptor::ReportReference.uuid(), - Attribute::new([BleCompositeReportType::Keyboard as u8, 2u8]) - .security(SecurityMode::JustWorks), - )?; - let output_keyboard_handle = output_keyboard.build(); - - let mut input_media_keys = service_builder.add_characteristic( - BleCharacteristics::HidReport.uuid(), - Attribute::new([0u8; 2]).security(SecurityMode::JustWorks), - Metadata::new(Properties::new().read().notify()), - )?; - let input_media_keys_desc = input_media_keys.add_descriptor( - BleDescriptor::ReportReference.uuid(), - Attribute::new([BleCompositeReportType::Media as u8, 1u8]) - .security(SecurityMode::JustWorks), - )?; - let input_media_keys_handle = input_media_keys.build(); - - let mut input_system_keys = service_builder.add_characteristic( - BleCharacteristics::HidReport.uuid(), - Attribute::new([0u8; 1]).security(SecurityMode::JustWorks), - Metadata::new(Properties::new().read().notify()), - )?; - let input_system_keys_desc = input_system_keys.add_descriptor( - BleDescriptor::ReportReference.uuid(), - Attribute::new([BleCompositeReportType::System as u8, 1u8]) - .security(SecurityMode::JustWorks), - )?; - let input_system_keys_handle = input_system_keys.build(); - - let mut input_mouse = service_builder.add_characteristic( - BleCharacteristics::HidReport.uuid(), - Attribute::new([0u8; 5]).security(SecurityMode::JustWorks), - Metadata::new(Properties::new().read().notify()), - )?; - let input_mouse_desc = input_mouse.add_descriptor( - BleDescriptor::ReportReference.uuid(), - Attribute::new([BleCompositeReportType::Mouse as u8, 1u8]) - .security(SecurityMode::JustWorks), - )?; - let input_mouse_handle = input_mouse.build(); - - let _service_handle = service_builder.build(); - - Ok(HidService { - hid_info: hid_info_handle.value_handle, - report_map: report_map_handle.value_handle, - hid_control: hid_control_handle.value_handle, - input_keyboard: input_keyboard_handle.value_handle, - input_keyboard_cccd: input_keyboard_handle.cccd_handle, - input_keyboard_descriptor: input_keyboard_desc.handle(), - output_keyboard: output_keyboard_handle.value_handle, - output_keyboard_descriptor: output_keyboard_desc.handle(), - input_media_keys: input_media_keys_handle.value_handle, - input_media_keys_cccd: input_media_keys_handle.cccd_handle, - input_media_keys_descriptor: input_media_keys_desc.handle(), - input_system_keys: input_system_keys_handle.value_handle, - input_system_keys_cccd: input_system_keys_handle.cccd_handle, - input_system_keys_descriptor: input_system_keys_desc.handle(), - input_mouse_keys: input_mouse_handle.value_handle, - input_mouse_keys_cccd: input_mouse_handle.cccd_handle, - input_mouse_keys_descriptor: input_mouse_desc.handle(), - }) - } - - pub(crate) fn send_ble_keyboard_report(&self, conn: &Connection, data: &[u8]) { - gatt_server::notify_value(conn, self.input_keyboard, data) - .map_err(|e| error!("send keyboard report error: {:?}", e)) - .ok(); - } - - pub(crate) fn send_ble_media_report(&self, conn: &Connection, data: &[u8]) { - gatt_server::notify_value(conn, self.input_media_keys, data) - .map_err(|e| error!("send keyboard report error: {:?}", e)) - .ok(); - } -} - -impl gatt_server::Service for HidService { - type Event = HidServiceEvent; - - fn on_write(&self, handle: u16, data: &[u8]) -> Option { - if handle == self.input_keyboard_cccd { - Some(HidServiceEvent::InputKeyboardCccdWrite) - } else if handle == self.input_media_keys_cccd { - Some(HidServiceEvent::InputMediaKeyCccdWrite) - } else if handle == self.input_mouse_keys_cccd { - Some(HidServiceEvent::InputMouseKeyCccdWrite) - } else if handle == self.input_system_keys_cccd { - Some(HidServiceEvent::InputSystemKeyCccdWrite) - } else if handle == self.output_keyboard { - // Fires if a keyboard output is changed - e.g. the caps lock LED - let led_indicator = LedIndicator::from_bits(data[0]); - info!("HID output keyboard: {:?}", led_indicator); - LED_SIGNAL.signal(led_indicator); - Some(HidServiceEvent::OutputKeyboard) - } else { - None - } - } -} - -#[allow(unused)] -#[derive(Debug)] -#[cfg_attr(feature = "defmt", derive(defmt::Format))] -pub(crate) enum HidServiceEvent { - InputKeyboardCccdWrite, - InputMediaKeyCccdWrite, - InputMouseKeyCccdWrite, - InputSystemKeyCccdWrite, - OutputKeyboard, -} - -pub(crate) struct BleKeyboardWriter<'a> { - conn: &'a Connection, - keyboard_handle: u16, - media_handle: u16, - system_control_handle: u16, - mouse_handle: u16, -} - -impl<'a> BleKeyboardWriter<'a> { - pub(crate) fn new( - conn: &'a Connection, - keyboard_handle: u16, - media_handle: u16, - system_control_handle: u16, - mouse_handle: u16, - ) -> Self { - Self { - conn, - keyboard_handle, - media_handle, - system_control_handle, - mouse_handle, - } - } - async fn write(&mut self, handle: u16, report: &[u8]) -> Result<(), HidError> { - gatt_server::notify_value(self.conn, handle, report).map_err(|e| { - error!("Send ble report error: {}", e); - match e { - gatt_server::NotifyValueError::Disconnected => HidError::BleDisconnected, - gatt_server::NotifyValueError::Raw(_) => HidError::BleRawError, - } - }) - } -} - -impl RunnableHidWriter for BleKeyboardWriter<'_> { - async fn get_report(&mut self) -> Self::ReportType { - KEYBOARD_REPORT_CHANNEL.receive().await - } -} - -impl HidWriterTrait for BleKeyboardWriter<'_> { - type ReportType = Report; - - async fn write_report(&mut self, report: Self::ReportType) -> Result { - match report { - Report::KeyboardReport(keyboard_report) => { - debug!("Writing keyboard report {}", keyboard_report); - let mut buf = [0u8; 8]; - let n = serialize(&mut buf, &keyboard_report) - .map_err(|_| HidError::ReportSerializeError)?; - self.write(self.keyboard_handle, &buf).await?; - Ok(n) - } - Report::MouseReport(mouse_report) => { - let mut buf = [0u8; 5]; - let n = serialize(&mut buf, &mouse_report) - .map_err(|_| HidError::ReportSerializeError)?; - self.write(self.mouse_handle, &buf).await?; - Ok(n) - } - Report::MediaKeyboardReport(media_keyboard_report) => { - let mut buf = [0u8; 2]; - let n = serialize(&mut buf, &media_keyboard_report) - .map_err(|_| HidError::ReportSerializeError)?; - self.write(self.media_handle, &buf).await?; - Ok(n) - } - Report::SystemControlReport(system_control_report) => { - let mut buf = [0u8; 2]; - let n = serialize(&mut buf, &system_control_report) - .map_err(|_| HidError::ReportSerializeError)?; - self.write(self.system_control_handle, &buf).await?; - Ok(n) - } - } - } -} diff --git a/rmk/src/ble/nrf/mod.rs b/rmk/src/ble/nrf/mod.rs deleted file mode 100644 index 50ea8d5c8..000000000 --- a/rmk/src/ble/nrf/mod.rs +++ /dev/null @@ -1,596 +0,0 @@ -pub(crate) mod advertise; -mod battery_service; -pub(crate) mod bonder; -mod device_information_service; -mod hid_service; -pub(crate) mod profile; -pub(crate) mod server; -pub(crate) mod spec; -mod vial_service; - -use self::server::BleServer; -use crate::ble::led::BleLedReader; -use crate::ble::nrf::hid_service::BleKeyboardWriter; -use crate::config::{BleBatteryConfig, RmkConfig, VialConfig}; -use crate::hid::{DummyWriter, RunnableHidWriter}; -use crate::keymap::KeyMap; -use crate::light::LightController; -use crate::run_keyboard; -use crate::storage::StorageKeys; -use crate::{ - ble::nrf::bonder::BondInfo, - storage::{get_bond_info_key, Storage, StorageData}, - CONNECTION_STATE, CONNECTION_TYPE, -}; -use advertise::{create_advertisement_data, SCAN_DATA}; -use bonder::MultiBonder; -use core::sync::atomic::{AtomicU8, Ordering}; -use core::{cell::RefCell, mem}; -use embassy_executor::Spawner; -use embassy_futures::join::join; -use embassy_futures::select::{select, select4, Either4}; -use embassy_time::Timer; -use embedded_hal::digital::OutputPin; -use embedded_storage_async::nor_flash::NorFlash as AsyncNorFlash; -use heapless::FnvIndexMap; -use nrf_softdevice::ble::peripheral::ConnectableAdvertisement; -use nrf_softdevice::ble::{PhySet, PhyUpdateError, TxPower}; -use nrf_softdevice::raw::sd_ble_gap_conn_param_update; -use nrf_softdevice::{ - ble::{gatt_server, peripheral, security::SecurityHandler as _, Connection}, - raw, Config, Flash, Softdevice, -}; -use profile::update_profile; -use sequential_storage::{cache::NoCache, map::fetch_item}; -use static_cell::StaticCell; -use vial_service::BleVialReaderWriter; -#[cfg(not(feature = "_no_usb"))] -use { - crate::light::UsbLedReader, - crate::register_usb_writer, - crate::usb::{ - descriptor::{CompositeReport, KeyboardReport, ViaReport}, - new_usb_builder, wait_for_usb_enabled, wait_for_usb_suspend, UsbKeyboardWriter, UsbState, - USB_STATE, - }, - crate::via::UsbVialReaderWriter, - crate::{add_usb_reader_writer, run_usb_device}, - embassy_futures::select::{select3, Either3}, - embassy_nrf::usb::vbus_detect::SoftwareVbusDetect, - embassy_usb::driver::Driver, - once_cell::sync::OnceCell, -}; - -/// Maximum number of bonded devices -pub const BONDED_DEVICE_NUM: usize = 8; -/// The number of the active profile -pub static ACTIVE_PROFILE: AtomicU8 = AtomicU8::new(0); - -#[cfg(not(feature = "_no_usb"))] -/// Software Vbus detect when using BLE + USB -pub static SOFTWARE_VBUS: OnceCell = OnceCell::new(); - -#[cfg(not(feature = "_no_usb"))] -/// Background task of nrf_softdevice -#[embassy_executor::task] -pub(crate) async fn softdevice_task(sd: &'static nrf_softdevice::Softdevice) -> ! { - use nrf_softdevice::SocEvent; - - use crate::usb::{UsbState, USB_STATE}; - - // Enable dcdc-mode, reduce power consumption - unsafe { - nrf_softdevice::raw::sd_power_dcdc_mode_set( - nrf_softdevice::raw::NRF_POWER_DCDC_MODES_NRF_POWER_DCDC_ENABLE as u8, - ); - nrf_softdevice::raw::sd_power_dcdc0_mode_set( - nrf_softdevice::raw::NRF_POWER_DCDC_MODES_NRF_POWER_DCDC_ENABLE as u8, - ); - }; - - // Enable USB event in softdevice - unsafe { - nrf_softdevice::raw::sd_power_usbpwrrdy_enable(1); - nrf_softdevice::raw::sd_power_usbdetected_enable(1); - nrf_softdevice::raw::sd_power_usbremoved_enable(1); - }; - - let software_vbus = SOFTWARE_VBUS.get_or_init(|| SoftwareVbusDetect::new(true, true)); - - // Read the USB status at the beginning - let mut usb_reg: u32 = 0; - unsafe { raw::sd_power_usbregstatus_get(&mut usb_reg) }; - if usb_reg & 1 == 1 { - software_vbus.detected(true); - USB_STATE.store(UsbState::Enabled as u8, Ordering::Relaxed); - } - - sd.run_with_callback(|event: SocEvent| { - match event { - SocEvent::PowerUsbRemoved => { - software_vbus.detected(false); - USB_STATE.store(UsbState::Disabled as u8, Ordering::Relaxed); - } - SocEvent::PowerUsbDetected => { - software_vbus.detected(true); - USB_STATE.store(UsbState::Enabled as u8, Ordering::Relaxed); - } - SocEvent::PowerUsbPowerReady => software_vbus.ready(), - _ => {} - }; - }) - .await -} - -// Some nRF BLE chips doesn't have USB, so the softdevice_task is different -#[cfg(feature = "_no_usb")] -#[embassy_executor::task] -pub(crate) async fn softdevice_task(sd: &'static nrf_softdevice::Softdevice) -> ! { - // Enable dcdc-mode, reduce power consumption - unsafe { - nrf_softdevice::raw::sd_power_dcdc_mode_set( - nrf_softdevice::raw::NRF_POWER_DCDC_MODES_NRF_POWER_DCDC_ENABLE as u8, - ); - }; - sd.run().await -} - -/// Helper macro for reading storage config -macro_rules! read_storage { - ($storage: ident, $key: expr, $buf: expr) => { - fetch_item::( - &mut $storage.flash, - $storage.storage_range.clone(), - &mut NoCache::new(), - &mut $buf, - $key, - ) - .await - }; -} - -/// Create default nrf ble config -pub(crate) fn nrf_ble_config(keyboard_name: &str) -> Config { - Config { - clock: Some(raw::nrf_clock_lf_cfg_t { - source: raw::NRF_CLOCK_LF_SRC_RC as u8, - rc_ctiv: 16, - rc_temp_ctiv: 2, - accuracy: raw::NRF_CLOCK_LF_ACCURACY_500_PPM as u8, - // External osc - // source: raw::NRF_CLOCK_LF_SRC_XTAL as u8, - // rc_ctiv: 0, - // rc_temp_ctiv: 0, - // accuracy: raw::NRF_CLOCK_LF_ACCURACY_20_PPM as u8, - }), - conn_gap: Some(raw::ble_gap_conn_cfg_t { - conn_count: 6, - event_length: 24, - }), - conn_gatt: Some(raw::ble_gatt_conn_cfg_t { att_mtu: 256 }), - gatts_attr_tab_size: Some(raw::ble_gatts_cfg_attr_tab_size_t { - attr_tab_size: 2048, - }), - gap_role_count: Some(raw::ble_gap_cfg_role_count_t { - adv_set_count: 1, - periph_role_count: 4, - #[cfg(not(any(feature = "nrf52810_ble", feature = "nrf52811_ble")))] - central_role_count: 4, - #[cfg(not(any(feature = "nrf52810_ble", feature = "nrf52811_ble")))] - central_sec_count: 2, - #[cfg(not(any(feature = "nrf52810_ble", feature = "nrf52811_ble")))] - _bitfield_1: raw::ble_gap_cfg_role_count_t::new_bitfield_1(0), - }), - gap_device_name: Some(raw::ble_gap_cfg_device_name_t { - p_value: keyboard_name.as_ptr() as _, - current_len: keyboard_name.len() as u16, - max_len: keyboard_name.len() as u16, - write_perm: unsafe { mem::zeroed() }, - _bitfield_1: raw::ble_gap_cfg_device_name_t::new_bitfield_1( - raw::BLE_GATTS_VLOC_STACK as u8, - ), - }), - conn_gattc: Some(raw::ble_gattc_conn_cfg_t { - write_cmd_tx_queue_size: 4, - }), - conn_gatts: Some(raw::ble_gatts_conn_cfg_t { - hvn_tx_queue_size: 4, - }), - ..Default::default() - } -} - -pub fn initialize_nrf_sd_and_flash( - keyboard_name: &str, - spawner: Spawner, - ble_addr: Option<[u8; 6]>, -) -> (&mut Softdevice, Flash) { - // Set ble config and enable nrf-softdevice first - let ble_config = nrf_ble_config(keyboard_name); - - let sd = Softdevice::enable(&ble_config); - - if let Some(addr) = ble_addr { - // This is used mainly for split - use nrf_softdevice::ble::{set_address, Address, AddressType}; - set_address(sd, &Address::new(AddressType::RandomStatic, addr)); - }; - - // Use the immutable ref of `Softdevice` to run the softdevice_task - // It can also be used for create flash instance - let sdv = unsafe { nrf_softdevice::Softdevice::steal() }; - spawner - .spawn(softdevice_task(sdv)) - .expect("Failed to start softdevice task"); - (sd, Flash::take(sdv)) -} - -pub(crate) async fn run_nrf_ble_keyboard< - 'a, - F: AsyncNorFlash, - #[cfg(not(feature = "_no_usb"))] D: Driver<'static>, - Out: OutputPin, - const ROW: usize, - const COL: usize, - const NUM_LAYER: usize, - const NUM_ENCODER: usize, ->( - keymap: &'a RefCell>, - storage: &mut Storage, - #[cfg(not(feature = "_no_usb"))] usb_driver: D, - light_controller: &mut LightController, - mut rmk_config: RmkConfig<'static>, - sd: &mut Softdevice, -) -> ! { - // Initialize usb device, ble service, etc - #[cfg(not(feature = "_no_usb"))] - // Initialize usb device and usb hid reader/writer - let ( - mut usb_device, - mut keyboard_reader, - mut keyboard_writer, - mut other_writer, - mut vial_reader_writer, - ) = { - let mut usb_builder: embassy_usb::Builder<'_, D> = - new_usb_builder(usb_driver, rmk_config.usb_config); - let keyboard_reader_writer = add_usb_reader_writer!(&mut usb_builder, KeyboardReport, 1, 8); - let other_writer = register_usb_writer!(&mut usb_builder, CompositeReport, 9); - let vial_reader_writer = add_usb_reader_writer!(&mut usb_builder, ViaReport, 32, 32); - let (keyboard_reader, keyboard_writer) = keyboard_reader_writer.split(); - let usb_device = usb_builder.build(); - ( - usb_device, - keyboard_reader, - keyboard_writer, - other_writer, - vial_reader_writer, - ) - }; - - // Initialize ble service - load_keyboard_states(storage).await; - let bond_info = load_bond_info(storage).await; - info!("Loaded {} saved bond info", bond_info.len()); - static BONDER: StaticCell = StaticCell::new(); - let bonder = BONDER.init(MultiBonder::new(RefCell::new(bond_info))); - let ble_server: BleServer = - BleServer::new(sd, rmk_config.usb_config, bonder).expect("Failed to start ble server"); - - // Main loop - loop { - // Init BLE advertising data - let mut config = peripheral::Config::default(); - // Interval: 500ms - config.interval = 800; - config.tx_power = TxPower::Plus4dBm; - let adv = ConnectableAdvertisement::ScannableUndirected { - adv_data: &create_advertisement_data(rmk_config.usb_config.product_name), - scan_data: &SCAN_DATA, - }; - // If there is a USB device, things become a little bit complex because we need to enable switching between USB and BLE. - // Remember that USB ALWAYS has higher priority than BLE. - #[cfg(not(feature = "_no_usb"))] - { - debug!( - "usb state: {}, connection type: {}", - USB_STATE.load(Ordering::SeqCst), - CONNECTION_TYPE.load(Ordering::Relaxed) - ); - // Check whether the USB is connected - if USB_STATE.load(Ordering::SeqCst) != UsbState::Disabled as u8 { - let usb_fut = run_keyboard( - keymap, - #[cfg(any(feature = "_nrf_ble", not(feature = "_no_external_storage")))] - storage, - run_usb_device(&mut usb_device), - light_controller, - UsbLedReader::new(&mut keyboard_reader), - UsbVialReaderWriter::new(&mut vial_reader_writer), - UsbKeyboardWriter::new(&mut keyboard_writer, &mut other_writer), - rmk_config.vial_config, - ); - if CONNECTION_TYPE.load(Ordering::Relaxed) == 0 { - info!("Running USB keyboard"); - // USB is connected, connection_type is USB, then run USB keyboard - match select3(usb_fut, wait_for_usb_suspend(), update_profile(bonder)).await { - Either3::Third(_) => { - Timer::after_millis(10).await; - continue; - } - _ => (), - } - } else { - // USB is connected, but connection type is BLE, try BLE while running USB keyboard - info!("Running USB keyboard, while advertising"); - let adv_fut = peripheral::advertise_pairable(sd, adv, &config, bonder); - match select3(adv_fut, usb_fut, update_profile(bonder)).await { - Either3::First(Ok(conn)) => { - run_ble_keyboard( - keymap, - storage, - light_controller, - rmk_config.vial_config, - &mut rmk_config.ble_battery_config, - &ble_server, - bonder, - conn, - ) - .await - } - _ => { - // Wait 10ms - Timer::after_millis(10).await; - continue; - } - } - } - } else { - // USB isn't connected, wait for any of BLE/USB connection - let dummy_task = run_dummy_keyboard(storage); - let adv_fut = peripheral::advertise_pairable(sd, adv, &config, bonder); - - info!("BLE advertising"); - // Wait for BLE or USB connection - match select3(adv_fut, wait_for_status_change(bonder), dummy_task).await { - Either3::First(Ok(conn)) => { - run_ble_keyboard( - keymap, - storage, - light_controller, - rmk_config.vial_config, - &mut rmk_config.ble_battery_config, - &ble_server, - bonder, - conn, - ) - .await - } - _ => { - // Wait 10ms for usb resuming/switching profile/advertising error - Timer::after_millis(10).await; - } - } - } - } - - #[cfg(feature = "_no_usb")] - match peripheral::advertise_pairable(sd, adv, &config, bonder).await { - Ok(conn) => { - run_ble_keyboard( - keymap, - storage, - light_controller, - rmk_config.vial_config, - &mut rmk_config.ble_battery_config, - &ble_server, - bonder, - conn, - ) - .await; - } - Err(e) => error!("Advertise error: {}", e), - } - - // Retry after 200 ms - Timer::after_millis(200).await; - } -} - -pub(crate) async fn load_keyboard_states< - F: AsyncNorFlash, - const ROW: usize, - const COL: usize, - const NUM_LAYER: usize, - const NUM_ENCODER: usize, ->( - storage: &mut Storage, -) { - let mut buf: [u8; 128] = [0; 128]; - - // Load current active profile - if let Ok(Some(StorageData::ActiveBleProfile(profile))) = - read_storage!(storage, &(StorageKeys::ActiveBleProfile as u32), buf) - { - debug!("Loaded active profile: {}", profile); - ACTIVE_PROFILE.store(profile, Ordering::SeqCst); - } else { - // If no saved active profile, use 0 as default - debug!("Loaded default active profile",); - ACTIVE_PROFILE.store(0, Ordering::SeqCst); - }; - - // Load current connection type - if let Ok(Some(StorageData::ConnectionType(conn_type))) = - read_storage!(storage, &(StorageKeys::ConnectionType as u32), buf) - { - CONNECTION_TYPE.store(conn_type, Ordering::Relaxed); - } else { - // If no saved connection type, use 0 as default - CONNECTION_TYPE.store(0, Ordering::Relaxed); - }; - - #[cfg(feature = "_no_usb")] - CONNECTION_TYPE.store(0, Ordering::Relaxed); -} - -pub(crate) async fn load_bond_info< - F: AsyncNorFlash, - const ROW: usize, - const COL: usize, - const NUM_LAYER: usize, - const NUM_ENCODER: usize, ->( - storage: &mut Storage, -) -> FnvIndexMap { - let mut buf: [u8; 128] = [0; 128]; - // Get all saved bond info, config BLE bonder - let mut bond_info: FnvIndexMap = FnvIndexMap::new(); - for key in 0..BONDED_DEVICE_NUM { - if let Ok(Some(StorageData::BondInfo(info))) = - read_storage!(storage, &get_bond_info_key(key as u8), buf) - { - bond_info.insert(key as u8, info).ok(); - } - } - bond_info -} - -async fn run_ble_keyboard< - 'a, - F: AsyncNorFlash, - Out: OutputPin, - const ROW: usize, - const COL: usize, - const NUM_LAYER: usize, - const NUM_ENCODER: usize, ->( - keymap: &'a RefCell>, - storage: &mut Storage, - light_controller: &mut LightController, - vial_config: VialConfig<'static>, - ble_battery_config: &mut BleBatteryConfig<'static>, - ble_server: &BleServer, - bonder: &'static MultiBonder, - mut conn: Connection, -) { - info!("Connected to BLE"); - bonder.load_sys_attrs(&conn); - if let Err(e) = conn.phy_update(PhySet::M2, PhySet::M2) { - error!("Failed to update PHY"); - if let PhyUpdateError::Raw(re) = e { - error!("Raw error code: {:?}", re); - } - } - match select4( - run_keyboard( - keymap, - storage, - run_ble_server(&conn, ble_server), - light_controller, - BleLedReader {}, - BleVialReaderWriter::new(ble_server.vial, &conn), - BleKeyboardWriter::new( - &conn, - ble_server.hid.input_keyboard, - ble_server.hid.input_media_keys, - ble_server.hid.input_system_keys, - ble_server.hid.input_mouse_keys, - ), - vial_config, - ), - ble_server.bas.clone().run(ble_battery_config, &conn), - wait_for_usb_enabled(), - update_profile(bonder), - ) - .await - { - Either4::First(_) => info!("BLE disconnected"), - Either4::Second(_) => info!("Bas service error"), - Either4::Third(_) => info!("Detected USB configured, quit BLE"), - Either4::Fourth(_) => info!("Switch profile"), - } - bonder.save_sys_attrs(&conn); -} - -pub(crate) async fn set_conn_params(conn: &Connection) { - // Wait for 5 seconds before setting connection parameters to avoid connection drop - embassy_time::Timer::after_secs(5).await; - if let Some(conn_handle) = conn.handle() { - // Update connection parameters - unsafe { - // For macOS/iOS(aka Apple devices), both interval should be set to 12 - let re = sd_ble_gap_conn_param_update( - conn_handle, - &raw::ble_gap_conn_params_t { - min_conn_interval: 12, - max_conn_interval: 12, - slave_latency: 99, - conn_sup_timeout: 500, // timeout: 5s - }, - ); - debug!("Set conn params result: {:?}", re); - - embassy_time::Timer::after_millis(5000).await; - - // Setting the conn param the second time ensures that we have best performance on all platforms - let re = sd_ble_gap_conn_param_update( - conn_handle, - &raw::ble_gap_conn_params_t { - min_conn_interval: 6, - max_conn_interval: 6, - slave_latency: 99, - conn_sup_timeout: 500, // timeout: 5s - }, - ); - debug!("Set conn params result: {:?}", re); - } - } -} - -// Dummy keyboard service is used to monitoring keys when there's no actual connection. -// It's useful for functions like switching active profiles when there's no connection. -pub(crate) async fn run_dummy_keyboard< - 'a, - 'b, - F: AsyncNorFlash, - const ROW: usize, - const COL: usize, - const NUM_LAYER: usize, - const NUM_ENCODER: usize, ->( - storage: &mut Storage, -) { - CONNECTION_STATE.store(false, Ordering::Release); - let storage_fut = storage.run(); - let mut dummy_writer = DummyWriter {}; - select(storage_fut, dummy_writer.run_writer()).await; -} - -#[cfg(not(feature = "_no_usb"))] -// Wait for USB enabled or BLE state changed -pub(crate) async fn wait_for_status_change(bonder: &MultiBonder) { - if CONNECTION_TYPE.load(Ordering::Relaxed) == 0 { - // Connection type is USB, USB has higher priority - select(wait_for_usb_enabled(), update_profile(bonder)).await; - } else { - // Connection type is BLE, so we don't consider USB - update_profile(bonder).await; - } -} - -async fn run_ble_server(conn: &Connection, ble_server: &BleServer) { - let err = join( - set_conn_params(&conn), - gatt_server::run(conn, ble_server, |_| {}), - ) - .await; - error!("BLE server exited with error: {:?}", err.1); -} - -#[cfg(feature = "_no_usb")] -async fn wait_for_usb_enabled() { - loop { - core::future::pending::<()>().await; - } -} diff --git a/rmk/src/ble/nrf/profile.rs b/rmk/src/ble/nrf/profile.rs deleted file mode 100644 index dbfd1d85d..000000000 --- a/rmk/src/ble/nrf/profile.rs +++ /dev/null @@ -1,85 +0,0 @@ -//! Manage BLE profiles -//! - -use core::sync::atomic::Ordering; - -use embassy_futures::yield_now; - -use crate::{ - ble::nrf::{ACTIVE_PROFILE, BONDED_DEVICE_NUM}, - channel::{BLE_PROFILE_CHANNEL, FLASH_CHANNEL}, - storage::FlashOperationMessage, - CONNECTION_TYPE, -}; - -use super::bonder::MultiBonder; - -/// BLE profile switch action -pub(crate) enum BleProfileAction { - SwitchProfile(u8), - PreviousProfile, - NextProfile, - ClearProfile, - ToggleConnection, -} - -// Wait for profile switch action and update the active profile -pub(crate) async fn update_profile(bonder: &MultiBonder) { - // Wait until there's a profile switch action - loop { - match BLE_PROFILE_CHANNEL.receive().await { - BleProfileAction::SwitchProfile(profile) => { - let current = ACTIVE_PROFILE.load(Ordering::SeqCst); - if profile == current { - // No need to switch to the same profile, just continue waiting - continue; - } - ACTIVE_PROFILE.store(profile, Ordering::SeqCst); - FLASH_CHANNEL - .send(FlashOperationMessage::ActiveBleProfile(profile)) - .await; - info!("Switch to BLE profile: {}", profile); - } - BleProfileAction::PreviousProfile => { - // Get current profile number and plus 1 - let mut profile = ACTIVE_PROFILE.load(Ordering::SeqCst); - profile = if profile == 0 { 7 } else { profile - 1 }; - ACTIVE_PROFILE.store(profile, Ordering::SeqCst); - FLASH_CHANNEL - .send(FlashOperationMessage::ActiveBleProfile(profile)) - .await; - info!("Switch to previous BLE profile"); - } - BleProfileAction::NextProfile => { - let mut profile = ACTIVE_PROFILE.load(Ordering::SeqCst) + 1; - profile = profile % BONDED_DEVICE_NUM as u8; - ACTIVE_PROFILE.store(profile, Ordering::SeqCst); - FLASH_CHANNEL - .send(FlashOperationMessage::ActiveBleProfile(profile)) - .await; - info!("Switch to next BLE profile"); - } - BleProfileAction::ClearProfile => { - let profile = ACTIVE_PROFILE.load(Ordering::SeqCst); - bonder.clear_bonded(profile); - FLASH_CHANNEL - .send(FlashOperationMessage::ClearSlot(profile)) - .await; - info!("Clear profile"); - } - BleProfileAction::ToggleConnection => { - let current = CONNECTION_TYPE.load(Ordering::SeqCst); - let updated = 1 - current; - CONNECTION_TYPE.store(updated, Ordering::SeqCst); - FLASH_CHANNEL - .send(FlashOperationMessage::ConnectionType(updated)) - .await; - } - } - break; - } - yield_now().await; - // Wait for the flash operation to complete - // A signal could be used here, but for simplicity, just waiting for 1s - embassy_time::Timer::after_secs(1).await -} diff --git a/rmk/src/ble/nrf/server.rs b/rmk/src/ble/nrf/server.rs deleted file mode 100644 index bf9428018..000000000 --- a/rmk/src/ble/nrf/server.rs +++ /dev/null @@ -1,117 +0,0 @@ -use super::{ - battery_service::{BatteryService, BatteryServiceEvent}, - device_information_service::DeviceInformationService, - hid_service::{HidService, HidServiceEvent}, - vial_service::{BleVialService, VialServiceEvent}, -}; -use crate::ble::device_info::{DeviceInformation, PnPID, VidSource}; -use crate::config::KeyboardUsbConfig; -use nrf_softdevice::{ - ble::{ - gatt_server::{self, RegisterError, Service, WriteOp}, - security::SecurityHandler, - Connection, - }, - Softdevice, -}; - -/// Wrapper struct for writing via BLE -pub(crate) struct BleHidWriter<'a, const N: usize> { - conn: &'a Connection, - handle: u16, -} - -// BleServer saves all services, which have connection handles in it -pub(crate) struct BleServer { - _dis: DeviceInformationService, - pub(crate) bas: BatteryService, - pub(crate) hid: HidService, - pub(crate) vial: BleVialService, - bonder: &'static dyn SecurityHandler, -} - -impl BleServer { - pub(crate) fn new( - sd: &mut Softdevice, - usb_config: KeyboardUsbConfig<'static>, - bonder: &'static dyn SecurityHandler, - ) -> Result { - let dis = DeviceInformationService::new( - sd, - &PnPID { - vid_source: VidSource::UsbIF, - vendor_id: 0x4C4B, - product_id: 0x4643, - product_version: 0x0000, - }, - DeviceInformation { - manufacturer_name: Some(usb_config.manufacturer), - model_number: Some(usb_config.product_name), - serial_number: Some(usb_config.serial_number), - ..Default::default() - }, - )?; - - let bas = BatteryService::new(sd)?; - - let hid = HidService::new(sd)?; - - let vial = BleVialService::new(sd)?; - - Ok(Self { - _dis: dis, - bas, - hid, - vial, - bonder, - }) - } -} - -impl gatt_server::Server for BleServer { - type Event = (); - - fn on_write( - &self, - conn: &Connection, - handle: u16, - _op: WriteOp, - _offset: usize, - data: &[u8], - ) -> Option { - if let Some(event) = self.hid.on_write(handle, data) { - match event { - HidServiceEvent::InputKeyboardCccdWrite - | HidServiceEvent::InputMediaKeyCccdWrite - | HidServiceEvent::InputMouseKeyCccdWrite - | HidServiceEvent::InputSystemKeyCccdWrite => { - info!("{:?}, handle: {}, data: {:?}", event, handle, data); - self.bonder.save_sys_attrs(conn) - } - HidServiceEvent::OutputKeyboard => (), - } - } - if let Some(event) = self.bas.on_write(handle, data) { - match event { - BatteryServiceEvent::BatteryLevelCccdWrite { notifications } => { - info!( - "BatteryLevelCccdWrite, handle: {}, data: {:?}, notif: {}", - handle, data, notifications - ); - self.bonder.save_sys_attrs(conn) - } - } - } - if let Some(event) = self.vial.on_write(handle, data) { - match event { - VialServiceEvent::InputVialKeyCccdWrite => { - info!("InputVialCccdWrite, handle: {}, data: {:?}", handle, data); - self.bonder.save_sys_attrs(conn) - } - VialServiceEvent::OutputVial => (), - } - } - - None - } -} diff --git a/rmk/src/ble/nrf/spec.rs b/rmk/src/ble/nrf/spec.rs deleted file mode 100644 index 91668395c..000000000 --- a/rmk/src/ble/nrf/spec.rs +++ /dev/null @@ -1,55 +0,0 @@ -use nrf_softdevice::ble::Uuid; - -/// HID service uuid defined in BLE protocol -pub(crate) const BLE_HID_SERVICE_UUID: Uuid = Uuid::new_16(0x1812); - -/// Specification uuid used in keyboards -/// -/// Full reference: https://www.bluetooth.com/specifications/assigned-numbers/ -/// UUID details: https://bitbucket.org/bluetooth-SIG/public/src/main/assigned_numbers/uuids/service_uuids.yaml -pub(crate) enum BleSpecification { - DeviceInformation = 0x180a, - BatteryService = 0x180f, -} - -/// Characteristics uuids used in keyboards -/// -/// refernece: https://bitbucket.org/bluetooth-SIG/public/src/main/assigned_numbers/uuids/characteristic_uuids.yaml -pub(crate) enum BleCharacteristics { - BatteryLevel = 0x2a19, - ModelNumber = 0x2a24, - SerialNumber = 0x2a25, - FirmwareRevision = 0x2a26, - HardwareRevision = 0x2a27, - SoftwareRevision = 0x2a28, - ManufacturerName = 0x2a29, - PnpId = 0x2a50, - // Characteristics of HID - HidInfo = 0x2a4a, - ReportMap = 0x2a4b, - HidControlPoint = 0x2a4c, - HidReport = 0x2a4d, - ProtocolMode = 0x2a4e, -} - -pub(crate) enum BleDescriptor { - ReportReference = 0x2908, -} - -impl BleDescriptor { - pub(crate) fn uuid(self) -> Uuid { - Uuid::new_16(self as u16) - } -} - -impl BleSpecification { - pub(crate) fn uuid(self) -> Uuid { - Uuid::new_16(self as u16) - } -} - -impl BleCharacteristics { - pub(crate) fn uuid(self) -> Uuid { - Uuid::new_16(self as u16) - } -} diff --git a/rmk/src/ble/nrf/vial_service.rs b/rmk/src/ble/nrf/vial_service.rs deleted file mode 100644 index 8a904fcf7..000000000 --- a/rmk/src/ble/nrf/vial_service.rs +++ /dev/null @@ -1,196 +0,0 @@ -use embassy_futures::block_on; -use nrf_softdevice::{ - ble::{ - gatt_server::{ - self, - builder::ServiceBuilder, - characteristic::{Attribute, Metadata, Properties}, - RegisterError, - }, - Connection, SecurityMode, - }, - Softdevice, -}; -use usbd_hid::descriptor::SerializedDescriptor; - -use crate::{ - channel::VIAL_READ_CHANNEL, - hid::{HidError, HidReaderTrait, HidWriterTrait}, - usb::descriptor::ViaReport, -}; - -use super::spec::{BleCharacteristics, BleDescriptor, BLE_HID_SERVICE_UUID}; - -#[derive(Debug, Clone, Copy)] -pub(crate) struct BleVialService { - pub(crate) input_vial: u16, - input_vial_cccd: u16, - input_vial_descriptor: u16, - pub(crate) output_vial: u16, - output_vial_descriptor: u16, - hid_info: u16, - report_map: u16, - hid_control: u16, - protocol_mode: u16, -} - -impl BleVialService { - pub(crate) fn new(sd: &mut Softdevice) -> Result { - let mut service_builder = ServiceBuilder::new(sd, BLE_HID_SERVICE_UUID)?; - - let hid_info_handle = service_builder - .add_characteristic( - BleCharacteristics::HidInfo.uuid(), - Attribute::new([ - 0x1u8, 0x1u8, // HID version: 1.1 - 0x00u8, // Country Code - 0x03u8, // Remote wake + Normally Connectable - ]) - .security(SecurityMode::JustWorks), - Metadata::new(Properties::new().read()), - )? - .build(); - - let report_map_handle = service_builder - .add_characteristic( - BleCharacteristics::ReportMap.uuid(), - Attribute::new(ViaReport::desc()).security(SecurityMode::JustWorks), - Metadata::new(Properties::new().read()), - )? - .build(); - - let hid_control_handle = service_builder - .add_characteristic( - BleCharacteristics::HidControlPoint.uuid(), - Attribute::new([0u8]).security(SecurityMode::JustWorks), - Metadata::new(Properties::new().write_without_response()), - )? - .build(); - - let protocol_mode_handle = service_builder - .add_characteristic( - BleCharacteristics::ProtocolMode.uuid(), - Attribute::new([0x01u8]).security(SecurityMode::JustWorks), - Metadata::new(Properties::new().read().write_without_response()), - )? - .build(); - - // Existing Vial input and output characteristics - let mut input_vial = service_builder.add_characteristic( - BleCharacteristics::HidReport.uuid(), - Attribute::new([0u8; 32]).security(SecurityMode::JustWorks), - Metadata::new(Properties::new().read().notify()), - )?; - let input_vial_desc = input_vial.add_descriptor( - BleDescriptor::ReportReference.uuid(), - Attribute::new([0u8, 1u8]).security(SecurityMode::JustWorks), - )?; - let input_vial_handle = input_vial.build(); - - let mut output_vial = service_builder.add_characteristic( - BleCharacteristics::HidReport.uuid(), - Attribute::new([0u8; 32]).security(SecurityMode::JustWorks), - Metadata::new(Properties::new().read().write().write_without_response()), - )?; - let output_vial_desc = output_vial.add_descriptor( - BleDescriptor::ReportReference.uuid(), - Attribute::new([0u8, 2u8]).security(SecurityMode::JustWorks), - )?; - let output_vial_handle = output_vial.build(); - - let _service_handle = service_builder.build(); - - Ok(BleVialService { - input_vial: input_vial_handle.value_handle, - input_vial_cccd: input_vial_handle.cccd_handle, - input_vial_descriptor: input_vial_desc.handle(), - output_vial: output_vial_handle.value_handle, - output_vial_descriptor: output_vial_desc.handle(), - hid_info: hid_info_handle.value_handle, - report_map: report_map_handle.value_handle, - hid_control: hid_control_handle.value_handle, - protocol_mode: protocol_mode_handle.value_handle, - }) - } - - pub(crate) fn send_ble_vial_report( - &self, - conn: &Connection, - data: &[u8], - ) -> Result<(), HidError> { - gatt_server::notify_value(conn, self.input_vial, data).map_err(|e| { - error!("Send ble report error: {:?}", e); - match e { - gatt_server::NotifyValueError::Disconnected => HidError::BleDisconnected, - gatt_server::NotifyValueError::Raw(_) => HidError::BleRawError, - } - }) - } -} - -impl gatt_server::Service for BleVialService { - type Event = VialServiceEvent; - - fn on_write(&self, handle: u16, data: &[u8]) -> Option { - if handle == self.input_vial_cccd { - Some(VialServiceEvent::InputVialKeyCccdWrite) - } else if handle == self.output_vial { - debug!("Vial output: {:?}", data); - let data = unsafe { *(data.as_ptr() as *const [u8; 32]) }; - // Retry at most 3 times - for _ in 0..3 { - if let Ok(_) = VIAL_READ_CHANNEL.try_send(data) { - break; - } - // Wait for 20ms before sending the next report - block_on(embassy_time::Timer::after_millis(20)); - error!("Vial output channel full"); - } - Some(VialServiceEvent::OutputVial) - } else { - None - } - } -} - -pub(crate) struct BleVialReaderWriter<'a> { - pub(crate) service: BleVialService, - pub(crate) conn: &'a Connection, -} - -impl<'a> BleVialReaderWriter<'a> { - pub(crate) fn new(service: BleVialService, conn: &'a Connection) -> Self { - Self { service, conn } - } -} - -impl HidWriterTrait for BleVialReaderWriter<'_> { - type ReportType = ViaReport; - - async fn write_report(&mut self, report: Self::ReportType) -> Result { - use ssmarshal::serialize; - let mut buf: [u8; 32] = [0; 32]; - let n = serialize(&mut buf, &report).map_err(|_| HidError::ReportSerializeError)?; - self.service.send_ble_vial_report(self.conn, &mut buf)?; - Ok(n) - } -} - -impl HidReaderTrait for BleVialReaderWriter<'_> { - type ReportType = ViaReport; - - async fn read_report(&mut self) -> Result { - let v = VIAL_READ_CHANNEL.receive().await; - Ok(ViaReport { - input_data: [0u8; 32], - output_data: v, - }) - } -} - -#[derive(Debug)] -#[cfg_attr(feature = "defmt", derive(defmt::Format))] -pub(crate) enum VialServiceEvent { - InputVialKeyCccdWrite, - OutputVial, -} diff --git a/rmk/src/ble/trouble/battery_service.rs b/rmk/src/ble/trouble/battery_service.rs new file mode 100644 index 000000000..077a521ae --- /dev/null +++ b/rmk/src/ble/trouble/battery_service.rs @@ -0,0 +1,63 @@ +use core::sync::atomic::{AtomicU8, Ordering}; + +use embassy_time::Timer; +use trouble_host::prelude::*; + +use super::ble_server::Server; + +/// Battery level global value. +/// The range of battery level is 0-100, 255 > level > 100 means the battery is charging. 255 means the battery level is not available. +pub(crate) static BATTERY_LEVEL: AtomicU8 = AtomicU8::new(255); + +/// Battery service +#[gatt_service(uuid = service::BATTERY)] +pub(crate) struct BatteryService { + /// Battery Level + #[descriptor(uuid = descriptors::VALID_RANGE, read, value = [0, 100])] + #[characteristic(uuid = characteristic::BATTERY_LEVEL, read, notify)] + pub(crate) level: u8, +} + +pub(crate) struct BleBatteryServer<'stack, 'server, 'conn> { + pub(crate) battery_level: Characteristic, + pub(crate) conn: &'conn GattConnection<'stack, 'server>, +} + +impl<'stack, 'server, 'conn> BleBatteryServer<'stack, 'server, 'conn> { + pub(crate) fn new(server: &Server, conn: &'conn GattConnection<'stack, 'server>) -> Self { + Self { + battery_level: server.battery_service.level, + conn, + } + } +} + +impl<'a> BleBatteryServer<'_, '_, '_> { + pub(crate) async fn run(&mut self) { + // Wait 2 seconds, ensure that gatt server has been started + Timer::after_secs(2).await; + + let report_battery_level = async { + loop { + let val = BATTERY_LEVEL.load(Ordering::Relaxed); + if val <= 100 { + match self.battery_level.notify(self.conn, &val).await { + Ok(_) => {} + Err(_) => { + error!("Failed to notify battery level"); + break; + } + } + } else if val < 255 { + debug!("Charging, val: {}", val); + } else { + debug!("Battery level not available"); + } + // Report battery level every 30s + Timer::after_secs(30).await + } + }; + + report_battery_level.await; + } +} diff --git a/rmk/src/ble/trouble/ble_server.rs b/rmk/src/ble/trouble/ble_server.rs new file mode 100644 index 000000000..6831a196e --- /dev/null +++ b/rmk/src/ble/trouble/ble_server.rs @@ -0,0 +1,190 @@ +use ssmarshal::serialize; +use trouble_host::prelude::*; +use usbd_hid::descriptor::SerializedDescriptor; + +use super::battery_service::BatteryService; +use crate::channel::{KEYBOARD_REPORT_CHANNEL, VIAL_READ_CHANNEL}; +use crate::hid::{HidError, HidReaderTrait, HidWriterTrait, Report, RunnableHidWriter}; +use crate::usb::descriptor::{CompositeReport, CompositeReportType, KeyboardReport, ViaReport}; + +// Used for saving the CCCD table +pub(crate) const CCCD_TABLE_SIZE: usize = _CCCD_TABLE_SIZE; + +// GATT Server definition +#[gatt_server] +pub(crate) struct Server { + pub(crate) battery_service: BatteryService, + pub(crate) hid_service: HidService, + pub(crate) via_service: ViaService, + pub(crate) composite_service: CompositeService, +} + +#[gatt_service(uuid = service::HUMAN_INTERFACE_DEVICE)] +pub(crate) struct HidService { + #[characteristic(uuid = "2a4a", read, value = [0x01, 0x01, 0x00, 0x03])] + pub(crate) hid_info: [u8; 4], + #[characteristic(uuid = "2a4b", read, value = KeyboardReport::desc().try_into().expect("Failed to convert KeyboardReport to [u8; 67]"))] + pub(crate) report_map: [u8; 67], + #[characteristic(uuid = "2a4c", write_without_response)] + pub(crate) hid_control_point: u8, + #[characteristic(uuid = "2a4e", read, write_without_response, value = 1)] + pub(crate) protocol_mode: u8, + #[descriptor(uuid = "2908", read, value = [0u8, 1u8])] + #[characteristic(uuid = "2a4d", read, notify)] + pub(crate) input_keyboard: [u8; 8], + #[descriptor(uuid = "2908", read, value = [0u8, 2u8])] + #[characteristic(uuid = "2a4d", read, write, write_without_response)] + pub(crate) output_keyboard: [u8; 1], +} + +#[gatt_service(uuid = service::HUMAN_INTERFACE_DEVICE)] +pub(crate) struct CompositeService { + #[characteristic(uuid = "2a4a", read, value = [0x01, 0x01, 0x00, 0x03])] + pub(crate) hid_info: [u8; 4], + #[characteristic(uuid = "2a4b", read, value = CompositeReport::desc().try_into().expect("Failed to convert CompositeReport to [u8; 111]"))] + pub(crate) report_map: [u8; 111], + #[characteristic(uuid = "2a4c", write_without_response)] + pub(crate) hid_control_point: u8, + #[characteristic(uuid = "2a4e", read, write_without_response, value = 1)] + pub(crate) protocol_mode: u8, + #[descriptor(uuid = "2908", read, value = [CompositeReportType::Mouse as u8, 1u8])] + #[characteristic(uuid = "2a4d", read, notify)] + pub(crate) mouse_report: [u8; 5], + #[descriptor(uuid = "2908", read, value = [CompositeReportType::Media as u8, 1u8])] + #[characteristic(uuid = "2a4d", read, notify)] + pub(crate) media_report: [u8; 2], + #[descriptor(uuid = "2908", read, value = [CompositeReportType::System as u8, 1u8])] + #[characteristic(uuid = "2a4d", read, notify)] + pub(crate) system_report: [u8; 1], +} + +#[gatt_service(uuid = service::HUMAN_INTERFACE_DEVICE)] +pub(crate) struct ViaService { + #[characteristic(uuid = "2a4a", read, value = [0x01, 0x01, 0x00, 0x03])] + pub(crate) hid_info: [u8; 4], + #[characteristic(uuid = "2a4b", read, value = ViaReport::desc().try_into().expect("Failed to convert ViaReport to [u8; 27]"))] + pub(crate) report_map: [u8; 27], + #[characteristic(uuid = "2a4c", write_without_response)] + pub(crate) hid_control_point: u8, + #[characteristic(uuid = "2a4e", read, write_without_response, value = 1)] + pub(crate) protocol_mode: u8, + #[descriptor(uuid = "2908", read, value = [0u8, 1u8])] + #[characteristic(uuid = "2a4d", read, notify)] + pub(crate) input_via: [u8; 32], + #[descriptor(uuid = "2908", read, value = [0u8, 2u8])] + #[characteristic(uuid = "2a4d", read, write, write_without_response)] + pub(crate) output_via: [u8; 32], +} + +pub(crate) struct BleHidServer<'stack, 'server, 'conn> { + pub(crate) input_keyboard: Characteristic<[u8; 8]>, + pub(crate) mouse_report: Characteristic<[u8; 5]>, + pub(crate) media_report: Characteristic<[u8; 2]>, + pub(crate) system_report: Characteristic<[u8; 1]>, + pub(crate) conn: &'conn GattConnection<'stack, 'server>, +} + +impl<'stack, 'server, 'conn> BleHidServer<'stack, 'server, 'conn> { + pub(crate) fn new(server: &Server, conn: &'conn GattConnection<'stack, 'server>) -> Self { + Self { + input_keyboard: server.hid_service.input_keyboard, + mouse_report: server.composite_service.mouse_report, + media_report: server.composite_service.media_report, + system_report: server.composite_service.system_report, + conn, + } + } +} + +impl HidWriterTrait for BleHidServer<'_, '_, '_> { + type ReportType = Report; + + async fn write_report(&mut self, report: Self::ReportType) -> Result { + match report { + Report::KeyboardReport(keyboard_report) => { + let mut buf = [0u8; 8]; + let n = serialize(&mut buf, &keyboard_report).map_err(|_| HidError::ReportSerializeError)?; + self.input_keyboard.notify(self.conn, &buf).await.map_err(|e| { + error!("Failed to notify keyboard report: {:?}", e); + HidError::BleError + })?; + Ok(n) + } + Report::MouseReport(mouse_report) => { + let mut buf = [0u8; 5]; + let n = serialize(&mut buf, &mouse_report).map_err(|_| HidError::ReportSerializeError)?; + self.mouse_report.notify(self.conn, &buf).await.map_err(|e| { + error!("Failed to notify mouse report: {:?}", e); + HidError::BleError + })?; + Ok(n) + } + Report::MediaKeyboardReport(media_keyboard_report) => { + let mut buf = [0u8; 2]; + let n = serialize(&mut buf, &media_keyboard_report).map_err(|_| HidError::ReportSerializeError)?; + self.media_report.notify(self.conn, &buf).await.map_err(|e| { + error!("Failed to notify media report: {:?}", e); + HidError::BleError + })?; + Ok(n) + } + Report::SystemControlReport(system_control_report) => { + let mut buf = [0u8; 1]; + let n = serialize(&mut buf, &system_control_report).map_err(|_| HidError::ReportSerializeError)?; + self.system_report.notify(self.conn, &buf).await.map_err(|e| { + error!("Failed to notify system report: {:?}", e); + HidError::BleError + })?; + Ok(n) + } + } + } +} + +impl RunnableHidWriter for BleHidServer<'_, '_, '_> { + async fn get_report(&mut self) -> Self::ReportType { + KEYBOARD_REPORT_CHANNEL.receive().await + } +} + +pub(crate) struct BleViaServer<'stack, 'server, 'conn> { + pub(crate) input_via: Characteristic<[u8; 32]>, + pub(crate) output_via: Characteristic<[u8; 32]>, + pub(crate) conn: &'conn GattConnection<'stack, 'server>, +} + +impl<'stack, 'server, 'conn> BleViaServer<'stack, 'server, 'conn> { + pub(crate) fn new(server: &Server, conn: &'conn GattConnection<'stack, 'server>) -> Self { + Self { + input_via: server.via_service.input_via, + output_via: server.via_service.output_via, + conn, + } + } +} + +impl HidWriterTrait for BleViaServer<'_, '_, '_> { + type ReportType = ViaReport; + + async fn write_report(&mut self, report: Self::ReportType) -> Result { + let mut buf = [0u8; 32]; + let n = serialize(&mut buf, &report).map_err(|_| HidError::ReportSerializeError)?; + self.input_via.notify(self.conn, &buf).await.map_err(|e| { + error!("Failed to notify via report: {:?}", e); + HidError::BleError + })?; + Ok(n) + } +} + +impl HidReaderTrait for BleViaServer<'_, '_, '_> { + type ReportType = ViaReport; + + async fn read_report(&mut self) -> Result { + let v = VIAL_READ_CHANNEL.receive().await; + Ok(ViaReport { + input_data: [0u8; 32], + output_data: v, + }) + } +} diff --git a/rmk/src/ble/trouble/mod.rs b/rmk/src/ble/trouble/mod.rs new file mode 100644 index 000000000..f4425c5ba --- /dev/null +++ b/rmk/src/ble/trouble/mod.rs @@ -0,0 +1,639 @@ +use core::cell::RefCell; +use core::sync::atomic::{AtomicU8, Ordering}; + +use battery_service::BleBatteryServer; +use ble_server::{BleHidServer, BleViaServer, Server}; +use embassy_futures::join::join; +use embassy_futures::select::{select, select3, Either3}; +use embassy_time::{with_timeout, Duration, Timer}; +use embedded_hal::digital::OutputPin; +use profile::{UPDATED_CCCD_TABLE, UPDATED_PROFILE}; +use rand_core::{CryptoRng, RngCore}; +use trouble_host::prelude::appearance::human_interface_device::KEYBOARD; +use trouble_host::prelude::service::{BATTERY, HUMAN_INTERFACE_DEVICE}; +use trouble_host::prelude::*; +#[cfg(not(feature = "_no_usb"))] +use { + crate::light::UsbLedReader, + crate::state::get_connection_type, + crate::usb::descriptor::{CompositeReport, KeyboardReport, ViaReport}, + crate::usb::UsbKeyboardWriter, + crate::usb::{add_usb_reader_writer, new_usb_builder, register_usb_writer}, + crate::usb::{USB_ENABLED, USB_SUSPENDED}, + crate::via::UsbVialReaderWriter, + embassy_futures::select::{select4, Either4}, + embassy_usb::driver::Driver, +}; +#[cfg(feature = "storage")] +use { + crate::storage::{Storage, StorageData, StorageKeys}, + crate::{read_storage, state::CONNECTION_TYPE}, + embedded_storage_async::nor_flash::NorFlash as AsyncNorFlash, +}; + +use crate::ble::led::BleLedReader; +use crate::ble::trouble::profile::{ProfileInfo, ProfileManager}; +use crate::channel::{KEYBOARD_REPORT_CHANNEL, LED_SIGNAL, VIAL_READ_CHANNEL}; +use crate::config::RmkConfig; +use crate::hid::{DummyWriter, RunnableHidWriter}; +use crate::keymap::KeyMap; +use crate::light::{LedIndicator, LightController}; +use crate::state::{ConnectionState, ConnectionType}; +use crate::{run_keyboard, CONNECTION_STATE}; + +pub(crate) mod battery_service; +pub(crate) mod ble_server; +pub(crate) mod profile; + +/// Maximum number of bonded devices +pub const BONDED_DEVICE_NUM: usize = 8; + +/// The number of the active profile +pub static ACTIVE_PROFILE: AtomicU8 = AtomicU8::new(0); + +/// Max number of connections +const CONNECTIONS_MAX: usize = 4; + +/// Max number of L2CAP channels +const L2CAP_CHANNELS_MAX: usize = 8; // Signal + att + +/// L2CAP MTU size +pub(crate) const L2CAP_MTU: usize = 255; + +/// Build the BLE stack. +pub async fn build_ble_stack<'a, C: Controller, RNG: RngCore + CryptoRng>( + controller: C, + host_address: [u8; 6], + random_generator: &mut RNG, + resources: &'a mut HostResources, +) -> Stack<'a, C> { + // Initialize trouble host stack + trouble_host::new(controller, resources) + .set_random_address(Address::random(host_address)) + .set_random_generator_seed(random_generator) +} + +/// Run the BLE stack. +pub(crate) async fn run_ble< + 'a, + 'b, + C: Controller, + #[cfg(feature = "storage")] F: AsyncNorFlash, + #[cfg(not(feature = "_no_usb"))] D: Driver<'static>, + Out: OutputPin, + const ROW: usize, + const COL: usize, + const NUM_LAYER: usize, + const NUM_ENCODER: usize, +>( + keymap: &'a RefCell>, + #[cfg(not(feature = "_no_usb"))] usb_driver: D, + stack: &'b Stack<'b, C>, + #[cfg(feature = "storage")] storage: &mut Storage, + light_controller: &mut LightController, + mut rmk_config: RmkConfig<'static>, +) { + // Initialize usb device and usb hid reader/writer + #[cfg(not(feature = "_no_usb"))] + let (mut usb_device, mut keyboard_reader, mut keyboard_writer, mut other_writer, mut vial_reader_writer) = { + let mut usb_builder: embassy_usb::Builder<'_, D> = new_usb_builder(usb_driver, rmk_config.usb_config); + let keyboard_reader_writer = add_usb_reader_writer!(&mut usb_builder, KeyboardReport, 1, 8); + let other_writer = register_usb_writer!(&mut usb_builder, CompositeReport, 9); + let vial_reader_writer = add_usb_reader_writer!(&mut usb_builder, ViaReport, 32, 32); + let (keyboard_reader, keyboard_writer) = keyboard_reader_writer.split(); + let usb_device = usb_builder.build(); + ( + usb_device, + keyboard_reader, + keyboard_writer, + other_writer, + vial_reader_writer, + ) + }; + + // Load current connection type + #[cfg(feature = "storage")] + { + let mut buf: [u8; 16] = [0; 16]; + if let Ok(Some(StorageData::ConnectionType(conn_type))) = + read_storage!(storage, &(StorageKeys::ConnectionType as u32), buf) + { + CONNECTION_TYPE.store(conn_type, Ordering::SeqCst); + } else { + // If no saved connection type, return default value + #[cfg(feature = "_no_usb")] + CONNECTION_TYPE.store(ConnectionType::Ble.into(), Ordering::SeqCst); + #[cfg(not(feature = "_no_usb"))] + CONNECTION_TYPE.store(ConnectionType::Usb.into(), Ordering::SeqCst); + } + } + + // Create profile manager + let mut profile_manager = ProfileManager::new(&stack); + + #[cfg(feature = "storage")] + // Load saved bonding information + profile_manager.load_bonded_devices(storage).await; + // Update bonding information in the stack + profile_manager.update_stack_bonds(); + + // Build trouble host stack + let Host { + mut peripheral, runner, .. + } = stack.build(); + + // Set conn param + info!("Starting advertising and GATT service"); + let server = Server::new_with_config(GapConfig::Peripheral(PeripheralConfig { + name: rmk_config.usb_config.product_name, + appearance: &appearance::human_interface_device::KEYBOARD, + })) + .unwrap(); + + #[cfg(not(feature = "_no_usb"))] + let background_task = join(ble_task(runner), usb_device.run()); + #[cfg(feature = "_no_usb")] + let background_task = ble_task(runner); + + // Main loop + join(background_task, async { + loop { + let adv_fut = advertise(rmk_config.usb_config.product_name, &mut peripheral, &server); + // USB + BLE dual mode + #[cfg(not(feature = "_no_usb"))] + { + match get_connection_type() { + ConnectionType::Usb => { + info!("USB priority mode, waiting for USB enabled or BLE connection"); + match select4( + USB_ENABLED.wait(), + adv_fut, + #[cfg(feature = "storage")] + run_dummy_keyboard(storage), + #[cfg(not(feature = "storage"))] + run_dummy_keyboard(), + profile_manager.update_profile(), + ) + .await + { + Either4::First(_) => { + info!("USB enabled, run USB keyboard"); + let usb_fut = run_keyboard( + keymap, + #[cfg(feature = "storage")] + storage, + USB_SUSPENDED.wait(), + light_controller, + UsbLedReader::new(&mut keyboard_reader), + UsbVialReaderWriter::new(&mut vial_reader_writer), + UsbKeyboardWriter::new(&mut keyboard_writer, &mut other_writer), + rmk_config.vial_config, + ); + select(usb_fut, profile_manager.update_profile()).await; + } + Either4::Second(Ok(conn)) => { + info!("No USB, BLE connected, run BLE keyboard"); + let ble_fut = run_ble_keyboard( + &server, + &conn, + &stack, + light_controller, + keymap, + &mut rmk_config, + #[cfg(feature = "storage")] + storage, + ); + select3(ble_fut, USB_SUSPENDED.wait(), profile_manager.update_profile()).await; + continue; + } + Either4::Second(Err(BleHostError::BleHost(Error::Timeout))) => { + warn!("Advertising timeout, sleep and wait for any key"); + + // Set CONNECTION_STATE to true to keep receiving messages from the peripheral + CONNECTION_STATE.store(ConnectionState::Connected.into(), Ordering::Release); + // Wait for the keyboard report for wake the keyboard + let _ = KEYBOARD_REPORT_CHANNEL.receive().await; + continue; + } + _ => {} + } + } + ConnectionType::Ble => { + info!("BLE priority mode, running USB keyboard while advertising"); + let usb_fut = run_keyboard( + keymap, + #[cfg(feature = "storage")] + storage, + core::future::pending::<()>(), // Run forever until BLE connected + light_controller, + UsbLedReader::new(&mut keyboard_reader), + UsbVialReaderWriter::new(&mut vial_reader_writer), + UsbKeyboardWriter::new(&mut keyboard_writer, &mut other_writer), + rmk_config.vial_config, + ); + match select3(adv_fut, usb_fut, profile_manager.update_profile()).await { + Either3::First(Ok(conn)) => { + info!("BLE connected, running BLE keyboard"); + select( + run_ble_keyboard( + &server, + &conn, + &stack, + light_controller, + keymap, + &mut rmk_config, + #[cfg(feature = "storage")] + storage, + ), + profile_manager.update_profile(), + ) + .await; + } + Either3::First(Err(BleHostError::BleHost(Error::Timeout))) => { + warn!("Advertising timeout, sleep and wait for any key"); + + // Set CONNECTION_STATE to true to keep receiving messages from the peripheral + CONNECTION_STATE.store(ConnectionState::Connected.into(), Ordering::Release); + // Wait for the keyboard report for wake the keyboard + let _ = KEYBOARD_REPORT_CHANNEL.receive().await; + continue; + } + _ => {} + } + } + } + } + + #[cfg(feature = "_no_usb")] + match adv_fut.await { + Ok(conn) => { + // BLE connected + select( + run_ble_keyboard( + &server, + &conn, + &stack, + light_controller, + keymap, + &mut rmk_config, + #[cfg(feature = "storage")] + storage, + ), + profile_manager.update_profile(), + ) + .await; + } + Err(e) => { + #[cfg(feature = "defmt")] + let e = defmt::Debug2Format(&e); + error!("Advertise error: {:?}", e); + } + } + + // Retry after 200 ms + Timer::after_millis(200).await; + } + }) + .await; +} + +/// This is a background task that is required to run forever alongside any other BLE tasks. +pub(crate) async fn ble_task(mut runner: Runner<'_, C>) { + loop { + // Signal to indicate the stack is started + #[cfg(feature = "split")] + crate::split::ble::central::STACK_STARTED.signal(true); + + if let Err(e) = runner.run().await { + panic!("[ble_task] error: {:?}", e); + } + } +} + +/// Stream Events until the connection closes. +/// +/// This function will handle the GATT events and process them. +/// This is how we interact with read and write requests. +async fn gatt_events_task(server: &Server<'_>, conn: &GattConnection<'_, '_>) -> Result<(), Error> { + let level = server.battery_service.level; + let output_keyboard = server.hid_service.output_keyboard; + let input_keyboard = server.hid_service.input_keyboard; + let output_via = server.via_service.output_via; + let input_via = server.via_service.input_via; + let battery_level = server.battery_service.level; + let mouse = server.composite_service.mouse_report; + let media = server.composite_service.media_report; + let system_control = server.composite_service.system_report; + + CONNECTION_STATE.store(ConnectionState::Connected.into(), Ordering::Release); + loop { + match conn.next().await { + GattConnectionEvent::Disconnected { reason } => { + info!("[gatt] disconnected: {:?}", reason); + break; + } + GattConnectionEvent::Bonded { bond_info } => { + info!("[gatt] bonded: {:?}", bond_info); + let profile_info = ProfileInfo { + slot_num: ACTIVE_PROFILE.load(Ordering::SeqCst), + info: bond_info, + removed: false, + cccd_table: server.get_cccd_table(conn.raw()).unwrap_or_default(), + }; + UPDATED_PROFILE.signal(profile_info); + } + GattConnectionEvent::Gatt { event } => { + match event { + Ok(event) => { + let mut cccd_updated = false; + let result = match &event { + GattEvent::Read(event) => { + if event.handle() == level.handle { + let value = server.get(&level); + debug!("Read GATT Event to Level: {:?}", value); + } else { + debug!("Read GATT Event to Unknown: {:?}", event.handle()); + } + + if conn.raw().encrypted() { + None + } else { + Some(AttErrorCode::INSUFFICIENT_ENCRYPTION) + } + } + GattEvent::Write(event) => { + if event.handle() == output_keyboard.handle { + let led_indicator = LedIndicator::from_bits(event.data()[0]); + debug!("Got keyboard state: {:?}", led_indicator); + LED_SIGNAL.signal(led_indicator); + } else if event.handle() == output_via.handle { + debug!("Got via packet: {:?}", event.data()); + let data = unsafe { *(event.data().as_ptr() as *const [u8; 32]) }; + VIAL_READ_CHANNEL.send(data).await; + } else if event.handle() + == input_keyboard.cccd_handle.expect("No CCCD for input keyboard") + || event.handle() == input_via.cccd_handle.expect("No CCCD for input via") + || event.handle() == mouse.cccd_handle.expect("No CCCD for mouse report") + || event.handle() == media.cccd_handle.expect("No CCCD for media report") + || event.handle() == system_control.cccd_handle.expect("No CCCD for system report") + || event.handle() == battery_level.cccd_handle.expect("No CCCD for battery level") + { + // CCCD write event + cccd_updated = true; + } else { + debug!("Write GATT Event to Unknown: {:?}", event.handle()); + } + + if conn.raw().encrypted() { + None + } else { + Some(AttErrorCode::INSUFFICIENT_ENCRYPTION) + } + } + }; + + // This step is also performed at drop(), but writing it explicitly is necessary + // in order to ensure reply is sent. + let result = if let Some(code) = result { + event.reject(code) + } else { + event.accept() + }; + match result { + Ok(reply) => { + reply.send().await; + } + Err(e) => { + warn!("[gatt] error sending response: {:?}", e); + } + } + + // Update CCCD table after processing the event + if cccd_updated { + if let Some(table) = server.get_cccd_table(conn.raw()) { + info!("Updated profile CCCD table: {:?}", table); + UPDATED_CCCD_TABLE.signal(table); + } + } + } + Err(e) => warn!("[gatt] error processing event: {:?}", e), + } + } + GattConnectionEvent::PhyUpdated { tx_phy, rx_phy } => { + info!("[gatt] PhyUpdated: {:?}, {:?}", tx_phy, rx_phy); + } + GattConnectionEvent::ConnectionParamsUpdated { + conn_interval, + peripheral_latency, + supervision_timeout, + } => { + info!( + "[gatt] ConnectionParamsUpdated: {:?}, {:?}, {:?}", + conn_interval, peripheral_latency, supervision_timeout + ); + } + } + } + info!("[gatt] task finished"); + Ok(()) +} + +/// Create an advertiser to use to connect to a BLE Central, and wait for it to connect. +async fn advertise<'a, 'b, C: Controller>( + name: &'a str, + peripheral: &mut Peripheral<'a, C>, + server: &'b Server<'_>, +) -> Result, BleHostError> { + // Wait for 10ms to ensure the USB is checked + embassy_time::Timer::after_millis(10).await; + let mut advertiser_data = [0; 31]; + AdStructure::encode_slice( + &[ + AdStructure::Flags(LE_GENERAL_DISCOVERABLE | BR_EDR_NOT_SUPPORTED), + AdStructure::ServiceUuids16(&[BATTERY.to_le_bytes(), HUMAN_INTERFACE_DEVICE.to_le_bytes()]), + AdStructure::CompleteLocalName(name.as_bytes()), + AdStructure::Unknown { + ty: 0x19, // Appearance + data: &KEYBOARD.to_le_bytes(), + }, + ], + &mut advertiser_data[..], + )?; + + let advertise_config = AdvertisementParameters { + primary_phy: PhyKind::Le2M, + secondary_phy: PhyKind::Le2M, + tx_power: TxPower::Plus8dBm, + interval_min: Duration::from_millis(200), + interval_max: Duration::from_millis(200), + ..Default::default() + }; + + info!("[adv] advertising"); + let advertiser = peripheral + .advertise( + &advertise_config, + Advertisement::ConnectableScannableUndirected { + adv_data: &advertiser_data[..], + scan_data: &[], + }, + ) + .await?; + + // Timeout for advertising is 300s + match with_timeout(Duration::from_secs(300), advertiser.accept()).await { + Ok(conn_res) => { + let conn = conn_res?.with_attribute_server(server)?; + info!("[adv] connection established"); + Ok(conn) + } + Err(_) => Err(BleHostError::BleHost(Error::Timeout)), + } +} + +// Dummy keyboard service is used to monitoring keys when there's no actual connection. +// It's useful for functions like switching active profiles when there's no connection. +pub(crate) async fn run_dummy_keyboard< + #[cfg(feature = "storage")] F: AsyncNorFlash, + #[cfg(feature = "storage")] const ROW: usize, + #[cfg(feature = "storage")] const COL: usize, + #[cfg(feature = "storage")] const NUM_LAYER: usize, + #[cfg(feature = "storage")] const NUM_ENCODER: usize, +>( + #[cfg(feature = "storage")] storage: &mut Storage, +) { + CONNECTION_STATE.store(ConnectionState::Disconnected.into(), Ordering::Release); + #[cfg(feature = "storage")] + let storage_fut = storage.run(); + let mut dummy_writer = DummyWriter {}; + #[cfg(feature = "storage")] + select(storage_fut, dummy_writer.run_writer()).await; + #[cfg(not(feature = "storage"))] + dummy_writer.run_writer().await; +} + +pub(crate) async fn set_conn_params<'a, 'b, C: Controller>(stack: &Stack<'_, C>, conn: &GattConnection<'a, 'b>) { + // Wait for 5 seconds before setting connection parameters to avoid connection drop + embassy_time::Timer::after_secs(5).await; + + // For macOS/iOS(aka Apple devices), both interval should be set to 15ms + if let Err(e) = conn + .raw() + .update_connection_params( + &stack, + &ConnectParams { + min_connection_interval: Duration::from_millis(15), + max_connection_interval: Duration::from_millis(15), + max_latency: 99, + event_length: Duration::from_secs(0), + supervision_timeout: Duration::from_secs(5), + }, + ) + .await + { + #[cfg(feature = "defmt")] + let e = defmt::Debug2Format(&e); + error!("[set_conn_params] error: {:?}", e); + } + + embassy_time::Timer::after_secs(5).await; + + // Setting the conn param the second time ensures that we have best performance on all platforms + loop { + match conn + .raw() + .update_connection_params( + &stack, + &ConnectParams { + min_connection_interval: Duration::from_micros(7500), + max_connection_interval: Duration::from_micros(7500), + max_latency: 99, + event_length: Duration::from_secs(0), + supervision_timeout: Duration::from_secs(5), + }, + ) + .await + { + Err(BleHostError::BleHost(Error::Hci(error))) => { + if 0x2A == error.to_status().into_inner() { + // Busy, retry + continue; + } else { + error!("[set_conn_params] 2nd time HCI error: {:?}", error); + break; + } + } + _ => break, + }; + } + + // Wait forever. This is because we want the conn params setting can be interrupted when the connection is lost. + // So this task shouldn't quit after setting the conn params. + core::future::pending::<()>().await; +} + +/// Run BLE keyboard with connected device +async fn run_ble_keyboard< + 'a, + 'b, + 'c, + 'd, + C: Controller, + Out: OutputPin, + #[cfg(feature = "storage")] F: AsyncNorFlash, + const ROW: usize, + const COL: usize, + const NUM_LAYER: usize, + const NUM_ENCODER: usize, +>( + server: &'b Server<'_>, + conn: &GattConnection<'a, 'b>, + stack: &Stack<'_, C>, + light_controller: &mut LightController, + keymap: &'c RefCell>, + rmk_config: &'d mut RmkConfig<'static>, + #[cfg(feature = "storage")] storage: &mut Storage, +) { + let ble_hid_server = BleHidServer::new(&server, &conn); + let ble_via_server = BleViaServer::new(&server, &conn); + let ble_led_reader = BleLedReader {}; + let mut ble_battery_server = BleBatteryServer::new(&server, &conn); + + // Load CCCD table from storage + #[cfg(feature = "storage")] + if let Ok(Some(bond_info)) = storage + .read_trouble_bond_info(ACTIVE_PROFILE.load(Ordering::SeqCst)) + .await + { + if bond_info.info.address == conn.raw().peer_address() { + info!("Loading CCCD table from storage: {:?}", bond_info.cccd_table); + server.set_cccd_table(conn.raw(), bond_info.cccd_table.clone()); + } + } + + let communication_task = async { + match select3( + gatt_events_task(&server, &conn), + set_conn_params(&stack, &conn), + ble_battery_server.run(), + ) + .await + { + Either3::First(e) => error!("[gatt_events_task] end: {:?}", e), + _ => {} + } + }; + + run_keyboard( + keymap, + #[cfg(feature = "storage")] + storage, + communication_task, + light_controller, + ble_led_reader, + ble_via_server, + ble_hid_server, + rmk_config.vial_config, + ) + .await; +} diff --git a/rmk/src/ble/trouble/profile.rs b/rmk/src/ble/trouble/profile.rs new file mode 100644 index 000000000..a6ee3a5f1 --- /dev/null +++ b/rmk/src/ble/trouble/profile.rs @@ -0,0 +1,312 @@ +//! Manage BLE profiles and bonding information + +use core::sync::atomic::Ordering; + +use embassy_futures::select::{select3, Either3}; +use embassy_sync::signal::Signal; +use trouble_host::prelude::*; +use trouble_host::{BondInformation, LongTermKey}; +#[cfg(feature = "storage")] +use { + crate::channel::FLASH_CHANNEL, + crate::storage::{FlashOperationMessage, FLASH_OPERATION_FINISHED}, +}; + +use super::ble_server::CCCD_TABLE_SIZE; +use crate::ble::trouble::{ACTIVE_PROFILE, BONDED_DEVICE_NUM}; +use crate::channel::BLE_PROFILE_CHANNEL; +use crate::state::CONNECTION_TYPE; + +pub(crate) static UPDATED_PROFILE: Signal = Signal::new(); +pub(crate) static UPDATED_CCCD_TABLE: Signal> = Signal::new(); + +/// BLE profile info +#[derive(Clone, Debug)] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] +pub struct ProfileInfo { + pub(crate) slot_num: u8, + pub(crate) removed: bool, + pub(crate) info: BondInformation, + pub(crate) cccd_table: CccdTable, +} + +impl Default for ProfileInfo { + fn default() -> Self { + Self { + slot_num: 0, + removed: false, + info: BondInformation { + ltk: LongTermKey(0), + address: BdAddr::default(), + }, + cccd_table: CccdTable::::default(), + } + } +} + +/// BLE profile switch action +pub(crate) enum BleProfileAction { + SwitchProfile(u8), + PreviousProfile, + NextProfile, + ClearProfile, + ToggleConnection, +} + +/// Manage BLE profiles and bonding information +/// +/// ProfileManager is responsible for: +/// 1. Managing multiple BLE profiles, allowing users to switch between multiple devices +/// 2. Storing and loading bonding information for each profile +/// 3. Updating the bonding information of the active profile to the BLE stack +/// 4. Handling profile switch, clear, and save operations +#[cfg(feature = "_ble")] +pub struct ProfileManager<'a, C: Controller> { + /// List of bonded devices + bonded_devices: heapless::Vec, + /// BLE stack + stack: &'a Stack<'a, C>, +} + +#[cfg(feature = "_ble")] +impl<'a, C: Controller> ProfileManager<'a, C> { + /// Create a new profile manager + pub fn new(stack: &'a Stack<'a, C>) -> Self { + Self { + bonded_devices: heapless::Vec::new(), + stack, + } + } + + /// Load stored bonding information + #[cfg(feature = "storage")] + pub async fn load_bonded_devices< + F: embedded_storage_async::nor_flash::NorFlash, + const ROW: usize, + const COL: usize, + const NUM_LAYER: usize, + const NUM_ENCODER: usize, + >( + &mut self, + storage: &mut crate::storage::Storage, + ) { + use crate::read_storage; + use crate::storage::{StorageData, StorageKeys}; + + self.bonded_devices.clear(); + for slot_num in 0..BONDED_DEVICE_NUM { + if let Ok(Some(info)) = storage.read_trouble_bond_info(slot_num as u8).await { + if !info.removed { + if let Err(e) = self.bonded_devices.push(info) { + error!("Failed to add bond info: {:?}", e); + } + } + } + } + debug!("Loaded {} bond info", self.bonded_devices.len()); + + let mut buf: [u8; 128] = [0; 128]; + + // Load current active profile, save to `ACTIVE_PROFILE` + if let Ok(Some(StorageData::ActiveBleProfile(profile))) = + read_storage!(storage, &(StorageKeys::ActiveBleProfile as u32), buf) + { + debug!("Loaded active profile: {}", profile); + ACTIVE_PROFILE.store(profile, Ordering::SeqCst); + } else { + // If no saved active profile, use 0 as default + debug!("Loaded default active profile",); + ACTIVE_PROFILE.store(0, Ordering::SeqCst); + }; + } + + /// Update bonding information in the stack according to the current active profile + pub fn update_stack_bonds(&self) { + let active_profile = ACTIVE_PROFILE.load(core::sync::atomic::Ordering::SeqCst); + + // Remove current bonding information in the stack + let current_bond_info = self.stack.get_bond_information(); + for bond in current_bond_info { + if let Err(e) = self.stack.remove_bond_information(bond.address) { + debug!("Remove bond info error: {:?}", e); + } + } + + // Add bonding information for the active profile + if let Some(info) = self + .bonded_devices + .iter() + .find(|bond_info| !bond_info.removed && bond_info.slot_num == active_profile) + { + debug!("Add bond info of profile {}: {:?}", active_profile, info); + if let Err(e) = self.stack.add_bond_information(info.info.clone()) { + debug!("Add bond info error: {:?}", e); + } + } + } + + /// Add/update bonding information + pub async fn add_profile_info(&mut self, profile_info: ProfileInfo) { + // Update profile information in memory + if let Some(index) = self + .bonded_devices + .iter() + .position(|info| info.slot_num == profile_info.slot_num) + { + if self.bonded_devices[index].info == profile_info.info { + info!("Skip saving same bonding info"); + return; + } + // If the bonding information with the same slot number exists, update it + self.bonded_devices[index] = profile_info.clone(); + } else { + // If there is no bonding information with the same slot number, add it + if let Err(e) = self.bonded_devices.push(profile_info.clone()) { + error!("Failed to add bond info: {:?}", e); + } + } + + #[cfg(feature = "storage")] + // Send bonding information to the flash task for saving + FLASH_CHANNEL + .send(crate::storage::FlashOperationMessage::ProfileInfo(profile_info)) + .await; + } + + /// Update CCCD table in the stack + pub async fn update_profile_cccd_table(&mut self, table: CccdTable) { + // Get current active profile + let active_profile = ACTIVE_PROFILE.load(Ordering::SeqCst); + + // Update profile information in memory + if let Some(index) = self + .bonded_devices + .iter() + .position(|info| info.slot_num == active_profile) + { + // Check whether the CCCD table is the same as the current one + if self.bonded_devices[index].cccd_table.inner() == table.inner() { + info!("Skip updating same CCCD table"); + return; + } + + debug!("Updating profile {} CCCD table: {:?}", active_profile, table); + let mut profile_info = self.bonded_devices[index].clone(); + profile_info.cccd_table = table; + self.bonded_devices[index] = profile_info.clone(); + + #[cfg(feature = "storage")] + FLASH_CHANNEL + .send(crate::storage::FlashOperationMessage::ProfileInfo(profile_info)) + .await; + } else { + error!("Failed to update profile CCCD table: profile not found"); + } + } + + /// Clear bonding information of the specified slot + pub async fn clear_bond(&mut self, slot_num: u8) { + // Update bonding information in memory + for bond_info in self.bonded_devices.iter_mut() { + if bond_info.slot_num == slot_num { + bond_info.removed = true; + } + } + + // Update the active bonding information in the stack + self.update_stack_bonds(); + + #[cfg(feature = "storage")] + // Send the clear slot message to the flash task + FLASH_CHANNEL + .send(crate::storage::FlashOperationMessage::ClearSlot(slot_num)) + .await; + } + + /// Switch to the specified profile, return true if the profile is switched + pub async fn switch_profile(&self, profile: u8) -> bool { + let current = ACTIVE_PROFILE.load(core::sync::atomic::Ordering::SeqCst); + if profile == current { + return false; + } + + ACTIVE_PROFILE.store(profile, core::sync::atomic::Ordering::SeqCst); + + // Update the active bonding information in the stack + self.update_stack_bonds(); + + #[cfg(feature = "storage")] + FLASH_CHANNEL + .send(crate::storage::FlashOperationMessage::ActiveBleProfile(profile)) + .await; + + info!("Switched to BLE profile: {}", profile); + true + } + + /// Wait for profile switch event and update active profile + /// + /// This function will wait for profile switch operation, then update the active profile + /// based on the operation type. After completing the operation, it will wait for a period + /// to ensure the flash operation is completed. + pub async fn update_profile(&mut self) { + // Wait for profile switch or updated profile event + loop { + match select3( + BLE_PROFILE_CHANNEL.receive(), + UPDATED_PROFILE.wait(), + UPDATED_CCCD_TABLE.wait(), + ) + .await + { + Either3::First(action) => { + #[cfg(feature = "storage")] + if FLASH_OPERATION_FINISHED.signaled() { + FLASH_OPERATION_FINISHED.reset(); + } + match action { + BleProfileAction::SwitchProfile(profile) => { + if !self.switch_profile(profile).await { + // If the profile is the same as the current profile, do nothing + continue; + } + } + BleProfileAction::PreviousProfile => { + let mut profile = ACTIVE_PROFILE.load(Ordering::SeqCst); + profile = if profile == 0 { 7 } else { profile - 1 }; + + self.switch_profile(profile).await; + } + BleProfileAction::NextProfile => { + let mut profile = ACTIVE_PROFILE.load(Ordering::SeqCst) + 1; + profile = profile % BONDED_DEVICE_NUM as u8; + + self.switch_profile(profile).await; + } + BleProfileAction::ClearProfile => { + let profile = ACTIVE_PROFILE.load(Ordering::SeqCst); + self.clear_bond(profile).await; + } + BleProfileAction::ToggleConnection => { + let current = CONNECTION_TYPE.load(Ordering::SeqCst); + let updated = 1 - current; + CONNECTION_TYPE.store(updated, Ordering::SeqCst); + #[cfg(feature = "storage")] + FLASH_CHANNEL.send(FlashOperationMessage::ConnectionType(updated)).await; + } + } + #[cfg(feature = "storage")] + FLASH_OPERATION_FINISHED.wait().await; + info!("Update profile done"); + break; + } + Either3::Second(profile_info) => { + self.add_profile_info(profile_info).await; + } + Either3::Third(table) => { + self.update_profile_cccd_table(table).await; + } + } + } + } +} diff --git a/rmk/src/boot.rs b/rmk/src/boot.rs index e0e717f3f..b893ec423 100644 --- a/rmk/src/boot.rs +++ b/rmk/src/boot.rs @@ -28,5 +28,5 @@ pub(crate) fn reboot_keyboard() { cortex_m::peripheral::SCB::sys_reset(); #[cfg(feature = "_esp_ble")] - esp_idf_svc::hal::reset::restart(); + esp_hal::system::software_reset(); } diff --git a/rmk/src/channel.rs b/rmk/src/channel.rs index 209f27103..407203684 100644 --- a/rmk/src/channel.rs +++ b/rmk/src/channel.rs @@ -1,28 +1,22 @@ //! Exposed channels which can be used to share data across devices & processors -//! -use crate::RawMutex; -pub use embassy_sync::blocking_mutex; -pub use embassy_sync::channel; + use embassy_sync::channel::Channel; -use embassy_sync::signal::Signal; -pub use embassy_sync::zerocopy_channel; +pub use embassy_sync::{blocking_mutex, channel, zerocopy_channel}; +#[cfg(feature = "_ble")] +use {crate::ble::trouble::profile::BleProfileAction, crate::light::LedIndicator, embassy_sync::signal::Signal}; -#[cfg(feature = "_nrf_ble")] -use crate::ble::nrf::profile::BleProfileAction; use crate::event::{Event, KeyEvent}; use crate::hid::Report; -#[cfg(feature = "_ble")] -use crate::light::LedIndicator; #[cfg(feature = "storage")] use crate::storage::FlashOperationMessage; +use crate::RawMutex; + pub const EVENT_CHANNEL_SIZE: usize = 16; pub const REPORT_CHANNEL_SIZE: usize = 16; /// Signal for control led indicator, it's used only in BLE keyboards, since BLE receiving is not async #[cfg(feature = "_ble")] pub static LED_SIGNAL: Signal = Signal::new(); -/// Channel for battery level updates -pub static BATTERY_LEVEL_SIGNAL: Signal = Signal::new(); /// Channel for key events only pub static KEY_EVENT_CHANNEL: Channel = Channel::new(); /// Channel for all other events @@ -34,5 +28,5 @@ pub(crate) static VIAL_READ_CHANNEL: Channel = Channel::n // Sync messages from server to flash #[cfg(feature = "storage")] pub(crate) static FLASH_CHANNEL: Channel = Channel::new(); -#[cfg(feature = "_nrf_ble")] +#[cfg(feature = "_ble")] pub(crate) static BLE_PROFILE_CHANNEL: Channel = Channel::new(); diff --git a/rmk/src/combo.rs b/rmk/src/combo.rs index bc280954c..db1bcbe6b 100644 --- a/rmk/src/combo.rs +++ b/rmk/src/combo.rs @@ -1,6 +1,7 @@ use heapless::Vec; -use crate::{action::KeyAction, event::KeyEvent}; +use crate::action::KeyAction; +use crate::event::KeyEvent; // Max number of combos pub(crate) const COMBO_MAX_NUM: usize = 8; @@ -25,11 +26,7 @@ impl Default for Combo { const COMBO_TRIGGERED: u8 = u8::MAX; impl Combo { - pub fn new>( - actions: I, - output: KeyAction, - layer: Option, - ) -> Self { + pub fn new>(actions: I, output: KeyAction, layer: Option) -> Self { Self { actions: Vec::from_iter(actions), output, @@ -39,19 +36,10 @@ impl Combo { } pub fn empty() -> Self { - Self::new( - Vec::::new(), - KeyAction::No, - None, - ) + Self::new(Vec::::new(), KeyAction::No, None) } - pub(crate) fn update( - &mut self, - key_action: KeyAction, - key_event: KeyEvent, - active_layer: u8, - ) -> bool { + pub(crate) fn update(&mut self, key_action: KeyAction, key_event: KeyEvent, active_layer: u8) -> bool { if !key_event.pressed || self.actions.is_empty() || self.state == COMBO_TRIGGERED { //ignore combo that without actions return false; @@ -63,10 +51,7 @@ impl Combo { } } - debug!( - "combo {:?} search key action {:?} ", - self.output, key_action - ); + debug!("combo {:?} search key action {:?} ", self.output, key_action); let action_idx = self.actions.iter().position(|&a| a == key_action); if let Some(i) = action_idx { self.state |= 1 << i; @@ -93,10 +78,7 @@ impl Combo { if self.is_all_pressed() { self.state = COMBO_TRIGGERED; - debug!( - "combo {:?} mark triggered, updated state: {}", - self.output, self.state - ); + debug!("combo {:?} mark triggered, updated state: {}", self.output, self.state); } self.output } diff --git a/rmk/src/config/esp_config.rs b/rmk/src/config/esp_config.rs index 876a84e3f..e141756f2 100644 --- a/rmk/src/config/esp_config.rs +++ b/rmk/src/config/esp_config.rs @@ -1,2 +1,5 @@ +use core::marker::PhantomData; #[derive(Clone, Copy, Debug, Default)] -pub struct BleBatteryConfig {} +pub struct BleBatteryConfig<'a> { + _marker: PhantomData<&'a ()>, +} diff --git a/rmk/src/config/mod.rs b/rmk/src/config/mod.rs index 323252b92..f39527dfd 100644 --- a/rmk/src/config/mod.rs +++ b/rmk/src/config/mod.rs @@ -4,25 +4,22 @@ mod esp_config; mod nrf_config; use ::heapless::Vec; +use embassy_sync::channel::Channel; +use embassy_time::Duration; +use embedded_hal::digital::OutputPin; #[cfg(feature = "_esp_ble")] pub use esp_config::BleBatteryConfig; #[cfg(feature = "_nrf_ble")] pub use nrf_config::BleBatteryConfig; -use embassy_sync::channel::Channel; -use embassy_time::Duration; -use embedded_hal::digital::OutputPin; - +use crate::combo::{Combo, COMBO_MAX_NUM}; +use crate::event::{Event, KeyEvent}; +use crate::fork::{Fork, FORK_MAX_NUM}; +use crate::hid::Report; +use crate::light::LedIndicator; #[cfg(feature = "storage")] use crate::storage::FlashOperationMessage; -use crate::{ - combo::{Combo, COMBO_MAX_NUM}, - event::{Event, KeyEvent}, - fork::{Fork, FORK_MAX_NUM}, - hid::Report, - light::LedIndicator, - RawMutex, -}; +use crate::RawMutex; /// The config struct for RMK keyboard. /// @@ -61,11 +58,8 @@ pub struct ChannelConfig< pub(crate) vial_read_channel: Channel, } -impl< - const KEY_EVENT_CHANNEL_SIZE: usize, - const EVENT_CHANNEL_SIZE: usize, - const REPORT_CHANNEL_SIZE: usize, - > Default for ChannelConfig +impl Default + for ChannelConfig { fn default() -> Self { Self { @@ -80,11 +74,8 @@ impl< } } -impl< - const KEY_EVENT_CHANNEL_SIZE: usize, - const EVENT_CHANNEL_SIZE: usize, - const REPORT_CHANNEL_SIZE: usize, - > ChannelConfig +impl + ChannelConfig { pub fn new() -> Self { Self::default() @@ -117,7 +108,7 @@ pub struct RmkConfig<'a> { #[cfg(feature = "_nrf_ble")] pub ble_battery_config: BleBatteryConfig<'a>, #[cfg(feature = "_esp_ble")] - pub ble_battery_config: BleBatteryConfig, + pub ble_battery_config: BleBatteryConfig<'a>, } /// Config for configurable action behavior @@ -137,6 +128,7 @@ pub struct TapHoldConfig { pub prior_idle_time: Duration, pub post_wait_time: Duration, pub hold_timeout: Duration, + pub permissive_hold: bool, } impl Default for TapHoldConfig { @@ -146,6 +138,7 @@ impl Default for TapHoldConfig { prior_idle_time: Duration::from_millis(120), post_wait_time: Duration::from_millis(50), hold_timeout: Duration::from_millis(250), + permissive_hold: true, } } } diff --git a/rmk/src/debounce/default_debouncer.rs b/rmk/src/debounce/default_debouncer.rs index 102175206..6103ad381 100644 --- a/rmk/src/debounce/default_debouncer.rs +++ b/rmk/src/debounce/default_debouncer.rs @@ -1,8 +1,7 @@ use embassy_time::Instant; -use crate::matrix::KeyState; - use super::{DebounceState, DebouncerTrait, DEBOUNCE_THRESHOLD}; +use crate::matrix::KeyState; /// Debounce counter info for each key. #[derive(Copy, Clone, Debug)] @@ -41,9 +40,7 @@ impl Default } } -impl - DefaultDebouncer -{ +impl DefaultDebouncer { /// Create a default debouncer pub fn new() -> Self { DefaultDebouncer { diff --git a/rmk/src/debounce/fast_debouncer.rs b/rmk/src/debounce/fast_debouncer.rs index e3e24df28..dfe0d23a5 100644 --- a/rmk/src/debounce/fast_debouncer.rs +++ b/rmk/src/debounce/fast_debouncer.rs @@ -1,8 +1,7 @@ use embassy_time::Instant; -use crate::matrix::KeyState; - use super::{DebounceState, DebouncerTrait, DEBOUNCE_THRESHOLD}; +use crate::matrix::KeyState; /// Fast per-key debouncer. /// The debouncing algorithm is similar as QMK's [asym eager defer pk debouncer](https://github.com/qmk/qmk_firmware/blob/2fd56317763e8b3b73f0db7488ef42a70f5b946e/quantum/debounce/asym_eager_defer_pk.c) @@ -19,9 +18,7 @@ impl Default } } -impl - RapidDebouncer -{ +impl RapidDebouncer { /// Create a rapid debouncer pub fn new() -> Self { RapidDebouncer { diff --git a/rmk/src/direct_pin.rs b/rmk/src/direct_pin.rs index 62b202ab4..fd97864c2 100644 --- a/rmk/src/direct_pin.rs +++ b/rmk/src/direct_pin.rs @@ -1,21 +1,17 @@ +use embassy_time::{Instant, Timer}; +use embedded_hal; +use embedded_hal::digital::InputPin; +#[cfg(feature = "async_matrix")] +use {embassy_futures::select::select_slice, embedded_hal_async::digital::Wait, heapless::Vec}; + #[cfg(feature = "rapid_debouncer")] use crate::debounce::fast_debouncer::RapidDebouncer; -use crate::debounce::DebounceState; -use crate::debounce::DebouncerTrait; -use crate::event::Event; -use crate::event::KeyEvent; +use crate::debounce::{DebounceState, DebouncerTrait}; +use crate::event::{Event, KeyEvent}; use crate::input_device::InputDevice; - use crate::matrix::KeyState; use crate::MatrixTrait; -use embassy_time::Instant; -use embassy_time::Timer; -use embedded_hal; -use embedded_hal::digital::InputPin; -#[cfg(feature = "async_matrix")] -use {embassy_futures::select::select_slice, embedded_hal_async::digital::Wait, heapless::Vec}; - /// DirectPinMartex only has input pins. pub struct DirectPinMatrix< #[cfg(feature = "async_matrix")] In: Wait + InputPin, @@ -139,6 +135,8 @@ impl< #[cfg(feature = "async_matrix")] async fn wait_for_key(&mut self) { + use core::pin::pin; + if let Some(start_time) = self.scan_start { // If no key press over 1ms, stop scanning and wait for interupt if start_time.elapsed().as_millis() <= 1 { @@ -159,7 +157,7 @@ impl< } } } - let _ = select_slice(futs.as_mut_slice()).await; + let _ = select_slice(pin!(futs.as_mut_slice())).await; } else { let mut futs: Vec<_, SIZE> = Vec::new(); for direct_pins_row in self.direct_pins.iter_mut() { @@ -169,7 +167,7 @@ impl< } } } - let _ = select_slice(futs.as_mut_slice()).await; + let _ = select_slice(pin!(futs.as_mut_slice())).await; } self.scan_start = Some(Instant::now()); } diff --git a/rmk/src/event.rs b/rmk/src/event.rs index 01a0c7782..a22c0df36 100644 --- a/rmk/src/event.rs +++ b/rmk/src/event.rs @@ -1,7 +1,11 @@ +use embassy_time::{Instant, Timer}; use postcard::experimental::max_size::MaxSize; use serde::{Deserialize, Serialize}; -use crate::input_device::rotary_encoder::Direction; +use crate::{ + action::{Action, KeyAction}, + input_device::rotary_encoder::Direction, +}; /// Raw events from input devices and keyboards /// @@ -24,6 +28,8 @@ pub enum Event { AxisEventStream(AxisEvent), /// Battery percentage event Battery(u16), + /// Charging state changed event, true means charging, false means not charging + ChargingState(bool), /// End of the event sequence /// /// This is used with [`Event::AxisEventStream`] to indicate the end of the event sequence. @@ -91,3 +97,14 @@ pub struct KeyEvent { pub col: u8, pub pressed: bool, } + +// record pressing tap hold keys +#[derive(Clone, Copy, Debug)] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] +pub struct PressedKeyEvent { + pub key_event: KeyEvent, + pub tap_action: Action, + pub hold_action: Action, + pub pressed_time: Instant, + pub deadline: u64, +} diff --git a/rmk/src/fork.rs b/rmk/src/fork.rs index 5a1ad45ab..663b4e612 100644 --- a/rmk/src/fork.rs +++ b/rmk/src/fork.rs @@ -1,7 +1,8 @@ +use core::ops::{BitAnd, BitOr, Not}; + use crate::action::KeyAction; use crate::hid_state::{HidModifiers, HidMouseButtons}; use crate::light::LedIndicator; -use core::ops::{BitAnd, BitOr, Not}; // Max number of fork behaviors pub(crate) const FORK_MAX_NUM: usize = 16; @@ -50,11 +51,7 @@ impl Not for StateBits { } impl StateBits { - pub const fn new_from( - modifiers: HidModifiers, - leds: LedIndicator, - mouse: HidMouseButtons, - ) -> Self { + pub const fn new_from(modifiers: HidModifiers, leds: LedIndicator, mouse: HidMouseButtons) -> Self { StateBits { modifiers: modifiers, leds: leds, diff --git a/rmk/src/hid.rs b/rmk/src/hid.rs index e21012d6e..894cd13f8 100644 --- a/rmk/src/hid.rs +++ b/rmk/src/hid.rs @@ -1,11 +1,16 @@ /// Traits and types for HID message reporting and listening. use core::{future::Future, sync::atomic::Ordering}; -use crate::{channel::KEYBOARD_REPORT_CHANNEL, usb::descriptor::KeyboardReport, CONNECTION_STATE}; -use embassy_usb::{class::hid::ReadError, driver::EndpointError}; +use embassy_usb::class::hid::ReadError; +use embassy_usb::driver::EndpointError; use serde::Serialize; use usbd_hid::descriptor::{AsInputReport, MediaKeyboardReport, MouseReport, SystemControlReport}; +use crate::channel::KEYBOARD_REPORT_CHANNEL; +use crate::state::ConnectionState; +use crate::usb::descriptor::KeyboardReport; +use crate::CONNECTION_STATE; + #[derive(Serialize, Debug)] pub enum Report { /// Normal keyboard hid report @@ -30,8 +35,7 @@ pub enum HidError { UsbPartialRead, BufferOverflow, ReportSerializeError, - BleDisconnected, - BleRawError, + BleError, } /// HidWriter trait is used for reporting HID messages to the host, via USB, BLE, etc. @@ -40,10 +44,7 @@ pub trait HidWriterTrait { type ReportType: AsInputReport; /// Write report to the host, return the number of bytes written if success. - fn write_report( - &mut self, - report: Self::ReportType, - ) -> impl Future>; + fn write_report(&mut self, report: Self::ReportType) -> impl Future>; } /// Runnable writer @@ -58,7 +59,7 @@ pub trait RunnableHidWriter: HidWriterTrait { // Get report to send let report = self.get_report().await; // Only send the report after the connection is established. - if CONNECTION_STATE.load(core::sync::atomic::Ordering::Acquire) { + if CONNECTION_STATE.load(Ordering::Acquire) == ConnectionState::Connected.into() { match self.write_report(report).await { Ok(_) => continue, Err(e) => error!("Failed to send report: {:?}", e), @@ -94,7 +95,7 @@ impl HidWriterTrait for DummyWriter { impl RunnableHidWriter for DummyWriter { async fn run_writer(&mut self) { // Set CONNECTION_STATE to true to keep receiving messages from the peripheral - CONNECTION_STATE.store(true, Ordering::Release); + CONNECTION_STATE.store(ConnectionState::Connected.into(), Ordering::Release); loop { let _ = KEYBOARD_REPORT_CHANNEL.receive().await; } diff --git a/rmk/src/hid_state.rs b/rmk/src/hid_state.rs index 974c93374..4767d70b7 100644 --- a/rmk/src/hid_state.rs +++ b/rmk/src/hid_state.rs @@ -1,6 +1,7 @@ -use bitfield_struct::bitfield; use core::ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, Not}; +use bitfield_struct::bitfield; + #[bitfield(u8, order = Lsb)] #[derive(Eq, PartialEq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] diff --git a/rmk/src/input_device/adc/nrf.rs b/rmk/src/input_device/adc/nrf.rs index 331b834e5..6547cc3e2 100644 --- a/rmk/src/input_device/adc/nrf.rs +++ b/rmk/src/input_device/adc/nrf.rs @@ -1,15 +1,14 @@ -use super::{AdcState, AnalogEventType}; -use crate::{ - event::{Axis, AxisEvent, AxisValType, Event}, - input_device::InputDevice, -}; use embassy_nrf::saadc::Saadc; -use embassy_time::Instant; +use embassy_time::{Duration, Instant}; + +use super::{AdcState, AnalogEventType}; +use crate::event::{Axis, AxisEvent, AxisValType, Event}; +use crate::input_device::InputDevice; pub struct NrfAdc<'a, const PIN_NUM: usize, const EVENT_NUM: usize> { saadc: Saadc<'a, PIN_NUM>, - polling_interval: u16, - light_sleep: Option, + polling_interval: Duration, + light_sleep: Option, buf: [[i16; PIN_NUM]; 2], // double buffer for waking up event_type: [AnalogEventType; EVENT_NUM], event_state: u8, @@ -25,8 +24,8 @@ impl<'a, const PIN_NUM: usize, const EVENT_NUM: usize> NrfAdc<'a, PIN_NUM, EVENT pub fn new( saadc: Saadc<'a, PIN_NUM>, event_type: [AnalogEventType; EVENT_NUM], - polling_interval: u16, - light_sleep: Option, + polling_interval: Duration, + light_sleep: Option, ) -> Self { Self { saadc, @@ -38,29 +37,30 @@ impl<'a, const PIN_NUM: usize, const EVENT_NUM: usize> NrfAdc<'a, PIN_NUM, EVENT channel_state: 0, buf_state: false, adc_state: AdcState::LightSleep, - active_instant: Instant::now(), + active_instant: Instant::MIN, } } } -impl<'a, const PIN_NUM: usize, const EVENT_NUM: usize> InputDevice - for NrfAdc<'a, PIN_NUM, EVENT_NUM> -{ +impl<'a, const PIN_NUM: usize, const EVENT_NUM: usize> InputDevice for NrfAdc<'a, PIN_NUM, EVENT_NUM> { async fn read_event(&mut self) -> Event { + if self.active_instant == Instant::MIN { + // filling for the first polling + self.saadc.sample(&mut self.buf[1]).await; + self.active_instant = Instant::now(); + } + if let Some(light_sleep) = self.light_sleep { if self.adc_state == AdcState::LightSleep { - { - embassy_time::Timer::after_millis(light_sleep as u64).await; - } + embassy_time::Timer::after(light_sleep).await; } else { - embassy_time::Timer::after_millis(self.polling_interval as u64).await; + embassy_time::Timer::after(self.polling_interval).await; } } else { - embassy_time::Timer::after_millis(self.polling_interval as u64).await; + embassy_time::Timer::after(self.polling_interval).await; } if self.active_instant.elapsed().as_millis() > 1200 { - debug!("ADC Sleep"); self.adc_state = AdcState::LightSleep; // sleep :) } @@ -77,7 +77,7 @@ impl<'a, const PIN_NUM: usize, const EVENT_NUM: usize> InputDevice self.saadc.sample(buf).await; for (a, b) in self.buf[0].iter().zip(self.buf[1].iter()) { if i16::abs(a - b) > 150 { - debug!("Adc Active"); + debug!("ADC Active"); self.adc_state = AdcState::Active; self.active_instant = Instant::now(); break; @@ -87,11 +87,7 @@ impl<'a, const PIN_NUM: usize, const EVENT_NUM: usize> InputDevice self.event_state = 0; } - let buf = if self.buf_state { - &self.buf[0] - } else { - &self.buf[1] - }; + let buf = if self.buf_state { &self.buf[0] } else { &self.buf[1] }; let ret_e = match self.event_type[self.event_state as usize] { AnalogEventType::Joystick(sz) => { @@ -116,8 +112,7 @@ impl<'a, const PIN_NUM: usize, const EVENT_NUM: usize> InputDevice error!("Joystick with more than 3 dimensions or empty is not supported. Skip this event"); } else { for i in 0..core::cmp::min(sz, 2) { - e[i as usize].value = - (buf[self.channel_state as usize] + i16::MIN / 2).saturating_mul(2); + e[i as usize].value = (buf[self.channel_state as usize] + i16::MIN / 2).saturating_mul(2); self.channel_state += 1; } } diff --git a/rmk/src/input_device/battery.rs b/rmk/src/input_device/battery.rs index f32174046..91c62d6c6 100644 --- a/rmk/src/input_device/battery.rs +++ b/rmk/src/input_device/battery.rs @@ -1,15 +1,61 @@ -use crate::{event::Event, input_device::ProcessResult, KeyMap}; use core::cell::RefCell; -use super::InputProcessor; +use embedded_hal::digital::InputPin; -pub struct BatteryProcessor< - 'a, - const ROW: usize, - const COL: usize, - const NUM_LAYER: usize, - const NUM_ENCODER: usize, -> { +use super::{InputDevice, InputProcessor}; +use crate::event::Event; +use crate::input_device::ProcessResult; +use crate::KeyMap; + +pub struct ChargingStateReader { + // Charging state pin or standby pin + state_input: I, + // True: low represents charging, False: high represents charging + low_active: bool, + // True: charging, False: not charging + current_charging_state: bool, + // First read done + first_read: bool, +} + +impl ChargingStateReader { + pub fn new(state_input: I, low_active: bool) -> Self { + Self { + state_input, + low_active, + current_charging_state: false, + first_read: false, + } + } +} + +impl InputDevice for ChargingStateReader { + async fn read_event(&mut self) -> Event { + // For the first read, don't check whether the charging state is changed + if !self.first_read { + let charging_state = self.state_input.is_low().unwrap_or(false); + self.current_charging_state = charging_state; + self.first_read = true; + return Event::ChargingState(charging_state); + } + + loop { + // Detect charging state + let charging_state = self.state_input.is_low().unwrap_or(false); + + // Only send event when charging state changes + if charging_state != self.current_charging_state { + self.current_charging_state = charging_state; + return Event::ChargingState(charging_state); + } + + // Check charging state every 5 seconds + embassy_time::Timer::after_secs(5).await; + } + } +} + +pub struct BatteryProcessor<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_ENCODER: usize> { keymap: &'a RefCell>, adc_divider_measured: u32, adc_divider_total: u32, @@ -30,7 +76,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E } } - #[cfg(feature = "_nrf_ble")] + #[cfg(feature = "_ble")] fn get_battery_percent(&self, val: u16) -> u8 { // Avoid overflow let val = val as i32; @@ -68,16 +114,41 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E } impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_ENCODER: usize> - InputProcessor<'a, ROW, COL, NUM_LAYER, NUM_ENCODER> - for BatteryProcessor<'a, ROW, COL, NUM_LAYER, NUM_ENCODER> + InputProcessor<'a, ROW, COL, NUM_LAYER, NUM_ENCODER> for BatteryProcessor<'a, ROW, COL, NUM_LAYER, NUM_ENCODER> { async fn process(&mut self, event: Event) -> ProcessResult { match event { Event::Battery(val) => { - info!("Detected battery ADC value: {:?}", val); - // failing to send is permitted, because the update frequency is not critical - #[cfg(feature = "_nrf_ble")] - crate::channel::BATTERY_LEVEL_SIGNAL.signal(self.get_battery_percent(val)); + debug!("Detected battery ADC value: {:?}", val); + + #[cfg(feature = "_ble")] + { + let current_value = + crate::ble::trouble::battery_service::BATTERY_LEVEL.load(core::sync::atomic::Ordering::Relaxed); + if current_value > 100 || current_value == 255 { + // When charging, don't update the battery level(which is inaccurate) + crate::ble::trouble::battery_service::BATTERY_LEVEL + .store(self.get_battery_percent(val), core::sync::atomic::Ordering::Relaxed); + } + } + ProcessResult::Stop + } + Event::ChargingState(charging) => { + info!("Charging state changed: {:?}", charging); + + #[cfg(feature = "_ble")] + { + if charging { + crate::ble::trouble::battery_service::BATTERY_LEVEL + .store(101, core::sync::atomic::Ordering::Relaxed); + } else { + // When discharging, the battery level is changed to 255(not available) + // Then wait for the `Event::Battery` to update the battery level to real value + crate::ble::trouble::battery_service::BATTERY_LEVEL + .store(255, core::sync::atomic::Ordering::Relaxed); + } + } + ProcessResult::Stop } _ => ProcessResult::Continue(event), diff --git a/rmk/src/input_device/joystick.rs b/rmk/src/input_device/joystick.rs index ea763d072..35aefe67e 100644 --- a/rmk/src/input_device/joystick.rs +++ b/rmk/src/input_device/joystick.rs @@ -1,13 +1,12 @@ +use core::cell::RefCell; + use usbd_hid::descriptor::MouseReport; -use crate::{ - channel::KEYBOARD_REPORT_CHANNEL, - event::Event, - hid::Report, - input_device::{InputProcessor, ProcessResult}, - keymap::KeyMap, -}; -use core::cell::RefCell; +use crate::channel::KEYBOARD_REPORT_CHANNEL; +use crate::event::Event; +use crate::hid::Report; +use crate::input_device::{InputProcessor, ProcessResult}; +use crate::keymap::KeyMap; pub struct JoystickProcessor< 'a, @@ -24,14 +23,8 @@ pub struct JoystickProcessor< resolution: u16, } -impl< - 'a, - const ROW: usize, - const COL: usize, - const NUM_LAYER: usize, - const NUM_ENCODER: usize, - const N: usize, - > JoystickProcessor<'a, ROW, COL, NUM_LAYER, NUM_ENCODER, N> +impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_ENCODER: usize, const N: usize> + JoystickProcessor<'a, ROW, COL, NUM_LAYER, NUM_ENCODER, N> { pub fn new( transform: [[i16; N]; N], @@ -50,10 +43,7 @@ impl< async fn generate_report(&mut self) { let mut report = [0i16; N]; - debug!( - "JoystickProcessor::generate_report: record = {:?}", - self.record - ); + debug!("JoystickProcessor::generate_report: record = {:?}", self.record); for (rec, b) in self.record.iter_mut().zip(self.bias.iter()) { *rec = rec.saturating_add(*b); } @@ -82,14 +72,8 @@ impl< } } -impl< - 'a, - const ROW: usize, - const COL: usize, - const NUM_LAYER: usize, - const NUM_ENCODER: usize, - const N: usize, - > InputProcessor<'a, ROW, COL, NUM_LAYER, NUM_ENCODER> +impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_ENCODER: usize, const N: usize> + InputProcessor<'a, ROW, COL, NUM_LAYER, NUM_ENCODER> for JoystickProcessor<'a, ROW, COL, NUM_LAYER, NUM_ENCODER, N> { async fn process(&mut self, event: Event) -> ProcessResult { diff --git a/rmk/src/input_device/mod.rs b/rmk/src/input_device/mod.rs index 19f4e228c..c13aaa91d 100644 --- a/rmk/src/input_device/mod.rs +++ b/rmk/src/input_device/mod.rs @@ -4,7 +4,10 @@ //! The `InputDevice` trait provides the interface for individual input devices, and the macros facilitate their concurrent execution. use core::cell::RefCell; -use crate::{channel::KEYBOARD_REPORT_CHANNEL, event::Event, hid::Report, keymap::KeyMap}; +use crate::channel::KEYBOARD_REPORT_CHANNEL; +use crate::event::Event; +use crate::hid::Report; +use crate::keymap::KeyMap; pub mod adc; pub mod battery; @@ -67,14 +70,7 @@ pub enum ProcessResult { /// Take the normal keyboard as the example: /// /// The [`crate::matrix::Matrix`] is actually an input device and the [`crate::keyboard::Keyboard`] is actually an input processor. -pub trait InputProcessor< - 'a, - const ROW: usize, - const COL: usize, - const NUM_LAYER: usize, - const NUM_ENCODER: usize = 0, -> -{ +pub trait InputProcessor<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_ENCODER: usize = 0> { /// Process the incoming events, convert them to HID report [`Report`], /// then send the report to the USB/BLE. /// diff --git a/rmk/src/input_device/rotary_encoder.rs b/rmk/src/input_device/rotary_encoder.rs index 24da24c66..39d7b76f2 100644 --- a/rmk/src/input_device/rotary_encoder.rs +++ b/rmk/src/input_device/rotary_encoder.rs @@ -10,6 +10,7 @@ use postcard::experimental::max_size::MaxSize; use serde::{Deserialize, Serialize}; use usbd_hid::descriptor::{MediaKeyboardReport, MouseReport}; +use super::{InputDevice, InputProcessor, ProcessResult}; use crate::action::{Action, KeyAction}; use crate::channel::KEYBOARD_REPORT_CHANNEL; use crate::event::{Event, RotaryEncoderEvent}; @@ -18,8 +19,6 @@ use crate::keycode::{ConsumerKey, KeyCode}; use crate::keymap::KeyMap; use crate::usb::descriptor::KeyboardReport; -use super::{InputDevice, InputProcessor, ProcessResult}; - /// Holds current/old state and both [`InputPin`](https://docs.rs/embedded-hal/latest/embedded_hal/digital/trait.InputPin.html) #[derive(Clone, Debug)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] @@ -230,20 +229,13 @@ impl< #[cfg(feature = "async_matrix")] { let (pin_a, pin_b) = self.pins(); - embassy_futures::select::select( - pin_a.wait_for_any_edge(), - pin_b.wait_for_any_edge(), - ) - .await; + embassy_futures::select::select(pin_a.wait_for_any_edge(), pin_b.wait_for_any_edge()).await; } let direction = self.update(); if direction != Direction::None { - return Event::RotaryEncoder(RotaryEncoderEvent { - id: self.id, - direction, - }); + return Event::RotaryEncoder(RotaryEncoderEvent { id: self.id, direction }); } } } @@ -278,9 +270,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E async fn process(&mut self, event: Event) -> ProcessResult { match event { Event::RotaryEncoder(e) => { - let action = if let Some(encoder_action) = - self.get_keymap().borrow().get_encoder_with_layer_cache(e) - { + let action = if let Some(encoder_action) = self.get_keymap().borrow().get_encoder_with_layer_cache(e) { match e.direction { Direction::Clockwise => encoder_action.clockwise(), Direction::CounterClockwise => encoder_action.counter_clockwise(), @@ -404,10 +394,8 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E })) .await; embassy_time::Timer::after_millis(2).await; - self.send_report(Report::MediaKeyboardReport(MediaKeyboardReport { - usage_id: 0, - })) - .await; + self.send_report(Report::MediaKeyboardReport(MediaKeyboardReport { usage_id: 0 })) + .await; } // Send a keycode report for a single key diff --git a/rmk/src/keyboard.rs b/rmk/src/keyboard.rs index c4b17a0fc..0c3da66ba 100644 --- a/rmk/src/keyboard.rs +++ b/rmk/src/keyboard.rs @@ -1,26 +1,26 @@ +use core::cell::RefCell; + +use embassy_futures::select::select; +use embassy_futures::yield_now; +use embassy_time::{Duration, Instant, Timer}; +use heapless::{Deque, FnvIndexMap, Vec}; +use usbd_hid::descriptor::{MediaKeyboardReport, MouseReport, SystemControlReport}; + +use crate::action::{Action, KeyAction}; use crate::boot; use crate::channel::{KEYBOARD_REPORT_CHANNEL, KEY_EVENT_CHANNEL}; use crate::combo::{Combo, COMBO_MAX_LENGTH}; use crate::config::BehaviorConfig; -use crate::event::KeyEvent; +use crate::event::{KeyEvent, PressedKeyEvent}; +use crate::fork::{ActiveFork, StateBits, FORK_MAX_NUM}; use crate::hid::Report; +use crate::hid_state::{HidModifiers, HidMouseButtons}; use crate::input_device::Runnable; -use crate::usb::descriptor::KeyboardReport; -use crate::{ - action::{Action, KeyAction}, - fork::{ActiveFork, StateBits, FORK_MAX_NUM}, - hid_state::{HidModifiers, HidMouseButtons}, - keyboard_macro::{MacroOperation, NUM_MACRO}, - keycode::{KeyCode, ModifierCombination}, - keymap::KeyMap, - light::LedIndicator, - usb::descriptor::ViaReport, -}; -use core::cell::RefCell; -use embassy_futures::{select::select, yield_now}; -use embassy_time::{Instant, Timer}; -use heapless::{Deque, FnvIndexMap, Vec}; -use usbd_hid::descriptor::{MediaKeyboardReport, MouseReport, SystemControlReport}; +use crate::keyboard_macro::{MacroOperation, NUM_MACRO}; +use crate::keycode::{KeyCode, ModifierCombination}; +use crate::keymap::KeyMap; +use crate::light::LedIndicator; +use crate::usb::descriptor::{KeyboardReport, ViaReport}; /// State machine for one shot keys #[derive(Default)] @@ -53,11 +53,18 @@ impl { + self.drain_unreleased_tap_hold_events(event).await; + } + _ => { + // Process key event + let key_event = KEY_EVENT_CHANNEL.receive().await; + // Process the key change + self.process_inner(key_event).await; + } + }; // After processing the key change, check if there are unprocessed events // This will happen if there's recursion in key processing loop { @@ -66,6 +73,7 @@ impl { +pub(crate) static LOCK_LED_STATES: core::sync::atomic::AtomicU8 = core::sync::atomic::AtomicU8::new(0u8); + +pub struct Keyboard<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_ENCODER: usize = 0> { /// Keymap pub(crate) keymap: &'a RefCell>, /// Unprocessed events unprocessed_events: Vec, + /// pressed and unreleased events, for holding keys + unreleased_events: Vec, + /// Timer which records the timestamp of key changes pub(crate) timer: [[Option; ROW]; COL], @@ -163,10 +167,7 @@ pub struct Keyboard< impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_ENCODER: usize> Keyboard<'a, ROW, COL, NUM_LAYER, NUM_ENCODER> { - pub fn new( - keymap: &'a RefCell>, - behavior: BehaviorConfig, - ) -> Self { + pub fn new(keymap: &'a RefCell>, behavior: BehaviorConfig) -> Self { Keyboard { keymap, timer: [[None; ROW]; COL], @@ -189,6 +190,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E fork_states: [None; FORK_MAX_NUM], fork_keep_mask: HidModifiers::default(), unprocessed_events: Vec::new(), + unreleased_events: Vec::new(), registered_keys: [None; 6], held_modifiers: HidModifiers::default(), held_keycodes: [KeyCode::No; 6], @@ -218,6 +220,34 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E KEYBOARD_REPORT_CHANNEL.sender().send(report).await } + async fn drain_unreleased_tap_hold_events(&mut self, event: PressedKeyEvent) { + let time_left = event.deadline - Instant::now().as_millis(); + if time_left <= 5 { + // Process hold timeout + debug!("Hold timeout event eagerly: {:?}", event); + self.process_key_action_normal(event.hold_action, event.key_event).await; + } else { + //wait hold timeout of new common key + match select( + Timer::after(Duration::from_millis(time_left)), + KEY_EVENT_CHANNEL.receive(), + ) + .await + { + embassy_futures::select::Either::First(_) => { + // Process hold timeout + debug!("Hold timeout event matched: {:?}", event); + self.process_key_action_normal(event.hold_action, event.key_event).await; + self.tap_hold_release_key(event.key_event); + } + embassy_futures::select::Either::Second(key_event) => { + // Process key event + debug!("Interrupted by new key event: {:?}", key_event); + self.process_inner(key_event).await; + } + } + } + } /// Process key changes at (row, col) async fn process_inner(&mut self, key_event: KeyEvent) { // Matrix should process key pressed event first, record the timestamp of key changes @@ -226,17 +256,11 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E } // Process key - let key_action = self - .keymap - .borrow_mut() - .get_action_with_layer_cache(key_event); + let key_action = self.keymap.borrow_mut().get_action_with_layer_cache(key_event); if self.combo_on { if let Some(key_action) = self.process_combo(key_action, key_event).await { - debug!( - "Process key action after combo: {:?}, {:?}", - key_action, key_event - ); + // debug!("Process key action after combo processing: {:?}, {:?}", key_action, key_event); self.process_key_action(key_action, key_event).await; } } else { @@ -270,8 +294,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E /// Send media report if needed pub(crate) async fn send_media_report(&mut self) { - self.send_report(Report::MediaKeyboardReport(self.media_report)) - .await; + self.send_report(Report::MediaKeyboardReport(self.media_report)).await; self.media_report.usage_id = 0; yield_now().await; } @@ -279,8 +302,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E /// Send mouse report if needed pub(crate) async fn send_mouse_report(&mut self) { // Prevent mouse report flooding, set maximum mouse report rate to 50 HZ - self.send_report(Report::MouseReport(self.mouse_report)) - .await; + self.send_report(Report::MouseReport(self.mouse_report)).await; yield_now().await; } @@ -314,19 +336,20 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E match key_action { KeyAction::No | KeyAction::Transparent => (), - KeyAction::Single(a) => self.process_key_action_normal(a, key_event).await, - KeyAction::WithModifier(a, m) => { - self.process_key_action_with_modifier(a, m, key_event).await + KeyAction::Single(a) => { + debug!("Process Single key action: {:?}, {:?}", a, key_event); + if !self.unreleased_events.is_empty() && !key_event.pressed { + self.fire_all_holding_keys_into_press_action().await; + } + self.process_key_action_normal(a, key_event).await; } + KeyAction::WithModifier(a, m) => self.process_key_action_with_modifier(a, m, key_event).await, KeyAction::Tap(a) => self.process_key_action_tap(a, key_event).await, KeyAction::TapHold(tap_action, hold_action) => { self.process_key_action_tap_hold(tap_action, hold_action, key_event) .await; } - KeyAction::OneShot(oneshot_action) => { - self.process_key_action_oneshot(oneshot_action, key_event) - .await - } + KeyAction::OneShot(oneshot_action) => self.process_key_action_oneshot(oneshot_action, key_event).await, KeyAction::LayerTapHold(tap_action, layer_num) => { let layer_action = Action::LayerOn(layer_num); self.process_key_action_tap_hold(tap_action, layer_action, key_event) @@ -341,6 +364,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E if !key_event.pressed { // Record release of current key, which will be used in tap/hold processing + debug!("Records a release event: {:?}", key_event); let mut is_mod = false; if let KeyAction::Single(Action::Key(k)) = key_action { if k.is_modifier() { @@ -363,10 +387,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E } if !key_event.pressed { - for (i, fork) in (&self.keymap.borrow().behavior.fork.forks) - .into_iter() - .enumerate() - { + for (i, fork) in (&self.keymap.borrow().behavior.fork.forks).into_iter().enumerate() { if fork.trigger == key_action { if let Some(active) = self.fork_states[i] { // If the originating key of a fork is released, simply release the replacement key @@ -381,9 +402,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E let mut decision_state = StateBits { // "explicit modifiers" includes the effect of one-shot modifiers, held modifiers keys only modifiers: self.resolve_explicit_modifiers(key_event.pressed), - leds: LedIndicator::from_bits( - LOCK_LED_STATES.load(core::sync::atomic::Ordering::Relaxed), - ), + leds: LedIndicator::from_bits(LOCK_LED_STATES.load(core::sync::atomic::Ordering::Relaxed)), mouse: HidMouseButtons::from_bits(self.mouse_report.buttons), }; @@ -393,14 +412,8 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E let mut replacement = key_action; 'bind: loop { - for (i, fork) in (&self.keymap.borrow().behavior.fork.forks) - .into_iter() - .enumerate() - { - if !triggered_forks[i] - && self.fork_states[i].is_none() - && fork.trigger == replacement - { + for (i, fork) in (&self.keymap.borrow().behavior.fork.forks).into_iter().enumerate() { + if !triggered_forks[i] && self.fork_states[i].is_none() && fork.trigger == replacement { let decision = (fork.match_any & decision_state) != StateBits::default() && (fork.match_none & decision_state) == StateBits::default(); @@ -470,10 +483,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E // (explicit modifier suppressing effect will be stopped only AFTER the release hid report is sent) fn try_finish_forks(&mut self, original_key_action: KeyAction, key_event: KeyEvent) { if !key_event.pressed { - for (i, fork) in (&self.keymap.borrow().behavior.fork.forks) - .into_iter() - .enumerate() - { + for (i, fork) in (&self.keymap.borrow().behavior.fork.forks).into_iter().enumerate() { if self.fork_states[i].is_some() && fork.trigger == original_key_action { // if the originating key of a fork is released the replacement decision is not valid anymore self.fork_states[i] = None; @@ -482,11 +492,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E } } - async fn process_combo( - &mut self, - key_action: KeyAction, - key_event: KeyEvent, - ) -> Option { + async fn process_combo(&mut self, key_action: KeyAction, key_event: KeyEvent) -> Option { let mut is_combo_action = false; let current_layer = self.keymap.borrow().get_activated_layer(); for combo in self.keymap.borrow_mut().behavior.combo.combos.iter_mut() { @@ -494,11 +500,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E } if key_event.pressed && is_combo_action { - if self - .combo_actions_buffer - .push_back((key_action, key_event)) - .is_err() - { + if self.combo_actions_buffer.push_back((key_action, key_event)).is_err() { error!("Combo actions buffer overflowed! This is a bug and should not happen!"); } @@ -510,24 +512,16 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E .combo .combos .iter_mut() - .find_map(|combo| { - (combo.is_all_pressed() && !combo.is_triggered()).then_some(combo.trigger()) - }); + .find_map(|combo| (combo.is_all_pressed() && !combo.is_triggered()).then_some(combo.trigger())); if next_action.is_some() { self.combo_actions_buffer.clear(); - debug!( - "Combo action {:?} matched:: clearing combo buffer", - next_action - ); + debug!("Combo action {:?} matched:: clearing combo buffer", next_action); } else { - let timeout = - embassy_time::Timer::after(self.keymap.borrow().behavior.combo.timeout); + let timeout = embassy_time::Timer::after(self.keymap.borrow().behavior.combo.timeout); match select(timeout, KEY_EVENT_CHANNEL.receive()).await { embassy_futures::select::Either::First(_) => self.dispatch_combos().await, - embassy_futures::select::Either::Second(event) => { - self.unprocessed_events.push(event).unwrap() - } + embassy_futures::select::Either::Second(event) => self.unprocessed_events.push(event).unwrap(), } } next_action @@ -563,6 +557,90 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E .for_each(Combo::reset); } + /* + * release hold key + * FIXME triggerd hold to early + */ + async fn release_key_action(&mut self, hold_action: Action, _tap_action: Action, key_event_released: KeyEvent) { + debug!("Releasing key {:?}] ", key_event_released); + + // handling hold key release + if key_event_released.pressed { + error!("release key action with pressed key, should never happen"); + //never call this while press8ng key + return; + } + + let key_event = key_event_released; + let col = key_event_released.col as usize; + let row = key_event_released.row as usize; + + //check if any key is held for too long + if let Some(e) = self.tap_hold_release_key(key_event_released) { + debug!("Drop unreleased th! {:?}] , became tap pressing", e); + self.process_key_action_normal(e.tap_action, e.key_event).await; + debug!("then release {:?}", e); + self.process_key_action_normal(e.tap_action, key_event_released).await; + } else { + //ignore timer, should be fire by main loop + debug!("TH key is released, should be hold action"); + + if let Some(_) = self.timer[col][row] { + // Release hold action, wait for `post_wait_time`, then clear timer + + debug!( + "[Deprecated] HOLD releasing: {:?}, {}, wait for `post_wait_time` for new releases", + hold_action, key_event.pressed + ); + let wait_release = async { + loop { + let next_key_event = KEY_EVENT_CHANNEL.receive().await; + if !next_key_event.pressed { + self.unprocessed_events.push(next_key_event).ok(); + } else { + break next_key_event; + } + } + }; + + let wait_timeout = embassy_time::Timer::after_millis( + self.keymap.borrow().behavior.tap_hold.post_wait_time.as_millis(), + ); + + match select(wait_timeout, wait_release).await { + embassy_futures::select::Either::First(_) => { + // Wait timeout, release the hold key finally + self.process_key_action_normal(hold_action, key_event).await; + } + embassy_futures::select::Either::Second(next_press) => { + // Next press event comes, add hold release to unprocessed list first, then add next press + self.unprocessed_events.push(key_event).ok(); + self.unprocessed_events.push(next_press).ok(); + } + }; + } else { + self.process_key_action_normal(hold_action, key_event).await; + } + } + // Clear timer + self.timer[col][row] = None; + } + + async fn trigger_hold_key_action_unreleased(&mut self) { + if self.unreleased_events.len() == 0 { + return; + } else { + debug!("Trigger all un released key as hold"); + //check if any key is held for too long + for i in 0..self.unreleased_events.len() { + let action = self.unreleased_events[i].hold_action; + let key_event = self.unreleased_events[i].key_event; + self.process_key_action_normal(action, key_event).await; + self.unreleased_events.remove(i); + } + } + } + async fn process_key_action_normal(&mut self, action: Action, key_event: KeyEvent) { match action { Action::Key(key) => self.process_action_key(key, key_event).await, @@ -632,6 +710,8 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E /// Tap action, send a key when the key is pressed, then release the key. async fn process_key_action_tap(&mut self, action: Action, mut key_event: KeyEvent) { + debug!("TAP action: {:?}, {:?}", action, key_event); + if key_event.pressed { self.process_key_action_normal(action, key_event).await; @@ -671,27 +751,21 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E /// - When the next key is releasing /// - When current tap/hold key is releasing /// - When tap/hold key is expired - async fn process_key_action_tap_hold( - &mut self, - tap_action: Action, - hold_action: Action, - key_event: KeyEvent, - ) { + async fn process_key_action_tap_hold(&mut self, tap_action: Action, hold_action: Action, key_event: KeyEvent) { if self.keymap.borrow().behavior.tap_hold.enable_hrm { + //FIXME remove this + // If HRM is enabled, check whether it's a different key is in key streak if let Some(last_release_time) = self.last_release.2 { if key_event.pressed { - if last_release_time.elapsed() - < self.keymap.borrow().behavior.tap_hold.prior_idle_time - && !(key_event.row == self.last_release.0.row - && key_event.col == self.last_release.0.col) + if last_release_time.elapsed() < self.keymap.borrow().behavior.tap_hold.prior_idle_time + && !(key_event.row == self.last_release.0.row && key_event.col == self.last_release.0.col) { // The previous key is a different key and released within `prior_idle_time`, it's in key streak debug!("Key streak detected, trigger tap action"); self.process_key_action_tap(tap_action, key_event).await; return; - } else if last_release_time.elapsed() - < self.keymap.borrow().behavior.tap_hold.hold_timeout + } else if last_release_time.elapsed() < self.keymap.borrow().behavior.tap_hold.hold_timeout && key_event.row == self.last_release.0.row && key_event.col == self.last_release.0.col { @@ -709,63 +783,26 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E let row = key_event.row as usize; let col = key_event.col as usize; + + //new hold key pressed , should push into unreleased events if key_event.pressed { // Press - self.timer[col][row] = Some(Instant::now()); - - let hold_timeout = embassy_time::Timer::after_millis( - self.keymap - .borrow() - .behavior - .tap_hold - .hold_timeout - .as_millis(), - ); - match select(hold_timeout, KEY_EVENT_CHANNEL.receive()).await { - embassy_futures::select::Either::First(_) => { - // Timeout, trigger hold - debug!("Hold timeout, got HOLD: {:?}, {:?}", hold_action, key_event); - self.process_key_action_normal(hold_action, key_event).await; - } - embassy_futures::select::Either::Second(e) => { - if e.row == key_event.row && e.col == key_event.col { - // If it's same key event and releasing within `hold_timeout`, trigger tap - if !e.pressed { - let elapsed = self.timer[col][row].unwrap().elapsed().as_millis(); - debug!("TAP action: {:?}, time elapsed: {}ms", tap_action, elapsed); - self.process_key_action_tap(tap_action, key_event).await; - - // Clear timer - self.timer[col][row] = None; - } - } else { - // A different key comes - // If it's a release event, the key is pressed BEFORE tap/hold key, so it should be regarded as a normal key - self.unprocessed_events.push(e).ok(); - if !e.pressed { - // we push the current tap/hold event again, the loop will process the release first, then re-process current tap/hold - self.unprocessed_events.push(key_event).ok(); - return; - } - - // Wait for key release, record all pressed keys during this - loop { - let next_key_event = KEY_EVENT_CHANNEL.receive().await; - self.unprocessed_events.push(next_key_event).ok(); - if !next_key_event.pressed { - break; - } - } - - // Process hold action - self.process_key_action_normal(hold_action, key_event).await; + let holdTimeOutValue = self.keymap.borrow().behavior.tap_hold.hold_timeout.as_millis(); + let now = Instant::now().as_millis(); + let pressedKeyEvent: PressedKeyEvent = PressedKeyEvent { + key_event, + tap_action, + hold_action, + pressed_time: Instant::now(), + deadline: now + holdTimeOutValue, + }; - // All other unprocessed events will be processed later - } - } - } + //TODO processing passed time + self.timer[col][row] = Some(pressedKeyEvent.pressed_time); + //save unprocessed key + self.tap_hold_save_new_pressed(pressedKeyEvent); } else { - // Release + // Release a th key, should check timeout for tap // find holding_after_tap key_event if let Some(index) = self.hold_after_tap.iter().position(|&k| { @@ -780,64 +817,123 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E self.hold_after_tap[index] = None; return; } - if self.timer[col][row].is_some() { - // Release hold action, wait for `post_wait_time`, then clear timer + + //check unreleased event and remove key with same rol and col + self.release_key_action(hold_action, tap_action, key_event).await; + } + } + + async fn process_key_action_holding( + &mut self, + _hold_timeout: Timer, + pressedKeyEvent: PressedKeyEvent, + ) -> Result<(), bool> { + let key_event = pressedKeyEvent.key_event; + + let hold_action = pressedKeyEvent.hold_action; + let tap_action = pressedKeyEvent.tap_action; + let deadline = pressedKeyEvent.deadline; + + let now = Instant::now().as_millis(); + let row = key_event.row as usize; + let col = key_event.col as usize; + + let hold_timeout = embassy_time::Timer::after_millis(deadline - now); + + //wait HOLD TIMEOUT for tap hold key + //TODO select unreleased keys at the same time + match select(hold_timeout, KEY_EVENT_CHANNEL.receive()).await { + embassy_futures::select::Either::First(_) => { + // Timeout, trigger hold debug!( - "HOLD releasing: {:?}, {}, wait for `post_wait_time` for new releases", - hold_action, key_event.pressed + "Holding timeout, key {:?} with code th!({:?},{:?}) trigger hold behavior", + key_event, hold_action, tap_action ); - let wait_release = async { - loop { - let next_key_event = KEY_EVENT_CHANNEL.receive().await; - if !next_key_event.pressed { - self.unprocessed_events.push(next_key_event).ok(); - } else { - break next_key_event; - } - } - }; + self.process_key_action_normal(hold_action, key_event).await; + Ok(()) + } - let wait_timeout = embassy_time::Timer::after_millis( - self.keymap - .borrow() - .behavior - .tap_hold - .post_wait_time - .as_millis(), - ); - match select(wait_timeout, wait_release).await { - embassy_futures::select::Either::First(_) => { - // Wait timeout, release the hold key finally - self.process_key_action_normal(hold_action, key_event).await; + embassy_futures::select::Either::Second(e) => { + // self.process_key_action_unreleased(key_event).await; + + //quick path for self releasing + if e.row == key_event.row && e.col == key_event.col { + debug!( + "self releasing {:?} before hold timeout: th!({:?},{:?})", + e, tap_action, hold_action + ); + // If it's same key event and releasing within `hold_timeout`, trigger tap + if !e.pressed { + let elapsed = self.timer[col][row].unwrap().elapsed().as_millis(); + debug!("TAP action: {:?}, time elapsed: {} ms", tap_action, elapsed); + // self.trigger_hold_key_action_unreleased().await; + self.process_key_action_tap(tap_action, key_event).await; + + // Clear timer + self.timer[col][row] = None; + self.tap_hold_release_key(key_event); + } else { + //TODO ignore pressed again, should never happen + warn!("Unexpected self release action: {:?}, ignored", tap_action); } - embassy_futures::select::Either::Second(next_press) => { - // Next press event comes, add hold release to unprocessed list first, then add next press - self.unprocessed_events.push(key_event).ok(); - self.unprocessed_events.push(next_press).ok(); + return Ok(()); + } else { + //new key arrive before timeout + debug!( + "New key {:?} arriving before hold timeout: th!({:?},{:?})", + e, tap_action, hold_action + ); + // A different key comes + if !e.pressed { + // If it's a release event, the key is pressed BEFORE tap/hold key, so it should be regarded as a normal key + debug!("New key released: {:?}, fire all holding keys", e); + + self.fire_all_holding_keys_into_press_action().await; + + self.unreleased_events.push(pressedKeyEvent).ok(); + } else { + // new pressed key, save current key to unreleased keys; + debug!("Save pressed key: {:?}, {:?}", hold_action, key_event); + self.unprocessed_events.push(e).ok(); } - }; - // Clear timer - self.timer[col][row] = None; - } else { - // The timer has been reset, fire hold release event - debug!("HOLD releasing: {:?}, {}", hold_action, key_event.pressed); - self.process_key_action_normal(hold_action, key_event).await; + + return Ok(()); + // Wait for key release, record all pressed keys during this + // loop { + // let next_key_event = KEY_EVENT_CHANNEL.receive().await; + // if !next_key_event.pressed { + + // // check self release for rolling keys + // if next_key_event.row == key_event.row && next_key_event.col == key_event.col { + // // release self before hold timeout, trigger tap + // self.process_key_action_tap(tap_action, key_event).await; + // // clean timer + // self.timer[col][row] = None; + // return; + // } else { + // self.unprocessed_events.push(next_key_event).ok(); + // // release other key , trigger hold + // break; + // } + // } else { + // self.unprocessed_events.push(next_key_event).ok(); + // } + // } + + // // Process hold action + // self.process_key_action_normal(hold_action, key_event).await; + + // All other unprocessed events will be processed later + } } } } - /// Process one shot action. async fn process_key_action_oneshot(&mut self, oneshot_action: Action, key_event: KeyEvent) { match oneshot_action { - Action::Modifier(m) => { - self.process_action_osm(m.to_hid_modifiers(), key_event) - .await - } + Action::Modifier(m) => self.process_action_osm(m.to_hid_modifiers(), key_event).await, Action::LayerOn(l) => self.process_action_osl(l, key_event).await, - _ => { - self.process_key_action_normal(oneshot_action, key_event) - .await - } + _ => self.process_key_action_normal(oneshot_action, key_event).await, } } @@ -858,8 +954,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E OneShotState::Initial(m) | OneShotState::Single(m) => { self.osm_state = OneShotState::Single(m); - let timeout = - embassy_time::Timer::after(self.keymap.borrow().behavior.one_shot.timeout); + let timeout = embassy_time::Timer::after(self.keymap.borrow().behavior.one_shot.timeout); match select(timeout, KEY_EVENT_CHANNEL.receive()).await { embassy_futures::select::Either::First(_) => { // Timeout, release modifiers @@ -913,8 +1008,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E OneShotState::Initial(l) | OneShotState::Single(l) => { self.osl_state = OneShotState::Single(l); - let timeout = - embassy_time::Timer::after(self.keymap.borrow().behavior.one_shot.timeout); + let timeout = embassy_time::Timer::after(self.keymap.borrow().behavior.one_shot.timeout); match select(timeout, KEY_EVENT_CHANNEL.receive()).await { embassy_futures::select::Either::First(_) => { // Timeout, deactivate layer @@ -942,7 +1036,9 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E async fn process_action_keycode(&mut self, mut key: KeyCode, key_event: KeyEvent) { if key == KeyCode::Again { key = self.last_key_code; + debug!("Repeat last key code: {:?} , {:?}", key, key_event); } else { + debug!("Last key code changed from {:?} to {:?}", self.last_key_code, key); self.last_key_code = key; } @@ -953,38 +1049,30 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E } else if key.is_mouse_key() { self.process_action_mouse(key, key_event).await; } else if key.is_user() { - #[cfg(feature = "_nrf_ble")] - use {crate::ble::nrf::profile::BleProfileAction, crate::channel::BLE_PROFILE_CHANNEL}; - #[cfg(feature = "_nrf_ble")] - if !key_event.pressed { - // Get user key id - let id = key as u8 - KeyCode::User0 as u8; - if id < 8 { - info!("Switch to profile: {}", id); - // User0~7: Swtich to the specific profile - BLE_PROFILE_CHANNEL - .send(BleProfileAction::SwitchProfile(id)) - .await; - } else if id == 8 { - // User8: Next profile - BLE_PROFILE_CHANNEL - .send(BleProfileAction::NextProfile) - .await; - } else if id == 9 { - // User9: Previous profile - BLE_PROFILE_CHANNEL - .send(BleProfileAction::PreviousProfile) - .await; - } else if id == 10 { - // User10: Clear profile - BLE_PROFILE_CHANNEL - .send(BleProfileAction::ClearProfile) - .await; - } else if id == 11 { - // User11: - BLE_PROFILE_CHANNEL - .send(BleProfileAction::ToggleConnection) - .await; + #[cfg(feature = "_ble")] + { + use crate::ble::trouble::profile::BleProfileAction; + use crate::channel::BLE_PROFILE_CHANNEL; + if !key_event.pressed { + // Get user key id + let id = key as u8 - KeyCode::User0 as u8; + if id < 8 { + info!("Switch to profile: {}", id); + // User0~7: Swtich to the specific profile + BLE_PROFILE_CHANNEL.send(BleProfileAction::SwitchProfile(id)).await; + } else if id == 8 { + // User8: Next profile + BLE_PROFILE_CHANNEL.send(BleProfileAction::NextProfile).await; + } else if id == 9 { + // User9: Previous profile + BLE_PROFILE_CHANNEL.send(BleProfileAction::PreviousProfile).await; + } else if id == 10 { + // User10: Clear profile + BLE_PROFILE_CHANNEL.send(BleProfileAction::ClearProfile).await; + } else if id == 11 { + // User11: + BLE_PROFILE_CHANNEL.send(BleProfileAction::ToggleConnection).await; + } } } } else if key.is_basic() { @@ -1282,45 +1370,36 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E let mut offset = 0; loop { // First, get the next macro operation - let (operation, new_offset) = self - .keymap - .borrow() - .get_next_macro_operation(macro_start_idx, offset); - + let (operation, new_offset) = + self.keymap.borrow().get_next_macro_operation(macro_start_idx, offset); // Execute the operation match operation { MacroOperation::Press(k) => { self.macro_texting = false; self.register_key(k, key_event); - self.send_keyboard_report_with_resolved_modifiers(true) - .await; + self.send_keyboard_report_with_resolved_modifiers(true).await; } MacroOperation::Release(k) => { self.macro_texting = false; self.unregister_key(k, key_event); - self.send_keyboard_report_with_resolved_modifiers(false) - .await; + self.send_keyboard_report_with_resolved_modifiers(false).await; } MacroOperation::Tap(k) => { self.macro_texting = false; self.register_key(k, key_event); - self.send_keyboard_report_with_resolved_modifiers(true) - .await; + self.send_keyboard_report_with_resolved_modifiers(true).await; embassy_time::Timer::after_millis(2).await; self.unregister_key(k, key_event); - self.send_keyboard_report_with_resolved_modifiers(false) - .await; + self.send_keyboard_report_with_resolved_modifiers(false).await; } MacroOperation::Text(k, is_cap) => { self.macro_texting = true; self.macro_caps = is_cap; self.register_keycode(k, key_event); - self.send_keyboard_report_with_resolved_modifiers(true) - .await; + self.send_keyboard_report_with_resolved_modifiers(true).await; embassy_time::Timer::after_millis(2).await; self.unregister_keycode(k, key_event); - self.send_keyboard_report_with_resolved_modifiers(false) - .await; + self.send_keyboard_report_with_resolved_modifiers(false).await; } MacroOperation::Delay(t) => { embassy_time::Timer::after_millis(t as u64).await; @@ -1328,8 +1407,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E MacroOperation::End => { if self.macro_texting { //restore the state of the keyboard (held modifiers, etc.) after text typing - self.send_keyboard_report_with_resolved_modifiers(false) - .await; + self.send_keyboard_report_with_resolved_modifiers(false).await; self.macro_texting = false; } break; @@ -1365,6 +1443,57 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E } } + //=============== holding keys + + // release all holding key into hold key action, ignore their timeout + async fn fire_all_holding_keys_into_press_action(&mut self) { + // If the slot is found, update the key in the slot + let unreleased_events: Vec = self.unreleased_events.iter().cloned().collect(); + debug!( + "Trigger all unreleased TH keys into hold action: {:?}", + unreleased_events + ); + self.unreleased_events.clear(); + for e in unreleased_events { + debug!("pressing key's hold action: {:?}", e.hold_action); + self.timer[e.key_event.col as usize][e.key_event.row as usize] = None; + self.process_key_action_normal(e.hold_action, e.key_event).await; + } + } + + // save pressed tap hold key into waiting list + fn tap_hold_save_new_pressed(&mut self, pressedKeyEvent: PressedKeyEvent) { + // If the slot is found, update the key in the slot + debug!("Save unreleased TapHold key: {:?}", pressedKeyEvent); + let _ = self.unreleased_events.push(pressedKeyEvent); + } + + //find same key position in unreleased events, marked as released + fn tap_hold_release_key(&mut self, key_event: KeyEvent) -> Option { + //release an unprocessed key + if let Some(pos) = self + .unreleased_events + .iter() + .position(|e| e.key_event.row == key_event.row && e.key_event.col == key_event.col) + { + debug!("Found pressed th key: {:?}", key_event); + let e = self.unreleased_events.remove(pos); + Some(e) + } else { + None + } + } + + //find the miniest deadline event + fn find_first_deadline_event(&mut self) -> Option { + //release an unprocessed key + if self.unreleased_events.len() > 0 { + return Some(self.unreleased_events.iter().min_by_key(|e| e.deadline).cloned()?); + } else { + return None?; + } + } + /// Register a key to be sent in hid report. fn register_keycode(&mut self, key: KeyCode, key_event: KeyEvent) { // First, find the key event slot according to the position @@ -1444,21 +1573,24 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E #[cfg(test)] mod test { - use super::*; - use crate::action::KeyAction; - use crate::config::{BehaviorConfig, CombosConfig, ForksConfig}; - use crate::fork::Fork; - use crate::hid_state::HidModifiers; - use crate::{a, k, layer, mo}; use embassy_futures::block_on; use embassy_futures::select::select; - use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, mutex::Mutex}; + use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; + use embassy_sync::mutex::Mutex; use embassy_time::{Duration, Timer}; use futures::{join, FutureExt}; use rusty_fork::rusty_fork_test; + use super::*; + use crate::action::KeyAction; + use crate::config::{BehaviorConfig, CombosConfig, ForksConfig}; + use crate::fork::Fork; + use crate::hid_state::HidModifiers; + use crate::{a, k, layer, mo, th}; + // mod key values const KC_LSHIFT: u8 = 1 << 1; + const KC_LGUI: u8 = 1 << 3; #[derive(Debug, Clone)] struct TestKeyPress { @@ -1511,16 +1643,17 @@ mod test { }, // Verify reports async { + let mut report_index = -1; for expected in expected_reports { match KEYBOARD_REPORT_CHANNEL.receive().await { Report::KeyboardReport(report) => { + report_index += 1; + // println!("Received {}th report from channel: {:?}", report_index, report); assert_eq!( - report, expected, - "Expected {:?} but actually {:?}", - expected, report + expected, report, + "on {}th reports, expected left but actually right", + report_index ); - - println!("Received expected key report: {:?}", report); } _ => panic!("Expected a KeyboardReport"), } @@ -1571,7 +1704,6 @@ mod test { reports }}; } - // Init logger for tests #[ctor::ctor] fn init_log() { @@ -1587,7 +1719,7 @@ mod test { layer!([ [k!(Grave), k!(Kc1), k!(Kc2), k!(Kc3), k!(Kc4), k!(Kc5), k!(Kc6), k!(Kc7), k!(Kc8), k!(Kc9), k!(Kc0), k!(Minus), k!(Equal), k!(Backspace)], [k!(Tab), k!(Q), k!(W), k!(E), k!(R), k!(T), k!(Y), k!(U), k!(I), k!(O), k!(P), k!(LeftBracket), k!(RightBracket), k!(Backslash)], - [k!(Escape), k!(A), k!(S), k!(D), k!(F), k!(G), k!(H), k!(J), k!(K), k!(L), k!(Semicolon), k!(Quote), a!(No), k!(Enter)], + [k!(Escape), th!(A, LShift), th!(S, LGui), k!(D), k!(F), k!(G), k!(H), k!(J), k!(K), k!(L), k!(Semicolon), k!(Quote), a!(No), k!(Enter)], [k!(LShift), k!(Z), k!(X), k!(C), k!(V), k!(B), k!(N), k!(M), k!(Comma), k!(Dot), k!(Slash), a!(No), a!(No), k!(RShift)], [k!(LCtrl), k!(LGui), k!(LAlt), a!(No), a!(No), k!(Space), a!(No), a!(No), a!(No), mo!(1), k!(RAlt), a!(No), k!(RGui), k!(RCtrl)] ]), @@ -1601,6 +1733,7 @@ mod test { ] } + #[rustfmt::skip] fn get_combos_config() -> CombosConfig { // Define the function to return the appropriate combo configuration CombosConfig { @@ -1649,6 +1782,7 @@ mod test { } rusty_fork_test! { + #[test] fn test_register_key() { let main = async { @@ -1658,25 +1792,23 @@ mod test { }; block_on(main); } - } - rusty_fork_test! { + #[test] fn test_basic_key_press_release() { let main = async { let mut keyboard = create_test_keyboard(); // Press A key - keyboard.process_inner(key_event(2, 1, true)).await; - assert_eq!(keyboard.held_keycodes[0], KeyCode::A); // A key's HID code is 0x04 + keyboard.process_inner(key_event(0, 0, true)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::Grave); // A key's HID code is 0x04 // Release A key - keyboard.process_inner(key_event(2, 1, false)).await; + keyboard.process_inner(key_event(0, 0, false)).await; assert_eq!(keyboard.held_keycodes[0], KeyCode::No); }; block_on(main); } - } - rusty_fork_test! { + #[test] fn test_modifier_key() { let main = async { @@ -1684,10 +1816,7 @@ mod test { // Press Shift key keyboard.register_key(KeyCode::LShift, key_event(3, 0, true)); - assert_eq!( - keyboard.held_modifiers, - HidModifiers::new().with_left_shift(true) - ); // Left Shift's modifier bit is 0x02 + assert_eq!(keyboard.held_modifiers, HidModifiers::new().with_left_shift(true)); // Left Shift's modifier bit is 0x02 // Release Shift key keyboard.unregister_key(KeyCode::LShift, key_event(3, 0, false)); @@ -1695,20 +1824,102 @@ mod test { }; block_on(main); } + + #[test] + fn test_tap_hold_key_multi_hold() { + + let main = async { + let mut keyboard = create_test_keyboard(); + + + let sequence = key_sequence![ + [2, 1, true, 10], // Press th!(A,shift) + [2, 2, true, 10], // press th!(S,lgui) + //hold timeout + [2, 3, true, 270], // press d + [2, 3, false, 290], // release d + [2, 1, false, 380], // Release A + [2, 2, false, 400], // Release s + ]; + let expected_reports = key_report![ + [KC_LSHIFT, [0, 0, 0, 0, 0, 0]], //shift + [KC_LSHIFT|KC_LGUI, [0, 0, 0, 0, 0, 0]], //shift + [KC_LSHIFT|KC_LGUI, [KeyCode::D as u8, 0, 0, 0, 0, 0]], // 0x7 + [KC_LSHIFT|KC_LGUI, [0, 0, 0, 0, 0, 0]], //shift + [KC_LGUI, [0, 0, 0, 0, 0, 0]], //shift and gui + [0, [0, 0, 0, 0, 0, 0]], + ]; + + run_key_sequence_test(&mut keyboard, &sequence, expected_reports).await; + }; + block_on(main); } - rusty_fork_test! { + #[test] - fn test_tap_hold_key() { + fn test_taphold_tap() { let main = async { let mut keyboard = create_test_keyboard(); - let tap_hold_action = - KeyAction::TapHold(Action::Key(KeyCode::A), Action::Key(KeyCode::LShift)); + + let sequence = key_sequence![ + [2, 1, true, 10], // Press TH shift A + //release before hold timeout + [2, 1, false, 100], // Release A + ]; + + let expected_reports = key_report![ + //should be a tapping A + [0, [0x04, 0, 0, 0, 0, 0]], + ]; + + run_key_sequence_test(&mut keyboard, &sequence, expected_reports).await; + }; + block_on(main); + } + + + #[test] + fn test_taphold_hold() { + let main = async { + let mut keyboard = create_test_keyboard(); + + let sequence = key_sequence![ + [2, 1, true, 10], // Press TH shift A + [2, 1, false, 300], // Release A + ]; + + let expected_reports = key_report![ + //tap on a + [2, [0, 0, 0, 0, 0, 0]], + ]; + + run_key_sequence_test(&mut keyboard, &sequence, expected_reports).await; + }; + block_on(main); + } + #[test] + fn test_tap_hold_key_tap_and_single_hold() { + + let main = async { + let mut keyboard = create_test_keyboard(); + let tap_hold_action = KeyAction::TapHold(Action::Key(KeyCode::A), Action::Key(KeyCode::LShift)); // Tap - keyboard - .process_key_action(tap_hold_action.clone(), key_event(2, 1, true)) - .await; - Timer::after(Duration::from_millis(10)).await; + join!( + keyboard.process_key_action(tap_hold_action.clone(), key_event(2, 1, true)), + Timer::after(Duration::from_millis(10)).then( |_| async { + //send release event + KEY_EVENT_CHANNEL.send(key_event(2, 1, false)).await; + }) + ); + + + match KEYBOARD_REPORT_CHANNEL.receive().await { + Report::KeyboardReport(report) => + assert_eq!(report.keycodes[0], 0x4), // A should be released + _ => panic!("Expected a Tap on A, but received a different report type"), + }; + + // a released keyboard .process_key_action(tap_hold_action.clone(), key_event(2, 1, false)) .await; @@ -1720,10 +1931,7 @@ mod test { .process_key_action(tap_hold_action.clone(), key_event(2, 1, true)) .await; Timer::after(Duration::from_millis(200)).await; // wait for hold timeout - assert_eq!( - keyboard.held_modifiers, - HidModifiers::new().with_left_shift(true) - ); // should activate Shift modifier + assert_eq!(keyboard.held_modifiers, HidModifiers::new().with_left_shift(true)); // should activate Shift modifier assert_eq!(keyboard.held_keycodes[0], KeyCode::No); // A should not be pressed keyboard @@ -1733,8 +1941,7 @@ mod test { }; block_on(main); } - } - rusty_fork_test! { + #[test] fn test_combo_timeout_and_ignore() { let main = async { @@ -1757,8 +1964,7 @@ mod test { block_on(main); } - } - rusty_fork_test! { + #[test] fn test_combo_with_mod_then_mod_timeout() { let main = async { @@ -1787,9 +1993,7 @@ mod test { block_on(main); } - } - rusty_fork_test! { #[test] fn test_combo_with_mod() { let main = async { @@ -1819,38 +2023,29 @@ mod test { block_on(main); } - } - rusty_fork_test! { #[test] fn test_multiple_keys() { let main = async { let mut keyboard = create_test_keyboard(); - keyboard.process_inner(key_event(2, 1, true)).await; - assert!(keyboard.held_keycodes.contains(&KeyCode::A)); + keyboard.process_inner(key_event(0, 0, true)).await; + assert!(keyboard.held_keycodes.contains(&KeyCode::Grave)); - keyboard.process_inner(key_event(3, 5, true)).await; - assert!( - keyboard.held_keycodes.contains(&KeyCode::A) - && keyboard.held_keycodes.contains(&KeyCode::B) - ); + keyboard.process_inner(key_event(1, 0, true)).await; + assert!(keyboard.held_keycodes.contains(&KeyCode::Grave) && keyboard.held_keycodes.contains(&KeyCode::Tab)); - keyboard.process_inner(key_event(3, 5, false)).await; - assert!( - keyboard.held_keycodes.contains(&KeyCode::A) - && !keyboard.held_keycodes.contains(&KeyCode::B) - ); + keyboard.process_inner(key_event(1, 0, false)).await; + assert!(keyboard.held_keycodes.contains(&KeyCode::Grave) && !keyboard.held_keycodes.contains(&KeyCode::Tab)); - keyboard.process_inner(key_event(2, 1, false)).await; - assert!(!keyboard.held_keycodes.contains(&KeyCode::A)); + keyboard.process_inner(key_event(0, 0, false)).await; + assert!(!keyboard.held_keycodes.contains(&KeyCode::Grave)); assert!(keyboard.held_keycodes.iter().all(|&k| k == KeyCode::No)); }; block_on(main); } - } - rusty_fork_test! { + #[test] fn test_repeat_key_single() { let main = async { @@ -1867,33 +2062,33 @@ mod test { assert_eq!(keyboard.held_keycodes[0], KeyCode::No); // A key's HID code is 0x04 // Press A key - keyboard.process_inner(key_event(2, 1, true)).await; - assert_eq!(keyboard.held_keycodes[0], KeyCode::A); // A key's HID code is 0x04 + keyboard.process_inner(key_event(2, 0, true)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::Escape); // A key's HID code is 0x04 // Release A key - keyboard.process_inner(key_event(2, 1, false)).await; + keyboard.process_inner(key_event(2, 0, false)).await; assert_eq!(keyboard.held_keycodes[0], KeyCode::No); // after another key is pressed, that key is repeated keyboard.process_inner(key_event(0, 0, true)).await; - assert_eq!(keyboard.held_keycodes[0], KeyCode::A); // A key's HID code is 0x04 + assert_eq!(keyboard.held_keycodes[0], KeyCode::Escape); // A key's HID code is 0x04 // releasing the repeat key keyboard.process_inner(key_event(0, 0, false)).await; assert_eq!(keyboard.held_keycodes[0], KeyCode::No); // A key's HID code is 0x04 // Press S key - keyboard.process_inner(key_event(2, 2, true)).await; - assert_eq!(keyboard.held_keycodes[0], KeyCode::S); // A key's HID code is 0x04 + keyboard.process_inner(key_event(1, 2, true)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::W); // A key's HID code is 0x04 // after another key is pressed, that key is repeated keyboard.process_inner(key_event(0, 0, true)).await; - assert_eq!(keyboard.held_keycodes[0], KeyCode::S); // A key's HID code is 0x04 + assert_eq!(keyboard.held_keycodes[0], KeyCode::W); // A key's HID code is 0x04 }; block_on(main); } - } - rusty_fork_test! { + + //fixme buggy #[test] fn test_repeat_key_th() { let main = async { @@ -1905,41 +2100,44 @@ mod test { KeyAction::TapHold(Action::Key(KeyCode::F), Action::Key(KeyCode::Again)), ); - // first press ever of the Again issues KeyCode:No - keyboard.process_inner(key_event(0, 0, true)).await; + keyboard.process_inner(key_event(0, 0, true)).await; // hold tap f keyboard .send_keyboard_report_with_resolved_modifiers(true) .await; - assert_eq!(keyboard.held_keycodes[0], KeyCode::No); // A key's HID code is 0x04 + // hold a ,should not output + assert_eq!(keyboard.held_keycodes[0], KeyCode::No); - // Press A key - keyboard.process_inner(key_event(2, 1, true)).await; - assert_eq!(keyboard.held_keycodes[0], KeyCode::A); // A key's HID code is 0x04 + keyboard.process_inner(key_event(1, 1, true)).await; // pre q + // hold q ,should output q + assert_eq!(keyboard.held_keycodes[0], KeyCode::Q); - // Release A key - keyboard.process_inner(key_event(2, 1, false)).await; + keyboard.process_inner(key_event(1, 1, false)).await; + // release q, should outputs nothing assert_eq!(keyboard.held_keycodes[0], KeyCode::No); - // after another key is pressed, that key is repeated - keyboard.process_inner(key_event(0, 0, true)).await; - assert_eq!(keyboard.held_keycodes[0], KeyCode::A); // A key's HID code is 0x04 + // release again + keyboard.process_inner(key_event(0, 0, false)).await; // - // releasing the repeat key + // press and release hold key + keyboard.process_inner(key_event(0, 0, true)).await; // press again + //force timeout + keyboard.fire_all_holding_keys_into_press_action().await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::Q); keyboard.process_inner(key_event(0, 0, false)).await; - assert_eq!(keyboard.held_keycodes[0], KeyCode::No); // A key's HID code is 0x04 - // Press S key - keyboard.process_inner(key_event(2, 2, true)).await; - assert_eq!(keyboard.held_keycodes[0], KeyCode::S); // A key's HID code is 0x04 + keyboard.process_inner(key_event(1, 2, true)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::W); // after another key is pressed, that key is repeated keyboard.process_inner(key_event(0, 0, true)).await; - assert_eq!(keyboard.held_keycodes[0], KeyCode::S); // A key's HID code is 0x04 + //force timeout + keyboard.fire_all_holding_keys_into_press_action().await; + keyboard.process_inner(key_event(0, 0, false)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::W); }; block_on(main); } - } - rusty_fork_test! { + #[test] fn test_key_action_transparent() { let main = async { @@ -1958,8 +2156,7 @@ mod test { }; block_on(main); } - } - rusty_fork_test! { + #[test] fn test_key_action_no() { let main = async { @@ -1987,7 +2184,6 @@ mod test { }) } - rusty_fork_test! { #[test] fn test_fork_with_held_modifier() { let main = async { @@ -2000,9 +2196,7 @@ mod test { ModifierCombination::default().with_shift(true), ), match_any: StateBits { - modifiers: HidModifiers::default() - .with_left_shift(true) - .with_right_shift(true), + modifiers: HidModifiers::default().with_left_shift(true).with_right_shift(true), leds: LedIndicator::default(), mouse: HidMouseButtons::default(), }, @@ -2017,9 +2211,7 @@ mod test { negative_output: KeyAction::Single(Action::Key(KeyCode::Comma)), positive_output: KeyAction::Single(Action::Key(KeyCode::Semicolon)), match_any: StateBits { - modifiers: HidModifiers::default() - .with_left_shift(true) - .with_right_shift(true), + modifiers: HidModifiers::default().with_left_shift(true).with_right_shift(true), leds: LedIndicator::default(), mouse: HidMouseButtons::default(), }, @@ -2049,53 +2241,51 @@ mod test { ); assert_eq!(keyboard.held_keycodes[0], KeyCode::Semicolon); - // //Release Dot key - // keyboard.process_inner(key_event(3, 9, false)).await; - // assert_eq!(keyboard.held_keycodes[0], KeyCode::No); - // assert_eq!( - // keyboard.resolve_modifiers(false), - // HidModifiers::new().with_left_shift(true) - // ); - - // // Release LShift key - // keyboard.process_inner(key_event(3, 0, false)).await; - // assert_eq!(keyboard.held_modifiers, HidModifiers::new()); - // assert_eq!(keyboard.resolve_modifiers(false), HidModifiers::new()); - - // // Press Comma key, by itself it should emit ',' - // keyboard.process_inner(key_event(3, 8, true)).await; - // assert_eq!(keyboard.held_keycodes[0], KeyCode::Comma); - - // // Release Dot key - // keyboard.process_inner(key_event(3, 8, false)).await; - // assert_eq!(keyboard.held_keycodes[0], KeyCode::No); - - // // Press LShift key - // keyboard.process_inner(key_event(3, 0, true)).await; - - // // Press Comma key, with shift it should emit ';' (shift is suppressed) - // keyboard.process_inner(key_event(3, 8, true)).await; - // assert_eq!(keyboard.resolve_modifiers(true), HidModifiers::new()); - // assert_eq!(keyboard.held_keycodes[0], KeyCode::Semicolon); - - // // Release Comma key, shift is still held - // keyboard.process_inner(key_event(3, 8, false)).await; - // assert_eq!(keyboard.held_keycodes[0], KeyCode::No); - // assert_eq!( - // keyboard.resolve_modifiers(false), - // HidModifiers::new().with_left_shift(true) - // ); - - // // Release LShift key - // keyboard.process_inner(key_event(3, 0, false)).await; - // assert_eq!(keyboard.held_modifiers, HidModifiers::new()); - // assert_eq!(keyboard.resolve_modifiers(false), HidModifiers::new()); + //Release Dot key + keyboard.process_inner(key_event(3, 9, false)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::No); + assert_eq!( + keyboard.resolve_modifiers(false), + HidModifiers::new().with_left_shift(true) + ); + + // Release LShift key + keyboard.process_inner(key_event(3, 0, false)).await; + assert_eq!(keyboard.held_modifiers, HidModifiers::new()); + assert_eq!(keyboard.resolve_modifiers(false), HidModifiers::new()); + + // Press Comma key, by itself it should emit ',' + keyboard.process_inner(key_event(3, 8, true)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::Comma); + + // Release Dot key + keyboard.process_inner(key_event(3, 8, false)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::No); + + // Press LShift key + keyboard.process_inner(key_event(3, 0, true)).await; + + // Press Comma key, with shift it should emit ';' (shift is suppressed) + keyboard.process_inner(key_event(3, 8, true)).await; + assert_eq!(keyboard.resolve_modifiers(true), HidModifiers::new()); + assert_eq!(keyboard.held_keycodes[0], KeyCode::Semicolon); + + // Release Comma key, shift is still held + keyboard.process_inner(key_event(3, 8, false)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::No); + assert_eq!( + keyboard.resolve_modifiers(false), + HidModifiers::new().with_left_shift(true) + ); + + // Release LShift key + keyboard.process_inner(key_event(3, 0, false)).await; + assert_eq!(keyboard.held_modifiers, HidModifiers::new()); + assert_eq!(keyboard.resolve_modifiers(false), HidModifiers::new()); }; block_on(main); } - } - rusty_fork_test! { #[test] fn test_fork_with_held_mouse_button() { let main = async { @@ -2114,9 +2304,7 @@ mod test { mouse: HidMouseButtons::default(), }, match_none: StateBits::default(), - kept_modifiers: HidModifiers::default() - .with_left_shift(true) - .with_right_shift(true), + kept_modifiers: HidModifiers::default().with_left_shift(true).with_right_shift(true), bindable: false, }; @@ -2135,90 +2323,85 @@ mod test { bindable: false, }; - let _keyboard = create_test_keyboard_with_forks(fork1, fork2); - - // // Press Z key, by itself it should emit 'MouseBtn5' - // keyboard.process_inner(key_event(3, 1, true)).await; - // assert_eq!(keyboard.held_keycodes[0], KeyCode::No); - // assert_eq!(keyboard.mouse_report.buttons, 1u8 << 4); // MouseBtn5 - - // // Release Z key - // keyboard.process_inner(key_event(3, 1, false)).await; - // assert_eq!(keyboard.held_keycodes[0], KeyCode::No); - // assert_eq!(keyboard.mouse_report.buttons, 0); - // - // // Press LCtrl key - // keyboard.process_inner(key_event(4, 0, true)).await; - // // Press LShift key - // keyboard.process_inner(key_event(3, 0, true)).await; - // assert_eq!( - // keyboard.resolve_modifiers(true), - // HidModifiers::new() - // .with_left_ctrl(true) - // .with_left_shift(true) - // ); - - // // Press 'Z' key, with Ctrl it should emit 'C', with suppressed ctrl, but kept shift - // keyboard.process_inner(key_event(3, 1, true)).await; - // assert_eq!( - // keyboard.resolve_modifiers(true), - // HidModifiers::new().with_left_shift(true) - // ); - // assert_eq!(keyboard.held_keycodes[0], KeyCode::C); - // assert_eq!(keyboard.mouse_report.buttons, 0); - - // // Release 'Z' key, suppression of ctrl is removed - // keyboard.process_inner(key_event(3, 1, false)).await; - // assert_eq!(keyboard.held_keycodes[0], KeyCode::No); - // assert_eq!( - // keyboard.resolve_modifiers(false), - // HidModifiers::new() - // .with_left_ctrl(true) - // .with_left_shift(true) - // ); - - // // Release LCtrl key - // keyboard.process_inner(key_event(4, 0, false)).await; - // assert_eq!( - // keyboard.resolve_modifiers(false), - // HidModifiers::new().with_left_shift(true) - // ); - - // // Release LShift key - // keyboard.process_inner(key_event(3, 0, false)).await; - // assert_eq!(keyboard.resolve_modifiers(false), HidModifiers::new()); - - // // Press 'A' key, by itself it should emit 'S' - // keyboard.process_inner(key_event(2, 1, true)).await; - // assert_eq!(keyboard.held_keycodes[0], KeyCode::S); - - // // Release 'A' key - // keyboard.process_inner(key_event(2, 1, false)).await; - // assert_eq!(keyboard.held_keycodes[0], KeyCode::No); - // assert_eq!(keyboard.resolve_modifiers(false), HidModifiers::new()); - // assert_eq!(keyboard.mouse_report.buttons, 0); - - // //Timer::after(Duration::from_millis(200)).await; // wait a bit - - // // Press Z key, by itself it should emit 'MouseBtn5' - // keyboard.process_inner(key_event(3, 1, true)).await; - // assert_eq!(keyboard.held_keycodes[0], KeyCode::No); - // assert_eq!(keyboard.mouse_report.buttons, 1u8 << 4); // MouseBtn5 //this fails, but ok in debug - why? - - // // Press 'A' key, with 'MouseBtn5' it should emit 'D' - // keyboard.process_inner(key_event(2, 1, true)).await; - // assert_eq!(keyboard.held_keycodes[0], KeyCode::D); - - // // Release Z (MouseBtn1) key, 'D' is still held - // keyboard.process_inner(key_event(3, 8, false)).await; - // assert_eq!(keyboard.held_keycodes[0], KeyCode::D); - - // // Release 'A' key -> releases 'D' - // keyboard.process_inner(key_event(2, 1, false)).await; - // assert_eq!(keyboard.held_keycodes[0], KeyCode::No); + let mut keyboard = create_test_keyboard_with_forks(fork1, fork2); + + // Press Z key, by itself it should emit 'MouseBtn5' + keyboard.process_inner(key_event(3, 1, true)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::No); + assert_eq!(keyboard.mouse_report.buttons, 1u8 << 4); // MouseBtn5 + + // Release Z key + keyboard.process_inner(key_event(3, 1, false)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::No); + assert_eq!(keyboard.mouse_report.buttons, 0); + + // Press LCtrl key + keyboard.process_inner(key_event(4, 0, true)).await; + // Press LShift key + keyboard.process_inner(key_event(3, 0, true)).await; + assert_eq!( + keyboard.resolve_modifiers(true), + HidModifiers::new().with_left_ctrl(true).with_left_shift(true) + ); + + // Press 'Z' key, with Ctrl it should emit 'C', with suppressed ctrl, but kept shift + keyboard.process_inner(key_event(3, 1, true)).await; + assert_eq!( + keyboard.resolve_modifiers(true), + HidModifiers::new().with_left_shift(true) + ); + assert_eq!(keyboard.held_keycodes[0], KeyCode::C); + assert_eq!(keyboard.mouse_report.buttons, 0); + + // Release 'Z' key, suppression of ctrl is removed + keyboard.process_inner(key_event(3, 1, false)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::No); + assert_eq!( + keyboard.resolve_modifiers(false), + HidModifiers::new().with_left_ctrl(true).with_left_shift(true) + ); + + // Release LCtrl key + keyboard.process_inner(key_event(4, 0, false)).await; + assert_eq!( + keyboard.resolve_modifiers(false), + HidModifiers::new().with_left_shift(true) + ); + + // Release LShift key + keyboard.process_inner(key_event(3, 0, false)).await; + assert_eq!(keyboard.resolve_modifiers(false), HidModifiers::new()); + + // Press 'A' key, by itself it should emit 'S' + keyboard.process_inner(key_event(2, 1, true)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::S); + + // Release 'A' key + keyboard.process_inner(key_event(2, 1, false)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::No); + assert_eq!(keyboard.resolve_modifiers(false), HidModifiers::new()); + assert_eq!(keyboard.mouse_report.buttons, 0); + + Timer::after(Duration::from_millis(200)).await; // wait a bit + + // Press Z key, by itself it should emit 'MouseBtn5' + keyboard.process_inner(key_event(3, 1, true)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::No); + assert_eq!(keyboard.mouse_report.buttons, 1u8 << 4); // MouseBtn5 //this fails, but ok in debug - why? + + // Press 'A' key, with 'MouseBtn5' it should emit 'D' + keyboard.process_inner(key_event(2, 1, true)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::D); + + // Release Z (MouseBtn1) key, 'D' is still held + keyboard.process_inner(key_event(3, 8, false)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::D); + + // Release 'A' key -> releases 'D' + keyboard.process_inner(key_event(2, 1, false)).await; + assert_eq!(keyboard.held_keycodes[0], KeyCode::No); }; block_on(main); } - } } diff --git a/rmk/src/keymap.rs b/rmk/src/keymap.rs index 0c6b17f46..ed0dad6a5 100644 --- a/rmk/src/keymap.rs +++ b/rmk/src/keymap.rs @@ -1,30 +1,23 @@ -use crate::{ - action::{EncoderAction, KeyAction}, - combo::{Combo, COMBO_MAX_NUM}, - config::BehaviorConfig, - event::{KeyEvent, RotaryEncoderEvent}, - keyboard_macro::{MacroOperation, MACRO_SPACE_SIZE}, - keycode::KeyCode, -}; -#[cfg(feature = "storage")] -use crate::{boot::reboot_keyboard, storage::Storage}; #[cfg(feature = "storage")] use embedded_storage_async::nor_flash::NorFlash; use num_enum::FromPrimitive; +use crate::action::{EncoderAction, KeyAction}; +use crate::combo::{Combo, COMBO_MAX_NUM}; +use crate::config::BehaviorConfig; +use crate::event::{KeyEvent, RotaryEncoderEvent}; +use crate::keyboard_macro::{MacroOperation, MACRO_SPACE_SIZE}; +use crate::keycode::KeyCode; +#[cfg(feature = "storage")] +use crate::{boot::reboot_keyboard, storage::Storage}; + /// Keymap represents the stack of layers. /// /// The conception of Keymap in rmk is borrowed from qmk: . /// /// Keymap should be binded to the actual pcb matrix definition. /// RMK detects hardware key strokes, uses tuple `(row, col, layer)` to retrieve the action from Keymap. -pub struct KeyMap< - 'a, - const ROW: usize, - const COL: usize, - const NUM_LAYER: usize, - const NUM_ENCODER: usize = 0, -> { +pub struct KeyMap<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_ENCODER: usize = 0> { /// Layers pub(crate) layers: &'a mut [[[KeyAction; COL]; ROW]; NUM_LAYER], /// Rotary encoders, each rotary encoder is represented as (Clockwise, CounterClockwise) @@ -143,11 +136,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E /// Get the next macro operation starting from given index and offset /// Return current macro operation and the next operations's offset - pub(crate) fn get_next_macro_operation( - &self, - macro_start_idx: usize, - offset: usize, - ) -> (MacroOperation, usize) { + pub(crate) fn get_next_macro_operation(&self, macro_start_idx: usize, offset: usize) -> (MacroOperation, usize) { let idx = macro_start_idx + offset; if idx >= self.macro_cache.len() - 1 { return (MacroOperation::End, offset); @@ -184,8 +173,8 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E (1, 4) => { // SS_QMK_PREFIX + SS_DELAY_CODE if idx + 3 < self.macro_cache.len() { - let delay_ms = (self.macro_cache[idx + 2] as u16 - 1) - + (self.macro_cache[idx + 3] as u16 - 1) * 255; + let delay_ms = + (self.macro_cache[idx + 2] as u16 - 1) + (self.macro_cache[idx + 3] as u16 - 1) * 255; (MacroOperation::Delay(delay_ms), offset + 4) } else { (MacroOperation::End, offset + 4) @@ -223,13 +212,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E } } - pub(crate) fn set_action_at( - &mut self, - row: usize, - col: usize, - layer_num: usize, - action: KeyAction, - ) { + pub(crate) fn set_action_at(&mut self, row: usize, col: usize, layer_num: usize, action: KeyAction) { self.layers[layer_num][row][col] = action; } @@ -272,10 +255,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E KeyAction::No } - pub(crate) fn get_encoder_with_layer_cache( - &self, - encoder_event: RotaryEncoderEvent, - ) -> Option<&EncoderAction> { + pub(crate) fn get_encoder_with_layer_cache(&self, encoder_event: RotaryEncoderEvent) -> Option<&EncoderAction> { let layer = self.get_activated_layer(); if let Some(encoders) = &self.encoders { encoders[layer as usize].get(encoder_event.id as usize) @@ -364,6 +344,7 @@ impl<'a, const ROW: usize, const COL: usize, const NUM_LAYER: usize, const NUM_E #[cfg(test)] mod test { + use super::{Combo, _reorder_combos}; use crate::combo::COMBO_MAX_NUM; use crate::fork::{Fork, StateBits, FORK_MAX_NUM}; use crate::hid_state::HidModifiers; @@ -371,8 +352,6 @@ mod test { use crate::keymap::_fill_vec; use crate::{action::KeyAction, keycode::KeyCode}; - use super::{Combo, _reorder_combos}; - #[test] fn test_fill_vec() { let mut combos: heapless::Vec<_, COMBO_MAX_NUM> = heapless::Vec::from_slice(&[ @@ -444,16 +423,7 @@ mod test { .collect(); assert_eq!( result, - vec![ - KeyCode::Z as u16, - KeyCode::Y as u16, - KeyCode::X as u16, - 0, - 0, - 0, - 0, - 0 - ] + vec![KeyCode::Z as u16, KeyCode::Y as u16, KeyCode::X as u16, 0, 0, 0, 0, 0] ); } } diff --git a/rmk/src/layout_macro.rs b/rmk/src/layout_macro.rs index b7cdde35d..a2c37848d 100644 --- a/rmk/src/layout_macro.rs +++ b/rmk/src/layout_macro.rs @@ -18,10 +18,7 @@ macro_rules! k { #[macro_export] macro_rules! wm { ($x: ident, $m: expr) => { - $crate::action::KeyAction::WithModifier( - $crate::action::Action::Key($crate::keycode::KeyCode::$x), - $m, - ) + $crate::action::KeyAction::WithModifier($crate::action::Action::Key($crate::keycode::KeyCode::$x), $m) }; } @@ -53,10 +50,7 @@ macro_rules! lm { #[macro_export] macro_rules! lt { ($x: literal, $k: ident) => { - $crate::action::KeyAction::LayerTapHold( - $crate::action::Action::Key($crate::keycode::KeyCode::$k), - $x, - ) + $crate::action::KeyAction::LayerTapHold($crate::action::Action::Key($crate::keycode::KeyCode::$k), $x) }; } @@ -64,10 +58,7 @@ macro_rules! lt { #[macro_export] macro_rules! mt { ($k: ident, $m: expr) => { - $crate::action::KeyAction::ModifierTapHold( - $crate::action::Action::Key($crate::keycode::KeyCode::$k), - $m, - ) + $crate::action::KeyAction::ModifierTapHold($crate::action::Action::Key($crate::keycode::KeyCode::$k), $m) }; } diff --git a/rmk/src/lib.rs b/rmk/src/lib.rs index 9602c1c04..6e06f5f39 100644 --- a/rmk/src/lib.rs +++ b/rmk/src/lib.rs @@ -18,43 +18,34 @@ include!(concat!(env!("OUT_DIR"), "/constants.rs")); // This mod MUST go first, so that the others see its macros. pub(crate) mod fmt; -#[cfg(feature = "_esp_ble")] -use crate::ble::esp::run_esp_ble_keyboard; -#[cfg(feature = "_nrf_ble")] -pub use crate::ble::nrf::initialize_nrf_sd_and_flash; -use crate::light::LightController; +use core::cell::RefCell; +use core::future::Future; +use core::sync::atomic::Ordering; + use config::{RmkConfig, VialConfig}; -use core::{ - cell::RefCell, - future::Future, - sync::atomic::{AtomicBool, AtomicU8}, -}; -pub use embassy_futures; use embassy_futures::select::{select4, Either4}; #[cfg(not(any(cortex_m)))] use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex as RawMutex; #[cfg(cortex_m)] use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex as RawMutex; -use embassy_time::Timer; +#[cfg(not(feature = "_no_usb"))] use embassy_usb::driver::Driver; -use embassy_usb::UsbDevice; use embedded_hal::digital::OutputPin; -pub use futures; use hid::{HidReaderTrait, HidWriterTrait, RunnableHidWriter}; use keymap::KeyMap; use light::{LedIndicator, LightService}; use matrix::MatrixTrait; -#[cfg(feature = "_nrf_ble")] -use nrf_softdevice::Softdevice; -pub use rmk_macro as macros; +use state::CONNECTION_STATE; +#[cfg(feature = "_ble")] +pub use trouble_host::prelude::HostResources; +#[cfg(feature = "_ble")] +use trouble_host::prelude::*; use usb::descriptor::ViaReport; use via::VialService; -#[cfg(all(not(feature = "_nrf_ble"), not(feature = "_no_usb")))] +#[cfg(all(not(feature = "_no_usb"), not(feature = "_ble")))] use { crate::light::UsbLedReader, - crate::usb::descriptor::{CompositeReport, KeyboardReport}, - crate::usb::{new_usb_builder, UsbKeyboardWriter}, - crate::via::UsbVialReaderWriter, + crate::usb::{add_usb_reader_writer, new_usb_builder, register_usb_writer, UsbKeyboardWriter}, }; #[cfg(feature = "storage")] use { @@ -63,10 +54,15 @@ use { embedded_storage_async::nor_flash::NorFlash as AsyncNorFlash, storage::Storage, }; +pub use {embassy_futures, futures, heapless, rmk_macro as macros}; +#[cfg(not(feature = "_ble"))] +use { + usb::descriptor::{CompositeReport, KeyboardReport}, + via::UsbVialReaderWriter, +}; -pub use heapless; -#[cfg(not(feature = "_no_usb"))] -use usb::{add_usb_reader_writer, register_usb_writer}; +use crate::light::LightController; +use crate::state::ConnectionState; pub mod action; #[cfg(feature = "_ble")] @@ -91,20 +87,12 @@ pub mod light; pub mod matrix; #[cfg(feature = "split")] pub mod split; +pub mod state; #[cfg(feature = "storage")] pub mod storage; pub(crate) mod usb; pub mod via; -/// Current connection type: -/// - 0: USB -/// - 1: BLE -/// - Other: reserved -pub(crate) static CONNECTION_TYPE: AtomicU8 = AtomicU8::new(0); -/// Whether the connection is ready. -/// After the connection is ready, the matrix starts scanning -pub(crate) static CONNECTION_STATE: AtomicBool = AtomicBool::new(false); - pub async fn initialize_keymap( default_keymap: &mut [[[action::KeyAction; COL]; ROW]; NUM_LAYER], behavior_config: config::BehaviorConfig, @@ -144,13 +132,7 @@ pub async fn initialize_encoder_keymap_and_storage< RefCell>, Storage, ) { - let mut storage = Storage::new( - flash, - default_keymap, - &Some(default_encoder_map), - storage_config, - ) - .await; + let mut storage = Storage::new(flash, default_keymap, &Some(default_encoder_map), storage_config).await; let keymap = RefCell::new( KeyMap::new_from_storage( @@ -182,17 +164,17 @@ pub async fn initialize_keymap_and_storage< ) { let mut storage = Storage::new(flash, default_keymap, &None, storage_config).await; - let keymap = RefCell::new( - KeyMap::new_from_storage(default_keymap, None, Some(&mut storage), behavior_config).await, - ); + let keymap = + RefCell::new(KeyMap::new_from_storage(default_keymap, None, Some(&mut storage), behavior_config).await); (keymap, storage) } #[allow(unreachable_code)] pub async fn run_rmk< 'a, + #[cfg(feature = "_ble")] C: Controller, #[cfg(feature = "storage")] F: AsyncNorFlash, - #[cfg(not(feature = "_no_usb"))] D: Driver<'static>, + #[cfg(not(feature = "_no_usb"))] D: Driver<'static>, // TODO: remove the static lifetime Out: OutputPin, const ROW: usize, const COL: usize, @@ -201,44 +183,30 @@ pub async fn run_rmk< >( keymap: &'a RefCell>, #[cfg(not(feature = "_no_usb"))] usb_driver: D, - #[cfg(feature = "storage")] mut storage: Storage, - mut light_controller: LightController, + #[cfg(feature = "_ble")] stack: &'a Stack<'a, C>, + #[cfg(feature = "storage")] storage: &mut Storage, + light_controller: &mut LightController, rmk_config: RmkConfig<'static>, - #[cfg(feature = "_nrf_ble")] sd: &mut Softdevice, ) -> ! { // Dispatch the keyboard runner - #[cfg(feature = "_nrf_ble")] - crate::ble::nrf::run_nrf_ble_keyboard( + #[cfg(feature = "_ble")] + crate::ble::trouble::run_ble( keymap, - &mut storage, #[cfg(not(feature = "_no_usb"))] usb_driver, - &mut light_controller, - rmk_config, - sd, - ) - .await; - - #[cfg(feature = "_esp_ble")] - run_esp_ble_keyboard( - keymap, - &mut storage, - #[cfg(not(feature = "_no_usb"))] - usb_driver, - &mut light_controller, + #[cfg(feature = "_ble")] + stack, + #[cfg(feature = "storage")] + storage, + light_controller, rmk_config, ) .await; // USB keyboard - #[cfg(all( - not(feature = "_nrf_ble"), - not(feature = "_no_usb"), - not(feature = "_esp_ble") - ))] + #[cfg(all(not(feature = "_no_usb"), not(feature = "_ble")))] { - let mut usb_builder: embassy_usb::Builder<'_, D> = - new_usb_builder(usb_driver, rmk_config.usb_config); + let mut usb_builder: embassy_usb::Builder<'_, D> = new_usb_builder(usb_driver, rmk_config.usb_config); let keyboard_reader_writer = add_usb_reader_writer!(&mut usb_builder, KeyboardReport, 1, 8); let mut other_writer = register_usb_writer!(&mut usb_builder, CompositeReport, 9); let mut vial_reader_writer = add_usb_reader_writer!(&mut usb_builder, ViaReport, 32, 32); @@ -249,9 +217,9 @@ pub async fn run_rmk< run_keyboard( keymap, #[cfg(feature = "storage")] - &mut storage, - run_usb_device(&mut usb_device), - &mut light_controller, + storage, + async { usb_device.run().await }, + light_controller, UsbLedReader::new(&mut keyboard_reader), UsbVialReaderWriter::new(&mut vial_reader_writer), UsbKeyboardWriter::new(&mut keyboard_writer, &mut other_writer), @@ -288,7 +256,7 @@ pub(crate) async fn run_keyboard< vial_config: VialConfig<'static>, ) { // The state will be changed to true after the keyboard starts running - CONNECTION_STATE.store(false, core::sync::atomic::Ordering::Release); + CONNECTION_STATE.store(ConnectionState::Connected.into(), Ordering::Release); let writer_fut = keyboard_writer.run_writer(); let mut light_service = LightService::new(light_controller, led_reader); let mut vial_service = VialService::new(keymap, vial_config, vial_reader_writer); @@ -297,34 +265,22 @@ pub(crate) async fn run_keyboard< let via_fut = vial_service.run(); #[cfg(feature = "storage")] - #[cfg(any(feature = "_ble", not(feature = "_no_external_storage")))] let storage_fut = storage.run(); - match select4( communication_task, - #[cfg(any(feature = "_ble", not(feature = "_no_external_storage")))] #[cfg(feature = "storage")] select(storage_fut, via_fut), #[cfg(not(feature = "storage"))] via_fut, - #[cfg(all(not(feature = "_ble"), feature = "_no_external_storage"))] - via_fut, led_fut, writer_fut, ) .await { - Either4::First(_) => error!("Communication or keyboard task has died"), - Either4::Second(_) => error!("Storage or vial task has died"), - Either4::Third(_) => error!("Led task has died"), - Either4::Fourth(_) => error!("Matrix or writer task has died"), + Either4::First(_) => error!("Communication task has ended"), + Either4::Second(_) => error!("Storage or vial task has ended"), + Either4::Third(_) => error!("Led task has ended"), + Either4::Fourth(_) => error!("Keyboard writer task has ended"), } - - warn!("Detected failure, restarting keyboard sevice after 1 second"); - Timer::after_secs(1).await; -} - -pub(crate) async fn run_usb_device<'d, D: Driver<'d>>(usb_device: &mut UsbDevice<'d, D>) { - CONNECTION_STATE.store(true, core::sync::atomic::Ordering::Release); - usb_device.run().await; + CONNECTION_STATE.store(ConnectionState::Disconnected.into(), Ordering::Release); } diff --git a/rmk/src/light.rs b/rmk/src/light.rs index 96535c688..7131681ff 100644 --- a/rmk/src/light.rs +++ b/rmk/src/light.rs @@ -1,14 +1,15 @@ -use crate::{ - config::{LightConfig, LightPinConfig}, - hid::{HidError, HidReaderTrait}, - keyboard::LOCK_LED_STATES, -}; -use bitfield_struct::bitfield; use core::ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, Not}; -use embassy_usb::{class::hid::HidReader, driver::Driver}; + +use bitfield_struct::bitfield; +use embassy_usb::class::hid::HidReader; +use embassy_usb::driver::Driver; use embedded_hal::digital::{Error, OutputPin, PinState}; use serde::{Deserialize, Serialize}; +use crate::config::{LightConfig, LightPinConfig}; +use crate::hid::{HidError, HidReaderTrait}; +use crate::keyboard::LOCK_LED_STATES; + #[bitfield(u8)] #[derive(Eq, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] @@ -60,13 +61,7 @@ impl BitOrAssign for LedIndicator { } impl LedIndicator { - pub const fn new_from( - num_lock: bool, - caps_lock: bool, - scroll_lock: bool, - compose: bool, - kana: bool, - ) -> Self { + pub const fn new_from(num_lock: bool, caps_lock: bool, scroll_lock: bool, compose: bool, kana: bool) -> Self { Self::new() .with_num_lock(num_lock) .with_caps_lock(caps_lock) @@ -145,11 +140,7 @@ struct SingleLed { impl SingleLed

{ fn new(p: LightPinConfig

) -> Self { - let on_state = if p.low_active { - PinState::Low - } else { - PinState::High - }; + let on_state = if p.low_active { PinState::Low } else { PinState::High }; Self { state: false, on_state, @@ -194,10 +185,7 @@ impl<'d, D: Driver<'d>> HidReaderTrait for UsbLedReader<'_, 'd, D> { async fn read_report(&mut self) -> Result { let mut buf = [0u8; 1]; - self.hid_reader - .read(&mut buf) - .await - .map_err(HidError::UsbReadError)?; + self.hid_reader.read(&mut buf).await.map_err(HidError::UsbReadError)?; LOCK_LED_STATES.store(buf[0], core::sync::atomic::Ordering::Relaxed); Ok(LedIndicator::from_bits(buf[0])) diff --git a/rmk/src/matrix.rs b/rmk/src/matrix.rs index 7d1d4b742..7bc006dba 100644 --- a/rmk/src/matrix.rs +++ b/rmk/src/matrix.rs @@ -1,15 +1,17 @@ -use crate::{ - debounce::{DebounceState, DebouncerTrait}, - event::{Event, KeyEvent}, - input_device::InputDevice, - CONNECTION_STATE, -}; use core::future::Future; +use core::sync::atomic::Ordering; + use embassy_time::{Instant, Timer}; use embedded_hal::digital::{InputPin, OutputPin}; #[cfg(feature = "async_matrix")] use {embassy_futures::select::select_slice, embedded_hal_async::digital::Wait, heapless::Vec}; +use crate::debounce::{DebounceState, DebouncerTrait}; +use crate::event::{Event, KeyEvent}; +use crate::input_device::InputDevice; +use crate::state::ConnectionState; +use crate::CONNECTION_STATE; + /// MatrixTrait is the trait for keyboard matrix. /// /// The keyboard matrix is a 2D matrix of keys, the matrix does the scanning and saves the result to each key's `KeyState`. @@ -22,7 +24,7 @@ pub trait MatrixTrait: InputDevice { // Wait for USB or BLE really connected fn wait_for_connected(&self) -> impl Future { async { - while !CONNECTION_STATE.load(core::sync::atomic::Ordering::Acquire) { + while CONNECTION_STATE.load(Ordering::Acquire) == ConnectionState::Disconnected.into() { embassy_time::Timer::after_millis(100).await; } info!("Connected, start scanning matrix"); @@ -100,11 +102,7 @@ impl< > Matrix { /// Create a matrix from input and output pins. - pub fn new( - input_pins: [In; INPUT_PIN_NUM], - output_pins: [Out; OUTPUT_PIN_NUM], - debouncer: D, - ) -> Self { + pub fn new(input_pins: [In; INPUT_PIN_NUM], output_pins: [Out; OUTPUT_PIN_NUM], debouncer: D) -> Self { Matrix { input_pins, output_pins, @@ -151,11 +149,9 @@ impl< if let DebounceState::Debounced = debounce_state { self.key_states[out_idx][in_idx].toggle_pressed(); #[cfg(feature = "col2row")] - let (row, col, key_state) = - (in_idx, out_idx, self.key_states[out_idx][in_idx]); + let (row, col, key_state) = (in_idx, out_idx, self.key_states[out_idx][in_idx]); #[cfg(not(feature = "col2row"))] - let (row, col, key_state) = - (out_idx, in_idx, self.key_states[out_idx][in_idx]); + let (row, col, key_state) = (out_idx, in_idx, self.key_states[out_idx][in_idx]); self.scan_pos = (out_idx, in_idx); return Event::Key(KeyEvent { @@ -202,6 +198,8 @@ impl< #[cfg(feature = "async_matrix")] async fn wait_for_key(&mut self) { + use core::pin::pin; + if let Some(start_time) = self.scan_start { // If no key press over 1ms, stop scanning and wait for interupt if start_time.elapsed().as_millis() <= 1 { @@ -220,7 +218,7 @@ impl< .iter_mut() .map(|input_pin| input_pin.wait_for_high()) .collect(); - let _ = select_slice(futs.as_mut_slice()).await; + let _ = select_slice(pin!(futs.as_mut_slice())).await; // Set all output pins back to low for out in self.output_pins.iter_mut() { @@ -263,7 +261,7 @@ impl InputDevice for TestMatrix { embassy_time::Timer::after_secs(5).await; } self.last = !self.last; - info!("Read event: {:?}", self.last); + // info!("Read event: {:?}", self.last); Event::Key(KeyEvent { row: 0, col: 0, diff --git a/rmk/src/split/ble/central.rs b/rmk/src/split/ble/central.rs new file mode 100644 index 000000000..e92cd6e3a --- /dev/null +++ b/rmk/src/split/ble/central.rs @@ -0,0 +1,255 @@ +use core::sync::atomic::Ordering; + +use embassy_futures::select::{select, Either}; +use embassy_sync::signal::Signal; +use embassy_time::Duration; +use trouble_host::prelude::*; + +use crate::ble::trouble::L2CAP_MTU; +use crate::split::driver::{PeripheralManager, SplitDriverError, SplitReader, SplitWriter}; +use crate::split::{SplitMessage, SPLIT_MESSAGE_MAX_SIZE}; +use crate::CONNECTION_STATE; + +pub(crate) static STACK_STARTED: Signal = Signal::new(); + +/// Gatt service used in split central to send split message to peripheral +#[gatt_service(uuid = "4dd5fbaa-18e5-4b07-bf0a-353698659946")] +struct SplitBleCentralService { + #[characteristic(uuid = "0e6313e3-bd0b-45c2-8d2e-37a2e8128bc3", read, notify)] + message_to_central: [u8; SPLIT_MESSAGE_MAX_SIZE], + + #[characteristic(uuid = "4b3514fb-cae4-4d38-a097-3a2a3d1c3b9c", write_without_response, read, notify)] + message_to_peripheral: [u8; SPLIT_MESSAGE_MAX_SIZE], +} + +/// Gatt server in split peripheral +#[gatt_server] +struct BleSplitCentralServer { + service: SplitBleCentralService, +} + +pub(crate) async fn run_ble_peripheral_manager< + 'a, + C: Controller, + const ROW: usize, + const COL: usize, + const ROW_OFFSET: usize, + const COL_OFFSET: usize, +>( + id: usize, + addr: [u8; 6], + stack: &'a Stack<'a, C>, +) { + let Host { mut central, .. } = stack.build(); + let address: Address = Address::random(addr); + info!("Peripheral peer address: {:?}", address); + let config = ConnectConfig { + connect_params: ConnectParams { + min_connection_interval: Duration::from_micros(7500), // 7.5ms + max_connection_interval: Duration::from_micros(7500), // 7.5ms + max_latency: 400, // 3s + supervision_timeout: Duration::from_secs(7), + ..Default::default() + }, + scan_config: ScanConfig { + filter_accept_list: &[(address.kind, &address.addr)], + ..Default::default() + }, + }; + wait_for_stack_started().await; + loop { + info!("Connecting peripheral"); + if let Err(e) = + connect_and_run_peripheral_manager::<_, ROW, COL, ROW_OFFSET, COL_OFFSET>(id, stack, &mut central, &config) + .await + { + #[cfg(feature = "defmt")] + let e = defmt::Debug2Format(&e); + error!("BLE central error: {:?}", e); + // Reconnect after 500ms + embassy_time::Timer::after_millis(500).await; + } + } +} + +async fn connect_and_run_peripheral_manager< + 'a, + C: Controller, + const ROW: usize, + const COL: usize, + const ROW_OFFSET: usize, + const COL_OFFSET: usize, +>( + id: usize, + stack: &'a Stack<'a, C>, + central: &mut Central<'a, C>, + config: &ConnectConfig<'_>, +) -> Result<(), BleHostError> { + let conn = central.connect(config).await?; + + info!("Connected to peripheral"); + let client = GattClient::::new(&stack, &conn).await?; + match select( + ble_central_task(&client, &conn), + run_peripheral_manager::<_, ROW, COL, ROW_OFFSET, COL_OFFSET>(id, &client), + ) + .await + { + Either::First(e) => e, + Either::Second(e) => e, + } +} + +async fn ble_central_task<'a, C: Controller>( + client: &GattClient<'a, C, 10, L2CAP_MTU>, + conn: &Connection<'a>, +) -> Result<(), BleHostError> { + let conn_check = async { + while conn.is_connected() { + embassy_time::Timer::after_secs(1).await; + } + }; + match select(client.task(), conn_check).await { + Either::First(e) => e, + Either::Second(_) => { + info!("Connection lost"); + Ok(()) + } + } +} + +async fn run_peripheral_manager< + 'a, + C: Controller, + const ROW: usize, + const COL: usize, + const ROW_OFFSET: usize, + const COL_OFFSET: usize, +>( + id: usize, + client: &GattClient<'a, C, 10, L2CAP_MTU>, +) -> Result<(), BleHostError> { + let services = client + .services_by_uuid(&Uuid::new_long([ + 70u8, 153u8, 101u8, 152u8, 54u8, 53u8, 10u8, 191u8, 7u8, 75u8, 229u8, 24u8, 170u8, 251u8, 213u8, 77u8, + ])) + .await?; + info!("Services found"); + if let Some(service) = services.first() { + let message_to_central = client + .characteristic_by_uuid::<[u8; SPLIT_MESSAGE_MAX_SIZE]>( + &service, + // uuid: 0e6313e3-bd0b-45c2-8d2e-37a2e8128bc3 + &Uuid::Uuid128([ + 195u8, 139u8, 18u8, 232u8, 162u8, 55u8, 46u8, 141u8, 194u8, 69u8, 11u8, 189u8, 227u8, 19u8, 99u8, + 14u8, + ]), + ) + .await?; + info!("Message to central found"); + let message_to_peripheral = client + .characteristic_by_uuid::<[u8; SPLIT_MESSAGE_MAX_SIZE]>( + &service, + // uuid: 4b3514fb-cae4-4d38-a097-3a2a3d1c3b9c + &Uuid::Uuid128([ + 156u8, 59u8, 28u8, 61u8, 42u8, 58u8, 151u8, 160u8, 56u8, 77u8, 228u8, 202u8, 251u8, 20u8, 53u8, + 75u8, + ]), + ) + .await?; + info!("Subscribing notifications"); + let listener = client.subscribe(&message_to_central, false).await?; + let split_ble_driver = BleSplitCentralDriver::new(listener, message_to_peripheral, client); + let peripheral_manager = PeripheralManager::::new(split_ble_driver, id); + peripheral_manager.run().await; + info!("Peripheral manager stopped"); + }; + Ok(()) +} + +/// Ble central driver which reads and writes the split message. +/// +/// Different from serial, BLE split message is processed in a separate service. +/// The BLE service should keep running, it processes the split message in the callback, which is not async. +/// It's impossible to implement `SplitReader` or `SplitWriter` for BLE service, +/// so we need this wrapper to forward split message to channel. +pub(crate) struct BleSplitCentralDriver<'a, 'b, 'c, C: Controller> { + // Listener for split message from peripheral + listener: NotificationListener<'b, L2CAP_MTU>, + // Characteristic to send split message to peripheral + message_to_peripheral: Characteristic<[u8; SPLIT_MESSAGE_MAX_SIZE]>, + // Client + client: &'c GattClient<'a, C, 10, L2CAP_MTU>, + // Cached connection state + connection_state: bool, +} + +impl<'a, 'b, 'c, C: Controller> BleSplitCentralDriver<'a, 'b, 'c, C> { + pub(crate) fn new( + listener: NotificationListener<'b, L2CAP_MTU>, + message_to_peripheral: Characteristic<[u8; SPLIT_MESSAGE_MAX_SIZE]>, + client: &'c GattClient<'a, C, 10, L2CAP_MTU>, + ) -> Self { + Self { + listener, + message_to_peripheral, + client, + connection_state: CONNECTION_STATE.load(Ordering::Acquire), + } + } +} + +impl<'a, 'b, 'c, C: Controller> SplitReader for BleSplitCentralDriver<'a, 'b, 'c, C> { + async fn read(&mut self) -> Result { + let data = self.listener.next().await; + let message = postcard::from_bytes(&data.as_ref()).map_err(|_| SplitDriverError::DeserializeError)?; + info!("Received split message: {:?}", message); + Ok(message) + } +} + +impl<'a, 'b, 'c, C: Controller> SplitWriter for BleSplitCentralDriver<'a, 'b, 'c, C> { + async fn write(&mut self, message: &SplitMessage) -> Result { + if let SplitMessage::ConnectionState(state) = message { + // ConnectionState changed, update cached state and notify peripheral + if self.connection_state != *state { + self.connection_state = *state; + } + } + // Always sync the connection state to peripheral since central doesn't know the CONNECTION_STATE of the peripheral. + let mut buf = [0_u8; SPLIT_MESSAGE_MAX_SIZE]; + match postcard::to_slice(&message, &mut buf) { + Ok(_bytes) => { + if let Err(e) = self + .client + .write_characteristic_without_response(&self.message_to_peripheral, &buf) + .await + { + if let BleHostError::BleHost(Error::NotFound) = e { + error!("Peripheral disconnected"); + return Err(SplitDriverError::Disconnected); + } + #[cfg(feature = "defmt")] + let e = defmt::Debug2Format(&e); + error!("BLE message_to_peripheral_write error: {:?}", e); + } + } + Err(e) => error!("Postcard serialize split message error: {}", e), + }; + + Ok(SPLIT_MESSAGE_MAX_SIZE) + } +} + +/// Wait for the BLE stack to start. +/// +/// If the BLE stack has been started, wait 500ms then quit. +pub(crate) async fn wait_for_stack_started() { + loop { + if STACK_STARTED.signaled() { + embassy_time::Timer::after_millis(500).await; + break; + } + embassy_time::Timer::after_millis(500).await; + } +} diff --git a/rmk/src/split/nrf/mod.rs b/rmk/src/split/ble/mod.rs similarity index 100% rename from rmk/src/split/nrf/mod.rs rename to rmk/src/split/ble/mod.rs diff --git a/rmk/src/split/ble/peripheral.rs b/rmk/src/split/ble/peripheral.rs new file mode 100644 index 000000000..ac3809ee0 --- /dev/null +++ b/rmk/src/split/ble/peripheral.rs @@ -0,0 +1,169 @@ +use embassy_futures::join::join; +use embassy_time::Timer; +use trouble_host::prelude::*; + +use crate::split::driver::{SplitDriverError, SplitReader, SplitWriter}; +use crate::split::peripheral::SplitPeripheral; +use crate::split::{SplitMessage, SPLIT_MESSAGE_MAX_SIZE}; +use crate::CONNECTION_STATE; + +/// Gatt service used in split peripheral to send split message to central +#[gatt_service(uuid = "4dd5fbaa-18e5-4b07-bf0a-353698659946")] +pub(crate) struct SplitBleService { + #[characteristic(uuid = "0e6313e3-bd0b-45c2-8d2e-37a2e8128bc3", read, notify)] + pub(crate) message_to_central: [u8; SPLIT_MESSAGE_MAX_SIZE], + + #[characteristic(uuid = "4b3514fb-cae4-4d38-a097-3a2a3d1c3b9c", write_without_response, read, notify)] + pub(crate) message_to_peripheral: [u8; SPLIT_MESSAGE_MAX_SIZE], +} + +/// Gatt server in split peripheral +#[gatt_server] +pub(crate) struct BleSplitPeripheralServer { + pub(crate) service: SplitBleService, +} + +/// BLE driver for split peripheral +pub(crate) struct BleSplitPeripheralDriver<'stack, 'server, 'c> { + message_to_peripheral: Characteristic<[u8; SPLIT_MESSAGE_MAX_SIZE]>, + message_to_central: Characteristic<[u8; SPLIT_MESSAGE_MAX_SIZE]>, + conn: &'c GattConnection<'stack, 'server>, +} + +impl<'stack, 'server, 'c> BleSplitPeripheralDriver<'stack, 'server, 'c> { + pub(crate) fn new(server: &'server BleSplitPeripheralServer, conn: &'c GattConnection<'stack, 'server>) -> Self { + Self { + message_to_central: server.service.message_to_central, + message_to_peripheral: server.service.message_to_peripheral, + conn, + } + } +} + +impl<'stack, 'server, 'c> SplitReader for BleSplitPeripheralDriver<'stack, 'server, 'c> { + async fn read(&mut self) -> Result { + let message = loop { + match self.conn.next().await { + GattConnectionEvent::Disconnected { reason } => { + error!("Disconnected from central: {:?}", reason); + CONNECTION_STATE.store(false, core::sync::atomic::Ordering::Release); + return Err(SplitDriverError::Disconnected); + } + GattConnectionEvent::Gatt { event } => match event { + Ok(gatt_event) => { + match &gatt_event { + GattEvent::Read(event) => { + info!("Gatt read event: {:?}", event.handle()); + } + GattEvent::Write(event) => { + // Write to peripheral + if event.handle() == self.message_to_peripheral.handle { + trace!("Got message from central: {:?}", event.data()); + match postcard::from_bytes::(&event.data()) { + Ok(message) => { + trace!("Message from central: {:?}", message); + break message; + } + Err(e) => error!("Postcard deserialize split message error: {}", e), + } + } else { + info!("Gatt write other event: {:?}", event.handle()); + } + } + }; + match gatt_event.accept() { + Ok(r) => r.send().await, + Err(e) => warn!("[gatt] error sending response: {:?}", e), + } + } + Err(e) => warn!("[gatt] error processing event: {:?}", e), + }, + _ => (), + } + }; + Ok(message) + } +} + +impl<'stack, 'server, 'c> SplitWriter for BleSplitPeripheralDriver<'stack, 'server, 'c> { + async fn write(&mut self, message: &SplitMessage) -> Result { + let mut buf = [0_u8; SPLIT_MESSAGE_MAX_SIZE]; + postcard::to_slice(message, &mut buf).map_err(|e| { + error!("Postcard serialize split message error: {}", e); + SplitDriverError::SerializeError + })?; + info!("Writing split message to central: {:?}", message); + self.message_to_central.notify(&self.conn, &buf).await.map_err(|e| { + error!("BLE notify error: {:?}", e); + SplitDriverError::BleError(1) + })?; + Ok(buf.len()) + } +} + +/// Initialize and run the nRF peripheral keyboard service via BLE. +/// +/// # Arguments +/// +/// * `input_pins` - input gpio pins +/// * `output_pins` - output gpio pins +/// * `spawner` - embassy task spawner, used to spawn nrf_softdevice background task +pub async fn initialize_nrf_ble_split_peripheral_and_run<'stack, C: Controller>( + central_addr: [u8; 6], + stack: &'stack Stack<'stack, C>, +) { + let Host { + mut peripheral, runner, .. + } = stack.build(); + + let peri_task = async { + let server = BleSplitPeripheralServer::new_default("rmk").unwrap(); + loop { + CONNECTION_STATE.store(false, core::sync::atomic::Ordering::Release); + match advertise(central_addr, &mut peripheral, &server).await { + Ok(conn) => { + info!("Conected to the central"); + let mut peripheral = SplitPeripheral::new(BleSplitPeripheralDriver::new(&server, &conn)); + peripheral.run().await; + info!("Disconnected from the central"); + } + Err(e) => { + #[cfg(feature = "defmt")] + let e = defmt::Debug2Format(&e); + error!("Advertise error: {:?}", e); + Timer::after_millis(500).await; + continue; + } + }; + } + }; + + join(ble_task(runner), peri_task).await; +} + +/// Create an advertiser to use to connect to a BLE Central, and wait for it to connect. +async fn advertise<'a, 'b, C: Controller>( + central_addr: [u8; 6], + peripheral: &mut Peripheral<'a, C>, + server: &'b BleSplitPeripheralServer<'_>, +) -> Result, BleHostError> { + let advertisement = Advertisement::ConnectableNonscannableDirected { + peer: Address::random(central_addr), + }; + let advertiser = peripheral + .advertise(&AdvertisementParameters::default(), advertisement) + .await?; + + let conn = advertiser.accept().await?.with_attribute_server(server)?; + info!("[adv] connection established"); + Ok(conn) +} + +/// This is a background task that is required to run forever alongside any other BLE tasks. +async fn ble_task(mut runner: Runner<'_, C>) { + loop { + if let Err(e) = runner.run().await { + panic!("[ble_task] error: {:?}", e); + } + } +} diff --git a/rmk/src/split/central.rs b/rmk/src/split/central.rs index 38a0567f3..b96345c6c 100644 --- a/rmk/src/split/central.rs +++ b/rmk/src/split/central.rs @@ -1,15 +1,19 @@ -#[cfg(feature = "rapid_debouncer")] -use crate::debounce::fast_debouncer::RapidDebouncer; -use crate::debounce::{DebounceState, DebouncerTrait}; -use crate::event::{Event, KeyEvent}; -use crate::input_device::InputDevice; -use crate::matrix::{KeyState, MatrixTrait}; +#[cfg(feature = "async_matrix")] +use core::pin::pin; + use embassy_time::{Instant, Timer}; use embedded_hal::digital::{InputPin, OutputPin}; #[cfg(feature = "async_matrix")] use embedded_hal_async::digital::Wait; -#[cfg(not(feature = "_nrf_ble"))] +#[cfg(not(feature = "_ble"))] use embedded_io_async::{Read, Write}; +#[cfg(feature = "_ble")] +use trouble_host::prelude::*; + +use crate::debounce::{DebounceState, DebouncerTrait}; +use crate::event::{Event, KeyEvent}; +use crate::input_device::InputDevice; +use crate::matrix::{KeyState, MatrixTrait}; /// Run central's peripheral manager task. /// @@ -18,23 +22,26 @@ use embedded_io_async::{Read, Write}; /// * `addr` - (optional) peripheral's BLE static address. This argument is enabled only for nRF BLE split now /// * `receiver` - (optional) serial port. This argument is enabled only for serial split now pub async fn run_peripheral_manager< + 'a, const ROW: usize, const COL: usize, const ROW_OFFSET: usize, const COL_OFFSET: usize, - #[cfg(not(feature = "_nrf_ble"))] S: Read + Write, + #[cfg(feature = "_ble")] C: Controller, + #[cfg(not(feature = "_ble"))] S: Read + Write, >( id: usize, - #[cfg(feature = "_nrf_ble")] addr: [u8; 6], - #[cfg(not(feature = "_nrf_ble"))] receiver: S, + #[cfg(feature = "_ble")] addr: [u8; 6], + #[cfg(feature = "_ble")] stack: &'a Stack<'a, C>, + #[cfg(not(feature = "_ble"))] receiver: S, ) { - #[cfg(feature = "_nrf_ble")] + #[cfg(feature = "_ble")] { - use crate::split::nrf::central::run_ble_peripheral_manager; - run_ble_peripheral_manager::(id, addr).await; + use crate::split::ble::central::run_ble_peripheral_manager; + run_ble_peripheral_manager::(id, addr, stack).await; }; - #[cfg(not(feature = "_nrf_ble"))] + #[cfg(not(feature = "_ble"))] { use crate::split::serial::run_serial_peripheral_manager; run_serial_peripheral_manager::(id, receiver).await; @@ -75,8 +82,7 @@ impl< const COL_OFFSET: usize, const INPUT_PIN_NUM: usize, const OUTPUT_PIN_NUM: usize, - > InputDevice - for CentralMatrix + > InputDevice for CentralMatrix { async fn read_event(&mut self) -> Event { loop { @@ -155,8 +161,7 @@ impl< const COL_OFFSET: usize, const INPUT_PIN_NUM: usize, const OUTPUT_PIN_NUM: usize, - > MatrixTrait - for CentralMatrix + > MatrixTrait for CentralMatrix { #[cfg(feature = "col2row")] const ROW: usize = INPUT_PIN_NUM; @@ -191,7 +196,7 @@ impl< .iter_mut() .map(|input_pin| input_pin.wait_for_high()) .collect(); - let _ = select_slice(futs.as_mut_slice()).await; + let _ = select_slice(pin!(futs.as_mut_slice())).await; // Set all output pins back to low for out in self.output_pins.iter_mut() { @@ -214,11 +219,7 @@ impl< > CentralMatrix { /// Initialization of central - pub fn new( - input_pins: [In; INPUT_PIN_NUM], - output_pins: [Out; OUTPUT_PIN_NUM], - debouncer: D, - ) -> Self { + pub fn new(input_pins: [In; INPUT_PIN_NUM], output_pins: [Out; OUTPUT_PIN_NUM], debouncer: D) -> Self { CentralMatrix { input_pins, output_pins, @@ -389,7 +390,7 @@ impl< } } } - let _ = select_slice(futs.as_mut_slice()).await; + let _ = select_slice(pin!(futs.as_mut_slice())).await; } else { let mut futs: Vec<_, SIZE> = Vec::new(); for direct_pins_row in self.direct_pins.iter_mut() { @@ -399,7 +400,7 @@ impl< } } } - let _ = select_slice(futs.as_mut_slice()).await; + let _ = select_slice(pin!(futs.as_mut_slice())).await; } self.scan_start = Some(Instant::now()); } diff --git a/rmk/src/split/driver.rs b/rmk/src/split/driver.rs index b550560d0..8c8d012ce 100644 --- a/rmk/src/split/driver.rs +++ b/rmk/src/split/driver.rs @@ -1,17 +1,16 @@ //! The abstracted driver layer of the split keyboard. //! -use super::SplitMessage; -use crate::channel::EVENT_CHANNEL; -use crate::input_device::InputDevice; -use crate::CONNECTION_STATE; -use crate::{ - channel::KEY_EVENT_CHANNEL, - event::{Event, KeyEvent}, -}; use core::sync::atomic::Ordering; + use embassy_futures::select::select; use embassy_time::{Instant, Timer}; +use super::SplitMessage; +use crate::channel::{EVENT_CHANNEL, KEY_EVENT_CHANNEL}; +use crate::event::{Event, KeyEvent}; +use crate::input_device::InputDevice; +use crate::CONNECTION_STATE; + #[derive(Debug, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub(crate) enum SplitDriverError { @@ -20,6 +19,7 @@ pub(crate) enum SplitDriverError { DeserializeError, SerializeError, BleError(u8), + Disconnected, } /// Split message reader from other split devices @@ -68,23 +68,22 @@ impl< /// /// The manager receives from the peripheral and forward the message to `KEY_EVENT_CHANNEL`. /// It also sync the `ConnectionState` to the peripheral periodically. - pub(crate) async fn run(mut self) -> ! { + pub(crate) async fn run(mut self) { let mut conn_state = CONNECTION_STATE.load(Ordering::Acquire); // Send connection state once on start - if let Err(e) = self - .receiver - .write(&SplitMessage::ConnectionState(conn_state)) - .await - { - error!("SplitDriver write error: {:?}", e); + if let Err(e) = self.receiver.write(&SplitMessage::ConnectionState(conn_state)).await { + match e { + SplitDriverError::Disconnected => return, + _ => error!("SplitDriver write error: {:?}", e), + } } let mut last_sync_time = Instant::now(); loop { - // Calculate the time until the next 1000ms sync + // Calculate the time until the next 3000ms sync let elapsed = last_sync_time.elapsed().as_millis() as u64; - let wait_time = if elapsed >= 1000 { 1 } else { 1000 - elapsed }; + let wait_time = if elapsed >= 3000 { 1 } else { 3000 - elapsed }; // Read the message from peripheral, or sync the connection state every 1000ms. match select(self.read_event(), Timer::after_millis(wait_time)).await { @@ -101,12 +100,12 @@ impl< embassy_futures::select::Either::Second(_) => { // Timer elapsed, sync the connection state conn_state = CONNECTION_STATE.load(Ordering::Acquire); - if let Err(e) = self - .receiver - .write(&SplitMessage::ConnectionState(conn_state)) - .await - { - error!("SplitDriver write error: {:?}", e); + debug!("Syncing connection state to peripheral: {}", conn_state); + if let Err(e) = self.receiver.write(&SplitMessage::ConnectionState(conn_state)).await { + match e { + SplitDriverError::Disconnected => return, + _ => error!("SplitDriver write error: {:?}", e), + } } last_sync_time = Instant::now(); } diff --git a/rmk/src/split/mod.rs b/rmk/src/split/mod.rs index 10a4e05af..00b33ba9a 100644 --- a/rmk/src/split/mod.rs +++ b/rmk/src/split/mod.rs @@ -3,15 +3,15 @@ use serde::{Deserialize, Serialize}; use crate::event::{Event, KeyEvent}; +#[cfg(feature = "_ble")] +pub mod ble; pub mod central; /// Common abstraction layer of split driver pub(crate) mod driver; -#[cfg(feature = "_nrf_ble")] -pub mod nrf; pub mod peripheral; #[cfg(feature = "rp2040_pio")] pub mod rp; -#[cfg(not(feature = "_nrf_ble"))] +#[cfg(not(feature = "_ble"))] pub mod serial; /// Maximum size of a split message diff --git a/rmk/src/split/nrf/central.rs b/rmk/src/split/nrf/central.rs deleted file mode 100644 index 8c4c6fca0..000000000 --- a/rmk/src/split/nrf/central.rs +++ /dev/null @@ -1,199 +0,0 @@ -use core::sync::atomic::{AtomicBool, Ordering}; - -use embassy_futures::{join::join, select::select}; -use embassy_sync::channel::{Channel, Receiver, Sender}; -use nrf_softdevice::ble::{central, gatt_client, Address, AddressType}; - -use crate::{ - split::{ - driver::{PeripheralManager, SplitDriverError, SplitReader, SplitWriter}, - SplitMessage, SPLIT_MESSAGE_MAX_SIZE, - }, - RawMutex, CONNECTION_STATE, -}; - -/// Gatt client used in split central to receive split message from peripherals -#[nrf_softdevice::gatt_client(uuid = "4dd5fbaa-18e5-4b07-bf0a-353698659946")] -pub(crate) struct BleSplitCentralClient { - #[characteristic(uuid = "0e6313e3-bd0b-45c2-8d2e-37a2e8128bc3", read, notify)] - pub(crate) message_to_central: [u8; SPLIT_MESSAGE_MAX_SIZE], - - #[characteristic(uuid = "4b3514fb-cae4-4d38-a097-3a2a3d1c3b9c", write)] - pub(crate) message_to_peripheral: [u8; SPLIT_MESSAGE_MAX_SIZE], -} - -pub(crate) async fn run_ble_peripheral_manager< - const ROW: usize, - const COL: usize, - const ROW_OFFSET: usize, - const COL_OFFSET: usize, ->( - id: usize, - addr: [u8; 6], -) { - // Channel is used to receive messages from peripheral - let receive_channel: Channel = Channel::new(); - // Channel is used to notify messages to peripheral - let notify_channel: Channel = Channel::new(); - - let receive_sender = receive_channel.sender(); - let receive_receiver = receive_channel.receiver(); - let notify_sender = notify_channel.sender(); - let notify_receiver = notify_channel.receiver(); - let run_ble_client = run_ble_client(receive_sender, notify_receiver, addr); - - let split_ble_driver = BleSplitCentralDriver { - receiver: receive_receiver, - sender: notify_sender, - connection_state: CONNECTION_STATE.load(Ordering::Acquire), - }; - - // Create peripheral manager instance - let peripheral_manager = - PeripheralManager::::new(split_ble_driver, id); - - info!("Running peripheral manager {}", id); - - join(peripheral_manager.run(), run_ble_client).await; -} - -// If the one peripheral client is connecting, don't try to connect again -static CONNECTING_CLIENT: AtomicBool = AtomicBool::new(false); - -/// Run a single ble client, which receives split message from the ble peripheral. -/// -/// All received messages are sent to the sender, those message are received in `SplitBleCentralDriver`. -/// Split driver will take `SplitBleCentralDriver` as the reader, process the message in matrix scanning. -pub(crate) async fn run_ble_client( - receive_sender: Sender<'_, RawMutex, SplitMessage, 8>, - notify_receiver: Receiver<'_, RawMutex, SplitMessage, 8>, - addr: [u8; 6], -) -> ! { - // Wait 1s, ensure that the softdevice is ready - embassy_time::Timer::after_secs(1).await; - let sd = unsafe { nrf_softdevice::Softdevice::steal() }; - loop { - let addrs = &[&Address::new(AddressType::RandomStatic, addr)]; - let mut config: central::ConnectConfig<'_> = central::ConnectConfig::default(); - config.conn_params = nrf_softdevice::raw::ble_gap_conn_params_t { - min_conn_interval: 6, - max_conn_interval: 6, - slave_latency: 99, - conn_sup_timeout: 500, // timeout: 5s - }; - config.scan_config.whitelist = Some(addrs); - let conn = loop { - if let Ok(_) = - CONNECTING_CLIENT.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst) - { - info!("Starting connect to {:?}", addrs); - let conn = match central::connect(sd, &config).await { - Ok(conn) => conn, - Err(e) => { - error!("BLE peripheral connect error: {:?}", e); - CONNECTING_CLIENT.store(false, Ordering::SeqCst); - continue; - } - }; - CONNECTING_CLIENT.store(false, Ordering::SeqCst); - break conn; - } - // Wait 200ms and check again - embassy_time::Timer::after_millis(200).await; - }; - - info!("Connected to peripheral"); - - let ble_client: BleSplitCentralClient = match gatt_client::discover(&conn).await { - Ok(client) => client, - Err(e) => { - error!("BLE discover error: {:?}", e); - continue; - } - }; - - // Enable notifications from the peripherals - if let Err(e) = ble_client.message_to_central_cccd_write(true).await { - error!("BLE message_to_central_cccd_write error: {:?}", e); - continue; - } - - // Receive peripheral's notifications - let receive_peripheral = gatt_client::run(&conn, &ble_client, |event| match event { - BleSplitCentralClientEvent::MessageToCentralNotification(message) => { - match postcard::from_bytes(&message) { - Ok(split_message) => { - info!("Received split message from peripheral: {}", split_message); - if let Err(e) = receive_sender.try_send(split_message) { - error!("BLE_SYNC_CHANNEL send message error: {:?}", e); - } - } - Err(e) => { - error!("Postcard deserialize split message error: {}", e); - } - }; - } - }); - - // Notify messages to peripheral - let notify_peripheral = async { - loop { - let mut buf = [0_u8; SPLIT_MESSAGE_MAX_SIZE]; - let message = notify_receiver.receive().await; - match postcard::to_slice(&message, &mut buf) { - Ok(_bytes) => { - if let Err(e) = ble_client.message_to_peripheral_write(&buf).await { - error!("BLE message_to_peripheral_write error: {:?}", e); - } - } - Err(e) => error!("Postcard serialize split message error: {}", e), - }; - } - }; - - match select(receive_peripheral, notify_peripheral).await { - embassy_futures::select::Either::First(e) => { - error!("BLE peripheral disconnect error: {:?}", e); - } - embassy_futures::select::Either::Second(_) => (), - } - - // Wait for 1s before trying to connect (again) - embassy_time::Timer::after_secs(1).await; - } -} - -/// Ble central driver which reads and writes the split message. -/// -/// Different from serial, BLE split message is processed in a separate service. -/// The BLE service should keep running, it processes the split message in the callback, which is not async. -/// It's impossible to implement `SplitReader` or `SplitWriter` for BLE service, -/// so we need this wrapper to forward split message to channel. -pub(crate) struct BleSplitCentralDriver<'a> { - // Receiver that receives message from peripheral - pub(crate) receiver: Receiver<'a, RawMutex, SplitMessage, 8>, - // Sender that send message to peripherals - pub(crate) sender: Sender<'a, RawMutex, SplitMessage, 8>, - // Cached connection state - connection_state: bool, -} - -impl<'a> SplitReader for BleSplitCentralDriver<'a> { - async fn read(&mut self) -> Result { - Ok(self.receiver.receive().await) - } -} - -impl SplitWriter for BleSplitCentralDriver<'_> { - async fn write(&mut self, message: &SplitMessage) -> Result { - if let SplitMessage::ConnectionState(state) = message { - // ConnectionState changed, update cached state and notify peripheral - if self.connection_state != *state { - self.connection_state = *state; - } - } - // Always sync the connection state to peripheral since central doesn't know the CONNECTION_STATE of the peripheral. - self.sender.send(message.clone()).await; - Ok(SPLIT_MESSAGE_MAX_SIZE) - } -} diff --git a/rmk/src/split/nrf/peripheral.rs b/rmk/src/split/nrf/peripheral.rs deleted file mode 100644 index fd968d48f..000000000 --- a/rmk/src/split/nrf/peripheral.rs +++ /dev/null @@ -1,167 +0,0 @@ -use crate::ble::nrf::initialize_nrf_sd_and_flash; -use crate::split::driver::{SplitDriverError, SplitReader, SplitWriter}; -use crate::split::peripheral::SplitPeripheral; -use crate::split::{SplitMessage, SPLIT_MESSAGE_MAX_SIZE}; -use embassy_executor::Spawner; -use embassy_futures::block_on; -use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; -use embassy_sync::channel::{Channel, Receiver}; -use nrf_softdevice::ble::gatt_server::set_sys_attrs; -use nrf_softdevice::ble::peripheral::{advertise_connectable, ConnectableAdvertisement}; -use nrf_softdevice::ble::{gatt_server, Connection, PhySet, PhyUpdateError}; -use nrf_softdevice::ble::{Address, AddressType}; - -/// Gatt service used in split peripheral to send split message to central -#[nrf_softdevice::gatt_service(uuid = "4dd5fbaa-18e5-4b07-bf0a-353698659946")] -pub(crate) struct SplitBleService { - #[characteristic(uuid = "0e6313e3-bd0b-45c2-8d2e-37a2e8128bc3", read, notify)] - pub(crate) message_to_central: [u8; SPLIT_MESSAGE_MAX_SIZE], - - #[characteristic(uuid = "4b3514fb-cae4-4d38-a097-3a2a3d1c3b9c", write_without_response)] - pub(crate) message_to_peripheral: [u8; SPLIT_MESSAGE_MAX_SIZE], -} - -/// Gatt server in split peripheral -#[nrf_softdevice::gatt_server] -pub(crate) struct BleSplitPeripheralServer { - pub(crate) service: SplitBleService, -} - -/// BLE driver for split peripheral -pub(crate) struct BleSplitPeripheralDriver<'a> { - server: &'a BleSplitPeripheralServer, - conn: &'a Connection, - receiver: Receiver<'a, ThreadModeRawMutex, SplitMessage, 4>, -} - -impl<'a> BleSplitPeripheralDriver<'a> { - pub(crate) fn new( - server: &'a BleSplitPeripheralServer, - conn: &'a Connection, - receiver: Receiver<'a, ThreadModeRawMutex, SplitMessage, 4>, - ) -> Self { - Self { - server, - conn, - receiver, - } - } -} - -impl<'a> SplitReader for BleSplitPeripheralDriver<'a> { - async fn read(&mut self) -> Result { - Ok(self.receiver.receive().await) - } -} - -impl<'a> SplitWriter for BleSplitPeripheralDriver<'a> { - async fn write(&mut self, message: &SplitMessage) -> Result { - let mut buf = [0_u8; SPLIT_MESSAGE_MAX_SIZE]; - let bytes = postcard::to_slice(message, &mut buf).map_err(|e| { - error!("Postcard serialize split message error: {}", e); - SplitDriverError::SerializeError - })?; - info!("Writing split message to central: {:?}", message); - gatt_server::notify_value( - &self.conn, - self.server.service.message_to_central_value_handle, - bytes, - ) - .map_err(|e| { - error!("BLE notify error: {:?}", e); - SplitDriverError::BleError(1) - })?; - Ok(bytes.len()) - } -} - -/// Initialize and run the nRF peripheral keyboard service via BLE. -/// -/// # Arguments -/// -/// * `input_pins` - input gpio pins -/// * `output_pins` - output gpio pins -/// * `spawner` - embassy task spawner, used to spawn nrf_softdevice background task -pub async fn initialize_nrf_ble_split_peripheral_and_run( - central_addr: [u8; 6], - peripheral_addr: [u8; 6], - spawner: Spawner, -) -> ! { - use embassy_futures::select::select; - use nrf_softdevice::ble::gatt_server; - - use crate::{ - split::nrf::peripheral::{ - BleSplitPeripheralDriver, BleSplitPeripheralServer, BleSplitPeripheralServerEvent, - SplitBleServiceEvent, - }, - CONNECTION_STATE, - }; - - let (sd, _) = initialize_nrf_sd_and_flash("rmk_split_peri", spawner, Some(peripheral_addr)); - - let server = - BleSplitPeripheralServer::new(sd).expect("Failed to start BLE split peripheral server"); - - loop { - CONNECTION_STATE.store(false, core::sync::atomic::Ordering::Release); - let advertisement: ConnectableAdvertisement<'_> = - ConnectableAdvertisement::NonscannableDirected { - peer: Address::new(AddressType::RandomStatic, central_addr), - }; - let mut conn = match advertise_connectable(sd, advertisement, &Default::default()).await { - Ok(conn) => conn, - Err(e) => { - error!("Split peripheral advertise error: {:?}", e); - continue; - } - }; - - // Channel used for receiving messages from central - let receive_channel: Channel = Channel::new(); - let receiver = receive_channel.receiver(); - let sender = receive_channel.sender(); - - // Set sys attr of peripheral - set_sys_attrs(&conn, None).ok(); - - // Set PHY used - if let Err(e) = conn.phy_update(PhySet::M2, PhySet::M2) { - error!("Failed to update PHY"); - if let PhyUpdateError::Raw(re) = e { - error!("Raw error code: {:?}", re); - } - } - - let server_fut = gatt_server::run(&conn, &server, |event| match event { - BleSplitPeripheralServerEvent::Service(split_event) => match split_event { - SplitBleServiceEvent::MessageToCentralCccdWrite { notifications } => { - info!("Split value CCCD updated: {}", notifications) - } - SplitBleServiceEvent::MessageToPeripheralWrite(message) => { - match postcard::from_bytes::(&message) { - Ok(message) => { - info!("Message from central: {:?}", message); - // Retry 3 times - for _i in 0..3 { - if let Err(e) = sender.try_send(message) { - error!("Send split message to reader error: {:?}", e); - // Wait for 20ms before the next try - block_on(embassy_time::Timer::after_millis(20)); - continue; - } - break; - } - } - Err(e) => error!("Postcard deserialize split message error: {}", e), - } - } - }, - }); - - let mut peripheral = - SplitPeripheral::new(BleSplitPeripheralDriver::new(&server, &conn, receiver)); - let peripheral_fut = peripheral.run(); - select(server_fut, peripheral_fut).await; - } -} diff --git a/rmk/src/split/peripheral.rs b/rmk/src/split/peripheral.rs index 93d1ff827..a3dc1bde0 100644 --- a/rmk/src/split/peripheral.rs +++ b/rmk/src/split/peripheral.rs @@ -1,14 +1,16 @@ +use embassy_futures::select::select3; +#[cfg(not(feature = "_ble"))] +use embedded_io_async::{Read, Write}; +#[cfg(feature = "_ble")] +use trouble_host::prelude::*; + use super::driver::{SplitReader, SplitWriter}; use super::SplitMessage; use crate::channel::{EVENT_CHANNEL, KEY_EVENT_CHANNEL}; -#[cfg(not(feature = "_nrf_ble"))] +#[cfg(not(feature = "_ble"))] use crate::split::serial::SerialSplitDriver; +use crate::state::ConnectionState; use crate::CONNECTION_STATE; -#[cfg(feature = "_nrf_ble")] -use embassy_executor::Spawner; -use embassy_futures::select::select3; -#[cfg(not(feature = "_nrf_ble"))] -use embedded_io_async::{Read, Write}; /// Run the split peripheral service. /// @@ -19,13 +21,16 @@ use embedded_io_async::{Read, Write}; /// * `peripheral_addr` - (optional) peripheral's BLE static address. This argument is enabled only for nRF BLE split now /// * `serial` - (optional) serial port used to send peripheral split message. This argument is enabled only for serial split now /// * `spawner`: (optional) embassy spawner used to spawn async tasks. This argument is enabled for non-esp microcontrollers -pub async fn run_rmk_split_peripheral<#[cfg(not(feature = "_nrf_ble"))] S: Write + Read>( - #[cfg(feature = "_nrf_ble")] central_addr: [u8; 6], - #[cfg(feature = "_nrf_ble")] peripheral_addr: [u8; 6], - #[cfg(not(feature = "_nrf_ble"))] serial: S, - #[cfg(feature = "_nrf_ble")] spawner: Spawner, +pub async fn run_rmk_split_peripheral< + 'a, + #[cfg(feature = "_ble")] C: Controller, + #[cfg(not(feature = "_ble"))] S: Write + Read, +>( + #[cfg(feature = "_ble")] central_addr: [u8; 6], + #[cfg(feature = "_ble")] stack: &'a Stack<'a, C>, + #[cfg(not(feature = "_ble"))] serial: S, ) { - #[cfg(not(feature = "_nrf_ble"))] + #[cfg(not(feature = "_ble"))] { let mut peripheral = SplitPeripheral::new(SerialSplitDriver::new(serial)); loop { @@ -33,13 +38,8 @@ pub async fn run_rmk_split_peripheral<#[cfg(not(feature = "_nrf_ble"))] S: Write } } - #[cfg(feature = "_nrf_ble")] - crate::split::nrf::peripheral::initialize_nrf_ble_split_peripheral_and_run( - central_addr, - peripheral_addr, - spawner, - ) - .await; + #[cfg(feature = "_ble")] + crate::split::ble::peripheral::initialize_nrf_ble_split_peripheral_and_run(central_addr, stack).await; } /// The split peripheral instance. @@ -56,7 +56,8 @@ impl SplitPeripheral { /// /// The peripheral uses the general matrix, does scanning and send the key events through `SplitWriter`. /// If also receives split messages from the central through `SplitReader`. - pub(crate) async fn run(&mut self) -> ! { + pub(crate) async fn run(&mut self) { + CONNECTION_STATE.store(ConnectionState::Connected.into(), core::sync::atomic::Ordering::Release); loop { match select3( self.split_driver.read(), @@ -76,6 +77,12 @@ impl SplitPeripheral { }, Err(e) => { error!("Split message read error: {:?}", e); + match e { + crate::split::driver::SplitDriverError::Disconnected => { + break; + } + _ => (), + } } }, embassy_futures::select::Either3::Second(e) => { diff --git a/rmk/src/split/rp/uart.rs b/rmk/src/split/rp/uart.rs index 1e20f4e08..49d668fcf 100644 --- a/rmk/src/split/rp/uart.rs +++ b/rmk/src/split/rp/uart.rs @@ -2,21 +2,17 @@ use core::cell::RefCell; use core::future::{poll_fn, Future}; use core::marker::PhantomData; use core::task::Poll; + use embassy_hal_internal::atomic_ring_buffer::RingBuffer; -use embassy_rp::Peripheral; -use embassy_rp::{ - clocks::clk_sys_freq, - gpio::{Drive, Level, Pull, SlewRate}, - interrupt::{ - typelevel::{Binding, Handler, Interrupt}, - Priority, - }, - pio::{ - Common, Config, Direction, FifoJoin, Instance, InterruptHandler, Pin, Pio, PioPin, - ShiftDirection, StateMachine, - }, - uart::Error, +use embassy_rp::clocks::clk_sys_freq; +use embassy_rp::gpio::{Drive, Level, Pull, SlewRate}; +use embassy_rp::interrupt::typelevel::{Binding, Handler, Interrupt}; +use embassy_rp::interrupt::Priority; +use embassy_rp::pio::{ + Common, Config, Direction, FifoJoin, Instance, InterruptHandler, Pin, Pio, PioPin, ShiftDirection, StateMachine, }; +use embassy_rp::uart::Error; +use embassy_rp::Peripheral; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::blocking_mutex::Mutex; use embassy_sync::waitqueue::AtomicWaker; @@ -292,10 +288,7 @@ impl<'a, PIO: Instance + UartPioAccess> BufferedUart<'a, PIO> { async fn enable_sm_tx(&mut self) { while !PIO::uart_buffer().idle_line.lock(|b| *b.borrow()) { - Timer::after(Duration::from_micros( - ((1_000_000u32 * 1) / BAUD_RATE) as u64, - )) - .await; + Timer::after(Duration::from_micros(((1_000_000u32 * 1) / BAUD_RATE) as u64)).await; } self.sm_rx.set_enable(false); self.set_pin_tx(); @@ -305,17 +298,12 @@ impl<'a, PIO: Instance + UartPioAccess> BufferedUart<'a, PIO> { async fn enable_sm_rx(&mut self) { while !self.sm_tx.tx().empty() {} - Timer::after(Duration::from_micros( - ((1_000_000u32 * 11) / BAUD_RATE) as u64, - )) - .await; + Timer::after(Duration::from_micros(((1_000_000u32 * 11) / BAUD_RATE) as u64)).await; self.sm_tx.set_enable(false); self.set_pin_rx(); - PIO::uart_buffer() - .idle_line - .lock(|b| *b.borrow_mut() = true); + PIO::uart_buffer().idle_line.lock(|b| *b.borrow_mut() = true); self.sm_rx.set_enable(true); } @@ -343,10 +331,7 @@ impl<'a, PIO: Instance + UartPioAccess> BufferedUart<'a, PIO> { self.sm_rx.set_pin_dirs(Direction::In, &[&self.pin_rx]); } - fn read_buffer<'c>( - &'c self, - buf: &'c mut [u8], - ) -> impl Future> + 'c { + fn read_buffer<'c>(&'c self, buf: &'c mut [u8]) -> impl Future> + 'c { poll_fn(move |cx| { if let Poll::Ready(r) = self.try_read(buf) { return Poll::Ready(r); @@ -381,10 +366,7 @@ impl<'a, PIO: Instance + UartPioAccess> BufferedUart<'a, PIO> { } if self.full_duplex { let result = self.write_ring(buf); - PIO::regs() - .irqs(0) - .inte() - .modify(|i| i.set_sm0_txnfull(true)); + PIO::regs().irqs(0).inte().modify(|i| i.set_sm0_txnfull(true)); return result; } else { if !self.sm_tx.is_enabled() { @@ -417,10 +399,7 @@ impl<'a, PIO: Instance + UartPioAccess> BufferedUart<'a, PIO> { if self.sm_tx.tx().try_push(byte) { return Poll::Ready(()); } - PIO::regs() - .irqs(0) - .inte() - .modify(|i| i.set_sm0_txnfull(true)); + PIO::regs().irqs(0).inte().modify(|i| i.set_sm0_txnfull(true)); PIO::uart_buffer().waker_tx.register(cx.waker()); Poll::Pending }) @@ -429,10 +408,7 @@ impl<'a, PIO: Instance + UartPioAccess> BufferedUart<'a, PIO> { async fn flush(&mut self) -> Result<(), Error> { if !self.sm_tx.tx().empty() { while !self.sm_tx.tx().empty() {} - Timer::after(Duration::from_micros( - ((1_000_000u32 * 11) / BAUD_RATE) as u64, - )) - .await; + Timer::after(Duration::from_micros(((1_000_000u32 * 11) / BAUD_RATE) as u64)).await; } Ok(()) } @@ -481,17 +457,11 @@ impl Handler for UartInterruptHan reader.pop_done(n); } if PIO::uart_buffer().buf_tx.is_empty() { - PIO::regs() - .irqs(0) - .inte() - .modify(|i| i.set_sm0_txnfull(false)); + PIO::regs().irqs(0).inte().modify(|i| i.set_sm0_txnfull(false)); } } else { // Half-Duplex Mode - PIO::regs() - .irqs(0) - .inte() - .modify(|i| i.set_sm0_txnfull(false)); + PIO::regs().irqs(0).inte().modify(|i| i.set_sm0_txnfull(false)); PIO::uart_buffer().waker_tx.wake(); } } @@ -502,17 +472,13 @@ impl Handler for UartInterruptHan } if ints & StatusBit::SM_IRQ1 != 0 { // Line Non-Idle Toogle Raised IRQ 1 - PIO::uart_buffer() - .idle_line - .lock(|b| *b.borrow_mut() = false); + PIO::uart_buffer().idle_line.lock(|b| *b.borrow_mut() = false); pio.irq().write(|f| f.set_irq(IrqBit::IRQ1)); PIO::Interrupt::unpend(); } if ints & StatusBit::SM_IRQ2 != 0 { // Line Idle Toogle Raised IRQ 2 - PIO::uart_buffer() - .idle_line - .lock(|b| *b.borrow_mut() = true); + PIO::uart_buffer().idle_line.lock(|b| *b.borrow_mut() = true); pio.irq().write(|f| f.set_irq(IrqBit::IRQ2)); PIO::Interrupt::unpend(); } diff --git a/rmk/src/split/serial/mod.rs b/rmk/src/split/serial/mod.rs index 3c60d4110..2d9f90455 100644 --- a/rmk/src/split/serial/mod.rs +++ b/rmk/src/split/serial/mod.rs @@ -1,11 +1,8 @@ use embedded_io_async::{Read, Write}; -use crate::split::{ - driver::{PeripheralManager, SplitReader, SplitWriter}, - SplitMessage, SPLIT_MESSAGE_MAX_SIZE, -}; - use super::driver::SplitDriverError; +use crate::split::driver::{PeripheralManager, SplitReader, SplitWriter}; +use crate::split::{SplitMessage, SPLIT_MESSAGE_MAX_SIZE}; // Receive split message from peripheral via serial and process it /// @@ -26,8 +23,7 @@ pub(crate) async fn run_serial_peripheral_manager< receiver: S, ) { let split_serial_driver: SerialSplitDriver = SerialSplitDriver::new(receiver); - let peripheral_manager = - PeripheralManager::::new(split_serial_driver, id); + let peripheral_manager = PeripheralManager::::new(split_serial_driver, id); info!("Running peripheral manager {}", id); peripheral_manager.run().await; @@ -72,19 +68,18 @@ impl SplitReader for SerialSplitDriver { } } - let (result, n_bytes_unused) = match postcard::take_from_bytes_cobs::( - &mut self.buffer.clone()[..self.n_bytes_part], - ) { - Ok((message, unused_bytes)) => (Ok(message), unused_bytes.len()), - Err(e) => { - error!("Postcard deserialize split message error: {}", e); - let n_bytes_unused = self.buffer[..self.n_bytes_part] - .iter() - .position(|&x| x == SENTINEL) - .map_or(0, |index| self.n_bytes_part - index - 1); - (Err(SplitDriverError::SerializeError), n_bytes_unused) - } - }; + let (result, n_bytes_unused) = + match postcard::take_from_bytes_cobs::(&mut self.buffer.clone()[..self.n_bytes_part]) { + Ok((message, unused_bytes)) => (Ok(message), unused_bytes.len()), + Err(e) => { + error!("Postcard deserialize split message error: {}", e); + let n_bytes_unused = self.buffer[..self.n_bytes_part] + .iter() + .position(|&x| x == SENTINEL) + .map_or(0, |index| self.n_bytes_part - index - 1); + (Err(SplitDriverError::SerializeError), n_bytes_unused) + } + }; self.buffer .copy_within(self.n_bytes_part - n_bytes_unused..self.n_bytes_part, 0); diff --git a/rmk/src/state.rs b/rmk/src/state.rs new file mode 100644 index 000000000..c04fcd528 --- /dev/null +++ b/rmk/src/state.rs @@ -0,0 +1,65 @@ +use core::sync::atomic::{AtomicBool, AtomicU8, Ordering}; + +/// Current connection type: +/// - 0: USB +/// - 1: BLE +/// - Other: reserved +pub(crate) static CONNECTION_TYPE: AtomicU8 = AtomicU8::new(0); +pub(crate) static CONNECTION_STATE: AtomicBool = AtomicBool::new(false); + +/// Current default connection type +pub enum ConnectionType { + Usb = 0, + Ble = 1, +} + +pub enum ConnectionState { + Disconnected, + Connected, +} + +impl From for ConnectionType { + fn from(value: u8) -> Self { + match value { + 0 => ConnectionType::Usb, + 1 => ConnectionType::Ble, + _ => unreachable!("Invalid connection type"), + } + } +} + +impl From for u8 { + fn from(conn_type: ConnectionType) -> u8 { + match conn_type { + ConnectionType::Usb => 0, + ConnectionType::Ble => 1, + } + } +} + +pub fn get_connection_type() -> ConnectionType { + CONNECTION_TYPE.load(Ordering::Acquire).into() +} + +pub fn get_connection_state() -> ConnectionState { + CONNECTION_STATE.load(Ordering::Acquire).into() +} + +impl From for ConnectionState { + fn from(value: bool) -> Self { + if value { + ConnectionState::Connected + } else { + ConnectionState::Disconnected + } + } +} + +impl From for bool { + fn from(state: ConnectionState) -> bool { + match state { + ConnectionState::Connected => true, + ConnectionState::Disconnected => false, + } + } +} diff --git a/rmk/src/storage/mod.rs b/rmk/src/storage/mod.rs index 62d5fb40c..1fec50dea 100644 --- a/rmk/src/storage/mod.rs +++ b/rmk/src/storage/mod.rs @@ -1,48 +1,50 @@ pub mod dummy_flash; mod eeconfig; -use crate::{ - action::EncoderAction, - channel::FLASH_CHANNEL, - combo::{Combo, COMBO_MAX_LENGTH, COMBO_MAX_NUM}, - config::StorageConfig, - fork::{Fork, StateBits, FORK_MAX_NUM}, - hid_state::{HidModifiers, HidMouseButtons}, - light::LedIndicator, - BUILD_HASH, -}; -use byteorder::{BigEndian, ByteOrder}; use core::fmt::Debug; use core::ops::Range; + +use byteorder::{BigEndian, ByteOrder}; use embassy_embedded_hal::adapter::BlockingAsync; +use embassy_sync::signal::Signal; use embedded_storage::nor_flash::NorFlash; use embedded_storage_async::nor_flash::NorFlash as AsyncNorFlash; use heapless::Vec; -use sequential_storage::{ - cache::NoCache, - map::{fetch_all_items, fetch_item, store_item, SerializationError, Value}, - Error as SSError, +use sequential_storage::cache::NoCache; +use sequential_storage::map::{fetch_all_items, fetch_item, store_item, SerializationError, Value}; +use sequential_storage::Error as SSError; +#[cfg(feature = "_ble")] +use { + crate::ble::trouble::ble_server::CCCD_TABLE_SIZE, + crate::ble::trouble::profile::ProfileInfo, + trouble_host::{prelude::*, BondInformation, LongTermKey}, }; -#[cfg(feature = "_nrf_ble")] -use {crate::ble::nrf::bonder::BondInfo, core::mem}; +use self::eeconfig::EeKeymapConfig; +use crate::action::{EncoderAction, KeyAction}; +use crate::channel::FLASH_CHANNEL; +use crate::combo::{Combo, COMBO_MAX_LENGTH, COMBO_MAX_NUM}; +use crate::config::StorageConfig; +use crate::fork::{Fork, StateBits, FORK_MAX_NUM}; +use crate::hid_state::{HidModifiers, HidMouseButtons}; use crate::keyboard_macro::MACRO_SPACE_SIZE; -use crate::{ - action::KeyAction, - via::keycode_convert::{from_via_keycode, to_via_keycode}, -}; +use crate::light::LedIndicator; +use crate::via::keycode_convert::{from_via_keycode, to_via_keycode}; +use crate::BUILD_HASH; -use self::eeconfig::EeKeymapConfig; +/// Signal to synchronize the flash operation status, usually used outside of the flash task. +/// True if the flash operation is finished correctly, false if the flash operation is finished with error. +pub(crate) static FLASH_OPERATION_FINISHED: Signal = Signal::new(); // Message send from bonder to flash task, which will do saving or clearing operation -#[derive(Clone, Copy, Debug)] +#[derive(Clone, Debug)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub(crate) enum FlashOperationMessage { - // Bond info to be saved - #[cfg(feature = "_nrf_ble")] - BondInfo(BondInfo), + #[cfg(feature = "_ble")] + // BLE profile info to be saved + ProfileInfo(ProfileInfo), + #[cfg(feature = "_ble")] // Current active BLE profile number - #[cfg(feature = "_nrf_ble")] ActiveBleProfile(u8), // Clear the storage Reset, @@ -92,9 +94,9 @@ pub(crate) enum StorageKeys { ConnectionType, EncoderKeys, ForkData, - #[cfg(feature = "_nrf_ble")] + #[cfg(feature = "_ble")] ActiveBleProfile = 0xEE, - #[cfg(feature = "_nrf_ble")] + #[cfg(feature = "_ble")] BleBondInfo = 0xEF, } @@ -112,15 +114,17 @@ impl StorageKeys { 8 => Some(StorageKeys::ConnectionType), 9 => Some(StorageKeys::EncoderKeys), 10 => Some(StorageKeys::ForkData), - #[cfg(feature = "_nrf_ble")] + #[cfg(feature = "_ble")] + 0xEE => Some(StorageKeys::ActiveBleProfile), + #[cfg(feature = "_ble")] 0xEF => Some(StorageKeys::BleBondInfo), _ => None, } } } -/// The data stored in the storage. -#[derive(Clone, Copy, Debug)] +#[derive(Clone, Debug)] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] pub(crate) enum StorageData { StorageConfig(LocalStorageConfig), LayoutConfig(LayoutConfig), @@ -132,9 +136,9 @@ pub(crate) enum StorageData { ComboData(ComboData), ConnectionType(u8), ForkData(ForkData), - #[cfg(feature = "_nrf_ble")] - BondInfo(BondInfo), - #[cfg(feature = "_nrf_ble")] + #[cfg(feature = "_ble")] + BondInfo(ProfileInfo), + #[cfg(feature = "_ble")] ActiveBleProfile(u8), } @@ -206,10 +210,7 @@ impl Value<'_> for StorageData { StorageData::EncoderConfig(e) => { buffer[0] = StorageKeys::EncoderKeys as u8; BigEndian::write_u16(&mut buffer[1..3], to_via_keycode(e.action.clockwise())); - BigEndian::write_u16( - &mut buffer[3..5], - to_via_keycode(e.action.counter_clockwise()), - ); + BigEndian::write_u16(&mut buffer[3..5], to_via_keycode(e.action.counter_clockwise())); buffer[5] = e.idx as u8; buffer[6] = e.layer as u8; Ok(7) @@ -228,10 +229,7 @@ impl Value<'_> for StorageData { } buffer[0] = StorageKeys::ComboData as u8; for i in 0..COMBO_MAX_LENGTH { - BigEndian::write_u16( - &mut buffer[1 + i * 2..3 + i * 2], - to_via_keycode(combo.actions[i]), - ); + BigEndian::write_u16(&mut buffer[1 + i * 2..3 + i * 2], to_via_keycode(combo.actions[i])); } BigEndian::write_u16( &mut buffer[1 + COMBO_MAX_LENGTH * 2..3 + COMBO_MAX_LENGTH * 2], @@ -250,13 +248,11 @@ impl Value<'_> for StorageData { BigEndian::write_u16( &mut buffer[7..9], - fork.match_any.leds.into_bits() as u16 - | (fork.match_none.leds.into_bits() as u16) << 8, + fork.match_any.leds.into_bits() as u16 | (fork.match_none.leds.into_bits() as u16) << 8, ); BigEndian::write_u16( &mut buffer[9..11], - fork.match_any.mouse.into_bits() as u16 - | (fork.match_none.mouse.into_bits() as u16) << 8, + fork.match_any.mouse.into_bits() as u16 | (fork.match_none.mouse.into_bits() as u16) << 8, ); BigEndian::write_u32( &mut buffer[11..15], @@ -272,25 +268,39 @@ impl Value<'_> for StorageData { buffer[1] = *ty; Ok(2) } - #[cfg(feature = "_nrf_ble")] - StorageData::BondInfo(b) => { - if buffer.len() < 121 { - return Err(SerializationError::BufferTooSmall); - } - - // Must be 120 - // info!("size of BondInfo: {}", size_of_val(self)); - buffer[0] = StorageKeys::BleBondInfo as u8; - let buf: [u8; 120] = unsafe { mem::transmute_copy(b) }; - buffer[1..121].copy_from_slice(&buf); - Ok(121) - } - #[cfg(feature = "_nrf_ble")] + #[cfg(feature = "_ble")] StorageData::ActiveBleProfile(slot_num) => { buffer[0] = StorageKeys::ActiveBleProfile as u8; buffer[1] = *slot_num; Ok(2) } + #[cfg(feature = "_ble")] + StorageData::BondInfo(b) => { + if buffer.len() < 23 + CCCD_TABLE_SIZE * 4 { + return Err(SerializationError::BufferTooSmall); + } + buffer[0] = StorageKeys::BleBondInfo as u8; + let ltk = b.info.ltk.to_le_bytes(); + let address = b.info.address; + buffer[1] = b.slot_num; + buffer[2..18].copy_from_slice(<k); + buffer[18..24].copy_from_slice(address.raw()); + let cccd_table = b.cccd_table.inner(); + for i in 0..CCCD_TABLE_SIZE { + match cccd_table.get(i) { + Some(cccd) => { + let handle: u16 = cccd.0; + let cccd: u16 = cccd.1.raw(); + buffer[24 + i * 4..26 + i * 4].copy_from_slice(&handle.to_le_bytes()); + buffer[26 + i * 4..28 + i * 4].copy_from_slice(&cccd.to_le_bytes()); + } + None => { + buffer[24 + i * 4..28 + i * 4].copy_from_slice(&[0, 0, 0, 0]); + } + }; + } + Ok(24 + CCCD_TABLE_SIZE * 4) + } } } @@ -324,9 +334,9 @@ impl Value<'_> for StorageData { } StorageKeys::LedLightConfig => Err(SerializationError::Custom(0)), StorageKeys::RgbLightConfig => Err(SerializationError::Custom(0)), - StorageKeys::KeymapConfig => Ok(StorageData::KeymapConfig( - EeKeymapConfig::from_bits(BigEndian::read_u16(&buffer[1..3])), - )), + StorageKeys::KeymapConfig => Ok(StorageData::KeymapConfig(EeKeymapConfig::from_bits( + BigEndian::read_u16(&buffer[1..3]), + ))), StorageKeys::LayoutConfig => { let default_layer = buffer[1]; let layout_option = BigEndian::read_u32(&buffer[2..6]); @@ -363,8 +373,7 @@ impl Value<'_> for StorageData { } let mut actions = [KeyAction::No; COMBO_MAX_LENGTH]; for i in 0..COMBO_MAX_LENGTH { - actions[i] = - from_via_keycode(BigEndian::read_u16(&buffer[1 + i * 2..3 + i * 2])); + actions[i] = from_via_keycode(BigEndian::read_u16(&buffer[1 + i * 2..3 + i * 2])); } let output = from_via_keycode(BigEndian::read_u16( &buffer[1 + COMBO_MAX_LENGTH * 2..3 + COMBO_MAX_LENGTH * 2], @@ -413,8 +422,7 @@ impl Value<'_> for StorageData { leds: LedIndicator::from_bits(((led_masks >> 8) & 0xFF) as u8), mouse: HidMouseButtons::from_bits(((mouse_masks >> 8) & 0xFF) as u8), }; - let kept_modifiers = - HidModifiers::from_bits(((modifier_masks >> 16) & 0xFF) as u8); + let kept_modifiers = HidModifiers::from_bits(((modifier_masks >> 16) & 0xFF) as u8); let bindable = (modifier_masks & (1 << 24)) != 0; Ok(StorageData::ForkData(ForkData { @@ -428,17 +436,34 @@ impl Value<'_> for StorageData { bindable, })) } - #[cfg(feature = "_nrf_ble")] + #[cfg(feature = "_ble")] + StorageKeys::ActiveBleProfile => { + if buffer.len() < 2 { + return Err(SerializationError::BufferTooSmall); + } + Ok(StorageData::ActiveBleProfile(buffer[1])) + } + #[cfg(feature = "_ble")] StorageKeys::BleBondInfo => { - // Make `transmute_copy` happy, because the compiler doesn't know the size of buffer - let mut buf = [0_u8; 120]; - buf.copy_from_slice(&buffer[1..121]); - let info: BondInfo = unsafe { mem::transmute_copy(&buf) }; - - Ok(StorageData::BondInfo(info)) + if buffer.len() < 23 + CCCD_TABLE_SIZE * 4 { + return Err(SerializationError::BufferTooSmall); + } + let slot_num = buffer[1]; + let ltk = LongTermKey::from_le_bytes(buffer[2..18].try_into().unwrap()); + let address = BdAddr::new(buffer[18..24].try_into().unwrap()); + let mut cccd_table_values = [(0u16, CCCD::default()); CCCD_TABLE_SIZE]; + for i in 0..CCCD_TABLE_SIZE { + let handle = u16::from_le_bytes(buffer[24 + i * 4..26 + i * 4].try_into().unwrap()); + let cccd = u16::from_le_bytes(buffer[26 + i * 4..28 + i * 4].try_into().unwrap()); + cccd_table_values[i] = (handle, cccd.into()); + } + Ok(StorageData::BondInfo(ProfileInfo { + slot_num, + removed: false, + info: BondInformation::new(address, ltk), + cccd_table: CccdTable::new(cccd_table_values), + })) } - #[cfg(feature = "_nrf_ble")] - StorageKeys::ActiveBleProfile => Ok(StorageData::ActiveBleProfile(buffer[1])), } } else { Err(SerializationError::Custom(1)) @@ -466,10 +491,10 @@ impl StorageData { StorageData::ForkData(_) => { panic!("To get fork key for ForkData, use `get_fork_key` instead"); } - #[cfg(feature = "_nrf_ble")] - StorageData::BondInfo(b) => get_bond_info_key(b.slot_num), - #[cfg(feature = "_nrf_ble")] + #[cfg(feature = "_ble")] StorageData::ActiveBleProfile(_) => StorageKeys::ActiveBleProfile as u32, + #[cfg(feature = "_ble")] + StorageData::BondInfo(b) => get_bond_info_key(b.slot_num), } } } @@ -546,11 +571,10 @@ pub struct Storage< /// Read out storage config, update and then save back. /// This macro applies to only some of the configs. -macro_rules! write_storage { +macro_rules! update_storage_field { ($f: expr, $buf: expr, $cache:expr, $key:ident, $field:ident, $range:expr) => { if let Ok(Some(StorageData::$key(mut saved))) = - fetch_item::($f, $range, $cache, $buf, &(StorageKeys::$key as u32)) - .await + fetch_item::($f, $range, $cache, $buf, &(StorageKeys::$key as u32)).await { saved.$field = $field; store_item::( @@ -568,13 +592,8 @@ macro_rules! write_storage { }; } -impl< - F: AsyncNorFlash, - const ROW: usize, - const COL: usize, - const NUM_LAYER: usize, - const NUM_ENCODER: usize, - > Storage +impl + Storage { pub async fn new( flash: F, @@ -608,9 +627,9 @@ impl< config.num_sectors, config.start_addr, ); + let storage_range = if start_addr == 0 { - (flash.capacity() - config.num_sectors as usize * F::ERASE_SIZE) as u32 - ..flash.capacity() as u32 + (flash.capacity() - config.num_sectors as usize * F::ERASE_SIZE) as u32..flash.capacity() as u32 } else { assert!( start_addr % F::ERASE_SIZE == 0, @@ -626,12 +645,10 @@ impl< }; // Check whether keymap and configs have been storaged in flash - if !storage.check_enable().await { + if !storage.check_enable().await || config.clear_storage { // Clear storage first debug!("Clearing storage!"); - let _ = - sequential_storage::erase_all(&mut storage.flash, storage.storage_range.clone()) - .await; + let _ = sequential_storage::erase_all(&mut storage.flash, storage.storage_range.clone()).await; // Initialize storage from keymap and config if storage @@ -667,7 +684,7 @@ impl< if let Err(e) = match info { FlashOperationMessage::LayoutOptions(layout_option) => { // Read out layout options, update layer option and save back - write_storage!( + update_storage_field!( &mut self.flash, &mut self.buffer, &mut storage_cache, @@ -681,7 +698,7 @@ impl< } FlashOperationMessage::DefaultLayer(default_layer) => { // Read out layout options, update layer option and save back - write_storage!( + update_storage_field!( &mut self.flash, &mut self.buffer, &mut storage_cache, @@ -714,11 +731,7 @@ impl< layer: layer as usize, action, }); - let key = get_keymap_key::( - row as usize, - col as usize, - layer as usize, - ); + let key = get_keymap_key::(row as usize, col as usize, layer as usize); store_item( &mut self.flash, self.storage_range.clone(), @@ -769,6 +782,7 @@ impl< ) .await } + #[cfg(feature = "_ble")] FlashOperationMessage::WriteFork(fork) => { let key = get_fork_key(fork.idx); store_item( @@ -781,7 +795,7 @@ impl< ) .await } - #[cfg(feature = "_nrf_ble")] + #[cfg(feature = "_ble")] FlashOperationMessage::ActiveBleProfile(profile) => { let data = StorageData::ActiveBleProfile(profile); store_item::( @@ -794,11 +808,11 @@ impl< ) .await } - #[cfg(feature = "_nrf_ble")] + #[cfg(feature = "_ble")] FlashOperationMessage::ClearSlot(key) => { info!("Clearing bond info slot_num: {}", key); // Remove item in `sequential-storage` is quite expensive, so just override the item with `removed = true` - let mut empty = BondInfo::default(); + let mut empty = ProfileInfo::default(); empty.removed = true; let data = StorageData::BondInfo(empty); store_item::( @@ -811,9 +825,9 @@ impl< ) .await } - #[cfg(feature = "_nrf_ble")] - FlashOperationMessage::BondInfo(b) => { - info!("Saving bond info: {:?}", b); + #[cfg(feature = "_ble")] + FlashOperationMessage::ProfileInfo(b) => { + debug!("Saving profile info: {:?}", b); let data = StorageData::BondInfo(b); store_item::( &mut self.flash, @@ -825,10 +839,13 @@ impl< ) .await } - #[cfg(not(feature = "_nrf_ble"))] + #[cfg(not(feature = "_ble"))] _ => Ok(()), } { print_storage_error::(e); + FLASH_OPERATION_FINISHED.signal(false); + } else { + FLASH_OPERATION_FINISHED.signal(true); } } } @@ -848,10 +865,7 @@ impl< .await { // Iterator the storage, read all keymap keys and encoder configs - while let Ok(Some((_key, item))) = key_iterator - .next::(&mut self.buffer) - .await - { + while let Ok(Some((_key, item))) = key_iterator.next::(&mut self.buffer).await { match item { StorageData::KeymapKey(key) => { if key.layer < NUM_LAYER && key.row < ROW && key.col < COL { @@ -893,10 +907,7 @@ impl< Ok(()) } - pub(crate) async fn read_combos( - &mut self, - combos: &mut Vec, - ) -> Result<(), ()> { + pub(crate) async fn read_combos(&mut self, combos: &mut Vec) -> Result<(), ()> { for (i, item) in combos.iter_mut().enumerate() { let key = get_combo_key(i); let read_data = fetch_item::( @@ -921,10 +932,7 @@ impl< Ok(()) } - pub(crate) async fn read_forks( - &mut self, - forks: &mut Vec, - ) -> Result<(), ()> { + pub(crate) async fn read_forks(&mut self, forks: &mut Vec) -> Result<(), ()> { for (i, item) in forks.iter_mut().enumerate() { let key = get_fork_key(i); let read_data = fetch_item::( @@ -1056,17 +1064,40 @@ impl< ) .await { - if config.enable && config.build_hash == BUILD_HASH { + // if config.enable && config.build_hash == BUILD_HASH { + if config.enable { return true; } } false } + + #[cfg(feature = "_ble")] + pub(crate) async fn read_trouble_bond_info(&mut self, slot_num: u8) -> Result, ()> { + let read_data = fetch_item::( + &mut self.flash, + self.storage_range.clone(), + &mut NoCache::new(), + &mut self.buffer, + &get_bond_info_key(slot_num), + ) + .await + .map_err(|e| print_storage_error::(e))?; + + if let Some(StorageData::BondInfo(info)) = read_data { + Ok(Some(info)) + } else { + Ok(None) + } + } } fn print_storage_error(e: SSError) { match e { - SSError::Storage { value: _ } => error!("Flash error"), + #[cfg(feature = "defmt")] + SSError::Storage { value: e } => error!("Flash error: {:?}", defmt::Debug2Format(&e)), + #[cfg(not(feature = "defmt"))] + SSError::Storage { value: _e } => error!("Flash error"), SSError::FullStorage => error!("Storage is full"), SSError::Corrupted {} => error!("Storage is corrupted"), SSError::BufferTooBig => error!("Buffer too big"), @@ -1089,3 +1120,18 @@ const fn get_buffer_size() -> usize { // Efficiently round up to the nearest multiple of 32 using bit manipulation. (buffer_size + 31) & !31 } + +#[macro_export] +/// Helper macro for reading storage config +macro_rules! read_storage { + ($storage: ident, $key: expr, $buf: expr) => { + ::sequential_storage::map::fetch_item::( + &mut $storage.flash, + $storage.storage_range.clone(), + &mut sequential_storage::cache::NoCache::new(), + &mut $buf, + $key, + ) + .await + }; +} diff --git a/rmk/src/usb/descriptor.rs b/rmk/src/usb/descriptor.rs index e999a6642..6db240e1d 100644 --- a/rmk/src/usb/descriptor.rs +++ b/rmk/src/usb/descriptor.rs @@ -24,9 +24,9 @@ use usbd_hid::descriptor::generator_prelude::*; #[derive(Default)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct KeyboardReport { - pub modifier: u8, //HidModifiers + pub modifier: u8, // HidModifiers pub reserved: u8, - pub leds: u8, //LedIndicator + pub leds: u8, // LedIndicator pub keycodes: [u8; 6], } diff --git a/rmk/src/usb/mod.rs b/rmk/src/usb/mod.rs index 5743080ad..53d1a3dbc 100644 --- a/rmk/src/usb/mod.rs +++ b/rmk/src/usb/mod.rs @@ -1,25 +1,21 @@ pub mod descriptor; -use core::sync::atomic::{AtomicU8, Ordering}; -use embassy_time::Timer; -use embassy_usb::{ - class::hid::{HidWriter, ReportId, RequestHandler}, - control::OutResponse, - driver::Driver, - Builder, Handler, -}; +use core::sync::atomic::Ordering; + +use embassy_sync::signal::Signal; +use embassy_usb::class::hid::{HidWriter, ReportId, RequestHandler}; +use embassy_usb::control::OutResponse; +use embassy_usb::driver::Driver; +use embassy_usb::{Builder, Handler}; use ssmarshal::serialize; use static_cell::StaticCell; -use crate::{ - channel::KEYBOARD_REPORT_CHANNEL, - config::KeyboardUsbConfig, - hid::{HidError, HidWriterTrait, Report, RunnableHidWriter}, - usb::descriptor::CompositeReportType, - CONNECTION_STATE, -}; - -pub(crate) static USB_STATE: AtomicU8 = AtomicU8::new(UsbState::Disabled as u8); +use crate::channel::KEYBOARD_REPORT_CHANNEL; +use crate::config::KeyboardUsbConfig; +use crate::hid::{HidError, HidWriterTrait, Report, RunnableHidWriter}; +use crate::state::ConnectionState; +use crate::usb::descriptor::CompositeReportType; +use crate::CONNECTION_STATE; /// USB state #[repr(u8)] @@ -44,39 +40,12 @@ impl From for UsbState { } } -pub(crate) async fn wait_for_usb_suspend() { - loop { - // Check usb suspend state every 500ms - Timer::after_millis(500).await; - let usb_state: UsbState = USB_STATE.load(Ordering::Acquire).into(); - if usb_state != UsbState::Configured { - break; - } - } -} - -/// Wait for USB connected(but USB might not be configured yet) -pub(crate) async fn wait_for_usb_enabled() { - loop { - // Check usb enable state every 500ms - Timer::after_millis(500).await; - - let usb_state: UsbState = USB_STATE.load(Ordering::Acquire).into(); - if usb_state == UsbState::Enabled { - break; - } - } -} - pub(crate) struct UsbKeyboardWriter<'a, 'd, D: Driver<'d>> { pub(crate) keyboard_writer: &'a mut HidWriter<'d, D, 8>, pub(crate) other_writer: &'a mut HidWriter<'d, D, 9>, } impl<'a, 'd, D: Driver<'d>> UsbKeyboardWriter<'a, 'd, D> { - pub(crate) fn new( - keyboard_writer: &'a mut HidWriter<'d, D, 8>, - other_writer: &'a mut HidWriter<'d, D, 9>, - ) -> Self { + pub(crate) fn new(keyboard_writer: &'a mut HidWriter<'d, D, 8>, other_writer: &'a mut HidWriter<'d, D, 9>) -> Self { Self { keyboard_writer, other_writer, @@ -106,8 +75,7 @@ impl<'d, D: Driver<'d>> HidWriterTrait for UsbKeyboardWriter<'_, 'd, D> { Report::MouseReport(mouse_report) => { let mut buf: [u8; 9] = [0; 9]; buf[0] = CompositeReportType::Mouse as u8; - let n = serialize(&mut buf[1..], &mouse_report) - .map_err(|_| HidError::ReportSerializeError)?; + let n = serialize(&mut buf[1..], &mouse_report).map_err(|_| HidError::ReportSerializeError)?; self.other_writer .write(&buf[0..n + 1]) .await @@ -117,8 +85,7 @@ impl<'d, D: Driver<'d>> HidWriterTrait for UsbKeyboardWriter<'_, 'd, D> { Report::MediaKeyboardReport(media_keyboard_report) => { let mut buf: [u8; 9] = [0; 9]; buf[0] = CompositeReportType::Media as u8; - let n = serialize(&mut buf[1..], &media_keyboard_report) - .map_err(|_| HidError::ReportSerializeError)?; + let n = serialize(&mut buf[1..], &media_keyboard_report).map_err(|_| HidError::ReportSerializeError)?; self.other_writer .write(&buf[0..n + 1]) .await @@ -128,8 +95,7 @@ impl<'d, D: Driver<'d>> HidWriterTrait for UsbKeyboardWriter<'_, 'd, D> { Report::SystemControlReport(system_control_report) => { let mut buf: [u8; 9] = [0; 9]; buf[0] = CompositeReportType::System as u8; - let n = serialize(&mut buf[1..], &system_control_report) - .map_err(|_| HidError::ReportSerializeError)?; + let n = serialize(&mut buf[1..], &system_control_report).map_err(|_| HidError::ReportSerializeError)?; self.other_writer .write(&buf[0..n + 1]) .await @@ -140,10 +106,7 @@ impl<'d, D: Driver<'d>> HidWriterTrait for UsbKeyboardWriter<'_, 'd, D> { } } -pub(crate) fn new_usb_builder<'d, D: Driver<'d>>( - driver: D, - keyboard_config: KeyboardUsbConfig<'d>, -) -> Builder<'d, D> { +pub(crate) fn new_usb_builder<'d, D: Driver<'d>>(driver: D, keyboard_config: KeyboardUsbConfig<'d>) -> Builder<'d, D> { // Create embassy-usb Config let mut usb_config = embassy_usb::Config::new(keyboard_config.vid, keyboard_config.pid); usb_config.manufacturer = Some(keyboard_config.manufacturer); @@ -254,44 +217,47 @@ impl UsbDeviceHandler { } } +pub(crate) static USB_ENABLED: Signal = Signal::new(); +pub(crate) static USB_SUSPENDED: Signal = Signal::new(); + impl Handler for UsbDeviceHandler { fn enabled(&mut self, enabled: bool) { if enabled { - USB_STATE.store(UsbState::Enabled as u8, Ordering::Relaxed); info!("Device enabled"); + USB_ENABLED.signal(()); } else { - USB_STATE.store(UsbState::Disabled as u8, Ordering::Relaxed); info!("Device disabled"); + if USB_ENABLED.signaled() { + USB_ENABLED.reset(); + } } } fn reset(&mut self) { - USB_STATE.store(UsbState::Enabled as u8, Ordering::Relaxed); info!("Bus reset, the Vbus current limit is 100mA"); } fn addressed(&mut self, addr: u8) { - USB_STATE.store(UsbState::Enabled as u8, Ordering::Relaxed); info!("USB address set to: {}", addr); } fn configured(&mut self, configured: bool) { if configured { - USB_STATE.store(UsbState::Configured as u8, Ordering::Relaxed); - CONNECTION_STATE.store(true, Ordering::Release); + CONNECTION_STATE.store(ConnectionState::Connected.into(), Ordering::Release); + USB_ENABLED.signal(()); info!("Device configured, it may now draw up to the configured current from Vbus.") } else { - USB_STATE.store(UsbState::Enabled as u8, Ordering::Relaxed); info!("Device is no longer configured, the Vbus current limit is 100mA."); } } fn suspended(&mut self, suspended: bool) { - USB_STATE.store(UsbState::Enabled as u8, Ordering::Release); if suspended { info!("Device suspended, the Vbus current limit is 500µA (or 2.5mA for high-power devices with remote wakeup enabled)."); + USB_SUSPENDED.signal(()); } else { info!("Device resumed, the Vbus current limit is 500µA (or 2.5mA for high-power devices with remote wakeup enabled)."); + USB_SUSPENDED.reset(); } } } diff --git a/rmk/src/via/keycode_convert.rs b/rmk/src/via/keycode_convert.rs index 2f579fc18..9de35569b 100644 --- a/rmk/src/via/keycode_convert.rs +++ b/rmk/src/via/keycode_convert.rs @@ -1,9 +1,7 @@ use num_enum::FromPrimitive; -use crate::{ - action::{Action, KeyAction}, - keycode::{KeyCode, ModifierCombination}, -}; +use crate::action::{Action, KeyAction}; +use crate::keycode::{KeyCode, ModifierCombination}; pub(crate) fn to_via_keycode(key_action: KeyAction) -> u16 { match key_action { @@ -77,10 +75,7 @@ pub(crate) fn to_via_keycode(key_action: KeyAction) -> u16 { 0x2000 | ((m.into_bits() as u16) << 8) | keycode } KeyAction::TapHold(tap, hold) => { - warn!( - "Tap hold action is not supported: tap: {:?}, hold: {:?}", - tap, hold - ); + warn!("Tap hold action is not supported: tap: {:?}, hold: {:?}", tap, hold); 0 } } @@ -221,17 +216,11 @@ mod test { // Mo(3) let via_keycode = 0x5223; - assert_eq!( - KeyAction::Single(Action::LayerOn(3)), - from_via_keycode(via_keycode) - ); + assert_eq!(KeyAction::Single(Action::LayerOn(3)), from_via_keycode(via_keycode)); // OSL(3) let via_keycode = 0x5283; - assert_eq!( - KeyAction::OneShot(Action::LayerOn(3)), - from_via_keycode(via_keycode) - ); + assert_eq!(KeyAction::OneShot(Action::LayerOn(3)), from_via_keycode(via_keycode)); // OSM RCtrl let via_keycode = 0x52B1; diff --git a/rmk/src/via/mod.rs b/rmk/src/via/mod.rs index fbb93b5bf..d2db993d9 100644 --- a/rmk/src/via/mod.rs +++ b/rmk/src/via/mod.rs @@ -1,23 +1,25 @@ -use crate::{ - boot, - config::VialConfig, - hid::{HidError, HidReaderTrait, HidWriterTrait}, - keyboard_macro::MACRO_SPACE_SIZE, - keymap::KeyMap, - usb::descriptor::ViaReport, - via::keycode_convert::{from_via_keycode, to_via_keycode}, -}; -#[cfg(feature = "storage")] -use crate::{channel::FLASH_CHANNEL, keyboard_macro::NUM_MACRO, storage::FlashOperationMessage}; -use byteorder::{BigEndian, ByteOrder, LittleEndian}; use core::cell::RefCell; -use embassy_time::Instant; -use embassy_time::Timer; -use embassy_usb::{class::hid::HidReaderWriter, driver::Driver}; +use core::sync::atomic::Ordering; + +use byteorder::{BigEndian, ByteOrder, LittleEndian}; +use embassy_time::{Instant, Timer}; +use embassy_usb::class::hid::HidReaderWriter; +use embassy_usb::driver::Driver; use num_enum::{FromPrimitive as _, TryFromPrimitive as _}; use protocol::{ViaCommand, ViaKeyboardInfo, VIA_FIRMWARE_VERSION, VIA_PROTOCOL_VERSION}; use vial::process_vial; +use crate::config::VialConfig; +use crate::hid::{HidError, HidReaderTrait, HidWriterTrait}; +use crate::keyboard_macro::MACRO_SPACE_SIZE; +use crate::keymap::KeyMap; +use crate::state::ConnectionState; +use crate::usb::descriptor::ViaReport; +use crate::via::keycode_convert::{from_via_keycode, to_via_keycode}; +use crate::{boot, CONNECTION_STATE}; +#[cfg(feature = "storage")] +use crate::{channel::FLASH_CHANNEL, keyboard_macro::NUM_MACRO, storage::FlashOperationMessage}; + pub(crate) mod keycode_convert; mod protocol; mod vial; @@ -68,8 +70,12 @@ impl< match self.process().await { Ok(_) => continue, Err(e) => { - error!("Process vial error: {:?}", e); - Timer::after_millis(500).await + if CONNECTION_STATE.load(Ordering::Relaxed) == ConnectionState::Disconnected.into() { + Timer::after_millis(1000).await; + } else { + error!("Process vial error: {:?}", e); + Timer::after_millis(10000).await; + } } } } @@ -118,10 +124,7 @@ impl< warn!("GetKeyboardValue - SwitchMatrixState") } ViaKeyboardInfo::FirmwareVersion => { - BigEndian::write_u32( - &mut report.input_data[2..6], - VIA_FIRMWARE_VERSION, - ); + BigEndian::write_u32(&mut report.input_data[2..6], VIA_FIRMWARE_VERSION); } _ => (), }, @@ -154,10 +157,7 @@ impl< let col = report.output_data[3] as usize; let action = keymap.borrow_mut().get_action_at(row, col, layer); let keycode = to_via_keycode(action); - info!( - "Getting keycode: {:02X} at ({},{}), layer {}", - keycode, row, col, layer - ); + info!("Getting keycode: {:02X} at ({},{}), layer {}", keycode, row, col, layer); BigEndian::write_u16(&mut report.input_data[4..6], keycode); } ViaCommand::DynamicKeymapSetKeyCode => { @@ -170,12 +170,9 @@ impl< "Setting keycode: 0x{:02X} at ({},{}), layer {} as {:?}", keycode, row, col, layer, action ); - keymap.borrow_mut().set_action_at( - row as usize, - col as usize, - layer as usize, - action, - ); + keymap + .borrow_mut() + .set_action_at(row as usize, col as usize, layer as usize, action); #[cfg(feature = "storage")] FLASH_CHANNEL .send(FlashOperationMessage::KeymapKey { @@ -226,10 +223,7 @@ impl< if size <= 28 { report.input_data[4..4 + size] .copy_from_slice(&self.keymap.borrow().macro_cache[offset..offset + size]); - debug!( - "Get macro buffer: offset: {}, data: {:?}", - offset, report.input_data - ); + debug!("Get macro buffer: offset: {}, data: {:?}", offset, report.input_data); } else { report.input_data[0] = 0xFF; } @@ -262,9 +256,7 @@ impl< #[cfg(feature = "storage")] if size < 28 || num_zero >= NUM_MACRO { let buf = self.keymap.borrow_mut().macro_cache; - FLASH_CHANNEL - .send(FlashOperationMessage::WriteMacro(buf)) - .await; + FLASH_CHANNEL.send(FlashOperationMessage::WriteMacro(buf)).await; info!("Flush macros to storage") } } @@ -316,8 +308,7 @@ impl< *a = action; idx += 2; let current_offset = offset as usize + i; - let (row, col, layer) = - get_position_from_offset(current_offset, row_num, col_num); + let (row, col, layer) = get_position_from_offset(current_offset, row_num, col_num); info!( "Setting keymap buffer of offset: {}, row,col,layer: {},{},{}", offset, row, col, layer @@ -356,11 +347,7 @@ impl< } } -fn get_position_from_offset( - offset: usize, - max_row: usize, - max_col: usize, -) -> (usize, usize, usize) { +fn get_position_from_offset(offset: usize, max_row: usize, max_col: usize) -> (usize, usize, usize) { let layer = offset / (max_col * max_row); let current_layer_offset = offset % (max_col * max_row); let row = current_layer_offset / max_col; diff --git a/rmk/src/via/vial.rs b/rmk/src/via/vial.rs index 2abc68593..bb4fe3320 100644 --- a/rmk/src/via/vial.rs +++ b/rmk/src/via/vial.rs @@ -3,13 +3,11 @@ use core::cell::RefCell; use byteorder::{BigEndian, ByteOrder, LittleEndian}; use num_enum::FromPrimitive; -use crate::{ - action::KeyAction, - combo::{Combo, COMBO_MAX_NUM}, - keymap::KeyMap, - usb::descriptor::ViaReport, - via::keycode_convert::{from_via_keycode, to_via_keycode}, -}; +use crate::action::KeyAction; +use crate::combo::{Combo, COMBO_MAX_NUM}; +use crate::keymap::KeyMap; +use crate::usb::descriptor::ViaReport; +use crate::via::keycode_convert::{from_via_keycode, to_via_keycode}; #[cfg(feature = "storage")] use crate::{ channel::FLASH_CHANNEL, @@ -96,12 +94,9 @@ pub(crate) async fn process_vial< if end > vial_keyboard_def.len() { end = vial_keyboard_def.len(); } - vial_keyboard_def[start..end] - .iter() - .enumerate() - .for_each(|(i, v)| { - report.input_data[i] = *v; - }); + vial_keyboard_def[start..end].iter().enumerate().for_each(|(i, v)| { + report.input_data[i] = *v; + }); debug!( "Vial return: page:{} start:{} end: {}, data: {:?}", page, start, end, report.input_data @@ -152,8 +147,7 @@ pub(crate) async fn process_vial< ); } LittleEndian::write_u16( - &mut report.input_data - [1 + VIAL_COMBO_MAX_LENGTH * 2..3 + VIAL_COMBO_MAX_LENGTH * 2], + &mut report.input_data[1 + VIAL_COMBO_MAX_LENGTH * 2..3 + VIAL_COMBO_MAX_LENGTH * 2], to_via_keycode(combo.output), ); } else { @@ -177,9 +171,8 @@ pub(crate) async fn process_vial< let mut actions = [KeyAction::No; COMBO_MAX_LENGTH]; let mut n: usize = 0; for i in 0..VIAL_COMBO_MAX_LENGTH { - let action = from_via_keycode(LittleEndian::read_u16( - &report.output_data[4 + i * 2..6 + i * 2], - )); + let action = + from_via_keycode(LittleEndian::read_u16(&report.output_data[4 + i * 2..6 + i * 2])); if action != KeyAction::No { if n >= COMBO_MAX_LENGTH { //fail if the combo action buffer is too small @@ -190,8 +183,7 @@ pub(crate) async fn process_vial< } } let output = from_via_keycode(LittleEndian::read_u16( - &report.output_data - [4 + VIAL_COMBO_MAX_LENGTH * 2..6 + VIAL_COMBO_MAX_LENGTH * 2], + &report.output_data[4 + VIAL_COMBO_MAX_LENGTH * 2..6 + VIAL_COMBO_MAX_LENGTH * 2], )); combo.actions.clear(); @@ -229,19 +221,16 @@ pub(crate) async fn process_vial< VialCommand::GetEncoder => { let layer = report.output_data[2]; let index = report.output_data[3]; - debug!( - "Received Vial - GetEncoder, encoder idx: {} at layer: {}", - index, layer - ); + debug!("Received Vial - GetEncoder, encoder idx: {} at layer: {}", index, layer); // Get encoder value if let Some(encoder_map) = &keymap.borrow().encoders { if let Some(encoder_layer) = encoder_map.get(layer as usize) { if let Some(encoder) = encoder_layer.get(index as usize) { let clockwise = to_via_keycode(encoder.clockwise()); - BigEndian::write_u16(&mut report.input_data[0..2], clockwise); let counter_clockwise = to_via_keycode(encoder.counter_clockwise()); - BigEndian::write_u16(&mut report.input_data[2..4], counter_clockwise); + BigEndian::write_u16(&mut report.input_data[0..2], counter_clockwise); + BigEndian::write_u16(&mut report.input_data[2..4], clockwise); return; } } @@ -258,7 +247,7 @@ pub(crate) async fn process_vial< "Received Vial - SetEncoder, encoder idx: {} clockwise: {} at layer: {}", index, clockwise, layer ); - let _encoder = if let Some(ref mut encoder_map) = &mut keymap.borrow_mut().encoders { + let _encoder = if let Some(ref mut encoder_map) = keymap.borrow_mut().encoders { if let Some(encoder_layer) = encoder_map.get_mut(layer as usize) { if let Some(encoder) = encoder_layer.get_mut(index as usize) { if clockwise == 1 { @@ -309,10 +298,7 @@ fn vial_combo(combos: &heapless::Vec, idx: usize) -> Optio .find_map(|(i, combo)| (i == idx).then_some(combo)) } -fn vial_combo_mut( - combos: &mut heapless::Vec, - idx: usize, -) -> Option<(usize, &mut Combo)> { +fn vial_combo_mut(combos: &mut heapless::Vec, idx: usize) -> Option<(usize, &mut Combo)> { combos .iter_mut() .enumerate() diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 000000000..db8dfe5cb --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,4 @@ +edition = "2024" +max_width=120 +group_imports = "StdExternalCrate" +imports_granularity = "Module" \ No newline at end of file diff --git a/scripts/check_all.ps1 b/scripts/check_all.ps1 index 7bbb860d1..172f2bdfb 100644 --- a/scripts/check_all.ps1 +++ b/scripts/check_all.ps1 @@ -23,7 +23,6 @@ $buildDirs = @( "examples/use_rust/py32f07x", "examples/use_config/nrf52832_ble", "examples/use_config/nrf52840_ble", - "examples/use_config/nrf52840_usb", "examples/use_config/rp2040", "examples/use_rust/rp2040_direct_pin", "examples/use_config/stm32f1", diff --git a/scripts/check_all.sh b/scripts/check_all.sh index 7af9fe99d..27a935d4d 100644 --- a/scripts/check_all.sh +++ b/scripts/check_all.sh @@ -1,11 +1,4 @@ # Compile examples -cd examples/use_rust/esp32c3_ble && cargo +esp build --release && cd ../../.. -cd examples/use_rust/esp32c6_ble && cargo +esp build --release && cd ../../.. -cd examples/use_rust/esp32s3_ble && cargo +esp build --release && cd ../../.. -cd examples/use_config/esp32c3_ble && cargo +esp build --release && cd ../../.. -cd examples/use_config/esp32c6_ble && cargo +esp build --release && cd ../../.. -cd examples/use_config/esp32s3_ble && cargo +esp build --release && cd ../../.. - cd examples/use_rust/nrf52832_ble && cargo build --release && cd ../../.. cd examples/use_rust/nrf52840 && cargo build --release && cd ../../.. cd examples/use_rust/nrf52840_ble && cargo build --release && cd ../../.. @@ -25,7 +18,6 @@ cd examples/use_config/nrf52832_ble && cargo build --release && cd ../../.. cd examples/use_config/nrf52840_ble && cargo build --release && cd ../../.. cd examples/use_config/nrf52840_ble_split && cargo build --release --bin central && cargo build --release --bin peripheral && cd ../../.. cd examples/use_config/nrf52840_ble_split_direct_pin && cargo build --release --bin central && cargo build --release --bin peripheral && cd ../../.. -cd examples/use_config/nrf52840_usb && cargo build --release && cd ../../.. cd examples/use_config/rp2040 && cargo build --release && cd ../../.. cd examples/use_config/rp2040_direct_pin && cargo build --release && cd ../../.. cd examples/use_config/rp2040_split && cargo build --release --bin central && cargo build --release --bin peripheral && cd ../../.. @@ -34,6 +26,14 @@ cd examples/use_config/stm32f1 && cargo build --release && cd ../../.. cd examples/use_config/stm32f4 && cargo build --release && cd ../../.. cd examples/use_config/stm32h7 && cargo build --release && cd ../../.. +cd examples/use_rust/esp32c3_ble && cargo build --release && cd ../../.. +cd examples/use_rust/esp32c6_ble && cargo build --release && cd ../../.. +cd examples/use_config/esp32c3_ble && cargo build --release && cd ../../.. +cd examples/use_config/esp32c6_ble && cargo build --release && cd ../../.. +. ~/export-esp.sh +cd examples/use_rust/esp32s3_ble && cargo +esp build --release && cd ../../.. +cd examples/use_config/esp32s3_ble && cargo +esp build --release && cd ../../.. + # Clean examples cd examples/use_rust/nrf52832_ble && cargo clean && cd ../../.. cd examples/use_rust/nrf52840 && cargo clean && cd ../../.. @@ -54,7 +54,6 @@ cd examples/use_config/nrf52832_ble && cargo clean && cd ../../.. cd examples/use_config/nrf52840_ble && cargo clean && cd ../../.. cd examples/use_config/nrf52840_ble_split && cargo clean && cd ../../.. cd examples/use_config/nrf52840_ble_split_direct_pin && cargo clean && cd ../../.. -cd examples/use_config/nrf52840_usb && cargo clean && cd ../../.. cd examples/use_config/rp2040 && cargo clean && cd ../../.. cd examples/use_config/rp2040_direct_pin && cargo clean && cd ../../.. cd examples/use_config/rp2040_split && cargo clean && cd ../../.. diff --git a/scripts/format_all.ps1 b/scripts/format_all.ps1 index 3b84e53d0..c1ffccad4 100644 --- a/scripts/format_all.ps1 +++ b/scripts/format_all.ps1 @@ -25,7 +25,6 @@ $dirs = @( "examples/use_config/nrf52832_ble", "examples/use_config/nrf52840_ble", "examples/use_config/nrf52840_ble_split", - "examples/use_config/nrf52840_usb", "examples/use_config/rp2040", "examples/use_config/rp2040_direct_pin", "examples/use_config/rp2040_split", diff --git a/scripts/format_all.sh b/scripts/format_all.sh index c21e6617b..e34931157 100644 --- a/scripts/format_all.sh +++ b/scripts/format_all.sh @@ -1,30 +1,29 @@ -cd rmk && cargo fmt && cd .. -cd rmk-macro && cargo fmt && cd .. +cd rmk && cargo +nightly fmt && cd .. +cd rmk-macro && cargo +nightly fmt && cd .. cd examples/use_rust/esp32c3_ble && cargo +esp fmt && cd ../../.. cd examples/use_rust/esp32c6_ble && cargo +esp fmt && cd ../../.. cd examples/use_rust/esp32s3_ble && cargo +esp fmt && cd ../../.. -cd examples/use_rust/hpm5300 && cargo fmt && cd ../../.. -cd examples/use_rust/nrf52832_ble && cargo fmt && cd ../../.. -cd examples/use_rust/nrf52840 && cargo fmt && cd ../../.. -cd examples/use_rust/nrf52840_ble && cargo fmt && cd ../../.. -cd examples/use_rust/nrf52840_ble_split && cargo fmt && cd ../../.. -cd examples/use_rust/rp2040 && cargo fmt && cd ../../.. -cd examples/use_rust/rp2040_direct_pin && cargo fmt && cd ../../.. -cd examples/use_rust/rp2040_split && cargo fmt && cd ../../.. -cd examples/use_rust/stm32f1 && cargo fmt && cd ../../.. -cd examples/use_rust/stm32f4 && cargo fmt && cd ../../.. -cd examples/use_rust/stm32h7 && cargo fmt && cd ../../.. -cd examples/use_rust/py32f07x && cargo fmt && cd ../../.. +cd examples/use_rust/hpm5300 && cargo +nightly fmt && cd ../../.. +cd examples/use_rust/nrf52832_ble && cargo +nightly fmt && cd ../../.. +cd examples/use_rust/nrf52840 && cargo +nightly fmt && cd ../../.. +cd examples/use_rust/nrf52840_ble && cargo +nightly fmt && cd ../../.. +cd examples/use_rust/nrf52840_ble_split && cargo +nightly fmt && cd ../../.. +cd examples/use_rust/rp2040 && cargo +nightly fmt && cd ../../.. +cd examples/use_rust/rp2040_direct_pin && cargo +nightly fmt && cd ../../.. +cd examples/use_rust/rp2040_split && cargo +nightly fmt && cd ../../.. +cd examples/use_rust/stm32f1 && cargo +nightly fmt && cd ../../.. +cd examples/use_rust/stm32f4 && cargo +nightly fmt && cd ../../.. +cd examples/use_rust/stm32h7 && cargo +nightly fmt && cd ../../.. +cd examples/use_rust/py32f07x && cargo +nightly fmt && cd ../../.. cd examples/use_config/esp32c3_ble && cargo +esp fmt && cd ../../.. cd examples/use_config/esp32c6_ble && cargo +esp fmt && cd ../../.. cd examples/use_config/esp32s3_ble && cargo +esp fmt && cd ../../.. -cd examples/use_config/nrf52832_ble && cargo fmt && cd ../../.. -cd examples/use_config/nrf52840_ble && cargo fmt && cd ../../.. -cd examples/use_config/nrf52840_ble_split && cargo fmt && cd ../../.. -cd examples/use_config/nrf52840_usb && cargo fmt && cd ../../.. -cd examples/use_config/rp2040 && cargo fmt && cd ../../.. -cd examples/use_config/rp2040_direct_pin && cargo fmt && cd ../../.. -cd examples/use_config/rp2040_split && cargo fmt && cd ../../.. -cd examples/use_config/stm32f1 && cargo fmt && cd ../../.. -cd examples/use_config/stm32f4 && cargo fmt && cd ../../.. -cd examples/use_config/stm32h7 && cargo fmt && cd ../../.. \ No newline at end of file +cd examples/use_config/nrf52832_ble && cargo +nightly fmt && cd ../../.. +cd examples/use_config/nrf52840_ble && cargo +nightly fmt && cd ../../.. +cd examples/use_config/nrf52840_ble_split && cargo +nightly fmt && cd ../../.. +cd examples/use_config/rp2040 && cargo +nightly fmt && cd ../../.. +cd examples/use_config/rp2040_direct_pin && cargo +nightly fmt && cd ../../.. +cd examples/use_config/rp2040_split && cargo +nightly fmt && cd ../../.. +cd examples/use_config/stm32f1 && cargo +nightly fmt && cd ../../.. +cd examples/use_config/stm32f4 && cargo +nightly fmt && cd ../../.. +cd examples/use_config/stm32h7 && cargo +nightly fmt && cd ../../.. \ No newline at end of file