Skip to content

Commit

Permalink
remove things to comply with non nighty; set supply configuration to …
Browse files Browse the repository at this point in the history
…match old default
  • Loading branch information
tarfu committed Dec 26, 2023
1 parent c9b7039 commit 4e1f193
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 28 deletions.
10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ exclude = ["examples"]
no-std-net = { git = "https://github.com/rushmorem/no-std-net", branch = "issue-15" }
ublox-sockets = { path = "../ublox-sockets" }
atat = { git = "https://github.com/BlackbirdHQ/atat", branch = "master" }
embassy-time = { package = "embassy-time", git = "https://github.com/embassy-rs/embassy", branch = "main" }
embassy-sync = { package = "embassy-sync", git = "https://github.com/embassy-rs/embassy", branch = "main" }
embassy-futures = { package = "embassy-futures", git = "https://github.com/embassy-rs/embassy", branch = "main" }
embassy-time = { git = "https://github.com/embassy-rs/embassy", branch = "main" }
embassy-sync = { git = "https://github.com/embassy-rs/embassy", branch = "main" }
embassy-futures = { git = "https://github.com/embassy-rs/embassy", branch = "main" }

#embassy-time = { path = "../embassy/embassy-time" }
#embassy-sync = { path = "../embassy/embassy-sync" }
#embassy-futures = { path = "../embassy/embassy-futures" }
21 changes: 14 additions & 7 deletions examples/embassy-stm32-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ edition = "2021"

