Big dependency updates (#7)

Co-authored-by: Zachary Sunforge <zachary.sunforge@bfpower.io>
Reviewed-on: #7
This commit is contained in:
2024-02-14 06:14:43 +00:00
parent babfb92222
commit 346c52e617
11 changed files with 72 additions and 84 deletions

View File

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

View File

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

View File

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

View File

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

View File

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