cleaned up dependencies
This commit is contained in:
parent
64a7cef47a
commit
d82b8e4d07
@ -10,7 +10,6 @@ use panic_probe as _;
|
|||||||
use defmt_rtt as _;
|
use defmt_rtt as _;
|
||||||
use portable_atomic::AtomicU32;
|
use portable_atomic::AtomicU32;
|
||||||
use va108xx_hal::{
|
use va108xx_hal::{
|
||||||
clock::{get_sys_clock, set_sys_clock},
|
|
||||||
pac::{self, interrupt},
|
pac::{self, interrupt},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
time::Hertz,
|
time::Hertz,
|
||||||
@ -32,7 +31,6 @@ fn main() -> ! {
|
|||||||
let mut delay = CountdownTimer::new(dp.tim2, 50.MHz());
|
let mut delay = CountdownTimer::new(dp.tim2, 50.MHz());
|
||||||
let mut last_ms = 0;
|
let mut last_ms = 0;
|
||||||
defmt::info!("-- Vorago system ticks using timers --");
|
defmt::info!("-- Vorago system ticks using timers --");
|
||||||
set_sys_clock(50.MHz());
|
|
||||||
let lib_type = LibType::Hal;
|
let lib_type = LibType::Hal;
|
||||||
match lib_type {
|
match lib_type {
|
||||||
LibType::Pac => {
|
LibType::Pac => {
|
||||||
@ -67,10 +65,10 @@ fn main() -> ! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LibType::Hal => {
|
LibType::Hal => {
|
||||||
let mut ms_timer = CountdownTimer::new(dp.tim0, get_sys_clock().unwrap());
|
let mut ms_timer = CountdownTimer::new(dp.tim0, 50.MHz());
|
||||||
ms_timer.enable_interrupt(InterruptConfig::new(interrupt::OC0, true, true));
|
ms_timer.enable_interrupt(InterruptConfig::new(interrupt::OC0, true, true));
|
||||||
ms_timer.start(1.kHz());
|
ms_timer.start(1.kHz());
|
||||||
let mut second_timer = CountdownTimer::new(dp.tim1, get_sys_clock().unwrap());
|
let mut second_timer = CountdownTimer::new(dp.tim1, 50.MHz());
|
||||||
second_timer.enable_interrupt(InterruptConfig::new(interrupt::OC1, true, true));
|
second_timer.enable_interrupt(InterruptConfig::new(interrupt::OC1, true, true));
|
||||||
second_timer.start(1.Hz());
|
second_timer.start(1.Hz());
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ keywords = ["no-std", "hal", "cortex-m", "vorago", "va108xx"]
|
|||||||
categories = ["aerospace", "embedded", "no-std", "hardware-support"]
|
categories = ["aerospace", "embedded", "no-std", "hardware-support"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
vorago-shared-periphs = { git = "https://egit.irs.uni-stuttgart.de/rust/vorago-shared-periphs.git", features = ["vor1x"] }
|
vorago-shared-periphs = { path = "../../vorago-shared-periphs", features = ["vor1x"] }
|
||||||
va108xx-hal = { path = "../va108xx-hal" }
|
va108xx-hal = { path = "../va108xx-hal" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -13,26 +13,10 @@ categories = ["aerospace", "embedded", "no-std", "hardware-support"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = { version = "0.7", features = ["critical-section-single-core"]}
|
cortex-m = { version = "0.7", features = ["critical-section-single-core"]}
|
||||||
cortex-m-rt = "0.7"
|
cortex-m-rt = "0.7"
|
||||||
nb = "1"
|
vorago-shared-periphs = { path = "../../vorago-shared-periphs", features = ["vor1x"] }
|
||||||
paste = "1"
|
|
||||||
vorago-shared-periphs = { git = "https://egit.irs.uni-stuttgart.de/rust/vorago-shared-periphs.git", features = ["vor1x"] }
|
|
||||||
embedded-hal = "1"
|
|
||||||
embedded-hal-async = "1"
|
|
||||||
embedded-hal-nb = "1"
|
|
||||||
embedded-io = "0.6"
|
|
||||||
embedded-io-async = "0.6"
|
|
||||||
fugit = "0.3"
|
fugit = "0.3"
|
||||||
typenum = "1"
|
|
||||||
critical-section = "1"
|
|
||||||
delegate = ">=0.12, <=0.13"
|
|
||||||
heapless = "0.8"
|
|
||||||
static_cell = "2"
|
|
||||||
thiserror = { version = "2", default-features = false }
|
thiserror = { version = "2", default-features = false }
|
||||||
void = { version = "1", default-features = false }
|
|
||||||
once_cell = { version = "1", default-features = false }
|
|
||||||
va108xx = { version = "0.5", default-features = false, features = ["critical-section", "defmt"] }
|
va108xx = { version = "0.5", default-features = false, features = ["critical-section", "defmt"] }
|
||||||
embassy-sync = "0.6"
|
|
||||||
|
|
||||||
defmt = { version = "0.3", optional = true }
|
defmt = { version = "0.3", optional = true }
|
||||||
|
|
||||||
[target.'cfg(all(target_arch = "arm", target_os = "none"))'.dependencies]
|
[target.'cfg(all(target_arch = "arm", target_os = "none"))'.dependencies]
|
||||||
@ -43,7 +27,7 @@ portable-atomic = "1"
|
|||||||
[features]
|
[features]
|
||||||
default = ["rt"]
|
default = ["rt"]
|
||||||
rt = ["va108xx/rt"]
|
rt = ["va108xx/rt"]
|
||||||
defmt = ["dep:defmt", "fugit/defmt", "embedded-hal/defmt-03", "vorago-shared-periphs/defmt"]
|
defmt = ["dep:defmt", "vorago-shared-periphs/defmt"]
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
@ -1,29 +1,9 @@
|
|||||||
//! # API for clock related functionality
|
//! # API for clock related functionality
|
||||||
//!
|
//!
|
||||||
//! This also includes functionality to enable the peripheral clocks
|
//! This also includes functionality to enable the peripheral clocks
|
||||||
use crate::time::Hertz;
|
|
||||||
use cortex_m::interrupt::{self, Mutex};
|
|
||||||
use once_cell::unsync::OnceCell;
|
|
||||||
|
|
||||||
pub use vorago_shared_periphs::gpio::FilterClkSel;
|
pub use vorago_shared_periphs::gpio::FilterClkSel;
|
||||||
pub use vorago_shared_periphs::sysconfig::{disable_peripheral_clock, enable_peripheral_clock};
|
pub use vorago_shared_periphs::sysconfig::{disable_peripheral_clock, enable_peripheral_clock};
|
||||||
|
|
||||||
static SYS_CLOCK: Mutex<OnceCell<Hertz>> = Mutex::new(OnceCell::new());
|
|
||||||
|
|
||||||
/// The Vorago in powered by an external clock which might have different frequencies.
|
|
||||||
/// The clock can be set here so it can be used by other software components as well.
|
|
||||||
/// The clock can be set exactly once
|
|
||||||
pub fn set_sys_clock(freq: impl Into<Hertz>) {
|
|
||||||
interrupt::free(|cs| {
|
|
||||||
SYS_CLOCK.borrow(cs).set(freq.into()).ok();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the configured system clock
|
|
||||||
pub fn get_sys_clock() -> Option<Hertz> {
|
|
||||||
interrupt::free(|cs| SYS_CLOCK.borrow(cs).get().copied())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_clk_div_register(syscfg: &mut va108xx::Sysconfig, clk_sel: FilterClkSel, div: u32) {
|
pub fn set_clk_div_register(syscfg: &mut va108xx::Sysconfig, clk_sel: FilterClkSel, div: u32) {
|
||||||
match clk_sel {
|
match clk_sel {
|
||||||
FilterClkSel::SysClk => (),
|
FilterClkSel::SysClk => (),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user