Big dependency updates #7

Merged
zack merged 2 commits from develop into master 2024-02-14 06:14:43 +00:00
11 changed files with 72 additions and 84 deletions

View File

@ -17,7 +17,7 @@ members = [
] ]
[workspace.package] [workspace.package]
version = "0.1.0" version = "0.2.0"
edition = "2021" edition = "2021"
repository = "https://git.bfpower.io/BFPOWER/physical" repository = "https://git.bfpower.io/BFPOWER/physical"
readme = "README.md" readme = "README.md"
@ -29,7 +29,7 @@ license = "MIT"
version = "0.2.*" version = "0.2.*"
# Units of measurement # Units of measurement
[workspace.dependencies.uom] [workspace.dependencies.uom]
version = "0.34.*" version = "0.35.*"
default-features = false default-features = false
features = ["f32", "si"] features = ["f32", "si"]
# Logging # Logging
@ -45,14 +45,14 @@ version = "3.6.*"
default-features = false default-features = false
# Embedded-HAL # Embedded-HAL
[workspace.dependencies.embedded-hal] [workspace.dependencies.embedded-hal]
version = "1.0.0-alpha.10" version = "1.0.*"
[workspace.dependencies.embedded-hal-async] [workspace.dependencies.embedded-hal-async]
version = "0.2.0-alpha.1" version = "1.0.*"
# Memory # Memory
[workspace.dependencies.static_cell] [workspace.dependencies.static_cell]
version = "1.1.*" version = "2.0.*"
[workspace.dependencies.heapless] [workspace.dependencies.heapless]
version = "0.7.*" version = "0.8.*"
# Other embedded utilities # Other embedded utilities
[workspace.dependencies.cortex-m] [workspace.dependencies.cortex-m]
version = "0.7.*" version = "0.7.*"
@ -72,23 +72,22 @@ features = ["uom"]
[workspace.dependencies.embassy-futures] [workspace.dependencies.embassy-futures]
version = "0.1.*" version = "0.1.*"
[workspace.dependencies.embassy-time] [workspace.dependencies.embassy-time]
version = "0.1.*" version = "0.3.*"
features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "nightly", ] features = ["defmt", "defmt-timestamp-uptime"]
[workspace.dependencies.embassy-sync] [workspace.dependencies.embassy-sync]
version = "0.1.*" version = "0.5.*"
features = ["defmt"] features = ["defmt"]
[workspace.dependencies.embassy-embedded-hal] [workspace.dependencies.embassy-embedded-hal]
version = "0.1.*" version = "0.1.*"
features = ["nightly"]
[workspace.dependencies.embassy-executor] [workspace.dependencies.embassy-executor]
version = "0.1.*" version = "0.5.*"
features = ["defmt", "arch-cortex-m", "integrated-timers", "executor-interrupt", "executor-thread", "nightly"] features = ["defmt", "arch-cortex-m", "integrated-timers", "executor-interrupt", "executor-thread"]
[workspace.dependencies.embassy-stm32] [workspace.dependencies.embassy-stm32]
version = "0.1.*" version = "0.1.*"
features = ["defmt", "unstable-traits", "unstable-pac", "nightly"] features = ["defmt", "unstable-pac"]
[workspace.dependencies.embassy-nrf] [workspace.dependencies.embassy-nrf]
version = "0.1.*" version = "0.1.*"
features = ["defmt", "unstable-traits", "nightly"] features = ["defmt"]
# Macros # Macros
[workspace.dependencies.syn] [workspace.dependencies.syn]
version = "2.0.*" version = "2.0.*"
@ -98,22 +97,6 @@ version = "1.0.*"
[workspace.dependencies.trybuild] [workspace.dependencies.trybuild]
version = "1.0.*" version = "1.0.*"
#---------------------------------------------------------------------------------------------------------------------
#----- Patch ------------------------
#---------------------------------------------------------------------------------------------------------------------
[patch.crates-io]
embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" }
embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" }
embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" }
embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" }
embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" }
embassy-net = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" }
embassy-net-driver = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" }
embassy-net-driver-channel = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" }
embassy-nrf = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" }
embassy-stm32 = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" }
embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "047ea9066f0d946fd4d706577b21df38fd3b1647" }
#--------------------------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------------------------
#----- Package ------------------------ #----- Package ------------------------
#--------------------------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
[target.'cfg(all(target_arch = "arm", target_os = "none"))'] [target.'cfg(all(target_arch = "arm", target_os = "none"))']
# replace STM32F429ZITx with your chip as listed in `probe-run --list-chips` # replace STM32F429ZITx with your chip as listed in `probe-rs chip list`
runner = "probe-rs-cli run --chip STM32F429ZITx" runner = "probe-rs run --chip STM32F411CEUx"
[build] [build]
target = "thumbv7em-none-eabi" target = "thumbv7em-none-eabi"

