Merge branch 'embassy-rs:master' into master
This commit is contained in:
commit
3d0ba58b2d
86
.github/workflows/doc.yml
vendored
Normal file
86
.github/workflows/doc.yml
vendored
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
name: Docs
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
env:
|
||||||
|
BUILDER_THREADS: '1'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
doc:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# Since stm32 crates take SO LONG to build, we split them
|
||||||
|
# into a separate job. This way it doesn't slow down updating
|
||||||
|
# the rest.
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
crates:
|
||||||
|
- stm32
|
||||||
|
- rest
|
||||||
|
|
||||||
|
# This will ensure at most one doc build job is running at a time
|
||||||
|
# (for stm32 and non-stm32 independently).
|
||||||
|
# If another job is already running, the new job will wait.
|
||||||
|
# If another job is already waiting, it'll be canceled.
|
||||||
|
# This means some commits will be skipped, but that's fine because
|
||||||
|
# we only care that the latest gets built.
|
||||||
|
concurrency: doc-${{ matrix.crates }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
- name: Install Rust targets
|
||||||
|
run: |
|
||||||
|
rustup target add x86_64-unknown-linux-gnu
|
||||||
|
rustup target add wasm32-unknown-unknown
|
||||||
|
rustup target add thumbv6m-none-eabi
|
||||||
|
rustup target add thumbv7m-none-eabi
|
||||||
|
rustup target add thumbv7em-none-eabi
|
||||||
|
rustup target add thumbv7em-none-eabihf
|
||||||
|
rustup target add thumbv8m.base-none-eabi
|
||||||
|
rustup target add thumbv8m.main-none-eabi
|
||||||
|
rustup target add thumbv8m.main-none-eabihf
|
||||||
|
|
||||||
|
- name: Install docserver
|
||||||
|
run: |
|
||||||
|
wget -q -O /usr/local/bin/builder "https://github.com/embassy-rs/docserver/releases/download/v0.3/builder"
|
||||||
|
chmod +x /usr/local/bin/builder
|
||||||
|
|
||||||
|
- name: build-stm32
|
||||||
|
if: ${{ matrix.crates=='stm32' }}
|
||||||
|
run: |
|
||||||
|
mkdir crates
|
||||||
|
builder ./embassy-stm32 crates/embassy-stm32/git.zup
|
||||||
|
builder ./stm32-metapac crates/stm32-metapac/git.zup
|
||||||
|
|
||||||
|
- name: build-rest
|
||||||
|
if: ${{ matrix.crates=='rest' }}
|
||||||
|
run: |
|
||||||
|
mkdir crates
|
||||||
|
builder ./embassy-boot/boot crates/embassy-boot/git.zup
|
||||||
|
builder ./embassy-boot/nrf crates/embassy-boot-nrf/git.zup
|
||||||
|
builder ./embassy-boot/stm32 crates/embassy-boot-stm32/git.zup
|
||||||
|
builder ./embassy-cortex-m crates/embassy-cortex-m/git.zup
|
||||||
|
builder ./embassy-embedded-hal crates/embassy-embedded-hal/git.zup
|
||||||
|
builder ./embassy-executor crates/embassy-executor/git.zup
|
||||||
|
builder ./embassy-futures crates/embassy-futures/git.zup
|
||||||
|
builder ./embassy-lora crates/embassy-lora/git.zup
|
||||||
|
builder ./embassy-net crates/embassy-net/git.zup
|
||||||
|
builder ./embassy-nrf crates/embassy-nrf/git.zup
|
||||||
|
builder ./embassy-rp crates/embassy-rp/git.zup
|
||||||
|
builder ./embassy-sync crates/embassy-sync/git.zup
|
||||||
|
builder ./embassy-time crates/embassy-time/git.zup
|
||||||
|
builder ./embassy-usb crates/embassy-usb/git.zup
|
||||||
|
builder ./embassy-usb-driver crates/embassy-usb-driver/git.zup
|
||||||
|
|
||||||
|
- name: upload
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.kube
|
||||||
|
echo "${{secrets.KUBECONFIG}}" > ~/.kube/config
|
||||||
|
POD=$(kubectl -n embassy get po -l app=docserver -o jsonpath={.items[0].metadata.name})
|
||||||
|
kubectl cp crates $POD:/data
|
||||||
|
|
||||||
|
|
2
.github/workflows/rust.yml
vendored
2
.github/workflows/rust.yml
vendored
@ -11,7 +11,7 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
all:
|
all:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
needs: [build-nightly, build-stable, test]
|
needs: [build-nightly, build-stable, test]
|
||||||
steps:
|
steps:
|
||||||
- name: Done
|
- name: Done
|
||||||
|
@ -3,6 +3,7 @@ authors = ["Dario Nieuwenhuis <dirbaio@dirbaio.net>"]
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
name = "embassy-basic-example"
|
name = "embassy-basic-example"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-executor = { version = "0.1.0", path = "../../../../../embassy-executor", features = ["defmt", "nightly"] }
|
embassy-executor = { version = "0.1.0", path = "../../../../../embassy-executor", features = ["defmt", "nightly"] }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "blinky-async"
|
name = "blinky-async"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = "0.7"
|
cortex-m = "0.7"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "blinky-hal"
|
name = "blinky-hal"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = "0.7"
|
cortex-m = "0.7"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "blinky-irq"
|
name = "blinky-irq"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = "0.7"
|
cortex-m = "0.7"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "blinky-pac"
|
name = "blinky-pac"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = "0.7"
|
cortex-m = "0.7"
|
||||||
|
@ -3,6 +3,7 @@ edition = "2021"
|
|||||||
name = "embassy-boot"
|
name = "embassy-boot"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Bootloader using Embassy"
|
description = "Bootloader using Embassy"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[package.metadata.embassy_docs]
|
[package.metadata.embassy_docs]
|
||||||
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-boot-v$VERSION/embassy-boot/boot/src/"
|
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-boot-v$VERSION/embassy-boot/boot/src/"
|
||||||
|
@ -3,6 +3,7 @@ edition = "2021"
|
|||||||
name = "embassy-boot-nrf"
|
name = "embassy-boot-nrf"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Bootloader lib for nRF chips"
|
description = "Bootloader lib for nRF chips"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[package.metadata.embassy_docs]
|
[package.metadata.embassy_docs]
|
||||||
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-boot-nrf-v$VERSION/embassy-boot/nrf/src/"
|
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-boot-nrf-v$VERSION/embassy-boot/nrf/src/"
|
||||||
|
@ -3,6 +3,7 @@ edition = "2021"
|
|||||||
name = "embassy-boot-stm32"
|
name = "embassy-boot-stm32"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Bootloader lib for STM32 chips"
|
description = "Bootloader lib for STM32 chips"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[package.metadata.embassy_docs]
|
[package.metadata.embassy_docs]
|
||||||
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-boot-nrf-v$VERSION/embassy-boot/stm32/src/"
|
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-boot-nrf-v$VERSION/embassy-boot/stm32/src/"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "embassy-cortex-m"
|
name = "embassy-cortex-m"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[package.metadata.embassy_docs]
|
[package.metadata.embassy_docs]
|
||||||
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-cortex-m-v$VERSION/embassy-cortex-m/src/"
|
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-cortex-m-v$VERSION/embassy-cortex-m/src/"
|
||||||
|
@ -2,13 +2,14 @@
|
|||||||
name = "embassy-embedded-hal"
|
name = "embassy-embedded-hal"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
|
|
||||||
[package.metadata.embassy_docs]
|
[package.metadata.embassy_docs]
|
||||||
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-embedded-hal-v$VERSION/embassy-embedded-hal/src/"
|
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-embedded-hal-v$VERSION/embassy-embedded-hal/src/"
|
||||||
src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-embedded-hal/src/"
|
src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-embedded-hal/src/"
|
||||||
features = ["nightly", "std"]
|
features = ["nightly", "std"]
|
||||||
target = "thumbv7em-none-eabi"
|
target = "x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
std = []
|
std = []
|
||||||
@ -18,8 +19,8 @@ nightly = ["embedded-hal-async", "embedded-storage-async"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
|
embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
|
||||||
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
|
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
|
||||||
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" }
|
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
|
||||||
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true }
|
embedded-hal-async = { version = "=0.1.0-alpha.2", optional = true }
|
||||||
embedded-storage = "0.3.0"
|
embedded-storage = "0.3.0"
|
||||||
embedded-storage-async = { version = "0.3.0", optional = true }
|
embedded-storage-async = { version = "0.3.0", optional = true }
|
||||||
nb = "1.0.0"
|
nb = "1.0.0"
|
||||||
|
@ -29,7 +29,7 @@ use core::future::Future;
|
|||||||
|
|
||||||
use embassy_sync::blocking_mutex::raw::RawMutex;
|
use embassy_sync::blocking_mutex::raw::RawMutex;
|
||||||
use embassy_sync::mutex::Mutex;
|
use embassy_sync::mutex::Mutex;
|
||||||
use embedded_hal_1::digital::blocking::OutputPin;
|
use embedded_hal_1::digital::OutputPin;
|
||||||
use embedded_hal_1::spi::ErrorType;
|
use embedded_hal_1::spi::ErrorType;
|
||||||
use embedded_hal_async::spi;
|
use embedded_hal_async::spi;
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ where
|
|||||||
type Error = SpiDeviceError<BUS::Error, CS::Error>;
|
type Error = SpiDeviceError<BUS::Error, CS::Error>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<M, BUS, CS> spi::SpiDevice for SpiDevice<'_, M, BUS, CS>
|
unsafe impl<M, BUS, CS> spi::SpiDevice for SpiDevice<'_, M, BUS, CS>
|
||||||
where
|
where
|
||||||
M: RawMutex + 'static,
|
M: RawMutex + 'static,
|
||||||
BUS: spi::SpiBusFlush + 'static,
|
BUS: spi::SpiBusFlush + 'static,
|
||||||
@ -122,7 +122,7 @@ where
|
|||||||
type Error = SpiDeviceError<BUS::Error, CS::Error>;
|
type Error = SpiDeviceError<BUS::Error, CS::Error>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<M, BUS, CS> spi::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS>
|
unsafe impl<M, BUS, CS> spi::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS>
|
||||||
where
|
where
|
||||||
M: RawMutex + 'static,
|
M: RawMutex + 'static,
|
||||||
BUS: spi::SpiBusFlush + SetConfig + 'static,
|
BUS: spi::SpiBusFlush + SetConfig + 'static,
|
||||||
|
@ -20,8 +20,7 @@ use core::cell::RefCell;
|
|||||||
|
|
||||||
use embassy_sync::blocking_mutex::raw::RawMutex;
|
use embassy_sync::blocking_mutex::raw::RawMutex;
|
||||||
use embassy_sync::blocking_mutex::Mutex;
|
use embassy_sync::blocking_mutex::Mutex;
|
||||||
use embedded_hal_1::i2c::blocking::{I2c, Operation};
|
use embedded_hal_1::i2c::{ErrorType, I2c, Operation};
|
||||||
use embedded_hal_1::i2c::ErrorType;
|
|
||||||
|
|
||||||
use crate::shared_bus::I2cDeviceError;
|
use crate::shared_bus::I2cDeviceError;
|
||||||
use crate::SetConfig;
|
use crate::SetConfig;
|
||||||
|
@ -22,9 +22,9 @@ use core::cell::RefCell;
|
|||||||
|
|
||||||
use embassy_sync::blocking_mutex::raw::RawMutex;
|
use embassy_sync::blocking_mutex::raw::RawMutex;
|
||||||
use embassy_sync::blocking_mutex::Mutex;
|
use embassy_sync::blocking_mutex::Mutex;
|
||||||
use embedded_hal_1::digital::blocking::OutputPin;
|
use embedded_hal_1::digital::OutputPin;
|
||||||
use embedded_hal_1::spi;
|
use embedded_hal_1::spi;
|
||||||
use embedded_hal_1::spi::blocking::SpiBusFlush;
|
use embedded_hal_1::spi::SpiBusFlush;
|
||||||
|
|
||||||
use crate::shared_bus::SpiDeviceError;
|
use crate::shared_bus::SpiDeviceError;
|
||||||
use crate::SetConfig;
|
use crate::SetConfig;
|
||||||
@ -50,7 +50,7 @@ where
|
|||||||
type Error = SpiDeviceError<BUS::Error, CS::Error>;
|
type Error = SpiDeviceError<BUS::Error, CS::Error>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<BUS, M, CS> embedded_hal_1::spi::blocking::SpiDevice for SpiDevice<'_, M, BUS, CS>
|
impl<BUS, M, CS> embedded_hal_1::spi::SpiDevice for SpiDevice<'_, M, BUS, CS>
|
||||||
where
|
where
|
||||||
M: RawMutex,
|
M: RawMutex,
|
||||||
BUS: SpiBusFlush,
|
BUS: SpiBusFlush,
|
||||||
@ -146,7 +146,7 @@ where
|
|||||||
type Error = SpiDeviceError<BUS::Error, CS::Error>;
|
type Error = SpiDeviceError<BUS::Error, CS::Error>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<BUS, M, CS> embedded_hal_1::spi::blocking::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS>
|
impl<BUS, M, CS> embedded_hal_1::spi::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS>
|
||||||
where
|
where
|
||||||
M: RawMutex,
|
M: RawMutex,
|
||||||
BUS: SpiBusFlush + SetConfig,
|
BUS: SpiBusFlush + SetConfig,
|
||||||
|
@ -2,12 +2,13 @@
|
|||||||
name = "embassy-executor"
|
name = "embassy-executor"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
|
|
||||||
[package.metadata.embassy_docs]
|
[package.metadata.embassy_docs]
|
||||||
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-executor-v$VERSION/embassy-executor/src/"
|
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-executor-v$VERSION/embassy-executor/src/"
|
||||||
src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-executor/src/"
|
src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-executor/src/"
|
||||||
features = ["nightly", "defmt", "unstable-traits"]
|
features = ["nightly", "defmt"]
|
||||||
flavors = [
|
flavors = [
|
||||||
{ name = "std", target = "x86_64-unknown-linux-gnu", features = ["std"] },
|
{ name = "std", target = "x86_64-unknown-linux-gnu", features = ["std"] },
|
||||||
{ name = "wasm", target = "wasm32-unknown-unknown", features = ["wasm"] },
|
{ name = "wasm", target = "wasm32-unknown-unknown", features = ["wasm"] },
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "embassy-hal-common"
|
name = "embassy-hal-common"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "embassy-lora"
|
name = "embassy-lora"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[package.metadata.embassy_docs]
|
[package.metadata.embassy_docs]
|
||||||
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-lora-v$VERSION/embassy-lora/src/"
|
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-lora-v$VERSION/embassy-lora/src/"
|
||||||
@ -30,8 +31,8 @@ log = { version = "0.4.14", optional = true }
|
|||||||
embassy-time = { version = "0.1.0", path = "../embassy-time" }
|
embassy-time = { version = "0.1.0", path = "../embassy-time" }
|
||||||
embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
|
embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
|
||||||
embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false, optional = true }
|
embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false, optional = true }
|
||||||
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" }
|
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
|
||||||
embedded-hal-async = { version = "0.1.0-alpha.1" }
|
embedded-hal-async = { version = "=0.1.0-alpha.2" }
|
||||||
embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common", default-features = false }
|
embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common", default-features = false }
|
||||||
futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] }
|
futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] }
|
||||||
embedded-hal = { version = "0.2", features = ["unproven"] }
|
embedded-hal = { version = "0.2", features = ["unproven"] }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "embassy-macros"
|
name = "embassy-macros"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
syn = { version = "1.0.76", features = ["full", "extra-traits"] }
|
syn = { version = "1.0.76", features = ["full", "extra-traits"] }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "embassy-net"
|
name = "embassy-net"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
|
|
||||||
[package.metadata.embassy_docs]
|
[package.metadata.embassy_docs]
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "embassy-nrf"
|
name = "embassy-nrf"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[package.metadata.embassy_docs]
|
[package.metadata.embassy_docs]
|
||||||
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-nrf-v$VERSION/embassy-nrf/src/"
|
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-nrf-v$VERSION/embassy-nrf/src/"
|
||||||
@ -73,8 +74,8 @@ embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" }
|
|||||||
embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional=true }
|
embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional=true }
|
||||||
|
|
||||||
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
|
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
|
||||||
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true}
|
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9", optional = true}
|
||||||
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true}
|
embedded-hal-async = { version = "=0.1.0-alpha.2", optional = true}
|
||||||
embedded-io = { version = "0.3.0", features = ["async"], optional = true }
|
embedded-io = { version = "0.3.0", features = ["async"], optional = true }
|
||||||
|
|
||||||
defmt = { version = "0.3", optional = true }
|
defmt = { version = "0.3", optional = true }
|
||||||
|
@ -574,7 +574,7 @@ mod eh1 {
|
|||||||
type Error = Infallible;
|
type Error = Infallible;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::InputPin for Input<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> {
|
||||||
fn is_high(&self) -> Result<bool, Self::Error> {
|
fn is_high(&self) -> Result<bool, Self::Error> {
|
||||||
Ok(self.is_high())
|
Ok(self.is_high())
|
||||||
}
|
}
|
||||||
@ -588,7 +588,7 @@ mod eh1 {
|
|||||||
type Error = Infallible;
|
type Error = Infallible;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::OutputPin for Output<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> {
|
||||||
fn set_high(&mut self) -> Result<(), Self::Error> {
|
fn set_high(&mut self) -> Result<(), Self::Error> {
|
||||||
Ok(self.set_high())
|
Ok(self.set_high())
|
||||||
}
|
}
|
||||||
@ -598,7 +598,7 @@ mod eh1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::StatefulOutputPin for Output<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> {
|
||||||
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
||||||
Ok(self.is_set_high())
|
Ok(self.is_set_high())
|
||||||
}
|
}
|
||||||
@ -615,7 +615,7 @@ mod eh1 {
|
|||||||
/// Implement [`InputPin`] for [`Flex`];
|
/// Implement [`InputPin`] for [`Flex`];
|
||||||
///
|
///
|
||||||
/// If the pin is not in input mode the result is unspecified.
|
/// If the pin is not in input mode the result is unspecified.
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::InputPin for Flex<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> {
|
||||||
fn is_high(&self) -> Result<bool, Self::Error> {
|
fn is_high(&self) -> Result<bool, Self::Error> {
|
||||||
Ok(self.is_high())
|
Ok(self.is_high())
|
||||||
}
|
}
|
||||||
@ -625,7 +625,7 @@ mod eh1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::OutputPin for Flex<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Flex<'d, T> {
|
||||||
fn set_high(&mut self) -> Result<(), Self::Error> {
|
fn set_high(&mut self) -> Result<(), Self::Error> {
|
||||||
Ok(self.set_high())
|
Ok(self.set_high())
|
||||||
}
|
}
|
||||||
@ -635,7 +635,7 @@ mod eh1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::StatefulOutputPin for Flex<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> {
|
||||||
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
||||||
Ok(self.is_set_high())
|
Ok(self.is_set_high())
|
||||||
}
|
}
|
||||||
|
@ -457,7 +457,7 @@ mod eh1 {
|
|||||||
type Error = Infallible;
|
type Error = Infallible;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, C: Channel, T: GpioPin> embedded_hal_1::digital::blocking::InputPin for InputChannel<'d, C, T> {
|
impl<'d, C: Channel, T: GpioPin> embedded_hal_1::digital::InputPin for InputChannel<'d, C, T> {
|
||||||
fn is_high(&self) -> Result<bool, Self::Error> {
|
fn is_high(&self) -> Result<bool, Self::Error> {
|
||||||
Ok(self.pin.is_high())
|
Ok(self.pin.is_high())
|
||||||
}
|
}
|
||||||
|
@ -446,25 +446,25 @@ mod eh1 {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance> embedded_hal_1::spi::blocking::SpiBusFlush for Spim<'d, T> {
|
impl<'d, T: Instance> embedded_hal_1::spi::SpiBusFlush for Spim<'d, T> {
|
||||||
fn flush(&mut self) -> Result<(), Self::Error> {
|
fn flush(&mut self) -> Result<(), Self::Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance> embedded_hal_1::spi::blocking::SpiBusRead<u8> for Spim<'d, T> {
|
impl<'d, T: Instance> embedded_hal_1::spi::SpiBusRead<u8> for Spim<'d, T> {
|
||||||
fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> {
|
fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> {
|
||||||
self.blocking_transfer(words, &[])
|
self.blocking_transfer(words, &[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance> embedded_hal_1::spi::blocking::SpiBusWrite<u8> for Spim<'d, T> {
|
impl<'d, T: Instance> embedded_hal_1::spi::SpiBusWrite<u8> for Spim<'d, T> {
|
||||||
fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> {
|
fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> {
|
||||||
self.blocking_write(words)
|
self.blocking_write(words)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance> embedded_hal_1::spi::blocking::SpiBus<u8> for Spim<'d, T> {
|
impl<'d, T: Instance> embedded_hal_1::spi::SpiBus<u8> for Spim<'d, T> {
|
||||||
fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> {
|
fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> {
|
||||||
self.blocking_transfer(read, write)
|
self.blocking_transfer(read, write)
|
||||||
}
|
}
|
||||||
|
@ -793,7 +793,7 @@ mod eh1 {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance> embedded_hal_1::i2c::blocking::I2c for Twim<'d, T> {
|
impl<'d, T: Instance> embedded_hal_1::i2c::I2c for Twim<'d, T> {
|
||||||
fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
|
fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
|
||||||
self.blocking_read(address, buffer)
|
self.blocking_read(address, buffer)
|
||||||
}
|
}
|
||||||
@ -823,14 +823,14 @@ mod eh1 {
|
|||||||
fn transaction<'a>(
|
fn transaction<'a>(
|
||||||
&mut self,
|
&mut self,
|
||||||
_address: u8,
|
_address: u8,
|
||||||
_operations: &mut [embedded_hal_1::i2c::blocking::Operation<'a>],
|
_operations: &mut [embedded_hal_1::i2c::Operation<'a>],
|
||||||
) -> Result<(), Self::Error> {
|
) -> Result<(), Self::Error> {
|
||||||
todo!();
|
todo!();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error>
|
fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error>
|
||||||
where
|
where
|
||||||
O: IntoIterator<Item = embedded_hal_1::i2c::blocking::Operation<'a>>,
|
O: IntoIterator<Item = embedded_hal_1::i2c::Operation<'a>>,
|
||||||
{
|
{
|
||||||
todo!();
|
todo!();
|
||||||
}
|
}
|
||||||
|
@ -1040,7 +1040,7 @@ mod eh1 {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance> embedded_hal_1::serial::blocking::Write for Uarte<'d, T> {
|
impl<'d, T: Instance> embedded_hal_1::serial::Write for Uarte<'d, T> {
|
||||||
fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
|
fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
|
||||||
self.blocking_write(buffer)
|
self.blocking_write(buffer)
|
||||||
}
|
}
|
||||||
@ -1054,7 +1054,7 @@ mod eh1 {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance> embedded_hal_1::serial::blocking::Write for UarteTx<'d, T> {
|
impl<'d, T: Instance> embedded_hal_1::serial::Write for UarteTx<'d, T> {
|
||||||
fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
|
fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
|
||||||
self.blocking_write(buffer)
|
self.blocking_write(buffer)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "embassy-rp"
|
name = "embassy-rp"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[package.metadata.embassy_docs]
|
[package.metadata.embassy_docs]
|
||||||
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-rp-v$VERSION/embassy-rp/src/"
|
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-rp-v$VERSION/embassy-rp/src/"
|
||||||
@ -31,7 +32,7 @@ nightly = ["embassy-executor/nightly", "embedded-hal-1", "embedded-hal-async", "
|
|||||||
|
|
||||||
# Implement embedded-hal 1.0 alpha traits.
|
# Implement embedded-hal 1.0 alpha traits.
|
||||||
# Implement embedded-hal-async traits if `nightly` is set as well.
|
# Implement embedded-hal-async traits if `nightly` is set as well.
|
||||||
unstable-traits = ["embedded-hal-1"]
|
unstable-traits = ["embedded-hal-1", "embedded-hal-nb"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
|
embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
|
||||||
@ -58,5 +59,6 @@ rp2040-pac2 = { git = "https://github.com/embassy-rs/rp2040-pac2", rev="017e3c90
|
|||||||
#rp2040-pac2 = { path = "../../rp2040-pac2", features = ["rt"] }
|
#rp2040-pac2 = { path = "../../rp2040-pac2", features = ["rt"] }
|
||||||
|
|
||||||
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
|
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
|
||||||
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true}
|
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9", optional = true}
|
||||||
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true}
|
embedded-hal-async = { version = "=0.1.0-alpha.2", optional = true}
|
||||||
|
embedded-hal-nb = { version = "=1.0.0-alpha.1", optional = true}
|
||||||
|
@ -867,7 +867,7 @@ mod eh1 {
|
|||||||
type Error = Infallible;
|
type Error = Infallible;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::InputPin for Input<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> {
|
||||||
fn is_high(&self) -> Result<bool, Self::Error> {
|
fn is_high(&self) -> Result<bool, Self::Error> {
|
||||||
Ok(self.is_high())
|
Ok(self.is_high())
|
||||||
}
|
}
|
||||||
@ -881,7 +881,7 @@ mod eh1 {
|
|||||||
type Error = Infallible;
|
type Error = Infallible;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::OutputPin for Output<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> {
|
||||||
fn set_high(&mut self) -> Result<(), Self::Error> {
|
fn set_high(&mut self) -> Result<(), Self::Error> {
|
||||||
Ok(self.set_high())
|
Ok(self.set_high())
|
||||||
}
|
}
|
||||||
@ -891,7 +891,7 @@ mod eh1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::StatefulOutputPin for Output<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> {
|
||||||
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
||||||
Ok(self.is_set_high())
|
Ok(self.is_set_high())
|
||||||
}
|
}
|
||||||
@ -901,7 +901,7 @@ mod eh1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::ToggleableOutputPin for Output<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::ToggleableOutputPin for Output<'d, T> {
|
||||||
fn toggle(&mut self) -> Result<(), Self::Error> {
|
fn toggle(&mut self) -> Result<(), Self::Error> {
|
||||||
Ok(self.toggle())
|
Ok(self.toggle())
|
||||||
}
|
}
|
||||||
@ -911,7 +911,7 @@ mod eh1 {
|
|||||||
type Error = Infallible;
|
type Error = Infallible;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::OutputPin for OutputOpenDrain<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for OutputOpenDrain<'d, T> {
|
||||||
fn set_high(&mut self) -> Result<(), Self::Error> {
|
fn set_high(&mut self) -> Result<(), Self::Error> {
|
||||||
Ok(self.set_high())
|
Ok(self.set_high())
|
||||||
}
|
}
|
||||||
@ -921,7 +921,7 @@ mod eh1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::StatefulOutputPin for OutputOpenDrain<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain<'d, T> {
|
||||||
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
||||||
Ok(self.is_set_high())
|
Ok(self.is_set_high())
|
||||||
}
|
}
|
||||||
@ -931,7 +931,7 @@ mod eh1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::ToggleableOutputPin for OutputOpenDrain<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::ToggleableOutputPin for OutputOpenDrain<'d, T> {
|
||||||
fn toggle(&mut self) -> Result<(), Self::Error> {
|
fn toggle(&mut self) -> Result<(), Self::Error> {
|
||||||
Ok(self.toggle())
|
Ok(self.toggle())
|
||||||
}
|
}
|
||||||
@ -941,7 +941,7 @@ mod eh1 {
|
|||||||
type Error = Infallible;
|
type Error = Infallible;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::InputPin for Flex<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> {
|
||||||
fn is_high(&self) -> Result<bool, Self::Error> {
|
fn is_high(&self) -> Result<bool, Self::Error> {
|
||||||
Ok(self.is_high())
|
Ok(self.is_high())
|
||||||
}
|
}
|
||||||
@ -951,7 +951,7 @@ mod eh1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::OutputPin for Flex<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Flex<'d, T> {
|
||||||
fn set_high(&mut self) -> Result<(), Self::Error> {
|
fn set_high(&mut self) -> Result<(), Self::Error> {
|
||||||
Ok(self.set_high())
|
Ok(self.set_high())
|
||||||
}
|
}
|
||||||
@ -961,7 +961,7 @@ mod eh1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::StatefulOutputPin for Flex<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> {
|
||||||
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
||||||
Ok(self.is_set_high())
|
Ok(self.is_set_high())
|
||||||
}
|
}
|
||||||
@ -971,7 +971,7 @@ mod eh1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Pin> embedded_hal_1::digital::blocking::ToggleableOutputPin for Flex<'d, T> {
|
impl<'d, T: Pin> embedded_hal_1::digital::ToggleableOutputPin for Flex<'d, T> {
|
||||||
fn toggle(&mut self) -> Result<(), Self::Error> {
|
fn toggle(&mut self) -> Result<(), Self::Error> {
|
||||||
Ok(self.toggle())
|
Ok(self.toggle())
|
||||||
}
|
}
|
||||||
|
@ -379,7 +379,7 @@ mod eh1 {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance, M: Mode> embedded_hal_1::i2c::blocking::I2c for I2c<'d, T, M> {
|
impl<'d, T: Instance, M: Mode> embedded_hal_1::i2c::I2c for I2c<'d, T, M> {
|
||||||
fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
|
fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
|
||||||
self.blocking_read(address, buffer)
|
self.blocking_read(address, buffer)
|
||||||
}
|
}
|
||||||
@ -421,16 +421,14 @@ mod eh1 {
|
|||||||
fn transaction<'a>(
|
fn transaction<'a>(
|
||||||
&mut self,
|
&mut self,
|
||||||
address: u8,
|
address: u8,
|
||||||
operations: &mut [embedded_hal_1::i2c::blocking::Operation<'a>],
|
operations: &mut [embedded_hal_1::i2c::Operation<'a>],
|
||||||
) -> Result<(), Self::Error> {
|
) -> Result<(), Self::Error> {
|
||||||
Self::setup(address.into())?;
|
Self::setup(address.into())?;
|
||||||
for i in 0..operations.len() {
|
for i in 0..operations.len() {
|
||||||
let last = i == operations.len() - 1;
|
let last = i == operations.len() - 1;
|
||||||
match &mut operations[i] {
|
match &mut operations[i] {
|
||||||
embedded_hal_1::i2c::blocking::Operation::Read(buf) => {
|
embedded_hal_1::i2c::Operation::Read(buf) => self.read_blocking_internal(buf, false, last)?,
|
||||||
self.read_blocking_internal(buf, false, last)?
|
embedded_hal_1::i2c::Operation::Write(buf) => self.write_blocking_internal(buf, last)?,
|
||||||
}
|
|
||||||
embedded_hal_1::i2c::blocking::Operation::Write(buf) => self.write_blocking_internal(buf, last)?,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -438,17 +436,15 @@ mod eh1 {
|
|||||||
|
|
||||||
fn transaction_iter<'a, O>(&mut self, address: u8, operations: O) -> Result<(), Self::Error>
|
fn transaction_iter<'a, O>(&mut self, address: u8, operations: O) -> Result<(), Self::Error>
|
||||||
where
|
where
|
||||||
O: IntoIterator<Item = embedded_hal_1::i2c::blocking::Operation<'a>>,
|
O: IntoIterator<Item = embedded_hal_1::i2c::Operation<'a>>,
|
||||||
{
|
{
|
||||||
Self::setup(address.into())?;
|
Self::setup(address.into())?;
|
||||||
let mut peekable = operations.into_iter().peekable();
|
let mut peekable = operations.into_iter().peekable();
|
||||||
while let Some(operation) = peekable.next() {
|
while let Some(operation) = peekable.next() {
|
||||||
let last = peekable.peek().is_none();
|
let last = peekable.peek().is_none();
|
||||||
match operation {
|
match operation {
|
||||||
embedded_hal_1::i2c::blocking::Operation::Read(buf) => {
|
embedded_hal_1::i2c::Operation::Read(buf) => self.read_blocking_internal(buf, false, last)?,
|
||||||
self.read_blocking_internal(buf, false, last)?
|
embedded_hal_1::i2c::Operation::Write(buf) => self.write_blocking_internal(buf, last)?,
|
||||||
}
|
|
||||||
embedded_hal_1::i2c::blocking::Operation::Write(buf) => self.write_blocking_internal(buf, last)?,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -523,25 +523,25 @@ mod eh1 {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::blocking::SpiBusFlush for Spi<'d, T, M> {
|
impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBusFlush for Spi<'d, T, M> {
|
||||||
fn flush(&mut self) -> Result<(), Self::Error> {
|
fn flush(&mut self) -> Result<(), Self::Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::blocking::SpiBusRead<u8> for Spi<'d, T, M> {
|
impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBusRead<u8> for Spi<'d, T, M> {
|
||||||
fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> {
|
fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> {
|
||||||
self.blocking_transfer(words, &[])
|
self.blocking_transfer(words, &[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::blocking::SpiBusWrite<u8> for Spi<'d, T, M> {
|
impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBusWrite<u8> for Spi<'d, T, M> {
|
||||||
fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> {
|
fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> {
|
||||||
self.blocking_write(words)
|
self.blocking_write(words)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::blocking::SpiBus<u8> for Spi<'d, T, M> {
|
impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBus<u8> for Spi<'d, T, M> {
|
||||||
fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> {
|
fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> {
|
||||||
self.blocking_transfer(read, write)
|
self.blocking_transfer(read, write)
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,7 @@ mod eh1 {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::nb::Read for UartRx<'d, T, M> {
|
impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Read for UartRx<'d, T, M> {
|
||||||
fn read(&mut self) -> nb::Result<u8, Self::Error> {
|
fn read(&mut self) -> nb::Result<u8, Self::Error> {
|
||||||
let r = T::regs();
|
let r = T::regs();
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -509,7 +509,7 @@ mod eh1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::blocking::Write for UartTx<'d, T, M> {
|
impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::Write for UartTx<'d, T, M> {
|
||||||
fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
|
fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
|
||||||
self.blocking_write(buffer)
|
self.blocking_write(buffer)
|
||||||
}
|
}
|
||||||
@ -519,7 +519,7 @@ mod eh1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::nb::Write for UartTx<'d, T, M> {
|
impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Write for UartTx<'d, T, M> {
|
||||||
fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> {
|
fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> {
|
||||||
self.blocking_write(&[char]).map_err(nb::Error::Other)
|
self.blocking_write(&[char]).map_err(nb::Error::Other)
|
||||||
}
|
}
|
||||||
@ -529,13 +529,13 @@ mod eh1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::nb::Read for Uart<'d, T, M> {
|
impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Read for Uart<'d, T, M> {
|
||||||
fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> {
|
fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> {
|
||||||
embedded_hal_02::serial::Read::read(&mut self.rx)
|
embedded_hal_02::serial::Read::read(&mut self.rx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::blocking::Write for Uart<'d, T, M> {
|
impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::Write for Uart<'d, T, M> {
|
||||||
fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
|
fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
|
||||||
self.blocking_write(buffer)
|
self.blocking_write(buffer)
|
||||||
}
|
}
|
||||||
@ -545,7 +545,7 @@ mod eh1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::nb::Write for Uart<'d, T, M> {
|
impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Write for Uart<'d, T, M> {
|
||||||
fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> {
|
fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> {
|
||||||
self.blocking_write(&[char]).map_err(nb::Error::Other)
|
self.blocking_write(&[char]).map_err(nb::Error::Other)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "embassy-stm32"
|
name = "embassy-stm32"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[package.metadata.embassy_docs]
|
[package.metadata.embassy_docs]
|
||||||
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-stm32-v$VERSION/embassy-stm32/src/"
|
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-stm32-v$VERSION/embassy-stm32/src/"
|
||||||
@ -42,8 +43,9 @@ embassy-net = { version = "0.1.0", path = "../embassy-net", optional = true }
|
|||||||
embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional = true }
|
embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional = true }
|
||||||
|
|
||||||
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
|
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
|
||||||
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true}
|
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9", optional = true}
|
||||||
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true}
|
embedded-hal-async = { version = "=0.1.0-alpha.2", optional = true}
|
||||||
|
embedded-hal-nb = { version = "=1.0.0-alpha.1", optional = true}
|
||||||
|
|
||||||
embedded-storage = "0.3.0"
|
embedded-storage = "0.3.0"
|
||||||
embedded-storage-async = { version = "0.3.0", optional = true }
|
embedded-storage-async = { version = "0.3.0", optional = true }
|
||||||
@ -102,7 +104,7 @@ unstable-pac = []
|
|||||||
|
|
||||||
# Implement embedded-hal 1.0 alpha traits.
|
# Implement embedded-hal 1.0 alpha traits.
|
||||||
# Implement embedded-hal-async traits if `nightly` is set as well.
|
# Implement embedded-hal-async traits if `nightly` is set as well.
|
||||||
unstable-traits = ["embedded-hal-1"]
|
unstable-traits = ["embedded-hal-1", "dep:embedded-hal-nb"]
|
||||||
|
|
||||||
# BEGIN GENERATED FEATURES
|
# BEGIN GENERATED FEATURES
|
||||||
# Generated by stm32-gen-features. DO NOT EDIT.
|
# Generated by stm32-gen-features. DO NOT EDIT.
|
||||||
|
@ -155,7 +155,7 @@ mod eh1 {
|
|||||||
type Error = Infallible;
|
type Error = Infallible;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: GpioPin> embedded_hal_1::digital::blocking::InputPin for ExtiInput<'d, T> {
|
impl<'d, T: GpioPin> embedded_hal_1::digital::InputPin for ExtiInput<'d, T> {
|
||||||
fn is_high(&self) -> Result<bool, Self::Error> {
|
fn is_high(&self) -> Result<bool, Self::Error> {
|
||||||
Ok(self.is_high())
|
Ok(self.is_high())
|
||||||
}
|
}
|
||||||
|
@ -23,17 +23,6 @@ impl<'d> Flash<'d> {
|
|||||||
Self { _inner: p }
|
Self { _inner: p }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unlock(p: impl Peripheral<P = FLASH> + 'd) -> Self {
|
|
||||||
let flash = Self::new(p);
|
|
||||||
|
|
||||||
unsafe { family::unlock() };
|
|
||||||
flash
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn lock(&mut self) {
|
|
||||||
unsafe { family::lock() };
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn blocking_read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Error> {
|
pub fn blocking_read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Error> {
|
||||||
let offset = FLASH_BASE as u32 + offset;
|
let offset = FLASH_BASE as u32 + offset;
|
||||||
if offset as usize >= FLASH_END || offset as usize + bytes.len() > FLASH_END {
|
if offset as usize >= FLASH_END || offset as usize + bytes.len() > FLASH_END {
|
||||||
@ -57,7 +46,12 @@ impl<'d> Flash<'d> {
|
|||||||
|
|
||||||
self.clear_all_err();
|
self.clear_all_err();
|
||||||
|
|
||||||
unsafe { family::blocking_write(offset, buf) }
|
unsafe {
|
||||||
|
family::unlock();
|
||||||
|
let res = family::blocking_write(offset, buf);
|
||||||
|
family::lock();
|
||||||
|
res
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn blocking_erase(&mut self, from: u32, to: u32) -> Result<(), Error> {
|
pub fn blocking_erase(&mut self, from: u32, to: u32) -> Result<(), Error> {
|
||||||
@ -72,7 +66,12 @@ impl<'d> Flash<'d> {
|
|||||||
|
|
||||||
self.clear_all_err();
|
self.clear_all_err();
|
||||||
|
|
||||||
unsafe { family::blocking_erase(from, to) }
|
unsafe {
|
||||||
|
family::unlock();
|
||||||
|
let res = family::blocking_erase(from, to);
|
||||||
|
family::lock();
|
||||||
|
res
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clear_all_err(&mut self) {
|
fn clear_all_err(&mut self) {
|
||||||
@ -82,7 +81,7 @@ impl<'d> Flash<'d> {
|
|||||||
|
|
||||||
impl Drop for Flash<'_> {
|
impl Drop for Flash<'_> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
self.lock();
|
unsafe { family::lock() };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -848,8 +848,7 @@ mod eh02 {
|
|||||||
|
|
||||||
#[cfg(feature = "unstable-traits")]
|
#[cfg(feature = "unstable-traits")]
|
||||||
mod eh1 {
|
mod eh1 {
|
||||||
use embedded_hal_1::digital::blocking::{InputPin, OutputPin, StatefulOutputPin, ToggleableOutputPin};
|
use embedded_hal_1::digital::{ErrorType, InputPin, OutputPin, StatefulOutputPin, ToggleableOutputPin};
|
||||||
use embedded_hal_1::digital::ErrorType;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ mod eh1 {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance> embedded_hal_1::i2c::blocking::I2c for I2c<'d, T> {
|
impl<'d, T: Instance> embedded_hal_1::i2c::I2c for I2c<'d, T> {
|
||||||
fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
|
fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
|
||||||
self.blocking_read(address, buffer)
|
self.blocking_read(address, buffer)
|
||||||
}
|
}
|
||||||
@ -364,14 +364,14 @@ mod eh1 {
|
|||||||
fn transaction<'a>(
|
fn transaction<'a>(
|
||||||
&mut self,
|
&mut self,
|
||||||
_address: u8,
|
_address: u8,
|
||||||
_operations: &mut [embedded_hal_1::i2c::blocking::Operation<'a>],
|
_operations: &mut [embedded_hal_1::i2c::Operation<'a>],
|
||||||
) -> Result<(), Self::Error> {
|
) -> Result<(), Self::Error> {
|
||||||
todo!();
|
todo!();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error>
|
fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error>
|
||||||
where
|
where
|
||||||
O: IntoIterator<Item = embedded_hal_1::i2c::blocking::Operation<'a>>,
|
O: IntoIterator<Item = embedded_hal_1::i2c::Operation<'a>>,
|
||||||
{
|
{
|
||||||
todo!();
|
todo!();
|
||||||
}
|
}
|
||||||
|
@ -883,7 +883,7 @@ mod eh1 {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance> embedded_hal_1::i2c::blocking::I2c for I2c<'d, T, NoDma, NoDma> {
|
impl<'d, T: Instance> embedded_hal_1::i2c::I2c for I2c<'d, T, NoDma, NoDma> {
|
||||||
fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
|
fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
|
||||||
self.blocking_read(address, buffer)
|
self.blocking_read(address, buffer)
|
||||||
}
|
}
|
||||||
@ -913,14 +913,14 @@ mod eh1 {
|
|||||||
fn transaction<'a>(
|
fn transaction<'a>(
|
||||||
&mut self,
|
&mut self,
|
||||||
_address: u8,
|
_address: u8,
|
||||||
_operations: &mut [embedded_hal_1::i2c::blocking::Operation<'a>],
|
_operations: &mut [embedded_hal_1::i2c::Operation<'a>],
|
||||||
) -> Result<(), Self::Error> {
|
) -> Result<(), Self::Error> {
|
||||||
todo!();
|
todo!();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error>
|
fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error>
|
||||||
where
|
where
|
||||||
O: IntoIterator<Item = embedded_hal_1::i2c::blocking::Operation<'a>>,
|
O: IntoIterator<Item = embedded_hal_1::i2c::Operation<'a>>,
|
||||||
{
|
{
|
||||||
todo!();
|
todo!();
|
||||||
}
|
}
|
||||||
|
@ -843,25 +843,25 @@ mod eh1 {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance, Tx, Rx> embedded_hal_1::spi::blocking::SpiBusFlush for Spi<'d, T, Tx, Rx> {
|
impl<'d, T: Instance, Tx, Rx> embedded_hal_1::spi::SpiBusFlush for Spi<'d, T, Tx, Rx> {
|
||||||
fn flush(&mut self) -> Result<(), Self::Error> {
|
fn flush(&mut self) -> Result<(), Self::Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance, W: Word> embedded_hal_1::spi::blocking::SpiBusRead<W> for Spi<'d, T, NoDma, NoDma> {
|
impl<'d, T: Instance, W: Word> embedded_hal_1::spi::SpiBusRead<W> for Spi<'d, T, NoDma, NoDma> {
|
||||||
fn read(&mut self, words: &mut [W]) -> Result<(), Self::Error> {
|
fn read(&mut self, words: &mut [W]) -> Result<(), Self::Error> {
|
||||||
self.blocking_read(words)
|
self.blocking_read(words)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance, W: Word> embedded_hal_1::spi::blocking::SpiBusWrite<W> for Spi<'d, T, NoDma, NoDma> {
|
impl<'d, T: Instance, W: Word> embedded_hal_1::spi::SpiBusWrite<W> for Spi<'d, T, NoDma, NoDma> {
|
||||||
fn write(&mut self, words: &[W]) -> Result<(), Self::Error> {
|
fn write(&mut self, words: &[W]) -> Result<(), Self::Error> {
|
||||||
self.blocking_write(words)
|
self.blocking_write(words)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance, W: Word> embedded_hal_1::spi::blocking::SpiBus<W> for Spi<'d, T, NoDma, NoDma> {
|
impl<'d, T: Instance, W: Word> embedded_hal_1::spi::SpiBus<W> for Spi<'d, T, NoDma, NoDma> {
|
||||||
fn transfer(&mut self, read: &mut [W], write: &[W]) -> Result<(), Self::Error> {
|
fn transfer(&mut self, read: &mut [W], write: &[W]) -> Result<(), Self::Error> {
|
||||||
self.blocking_transfer(read, write)
|
self.blocking_transfer(read, write)
|
||||||
}
|
}
|
||||||
|
@ -160,6 +160,30 @@ impl<'d, T: BasicInstance, RxDma> UartRx<'d, T, RxDma> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn nb_read(&mut self) -> Result<u8, nb::Error<Error>> {
|
||||||
|
let r = T::regs();
|
||||||
|
unsafe {
|
||||||
|
let sr = sr(r).read();
|
||||||
|
if sr.pe() {
|
||||||
|
rdr(r).read_volatile();
|
||||||
|
Err(nb::Error::Other(Error::Parity))
|
||||||
|
} else if sr.fe() {
|
||||||
|
rdr(r).read_volatile();
|
||||||
|
Err(nb::Error::Other(Error::Framing))
|
||||||
|
} else if sr.ne() {
|
||||||
|
rdr(r).read_volatile();
|
||||||
|
Err(nb::Error::Other(Error::Noise))
|
||||||
|
} else if sr.ore() {
|
||||||
|
rdr(r).read_volatile();
|
||||||
|
Err(nb::Error::Other(Error::Overrun))
|
||||||
|
} else if sr.rxne() {
|
||||||
|
Ok(rdr(r).read_volatile())
|
||||||
|
} else {
|
||||||
|
Err(nb::Error::WouldBlock)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error> {
|
pub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let r = T::regs();
|
let r = T::regs();
|
||||||
@ -263,6 +287,10 @@ impl<'d, T: BasicInstance, TxDma, RxDma> Uart<'d, T, TxDma, RxDma> {
|
|||||||
self.rx.read(buffer).await
|
self.rx.read(buffer).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn nb_read(&mut self) -> Result<u8, nb::Error<Error>> {
|
||||||
|
self.rx.nb_read()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error> {
|
pub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error> {
|
||||||
self.rx.blocking_read(buffer)
|
self.rx.blocking_read(buffer)
|
||||||
}
|
}
|
||||||
@ -281,27 +309,7 @@ mod eh02 {
|
|||||||
impl<'d, T: BasicInstance, RxDma> embedded_hal_02::serial::Read<u8> for UartRx<'d, T, RxDma> {
|
impl<'d, T: BasicInstance, RxDma> embedded_hal_02::serial::Read<u8> for UartRx<'d, T, RxDma> {
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> {
|
fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> {
|
||||||
let r = T::regs();
|
self.nb_read()
|
||||||
unsafe {
|
|
||||||
let sr = sr(r).read();
|
|
||||||
if sr.pe() {
|
|
||||||
rdr(r).read_volatile();
|
|
||||||
Err(nb::Error::Other(Error::Parity))
|
|
||||||
} else if sr.fe() {
|
|
||||||
rdr(r).read_volatile();
|
|
||||||
Err(nb::Error::Other(Error::Framing))
|
|
||||||
} else if sr.ne() {
|
|
||||||
rdr(r).read_volatile();
|
|
||||||
Err(nb::Error::Other(Error::Noise))
|
|
||||||
} else if sr.ore() {
|
|
||||||
rdr(r).read_volatile();
|
|
||||||
Err(nb::Error::Other(Error::Overrun))
|
|
||||||
} else if sr.rxne() {
|
|
||||||
Ok(rdr(r).read_volatile())
|
|
||||||
} else {
|
|
||||||
Err(nb::Error::WouldBlock)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +326,7 @@ mod eh02 {
|
|||||||
impl<'d, T: BasicInstance, TxDma, RxDma> embedded_hal_02::serial::Read<u8> for Uart<'d, T, TxDma, RxDma> {
|
impl<'d, T: BasicInstance, TxDma, RxDma> embedded_hal_02::serial::Read<u8> for Uart<'d, T, TxDma, RxDma> {
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> {
|
fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> {
|
||||||
embedded_hal_02::serial::Read::read(&mut self.rx)
|
self.nb_read()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,6 +367,58 @@ mod eh1 {
|
|||||||
impl<'d, T: BasicInstance, RxDma> embedded_hal_1::serial::ErrorType for UartRx<'d, T, RxDma> {
|
impl<'d, T: BasicInstance, RxDma> embedded_hal_1::serial::ErrorType for UartRx<'d, T, RxDma> {
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'d, T: BasicInstance, RxDma> embedded_hal_nb::serial::Read for UartRx<'d, T, RxDma> {
|
||||||
|
fn read(&mut self) -> nb::Result<u8, Self::Error> {
|
||||||
|
self.nb_read()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'d, T: BasicInstance, TxDma> embedded_hal_1::serial::Write for UartTx<'d, T, TxDma> {
|
||||||
|
fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
|
||||||
|
self.blocking_write(buffer)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flush(&mut self) -> Result<(), Self::Error> {
|
||||||
|
self.blocking_flush()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'d, T: BasicInstance, TxDma> embedded_hal_nb::serial::Write for UartTx<'d, T, TxDma> {
|
||||||
|
fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> {
|
||||||
|
self.blocking_write(&[char]).map_err(nb::Error::Other)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flush(&mut self) -> nb::Result<(), Self::Error> {
|
||||||
|
self.blocking_flush().map_err(nb::Error::Other)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'d, T: BasicInstance, TxDma, RxDma> embedded_hal_nb::serial::Read for Uart<'d, T, TxDma, RxDma> {
|
||||||
|
fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> {
|
||||||
|
self.nb_read()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'d, T: BasicInstance, TxDma, RxDma> embedded_hal_1::serial::Write for Uart<'d, T, TxDma, RxDma> {
|
||||||
|
fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
|
||||||
|
self.blocking_write(buffer)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flush(&mut self) -> Result<(), Self::Error> {
|
||||||
|
self.blocking_flush()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'d, T: BasicInstance, TxDma, RxDma> embedded_hal_nb::serial::Write for Uart<'d, T, TxDma, RxDma> {
|
||||||
|
fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> {
|
||||||
|
self.blocking_write(&[char]).map_err(nb::Error::Other)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flush(&mut self) -> nb::Result<(), Self::Error> {
|
||||||
|
self.blocking_flush().map_err(nb::Error::Other)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
|
@ -2,6 +2,16 @@
|
|||||||
name = "embassy-sync"
|
name = "embassy-sync"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
description = "no-std, no-alloc synchronization primitives with async support"
|
||||||
|
repository = "https://github.com/embassy-rs/embassy"
|
||||||
|
readme = "README.md"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
categories = [
|
||||||
|
"embedded",
|
||||||
|
"no-std",
|
||||||
|
"concurrency",
|
||||||
|
"asynchronous",
|
||||||
|
]
|
||||||
|
|
||||||
[package.metadata.embassy_docs]
|
[package.metadata.embassy_docs]
|
||||||
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-sync-v$VERSION/embassy-sync/src/"
|
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-sync-v$VERSION/embassy-sync/src/"
|
||||||
|
@ -1,12 +1,32 @@
|
|||||||
# embassy-sync
|
# embassy-sync
|
||||||
|
|
||||||
Synchronization primitives and data structures with an async API:
|
An [Embassy](https://embassy.dev) project.
|
||||||
|
|
||||||
|
Synchronization primitives and data structures with async support:
|
||||||
|
|
||||||
- [`Channel`](channel::Channel) - A Multiple Producer Multiple Consumer (MPMC) channel. Each message is only received by a single consumer.
|
- [`Channel`](channel::Channel) - A Multiple Producer Multiple Consumer (MPMC) channel. Each message is only received by a single consumer.
|
||||||
- [`PubSubChannel`](pubsub::PubSubChannel) - A broadcast channel (publish-subscribe) channel. Each message is received by all consumers.
|
- [`PubSubChannel`](pubsub::PubSubChannel) - A broadcast channel (publish-subscribe) channel. Each message is received by all consumers.
|
||||||
- [`Signal`](signal::Signal) - Signalling latest value to a single consumer.
|
- [`Signal`](signal::Signal) - Signalling latest value to a single consumer.
|
||||||
- [`Mutex`](mutex::Mutex) - A Mutex for synchronizing state between asynchronous tasks.
|
- [`Mutex`](mutex::Mutex) - Mutex for synchronizing state between asynchronous tasks.
|
||||||
- [`Pipe`](pipe::Pipe) - Byte stream implementing `embedded_io` traits.
|
- [`Pipe`](pipe::Pipe) - Byte stream implementing `embedded_io` traits.
|
||||||
- [`WakerRegistration`](waitqueue::WakerRegistration) - Utility to register and wake a `Waker`.
|
- [`WakerRegistration`](waitqueue::WakerRegistration) - Utility to register and wake a `Waker`.
|
||||||
- [`AtomicWaker`](waitqueue::AtomicWaker) - A variant of `WakerRegistration` accessible using a non-mut API.
|
- [`AtomicWaker`](waitqueue::AtomicWaker) - A variant of `WakerRegistration` accessible using a non-mut API.
|
||||||
- [`MultiWakerRegistration`](waitqueue::MultiWakerRegistration) - Utility registering and waking multiple `Waker`'s.
|
- [`MultiWakerRegistration`](waitqueue::MultiWakerRegistration) - Utility registering and waking multiple `Waker`'s.
|
||||||
|
|
||||||
|
## Interoperability
|
||||||
|
|
||||||
|
Futures from this crate can run on any executor.
|
||||||
|
|
||||||
|
## Minimum supported Rust version (MSRV)
|
||||||
|
|
||||||
|
Embassy is guaranteed to compile on the latest stable Rust version at the time of release. It might compile with older versions but that may change in any new patch release.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This work is licensed under either of
|
||||||
|
|
||||||
|
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||||
|
<http://www.apache.org/licenses/LICENSE-2.0>)
|
||||||
|
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
|
||||||
|
|
||||||
|
at your option.
|
||||||
|
@ -192,6 +192,10 @@ impl<M: RawMutex, T: Clone, const CAP: usize, const SUBS: usize, const PUBS: usi
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn available(&self, next_message_id: u64) -> u64 {
|
||||||
|
self.inner.lock(|s| s.borrow().next_message_id - next_message_id)
|
||||||
|
}
|
||||||
|
|
||||||
fn publish_with_context(&self, message: T, cx: Option<&mut Context<'_>>) -> Result<(), T> {
|
fn publish_with_context(&self, message: T, cx: Option<&mut Context<'_>>) -> Result<(), T> {
|
||||||
self.inner.lock(|s| {
|
self.inner.lock(|s| {
|
||||||
let mut s = s.borrow_mut();
|
let mut s = s.borrow_mut();
|
||||||
@ -217,6 +221,13 @@ impl<M: RawMutex, T: Clone, const CAP: usize, const SUBS: usize, const PUBS: usi
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn space(&self) -> usize {
|
||||||
|
self.inner.lock(|s| {
|
||||||
|
let s = s.borrow();
|
||||||
|
s.queue.capacity() - s.queue.len()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fn unregister_subscriber(&self, subscriber_next_message_id: u64) {
|
fn unregister_subscriber(&self, subscriber_next_message_id: u64) {
|
||||||
self.inner.lock(|s| {
|
self.inner.lock(|s| {
|
||||||
let mut s = s.borrow_mut();
|
let mut s = s.borrow_mut();
|
||||||
@ -388,6 +399,10 @@ pub trait PubSubBehavior<T> {
|
|||||||
/// If the message is not yet present and a context is given, then its waker is registered in the subsriber wakers.
|
/// If the message is not yet present and a context is given, then its waker is registered in the subsriber wakers.
|
||||||
fn get_message_with_context(&self, next_message_id: &mut u64, cx: Option<&mut Context<'_>>) -> Poll<WaitResult<T>>;
|
fn get_message_with_context(&self, next_message_id: &mut u64, cx: Option<&mut Context<'_>>) -> Poll<WaitResult<T>>;
|
||||||
|
|
||||||
|
/// Get the amount of messages that are between the given the next_message_id and the most recent message.
|
||||||
|
/// This is not necessarily the amount of messages a subscriber can still received as it may have lagged.
|
||||||
|
fn available(&self, next_message_id: u64) -> u64;
|
||||||
|
|
||||||
/// Try to publish a message to the queue.
|
/// Try to publish a message to the queue.
|
||||||
///
|
///
|
||||||
/// If the queue is full and a context is given, then its waker is registered in the publisher wakers.
|
/// If the queue is full and a context is given, then its waker is registered in the publisher wakers.
|
||||||
@ -396,6 +411,9 @@ pub trait PubSubBehavior<T> {
|
|||||||
/// Publish a message immediately
|
/// Publish a message immediately
|
||||||
fn publish_immediate(&self, message: T);
|
fn publish_immediate(&self, message: T);
|
||||||
|
|
||||||
|
/// The amount of messages that can still be published without having to wait or without having to lag the subscribers
|
||||||
|
fn space(&self) -> usize;
|
||||||
|
|
||||||
/// Let the channel know that a subscriber has dropped
|
/// Let the channel know that a subscriber has dropped
|
||||||
fn unregister_subscriber(&self, subscriber_next_message_id: u64);
|
fn unregister_subscriber(&self, subscriber_next_message_id: u64);
|
||||||
|
|
||||||
@ -539,4 +557,59 @@ mod tests {
|
|||||||
|
|
||||||
drop(sub0);
|
drop(sub0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[futures_test::test]
|
||||||
|
async fn correct_available() {
|
||||||
|
let channel = PubSubChannel::<NoopRawMutex, u32, 4, 4, 4>::new();
|
||||||
|
|
||||||
|
let sub0 = channel.subscriber().unwrap();
|
||||||
|
let mut sub1 = channel.subscriber().unwrap();
|
||||||
|
let pub0 = channel.publisher().unwrap();
|
||||||
|
|
||||||
|
assert_eq!(sub0.available(), 0);
|
||||||
|
assert_eq!(sub1.available(), 0);
|
||||||
|
|
||||||
|
pub0.publish(42).await;
|
||||||
|
|
||||||
|
assert_eq!(sub0.available(), 1);
|
||||||
|
assert_eq!(sub1.available(), 1);
|
||||||
|
|
||||||
|
sub1.next_message().await;
|
||||||
|
|
||||||
|
assert_eq!(sub1.available(), 0);
|
||||||
|
|
||||||
|
pub0.publish(42).await;
|
||||||
|
|
||||||
|
assert_eq!(sub0.available(), 2);
|
||||||
|
assert_eq!(sub1.available(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[futures_test::test]
|
||||||
|
async fn correct_space() {
|
||||||
|
let channel = PubSubChannel::<NoopRawMutex, u32, 4, 4, 4>::new();
|
||||||
|
|
||||||
|
let mut sub0 = channel.subscriber().unwrap();
|
||||||
|
let mut sub1 = channel.subscriber().unwrap();
|
||||||
|
let pub0 = channel.publisher().unwrap();
|
||||||
|
|
||||||
|
assert_eq!(pub0.space(), 4);
|
||||||
|
|
||||||
|
pub0.publish(42).await;
|
||||||
|
|
||||||
|
assert_eq!(pub0.space(), 3);
|
||||||
|
|
||||||
|
pub0.publish(42).await;
|
||||||
|
|
||||||
|
assert_eq!(pub0.space(), 2);
|
||||||
|
|
||||||
|
sub0.next_message().await;
|
||||||
|
sub0.next_message().await;
|
||||||
|
|
||||||
|
assert_eq!(pub0.space(), 2);
|
||||||
|
|
||||||
|
sub1.next_message().await;
|
||||||
|
assert_eq!(pub0.space(), 3);
|
||||||
|
sub1.next_message().await;
|
||||||
|
assert_eq!(pub0.space(), 4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,14 @@ impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Pub<'a, PSB, T> {
|
|||||||
pub fn try_publish(&self, message: T) -> Result<(), T> {
|
pub fn try_publish(&self, message: T) -> Result<(), T> {
|
||||||
self.channel.publish_with_context(message, None)
|
self.channel.publish_with_context(message, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The amount of messages that can still be published without having to wait or without having to lag the subscribers
|
||||||
|
///
|
||||||
|
/// *Note: In the time between checking this and a publish action, other publishers may have had time to publish something.
|
||||||
|
/// So checking doesn't give any guarantees.*
|
||||||
|
pub fn space(&self) -> usize {
|
||||||
|
self.channel.space()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Drop for Pub<'a, PSB, T> {
|
impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Drop for Pub<'a, PSB, T> {
|
||||||
@ -115,6 +123,14 @@ impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> ImmediatePub<'a, PSB, T> {
|
|||||||
pub fn try_publish(&self, message: T) -> Result<(), T> {
|
pub fn try_publish(&self, message: T) -> Result<(), T> {
|
||||||
self.channel.publish_with_context(message, None)
|
self.channel.publish_with_context(message, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The amount of messages that can still be published without having to wait or without having to lag the subscribers
|
||||||
|
///
|
||||||
|
/// *Note: In the time between checking this and a publish action, other publishers may have had time to publish something.
|
||||||
|
/// So checking doesn't give any guarantees.*
|
||||||
|
pub fn space(&self) -> usize {
|
||||||
|
self.channel.space()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An immediate publisher that holds a dynamic reference to the channel
|
/// An immediate publisher that holds a dynamic reference to the channel
|
||||||
@ -158,6 +174,7 @@ impl<'a, M: RawMutex, T: Clone, const CAP: usize, const SUBS: usize, const PUBS:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Future for the publisher wait action
|
/// Future for the publisher wait action
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct PublisherWaitFuture<'s, 'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> {
|
pub struct PublisherWaitFuture<'s, 'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> {
|
||||||
/// The message we need to publish
|
/// The message we need to publish
|
||||||
message: Option<T>,
|
message: Option<T>,
|
||||||
|
@ -64,6 +64,11 @@ impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Sub<'a, PSB, T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The amount of messages this subscriber hasn't received yet
|
||||||
|
pub fn available(&self) -> u64 {
|
||||||
|
self.channel.available(self.next_message_id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Drop for Sub<'a, PSB, T> {
|
impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Drop for Sub<'a, PSB, T> {
|
||||||
@ -135,6 +140,7 @@ impl<'a, M: RawMutex, T: Clone, const CAP: usize, const SUBS: usize, const PUBS:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Future for the subscriber wait action
|
/// Future for the subscriber wait action
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct SubscriberWaitFuture<'s, 'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> {
|
pub struct SubscriberWaitFuture<'s, 'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> {
|
||||||
subscriber: &'s mut Sub<'a, PSB, T>,
|
subscriber: &'s mut Sub<'a, PSB, T>,
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "embassy-time"
|
name = "embassy-time"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
|
|
||||||
[package.metadata.embassy_docs]
|
[package.metadata.embassy_docs]
|
||||||
@ -105,8 +106,8 @@ defmt = { version = "0.3", optional = true }
|
|||||||
log = { version = "0.4.14", optional = true }
|
log = { version = "0.4.14", optional = true }
|
||||||
|
|
||||||
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" }
|
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" }
|
||||||
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true}
|
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9", optional = true}
|
||||||
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true}
|
embedded-hal-async = { version = "=0.1.0-alpha.2", optional = true}
|
||||||
|
|
||||||
futures-util = { version = "0.3.17", default-features = false }
|
futures-util = { version = "0.3.17", default-features = false }
|
||||||
embassy-macros = { version = "0.1.0", path = "../embassy-macros"}
|
embassy-macros = { version = "0.1.0", path = "../embassy-macros"}
|
||||||
|
@ -18,7 +18,7 @@ pub struct Delay;
|
|||||||
mod eh1 {
|
mod eh1 {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
impl embedded_hal_1::delay::blocking::DelayUs for Delay {
|
impl embedded_hal_1::delay::DelayUs for Delay {
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
|
||||||
fn delay_us(&mut self, us: u32) -> Result<(), Self::Error> {
|
fn delay_us(&mut self, us: u32) -> Result<(), Self::Error> {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "embassy-usb-driver"
|
name = "embassy-usb-driver"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
@ -54,12 +54,16 @@ impl From<EndpointAddress> for u8 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl EndpointAddress {
|
impl EndpointAddress {
|
||||||
const INBITS: u8 = Direction::In as u8;
|
const INBITS: u8 = 0x80;
|
||||||
|
|
||||||
/// Constructs a new EndpointAddress with the given index and direction.
|
/// Constructs a new EndpointAddress with the given index and direction.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn from_parts(index: usize, dir: Direction) -> Self {
|
pub fn from_parts(index: usize, dir: Direction) -> Self {
|
||||||
EndpointAddress(index as u8 | dir as u8)
|
let dir_u8 = match dir {
|
||||||
|
Direction::Out => 0x00,
|
||||||
|
Direction::In => Self::INBITS,
|
||||||
|
};
|
||||||
|
EndpointAddress(index as u8 | dir_u8)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the direction part of the address.
|
/// Gets the direction part of the address.
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
name = "embassy-usb"
|
name = "embassy-usb"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[package.metadata.embassy_docs]
|
[package.metadata.embassy_docs]
|
||||||
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-usb-v$VERSION/embassy-usb/src/"
|
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-usb-v$VERSION/embassy-usb/src/"
|
||||||
src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-usb/src/"
|
src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-usb/src/"
|
||||||
features = ["defmt"]
|
features = ["defmt", "usbd-hid"]
|
||||||
target = "thumbv7em-none-eabi"
|
target = "thumbv7em-none-eabi"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-boot-nrf-examples"
|
name = "embassy-boot-nrf-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync" }
|
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync" }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-boot-stm32f3-examples"
|
name = "embassy-boot-stm32f3-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -17,7 +17,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
|
|||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
let flash = Flash::unlock(p.FLASH);
|
let flash = Flash::new(p.FLASH);
|
||||||
let mut flash = BlockingAsync::new(flash);
|
let mut flash = BlockingAsync::new(flash);
|
||||||
|
|
||||||
let button = Input::new(p.PC13, Pull::Up);
|
let button = Input::new(p.PC13, Pull::Up);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-boot-stm32f7-examples"
|
name = "embassy-boot-stm32f7-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -16,7 +16,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
|
|||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
let mut flash = Flash::unlock(p.FLASH);
|
let mut flash = Flash::new(p.FLASH);
|
||||||
|
|
||||||
let button = Input::new(p.PC13, Pull::Down);
|
let button = Input::new(p.PC13, Pull::Down);
|
||||||
let mut button = ExtiInput::new(button, p.EXTI13);
|
let mut button = ExtiInput::new(button, p.EXTI13);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-boot-stm32h7-examples"
|
name = "embassy-boot-stm32h7-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync" }
|
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync" }
|
||||||
|
@ -16,7 +16,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
|
|||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
let mut flash = Flash::unlock(p.FLASH);
|
let mut flash = Flash::new(p.FLASH);
|
||||||
|
|
||||||
let button = Input::new(p.PC13, Pull::Down);
|
let button = Input::new(p.PC13, Pull::Down);
|
||||||
let mut button = ExtiInput::new(button, p.EXTI13);
|
let mut button = ExtiInput::new(button, p.EXTI13);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-boot-stm32l0-examples"
|
name = "embassy-boot-stm32l0-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -18,7 +18,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
|
|||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
let flash = Flash::unlock(p.FLASH);
|
let flash = Flash::new(p.FLASH);
|
||||||
let mut flash = BlockingAsync::new(flash);
|
let mut flash = BlockingAsync::new(flash);
|
||||||
|
|
||||||
let button = Input::new(p.PB2, Pull::Up);
|
let button = Input::new(p.PB2, Pull::Up);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-boot-stm32l1-examples"
|
name = "embassy-boot-stm32l1-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -18,7 +18,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
|
|||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
let flash = Flash::unlock(p.FLASH);
|
let flash = Flash::new(p.FLASH);
|
||||||
let mut flash = BlockingAsync::new(flash);
|
let mut flash = BlockingAsync::new(flash);
|
||||||
|
|
||||||
let button = Input::new(p.PB2, Pull::Up);
|
let button = Input::new(p.PB2, Pull::Up);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-boot-stm32l4-examples"
|
name = "embassy-boot-stm32l4-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -17,7 +17,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
|
|||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
let flash = Flash::unlock(p.FLASH);
|
let flash = Flash::new(p.FLASH);
|
||||||
let mut flash = BlockingAsync::new(flash);
|
let mut flash = BlockingAsync::new(flash);
|
||||||
|
|
||||||
let button = Input::new(p.PC13, Pull::Up);
|
let button = Input::new(p.PC13, Pull::Up);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-boot-stm32wl-examples"
|
name = "embassy-boot-stm32wl-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -17,7 +17,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
|
|||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
let flash = Flash::unlock(p.FLASH);
|
let flash = Flash::new(p.FLASH);
|
||||||
let mut flash = BlockingAsync::new(flash);
|
let mut flash = BlockingAsync::new(flash);
|
||||||
|
|
||||||
let button = Input::new(p.PA0, Pull::Up);
|
let button = Input::new(p.PA0, Pull::Up);
|
||||||
|
@ -3,6 +3,7 @@ edition = "2021"
|
|||||||
name = "nrf-bootloader-example"
|
name = "nrf-bootloader-example"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Bootloader for nRF chips"
|
description = "Bootloader for nRF chips"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
defmt = { version = "0.3", optional = true }
|
defmt = { version = "0.3", optional = true }
|
||||||
|
@ -3,6 +3,7 @@ edition = "2021"
|
|||||||
name = "stm32-bootloader-example"
|
name = "stm32-bootloader-example"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Example bootloader for STM32 chips"
|
description = "Example bootloader for STM32 chips"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
defmt = { version = "0.3", optional = true }
|
defmt = { version = "0.3", optional = true }
|
||||||
|
@ -20,7 +20,7 @@ fn main() -> ! {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
let mut bl: BootLoader<ERASE_SIZE, WRITE_SIZE> = BootLoader::default();
|
let mut bl: BootLoader<ERASE_SIZE, WRITE_SIZE> = BootLoader::default();
|
||||||
let flash = Flash::unlock(p.FLASH);
|
let flash = Flash::new(p.FLASH);
|
||||||
let mut flash = BootFlash::<_, ERASE_SIZE, ERASE_VALUE>::new(flash);
|
let mut flash = BootFlash::<_, ERASE_SIZE, ERASE_VALUE>::new(flash);
|
||||||
let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash));
|
let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash));
|
||||||
core::mem::drop(flash);
|
core::mem::drop(flash);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-nrf-rtos-trace-examples"
|
name = "embassy-nrf-rtos-trace-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["log", "nightly"]
|
default = ["log", "nightly"]
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-nrf-examples"
|
name = "embassy-nrf-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["nightly"]
|
default = ["nightly"]
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-rp-examples"
|
name = "embassy-rp-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@ -26,7 +27,7 @@ st7789 = "0.6.1"
|
|||||||
display-interface = "0.4.1"
|
display-interface = "0.4.1"
|
||||||
byte-slice-cast = { version = "1.2.0", default-features = false }
|
byte-slice-cast = { version = "1.2.0", default-features = false }
|
||||||
|
|
||||||
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" }
|
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
|
||||||
embedded-hal-async = { version = "0.1.0-alpha.1" }
|
embedded-hal-async = { version = "0.1.0-alpha.1" }
|
||||||
embedded-io = { version = "0.3.0", features = ["async", "defmt"] }
|
embedded-io = { version = "0.3.0", features = ["async", "defmt"] }
|
||||||
static_cell = "1.0.0"
|
static_cell = "1.0.0"
|
||||||
|
70
examples/rp/src/bin/i2c_blocking.rs
Normal file
70
examples/rp/src/bin/i2c_blocking.rs
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
use defmt::*;
|
||||||
|
use embassy_executor::Spawner;
|
||||||
|
use embassy_rp::i2c::{self, Config};
|
||||||
|
use embassy_time::{Duration, Timer};
|
||||||
|
use embedded_hal_1::i2c::I2c;
|
||||||
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
mod mcp23017 {
|
||||||
|
pub const ADDR: u8 = 0x20; // default addr
|
||||||
|
|
||||||
|
pub const IODIRA: u8 = 0x00;
|
||||||
|
pub const IPOLA: u8 = 0x02;
|
||||||
|
pub const GPINTENA: u8 = 0x04;
|
||||||
|
pub const DEFVALA: u8 = 0x06;
|
||||||
|
pub const INTCONA: u8 = 0x08;
|
||||||
|
pub const IOCONA: u8 = 0x0A;
|
||||||
|
pub const GPPUA: u8 = 0x0C;
|
||||||
|
pub const INTFA: u8 = 0x0E;
|
||||||
|
pub const INTCAPA: u8 = 0x10;
|
||||||
|
pub const GPIOA: u8 = 0x12;
|
||||||
|
pub const OLATA: u8 = 0x14;
|
||||||
|
pub const IODIRB: u8 = 0x01;
|
||||||
|
pub const IPOLB: u8 = 0x03;
|
||||||
|
pub const GPINTENB: u8 = 0x05;
|
||||||
|
pub const DEFVALB: u8 = 0x07;
|
||||||
|
pub const INTCONB: u8 = 0x09;
|
||||||
|
pub const IOCONB: u8 = 0x0B;
|
||||||
|
pub const GPPUB: u8 = 0x0D;
|
||||||
|
pub const INTFB: u8 = 0x0F;
|
||||||
|
pub const INTCAPB: u8 = 0x11;
|
||||||
|
pub const GPIOB: u8 = 0x13;
|
||||||
|
pub const OLATB: u8 = 0x15;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[embassy_executor::main]
|
||||||
|
async fn main(_spawner: Spawner) {
|
||||||
|
let p = embassy_rp::init(Default::default());
|
||||||
|
|
||||||
|
let sda = p.PIN_14;
|
||||||
|
let scl = p.PIN_15;
|
||||||
|
|
||||||
|
info!("set up i2c ");
|
||||||
|
let mut i2c = i2c::I2c::new_blocking(p.I2C1, scl, sda, Config::default());
|
||||||
|
|
||||||
|
use mcp23017::*;
|
||||||
|
|
||||||
|
info!("init mcp23017 config for IxpandO");
|
||||||
|
// init - a outputs, b inputs
|
||||||
|
i2c.write(ADDR, &[IODIRA, 0x00]).unwrap();
|
||||||
|
i2c.write(ADDR, &[IODIRB, 0xff]).unwrap();
|
||||||
|
i2c.write(ADDR, &[GPPUB, 0xff]).unwrap(); // pullups
|
||||||
|
|
||||||
|
let mut val = 0xaa;
|
||||||
|
loop {
|
||||||
|
let mut portb = [0];
|
||||||
|
|
||||||
|
i2c.write(mcp23017::ADDR, &[GPIOA, val]).unwrap();
|
||||||
|
i2c.write_read(mcp23017::ADDR, &[GPIOB], &mut portb).unwrap();
|
||||||
|
|
||||||
|
info!("portb = {:02x}", portb[0]);
|
||||||
|
val = !val;
|
||||||
|
|
||||||
|
Timer::after(Duration::from_secs(1)).await;
|
||||||
|
}
|
||||||
|
}
|
@ -108,9 +108,9 @@ mod shared_spi {
|
|||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
|
|
||||||
use embedded_hal_1::digital::blocking::OutputPin;
|
use embedded_hal_1::digital::OutputPin;
|
||||||
use embedded_hal_1::spi;
|
use embedded_hal_1::spi;
|
||||||
use embedded_hal_1::spi::blocking::SpiDevice;
|
use embedded_hal_1::spi::SpiDevice;
|
||||||
|
|
||||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||||
pub enum SpiDeviceWithCsError<BUS, CS> {
|
pub enum SpiDeviceWithCsError<BUS, CS> {
|
||||||
@ -153,7 +153,7 @@ mod shared_spi {
|
|||||||
|
|
||||||
impl<'a, BUS, CS> SpiDevice for SpiDeviceWithCs<'a, BUS, CS>
|
impl<'a, BUS, CS> SpiDevice for SpiDeviceWithCs<'a, BUS, CS>
|
||||||
where
|
where
|
||||||
BUS: spi::blocking::SpiBusFlush,
|
BUS: spi::SpiBusFlush,
|
||||||
CS: OutputPin,
|
CS: OutputPin,
|
||||||
{
|
{
|
||||||
type Bus = BUS;
|
type Bus = BUS;
|
||||||
@ -182,7 +182,7 @@ mod shared_spi {
|
|||||||
|
|
||||||
/// Driver for the XPT2046 resistive touchscreen sensor
|
/// Driver for the XPT2046 resistive touchscreen sensor
|
||||||
mod touch {
|
mod touch {
|
||||||
use embedded_hal_1::spi::blocking::{SpiBus, SpiBusRead, SpiBusWrite, SpiDevice};
|
use embedded_hal_1::spi::{SpiBus, SpiBusRead, SpiBusWrite, SpiDevice};
|
||||||
|
|
||||||
struct Calibration {
|
struct Calibration {
|
||||||
x1: i32,
|
x1: i32,
|
||||||
@ -246,8 +246,8 @@ mod touch {
|
|||||||
|
|
||||||
mod my_display_interface {
|
mod my_display_interface {
|
||||||
use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand};
|
use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand};
|
||||||
use embedded_hal_1::digital::blocking::OutputPin;
|
use embedded_hal_1::digital::OutputPin;
|
||||||
use embedded_hal_1::spi::blocking::{SpiBusWrite, SpiDevice};
|
use embedded_hal_1::spi::{SpiBusWrite, SpiDevice};
|
||||||
|
|
||||||
/// SPI display interface.
|
/// SPI display interface.
|
||||||
///
|
///
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-std-examples"
|
name = "embassy-std-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["log"] }
|
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["log"] }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "embassy-stm32f0-examples"
|
name = "embassy-stm32f0-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-stm32f1-examples"
|
name = "embassy-stm32f1-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-stm32f2-examples"
|
name = "embassy-stm32f2-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-stm32f3-examples"
|
name = "embassy-stm32f3-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -15,7 +15,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
|
|
||||||
const ADDR: u32 = 0x26000;
|
const ADDR: u32 = 0x26000;
|
||||||
|
|
||||||
let mut f = Flash::unlock(p.FLASH);
|
let mut f = Flash::new(p.FLASH);
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-stm32f4-examples"
|
name = "embassy-stm32f4-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -13,7 +13,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
info!("Hello Flash!");
|
info!("Hello Flash!");
|
||||||
|
|
||||||
let mut f = Flash::unlock(p.FLASH);
|
let mut f = Flash::new(p.FLASH);
|
||||||
|
|
||||||
// Sector 5
|
// Sector 5
|
||||||
test_flash(&mut f, 128 * 1024, 128 * 1024);
|
test_flash(&mut f, 128 * 1024, 128 * 1024);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-stm32f7-examples"
|
name = "embassy-stm32f7-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -19,7 +19,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
// wait a bit before accessing the flash
|
// wait a bit before accessing the flash
|
||||||
Timer::after(Duration::from_millis(300)).await;
|
Timer::after(Duration::from_millis(300)).await;
|
||||||
|
|
||||||
let mut f = Flash::unlock(p.FLASH);
|
let mut f = Flash::new(p.FLASH);
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 32];
|
let mut buf = [0u8; 32];
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-stm32g0-examples"
|
name = "embassy-stm32g0-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-stm32g4-examples"
|
name = "embassy-stm32g4-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-stm32h7-examples"
|
name = "embassy-stm32h7-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
||||||
@ -17,8 +18,8 @@ defmt-rtt = "0.3"
|
|||||||
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
|
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
|
||||||
cortex-m-rt = "0.7.0"
|
cortex-m-rt = "0.7.0"
|
||||||
embedded-hal = "0.2.6"
|
embedded-hal = "0.2.6"
|
||||||
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" }
|
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
|
||||||
embedded-hal-async = { version = "0.1.0-alpha.1" }
|
embedded-hal-async = { version = "=0.1.0-alpha.2" }
|
||||||
embedded-nal-async = "0.2.0"
|
embedded-nal-async = "0.2.0"
|
||||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||||
|
@ -19,7 +19,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
// wait a bit before accessing the flash
|
// wait a bit before accessing the flash
|
||||||
Timer::after(Duration::from_millis(300)).await;
|
Timer::after(Duration::from_millis(300)).await;
|
||||||
|
|
||||||
let mut f = Flash::unlock(p.FLASH);
|
let mut f = Flash::new(p.FLASH);
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 32];
|
let mut buf = [0u8; 32];
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-stm32l0-examples"
|
name = "embassy-stm32l0-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["nightly"]
|
default = ["nightly"]
|
||||||
|
@ -15,7 +15,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
|
|
||||||
const ADDR: u32 = 0x26000;
|
const ADDR: u32 = 0x26000;
|
||||||
|
|
||||||
let mut f = Flash::unlock(p.FLASH);
|
let mut f = Flash::new(p.FLASH);
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-stm32l1-examples"
|
name = "embassy-stm32l1-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -15,7 +15,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
|
|
||||||
const ADDR: u32 = 0x26000;
|
const ADDR: u32 = 0x26000;
|
||||||
|
|
||||||
let mut f = Flash::unlock(p.FLASH);
|
let mut f = Flash::new(p.FLASH);
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-stm32l4-examples"
|
name = "embassy-stm32l4-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
||||||
@ -18,8 +19,8 @@ defmt-rtt = "0.3"
|
|||||||
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
|
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
|
||||||
cortex-m-rt = "0.7.0"
|
cortex-m-rt = "0.7.0"
|
||||||
embedded-hal = "0.2.6"
|
embedded-hal = "0.2.6"
|
||||||
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" }
|
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
|
||||||
embedded-hal-async = { version = "0.1.0-alpha.1" }
|
embedded-hal-async = { version = "=0.1.0-alpha.2" }
|
||||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||||
heapless = { version = "0.7.5", default-features = false }
|
heapless = { version = "0.7.5", default-features = false }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-stm32l5-examples"
|
name = "embassy-stm32l5-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-stm32u5-examples"
|
name = "embassy-stm32u5-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-stm32wb-examples"
|
name = "embassy-stm32wb-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-stm32wl-examples"
|
name = "embassy-stm32wl-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
||||||
|
@ -15,7 +15,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
|
|
||||||
const ADDR: u32 = 0x36000;
|
const ADDR: u32 = 0x36000;
|
||||||
|
|
||||||
let mut f = Flash::unlock(p.FLASH);
|
let mut f = Flash::new(p.FLASH);
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-wasm-example"
|
name = "embassy-wasm-example"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "gen_features"
|
name = "gen_features"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
name = "stm32-metapac-gen"
|
name = "stm32-metapac-gen"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "embassy-rp-tests"
|
name = "embassy-rp-tests"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
|
||||||
@ -16,8 +17,8 @@ defmt-rtt = "0.3.0"
|
|||||||
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
|
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
|
||||||
cortex-m-rt = "0.7.0"
|
cortex-m-rt = "0.7.0"
|
||||||
embedded-hal = "0.2.6"
|
embedded-hal = "0.2.6"
|
||||||
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" }
|
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
|
||||||
embedded-hal-async = { version = "0.1.0-alpha.1" }
|
embedded-hal-async = { version = "=0.1.0-alpha.2" }
|
||||||
panic-probe = { version = "0.3.0", features = ["print-defmt"] }
|
panic-probe = { version = "0.3.0", features = ["print-defmt"] }
|
||||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||||
embedded-io = { version = "0.3.0", features = ["async"] }
|
embedded-io = { version = "0.3.0", features = ["async"] }
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user