# Example for the STM32H747I-DISCO board with SARA-R5 modem attached to UART8
[dependencies]
embassy-stm32 = { version = "0.1.0", git = "https://github.com/embassy-rs/embassy.git", branch = "main", features = ["defmt", "stm32h747xi-cm7", "time-driver-any", "exti", "memory-x", "unstable-pac"] }
embassy-executor = { version = "0.4.0", features = ["nightly", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
embassy-stm32 = { version = "0.1.0", features = ["defmt", "stm32h747xi-cm7", "time-driver-any", "exti", "memory-x", "unstable-pac"] }
embassy-executor = { version = "0.4.0", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
embassy-time = { version = "0.2", features = ["defmt", "defmt-timestamp-uptime"] }
embassy-sync = { version = "0.5", features = ["defmt"] }

Expand All @@ -18,7 +18,7 @@ defmt = "0.3.5"
defmt-rtt = "0.4.0"
panic-probe = { version = "0.3.1", features = ["print-defmt"] }

static_cell = { version = "2.0", features = ["nightly"]}
static_cell = { version = "2.0", features = []}

atat = { version = "0.20.0", features = ["derive", "bytes", "defmt"] }
ublox-cellular-rs = {version = "0.4.0", path = "../..", features = ["sara-r5", "defmt", "async"]}
Expand All @@ -27,10 +27,17 @@ ublox-cellular-rs = {version = "0.4.0", path = "../..", features = ["sara-r5", "
ublox-sockets = { git = "https://github.com/BlackbirdHQ/ublox-sockets", branch = "feature/async-borrowed-sockets" }
atat = { git = "https://github.com/BlackbirdHQ/atat", branch = "master" }
no-std-net = { git = "https://github.com/rushmorem/no-std-net", branch = "issue-15" }
embassy-time = { package = "embassy-time", git = "https://github.com/embassy-rs/embassy", branch = "main" }
embassy-sync = { package = "embassy-sync", git = "https://github.com/embassy-rs/embassy", branch = "main" }
embassy-futures = { package = "embassy-futures", git = "https://github.com/embassy-rs/embassy", branch = "main" }
embassy-executor = { package = "embassy-executor", git = "https://github.com/embassy-rs/embassy", branch = "main" }
embassy-stm32 = { git = "https://github.com/embassy-rs/embassy", branch = "main" }
embassy-time = { git = "https://github.com/embassy-rs/embassy", branch = "main" }
embassy-sync = { git = "https://github.com/embassy-rs/embassy", branch = "main" }
embassy-futures = { git = "https://github.com/embassy-rs/embassy", branch = "main" }
embassy-executor = { git = "https://github.com/embassy-rs/embassy", branch = "main" }

#embassy-stm32 = { path = "../../../embassy/embassy-stm32" }
#embassy-time = { path = "../../../embassy/embassy-time" }
#embassy-sync = { path = "../../../embassy/embassy-sync" }
#embassy-futures = { path = "../../../embassy/embassy-futures" }
#embassy-executor = { path = "../../../embassy/embassy-executor" }

#ublox-sockets = { path = "../../../ublox-sockets" }
#atat = { path = "../../../atat/atat" }
Expand Down
4 changes: 2 additions & 2 deletions examples/embassy-stm32-example/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Before upgrading check that everything is available on all tier1 targets here:
# https://rust-lang.github.io/rustup-components-history
[toolchain]
#channel = "beta-2023-12-17"
channel = "nightly-2023-12-17"
channel = "beta-2023-12-17"
#channel = "nightly-2023-12-17"
components = [ "rust-src", "rustfmt", "llvm-tools" ]
targets = [
"thumbv7em-none-eabi",
Expand Down
44 changes: 31 additions & 13 deletions examples/embassy-stm32-example/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#![no_std]
#![no_main]
#![allow(stable_features)]
#![feature(type_alias_impl_trait)]
// #![feature(type_alias_impl_trait)]

use atat::asynch::Client;
use atat::UrcChannel;
use atat::ResponseSlot;
use atat::UrcChannel;
use core::cell::RefCell;
use cortex_m_rt::entry;
use defmt::*;
Expand All @@ -17,7 +17,6 @@ use embassy_stm32::time::{khz, mhz};
use embassy_stm32::usart::{BufferedUart, BufferedUartRx, BufferedUartTx};
use embassy_stm32::{bind_interrupts, interrupt, peripherals, usart, Config};
use embassy_time::{Duration, Timer};
use static_cell::make_static;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};

Expand Down Expand Up @@ -80,14 +79,15 @@ async fn main_task(spawner: Spawner) {
let mut config = Config::default();
{
use embassy_stm32::rcc::*;
config.rcc.supply_config = SupplyConfig::DirectSMPS;
config.rcc.hsi = Some(HSIPrescaler::DIV1);
config.rcc.csi = true;
config.rcc.pll1 = Some(Pll {
source: PllSource::HSI,
prediv: PllPreDiv::DIV4,
mul: PllMul::MUL50,
divp: Some(PllDiv::DIV2),
divq: Some(PllDiv::DIV8), // used by SPI3. 100Mhz.
divq: Some(PllDiv::DIV8), // 100mhz
divr: None,
});
config.rcc.sys = Sysclk::PLL1_P; // 400 Mhz
Expand All @@ -104,8 +104,9 @@ async fn main_task(spawner: Spawner) {
let led2_pin = p.PI13.degrade();
let led3_pin = p.PI14.degrade();

let tx_buf = &mut make_static!([0u8; 16])[..];
let rx_buf = &mut make_static!([0u8; 16])[..];
static tx_buf: StaticCell<[u8; 16]> = StaticCell::new();
static rx_buf: StaticCell<[u8; 16]> = StaticCell::new();

let (tx_pin, rx_pin, uart) = (p.PJ8, p.PJ9, p.UART8);
let mut uart_config = embassy_stm32::usart::Config::default();
{
Expand All @@ -116,7 +117,15 @@ async fn main_task(spawner: Spawner) {
uart_config.data_bits = embassy_stm32::usart::DataBits::DataBits8;
}

let uart = BufferedUart::new(uart, Irqs, rx_pin, tx_pin, tx_buf, rx_buf, uart_config);
let uart = BufferedUart::new(
uart,
Irqs,
rx_pin,
tx_pin,
tx_buf.init([0u8; 16]),
rx_buf.init([0u8; 16]),
uart_config,
);
let (writer, reader) = uart.unwrap().split();
// let power = Output::new(p.PJ4, Level::High, Speed::VeryHigh).degrade();
// let reset = Output::new(p.PF8, Level::High, Speed::VeryHigh).degrade();
Expand All @@ -138,14 +147,24 @@ async fn main_task(spawner: Spawner) {
&RES_SLOT,
&URC_CHANNEL,
);
let buf = static_cell::make_static!([0; 1024]);
let mut client = Client::new(writer, &RES_SLOT, buf, atat::Config::default());
static buf: StaticCell<[u8; INGRESS_BUF_SIZE]> = StaticCell::new();
let mut client = Client::new(
writer,
&RES_SLOT,
buf.init([0; INGRESS_BUF_SIZE]),
atat::Config::default(),
);

spawner.spawn(ingress_task(ingress, reader)).unwrap();

let state = make_static!(State::new(client));
let (device, mut control, mut runner) =
ublox_cellular::asynch::new(state, &URC_CHANNEL, celullar_config).await;
static state: StaticCell<State<Client<BufferedUartTx<UART8>, INGRESS_BUF_SIZE>>> =
StaticCell::new();
let (device, mut control, mut runner) = ublox_cellular::asynch::new(
state.init(State::new(client)),
&URC_CHANNEL,
celullar_config,
)
.await;
// defmt::info!("{:?}", runner.init().await);
// control.set_desired_state(PowerState::Connected).await;

Expand All @@ -165,7 +184,6 @@ async fn main_task(spawner: Spawner) {
}
Timer::after(Duration::from_millis(5000)).await;
}
defmt::unwrap!(spawner.spawn(cellular_task(runner)));

loop {
Timer::after(Duration::from_millis(1000)).await;
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![cfg_attr(not(test), no_std)]
#![cfg_attr(feature = "async", allow(incomplete_features))]
#![cfg_attr(feature = "async", feature(generic_const_exprs))]
#![cfg_attr(feature = "async", feature(async_fn_in_trait))]
#![cfg_attr(feature = "async", feature(type_alias_impl_trait))]
// #![cfg_attr(feature = "async", feature(generic_const_exprs))]
// #![cfg_attr(feature = "async", feature(async_fn_in_trait))]
// #![cfg_attr(feature = "async", feature(type_alias_impl_trait))]

// This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt;
Expand Down

0 comments on commit 4e1f193

Please sign in to comment.