View File

@ -16,6 +16,8 @@ features = ["embassy-sync"]
[dependencies.physical-ads1256] [dependencies.physical-ads1256]
path = "../../peripheral-components/ads1256/node" path = "../../peripheral-components/ads1256/node"
features = ["poll"] features = ["poll"]
[dependencies.static_cell]
workspace = true
[dependencies.ads1256] [dependencies.ads1256]
workspace = true workspace = true
[dependencies.uom] [dependencies.uom]
@ -31,7 +33,7 @@ features = ["critical-section-single-core"]
workspace = true workspace = true
[dependencies.embassy-stm32] [dependencies.embassy-stm32]
workspace = true workspace = true
features = ["stm32f429zi", "memory-x", "time", "exti", "time-driver-any"] features = ["stm32f411ce", "memory-x", "time", "exti", "time-driver-any"]
[dependencies.embassy-executor] [dependencies.embassy-executor]
workspace = true workspace = true
[dependencies.embassy-futures] [dependencies.embassy-futures]

View File

@ -1,6 +1,5 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
#![feature(type_alias_impl_trait, async_fn_in_trait)]
use core::cell::Cell; use core::cell::Cell;
use cortex_m::prelude::_embedded_hal_blocking_delay_DelayUs; use cortex_m::prelude::_embedded_hal_blocking_delay_DelayUs;
@ -26,8 +25,8 @@ use uom::si::electric_potential::volt;
use uom::si::f32; use uom::si::f32;
use defmt::{debug, error, info, trace, unwrap}; use defmt::{debug, error, info, trace, unwrap};
use embassy_executor::_export::StaticCell; use static_cell::StaticCell;
use embassy_stm32::peripherals::{PF6, PF7, SPI3}; use embassy_stm32::peripherals::{PA1, PA3, SPI1};
use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_sync::blocking_mutex::raw::NoopRawMutex;
use embassy_sync::pubsub::PubSubChannel; use embassy_sync::pubsub::PubSubChannel;
use physical_node::transducer::{Publish, StatefulPublisher}; use physical_node::transducer::{Publish, StatefulPublisher};
@ -61,8 +60,8 @@ struct Inputs {
// Inputs // Inputs
static ANALOG_INPUTS: StaticCell<Inputs> = StaticCell::new(); static ANALOG_INPUTS: StaticCell<Inputs> = StaticCell::new();
static ADS_1256: StaticCell<Ads1256<Ads1256Delay, Output<PF7>, ExtiInput<PF6>>> = StaticCell::new(); static ADS_1256: StaticCell<Ads1256<Ads1256Delay, Output<PA1>, ExtiInput<PA3>>> = StaticCell::new();
static SPI: StaticCell<Spi<SPI3, NoDma, NoDma>> = StaticCell::new(); static SPI: StaticCell<Spi<SPI1, NoDma, NoDma>> = StaticCell::new();
#[embassy_executor::main] #[embassy_executor::main]
async fn main(spawner: Spawner) { async fn main(spawner: Spawner) {
@ -79,18 +78,18 @@ async fn main(spawner: Spawner) {
let mut spi_conf = spi::Config::default(); let mut spi_conf = spi::Config::default();
spi_conf.mode = spi::MODE_1; spi_conf.mode = spi::MODE_1;
spi_conf.bit_order = spi::BitOrder::MsbFirst; spi_conf.bit_order = spi::BitOrder::MsbFirst;
spi_conf.frequency = Hertz(ads1256::defaults::SPI_CLK_HZ);
let ads1256_data_ready = ExtiInput::new(Input::new(p.PF6, Pull::Up), p.EXTI6); let ads1256_data_ready = ExtiInput::new(Input::new(p.PA3, Pull::Up), p.EXTI3);
let select_ads1256 = Output::new(p.PF7, Level::High, Speed::VeryHigh); let select_ads1256 = Output::new(p.PA1, Level::High, Speed::VeryHigh);
let spi = SPI.init(Spi::new( let spi = SPI.init(Spi::new(
p.SPI3, p.SPI1,
p.PC10, p.PA5,
p.PC12, p.PA7,
p.PC11, p.PA6,
NoDma, NoDma,
NoDma, NoDma,
Hertz(ads1256::defaults::SPI_CLK_HZ),
spi_conf, spi_conf,
)); ));
@ -120,8 +119,8 @@ async fn main(spawner: Spawner) {
#[embassy_executor::task] #[embassy_executor::task]
async fn drive_inputs_task( async fn drive_inputs_task(
ads_1256: &'static mut Ads1256<Ads1256Delay, Output<'static, PF7>, ExtiInput<'static, PF6>>, ads_1256: &'static mut Ads1256<Ads1256Delay, Output<'static, PA1>, ExtiInput<'static, PA3>>,
spi: &'static mut Spi<'static, SPI3, NoDma, NoDma>, spi: &'static mut Spi<'static, SPI1, NoDma, NoDma>,
inputs: &'static Inputs, inputs: &'static Inputs,
) { ) {
let Inputs { ai0, ai1, ai2 } = inputs; let Inputs { ai0, ai1, ai2 } = inputs;

View File

@ -1,6 +1,5 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
#![feature(type_alias_impl_trait, async_fn_in_trait)]
use core::cell::Cell; use core::cell::Cell;
@ -27,8 +26,8 @@ use uom::si::electric_potential::volt;
use uom::si::f32; use uom::si::f32;
use defmt::info; use defmt::info;
use embassy_executor::_export::StaticCell; use static_cell::StaticCell;
use embassy_stm32::peripherals::{EXTI6, PF6, PF7, SPI3}; use embassy_stm32::peripherals::{PA1, PA3, SPI1};
use embassy_sync::blocking_mutex::raw::NoopRawMutex; use embassy_sync::blocking_mutex::raw::NoopRawMutex;
use embassy_sync::mutex::Mutex; use embassy_sync::mutex::Mutex;
use embassy_sync::pubsub::PubSubChannel; use embassy_sync::pubsub::PubSubChannel;
@ -65,9 +64,9 @@ type ExampleInput = AutocalPollStatePub<
NoopRawMutex, NoopRawMutex,
ModInputOnly, ModInputOnly,
Ads1256Delay, Ads1256Delay,
Output<'static, PF7>, Output<'static, PA1>,
ExtiInput<'static, PF6>, ExtiInput<'static, PA3>,
Spi<'static, SPI3, NoDma, NoDma>, Spi<'static, SPI1, NoDma, NoDma>,
10, 10,
1, 1,
>; >;
@ -81,9 +80,9 @@ struct Inputs {
// Inputs // Inputs
static ANALOG_INPUTS: StaticCell<Inputs> = StaticCell::new(); static ANALOG_INPUTS: StaticCell<Inputs> = StaticCell::new();
static ADS_1256: StaticCell< static ADS_1256: StaticCell<
Mutex<NoopRawMutex, Ads1256<Ads1256Delay, Output<PF7>, ExtiInput<PF6>>>, Mutex<NoopRawMutex, Ads1256<Ads1256Delay, Output<PA1>, ExtiInput<PA3>>>,
> = StaticCell::new(); > = StaticCell::new();
static SPI: StaticCell<Mutex<NoopRawMutex, Spi<SPI3, NoDma, NoDma>>> = StaticCell::new(); static SPI: StaticCell<Mutex<NoopRawMutex, Spi<SPI1, NoDma, NoDma>>> = StaticCell::new();
#[embassy_executor::main] #[embassy_executor::main]
async fn main(spawner: Spawner) { async fn main(spawner: Spawner) {
@ -100,20 +99,22 @@ async fn main(spawner: Spawner) {
let mut spi_conf = spi::Config::default(); let mut spi_conf = spi::Config::default();
spi_conf.mode = spi::MODE_1; spi_conf.mode = spi::MODE_1;
spi_conf.bit_order = spi::BitOrder::MsbFirst; spi_conf.bit_order = spi::BitOrder::MsbFirst;
spi_conf.frequency = Hertz(ads1256::defaults::SPI_CLK_HZ);
let ads1256_data_ready = ExtiInput::new(Input::new(p.PF6, Pull::Up), p.EXTI6); let ads1256_data_ready = ExtiInput::new(Input::new(p.PA3, Pull::Up), p.EXTI3);
let select_ads1256 = Output::new(p.PF7, Level::High, Speed::VeryHigh); let select_ads1256 = Output::new(p.PA1, Level::High, Speed::VeryHigh);
let spi = SPI.init(Mutex::new(Spi::new( let spi = SPI.init(Mutex::new(
p.SPI3, Spi::new(
p.PC10, p.SPI1,
p.PC12, p.PA5,
p.PC11, p.PA7,
p.PA6,
NoDma, NoDma,
NoDma, NoDma,
Hertz(ads1256::defaults::SPI_CLK_HZ),
spi_conf, spi_conf,
))); )
));
let ads_1256 = let ads_1256 =
ADS_1256.init(Mutex::new(Ads1256::new(Ads1256Delay, select_ads1256, ads1256_data_ready))); ADS_1256.init(Mutex::new(Ads1256::new(Ads1256Delay, select_ads1256, ads1256_data_ready)));

View File

@ -1,6 +1,5 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
#![feature(type_alias_impl_trait, async_fn_in_trait)]
use cortex_m::prelude::_embedded_hal_blocking_delay_DelayUs; use cortex_m::prelude::_embedded_hal_blocking_delay_DelayUs;
// Necessary unused import. // Necessary unused import.
@ -64,18 +63,18 @@ async fn main(spawner: Spawner) {
let mut spi_conf = spi::Config::default(); let mut spi_conf = spi::Config::default();
spi_conf.mode = spi::MODE_1; spi_conf.mode = spi::MODE_1;
spi_conf.bit_order = spi::BitOrder::MsbFirst; spi_conf.bit_order = spi::BitOrder::MsbFirst;
spi_conf.frequency = Hertz(ads1256::defaults::SPI_CLK_HZ);
let ads1256_data_ready = ExtiInput::new(Input::new(p.PF6, Pull::Up), p.EXTI6); let ads1256_data_ready = ExtiInput::new(Input::new(p.PA3, Pull::Up), p.EXTI3);
let select_ads1256 = Output::new(p.PF7, Level::High, Speed::VeryHigh); let select_ads1256 = Output::new(p.PA1, Level::High, Speed::VeryHigh);
let mut spi = Spi::new( let mut spi = Spi::new(
p.SPI3, p.SPI1,
p.PC10, p.PA5,
p.PC12, p.PA7,
p.PC11, p.PA6,
NoDma, NoDma,
NoDma, NoDma,
Hertz(ads1256::defaults::SPI_CLK_HZ),
spi_conf, spi_conf,
); );

View File

@ -1,5 +1,4 @@
#![no_std] #![no_std]
#![feature(async_fn_in_trait)]
pub mod transducer; pub mod transducer;

View File

@ -1,4 +1,3 @@
#![no_std] #![no_std]
#![feature(async_fn_in_trait, impl_trait_projections)]
pub mod standard; pub mod standard;

View File

@ -1,8 +1,8 @@
# Before upgrading check that everything is available on all tier1 targets here: # Before upgrading check that everything is available on all tier1 targets here:
# https://rust-lang.github.io/rustup-components-history # https://rust-lang.github.io/rustup-components-history
[toolchain] [toolchain]
channel = "nightly-2023-04-18" channel = "1.75"
components = [ "rust-src", "rustfmt", "llvm-tools-preview" ] components = [ "rust-src", "rustfmt", "llvm-tools" ]
targets = [ targets = [
"thumbv7em-none-eabi", "thumbv7em-none-eabi",
"thumbv7m-none-eabi", "thumbv7m-none-eabi",

View File

@ -15,7 +15,8 @@ pub enum CriticalError {
} }
impl CriticalError { impl CriticalError {
pub fn emergency_procedure(self, procedure: impl FnOnce(CriticalError) -> !) -> ! { //TODO: Switch to using ! as the return type for the FnOnce and the entire function when the ! feature is stabilized
pub fn emergency_procedure(self, procedure: impl FnOnce(CriticalError)) {
procedure(self); procedure(self);
} }
} }
@ -24,18 +25,24 @@ impl CriticalError {
pub trait CriticalErrResult: Copy { pub trait CriticalErrResult: Copy {
type Value: Copy; type Value: Copy;
//TODO: Switch to using ! as the return type for the FnOnce when the ! feature is stabilized
/// Execute emergency procedure in the event of a critical, the emergency procedure cannot /// Execute emergency procedure in the event of a critical, the emergency procedure cannot
/// return. It should usually terminate the program, potentially rebooting the device in some sort of recovery mode. /// return. It should usually terminate the program, potentially rebooting the device in some sort of recovery mode.
fn err_emproc(self, procedure: impl FnOnce(CriticalError) -> !) -> Self::Value; fn err_emproc(self, procedure: impl FnOnce(CriticalError)) -> Self::Value;
} }
impl<T: Copy> CriticalErrResult for Result<T, CriticalError> { impl<T: Copy> CriticalErrResult for Result<T, CriticalError> {
type Value = T; type Value = T;
fn err_emproc(self, procedure: impl FnOnce(CriticalError) -> !) -> Self::Value { //TODO: Switch to using ! as the return type for the FnOnce when the ! feature is stabilized
fn err_emproc(self, procedure: impl FnOnce(CriticalError)) -> Self::Value {
match self { match self {
Ok(val) => val, Ok(val) => val,
Err(error) => error.emergency_procedure(procedure), Err(error) => {
error.emergency_procedure(procedure);
//TODO: Remove this panic when we switch to ! return type
panic!()
},
} }
} }
} }

View File

@ -1,5 +1,4 @@
#![no_std] #![no_std]
#![feature(async_fn_in_trait, never_type)]
pub mod transducer; pub mod transducer;
pub mod cell; pub mod cell;