Compare commits
1 Commits
main
...
adee40d953
Author | SHA1 | Date | |
---|---|---|---|
adee40d953 |
@ -34,9 +34,6 @@ It also contains the following helper crates:
|
|||||||
[`RTIC`](https://rtic.rs/2/book/en/) and [`embassy`](https://github.com/embassy-rs/embassy)
|
[`RTIC`](https://rtic.rs/2/book/en/) and [`embassy`](https://github.com/embassy-rs/embassy)
|
||||||
native Rust RTOSes.
|
native Rust RTOSes.
|
||||||
|
|
||||||
The majority of the HAL implementation and the Embassy-rs support are contained in the external
|
|
||||||
[`vorago-shared-periphs`](https://egit.irs.uni-stuttgart.de/rust/vorago-shared-periphs) crate.
|
|
||||||
|
|
||||||
## Using the `.cargo/config.toml` file
|
## Using the `.cargo/config.toml` file
|
||||||
|
|
||||||
Use the following command to have a starting `config.toml` file
|
Use the following command to have a starting `config.toml` file
|
||||||
|
@ -6,13 +6,14 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
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"
|
cortex-m-rt = "0.7"
|
||||||
defmt = "1"
|
panic-halt = "1"
|
||||||
defmt-rtt = "0.4"
|
rtt-target = "0.6"
|
||||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
panic-rtt-target = "0.2"
|
||||||
embedded-hal = "1"
|
embedded-hal = "1"
|
||||||
|
embedded-hal-nb = "1"
|
||||||
|
embedded-io = "0.6"
|
||||||
|
|
||||||
[dependencies.va108xx-hal]
|
[dependencies.va108xx-hal]
|
||||||
version = "0.11"
|
version = "0.11"
|
||||||
features = ["rt"]
|
features = ["rt"]
|
||||||
path = "../va108xx-hal"
|
|
||||||
|
|
||||||
|
@ -7,21 +7,18 @@
|
|||||||
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use embedded_hal::delay::DelayNs;
|
use embedded_hal::delay::DelayNs;
|
||||||
// Logging provider
|
use panic_rtt_target as _;
|
||||||
use defmt_rtt as _;
|
use rtt_target::{rprintln, rtt_init_print};
|
||||||
// Panic provider
|
|
||||||
use panic_probe as _;
|
|
||||||
use va108xx_hal::{
|
use va108xx_hal::{
|
||||||
gpio::{regs::Gpio, Input, Output, PinState, Pull},
|
gpio::{PinState, PinsA, PinsB},
|
||||||
pac,
|
pac::{self, interrupt},
|
||||||
pins::{PinsA, PinsB, Port},
|
|
||||||
prelude::*,
|
prelude::*,
|
||||||
time::Hertz,
|
time::Hertz,
|
||||||
timer::CountdownTimer,
|
timer::{default_ms_irq_handler, set_up_ms_tick, CountdownTimer, InterruptConfig},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[derive(Debug, defmt::Format)]
|
#[derive(Debug)]
|
||||||
enum TestCase {
|
enum TestCase {
|
||||||
// Tie PORTA[0] to PORTA[1] for these tests!
|
// Tie PORTA[0] to PORTA[1] for these tests!
|
||||||
TestBasic,
|
TestBasic,
|
||||||
@ -35,18 +32,18 @@ enum TestCase {
|
|||||||
Pulse,
|
Pulse,
|
||||||
// Tie PA0, PA1 and PA3 to an oscilloscope
|
// Tie PA0, PA1 and PA3 to an oscilloscope
|
||||||
DelayGpio,
|
DelayGpio,
|
||||||
// PA0 can be checked with an oscillsope to verify timing correctness.
|
|
||||||
DelayMs,
|
DelayMs,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
defmt::println!("-- VA108xx Test Application --");
|
rtt_init_print!();
|
||||||
let dp = pac::Peripherals::take().unwrap();
|
rprintln!("-- VA108xx Test Application --");
|
||||||
|
let mut dp = pac::Peripherals::take().unwrap();
|
||||||
let cp = cortex_m::Peripherals::take().unwrap();
|
let cp = cortex_m::Peripherals::take().unwrap();
|
||||||
let pinsa = PinsA::new(dp.porta);
|
let pinsa = PinsA::new(&mut dp.sysconfig, dp.porta);
|
||||||
let pinsb = PinsB::new(dp.portb);
|
let pinsb = PinsB::new(&mut dp.sysconfig, dp.portb);
|
||||||
let mut led1 = Output::new(pinsa.pa10, PinState::Low);
|
let mut led1 = pinsa.pa10.into_readable_push_pull_output();
|
||||||
let test_case = TestCase::DelayMs;
|
let test_case = TestCase::DelayMs;
|
||||||
|
|
||||||
match test_case {
|
match test_case {
|
||||||
@ -54,20 +51,20 @@ fn main() -> ! {
|
|||||||
| TestCase::TestPulldown
|
| TestCase::TestPulldown
|
||||||
| TestCase::TestPullup
|
| TestCase::TestPullup
|
||||||
| TestCase::TestMask => {
|
| TestCase::TestMask => {
|
||||||
defmt::info!(
|
rprintln!(
|
||||||
"Test case {:?}. Make sure to tie PORTA[0] to PORTA[1]",
|
"Test case {:?}. Make sure to tie PORTA[0] to PORTA[1]",
|
||||||
test_case
|
test_case
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
defmt::info!("Test case {:?}", test_case);
|
rprintln!("Test case {:?}", test_case);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
match test_case {
|
match test_case {
|
||||||
TestCase::TestBasic => {
|
TestCase::TestBasic => {
|
||||||
// Tie PORTA[0] to PORTA[1] for these tests!
|
// Tie PORTA[0] to PORTA[1] for these tests!
|
||||||
let mut out = Output::new(pinsa.pa0, PinState::Low);
|
let mut out = pinsa.pa0.into_readable_push_pull_output();
|
||||||
let input = Input::new_floating(pinsa.pa1);
|
let input = pinsa.pa1.into_floating_input();
|
||||||
out.set_high();
|
out.set_high();
|
||||||
assert!(input.is_high());
|
assert!(input.is_high());
|
||||||
out.set_low();
|
out.set_low();
|
||||||
@ -75,74 +72,73 @@ fn main() -> ! {
|
|||||||
}
|
}
|
||||||
TestCase::TestPullup => {
|
TestCase::TestPullup => {
|
||||||
// Tie PORTA[0] to PORTA[1] for these tests!
|
// Tie PORTA[0] to PORTA[1] for these tests!
|
||||||
let input = Input::new_with_pull(pinsa.pa1, Pull::Up);
|
let input = pinsa.pa1.into_pull_up_input();
|
||||||
assert!(input.is_high());
|
assert!(input.is_high());
|
||||||
let mut out = Output::new(pinsa.pa0, PinState::Low);
|
let mut out = pinsa.pa0.into_readable_push_pull_output();
|
||||||
out.set_low();
|
out.set_low();
|
||||||
assert!(input.is_low());
|
assert!(input.is_low());
|
||||||
out.set_high();
|
out.set_high();
|
||||||
assert!(input.is_high());
|
assert!(input.is_high());
|
||||||
|
out.into_floating_input();
|
||||||
|
assert!(input.is_high());
|
||||||
}
|
}
|
||||||
TestCase::TestPulldown => {
|
TestCase::TestPulldown => {
|
||||||
// Tie PORTA[0] to PORTA[1] for these tests!
|
// Tie PORTA[0] to PORTA[1] for these tests!
|
||||||
let input = Input::new_with_pull(pinsa.pa1, Pull::Down);
|
let input = pinsa.pa1.into_pull_down_input();
|
||||||
assert!(input.is_low());
|
assert!(input.is_low());
|
||||||
let mut out = Output::new(pinsa.pa0, PinState::Low);
|
let mut out = pinsa.pa0.into_push_pull_output();
|
||||||
out.set_low();
|
out.set_low();
|
||||||
assert!(input.is_low());
|
assert!(input.is_low());
|
||||||
out.set_high();
|
out.set_high();
|
||||||
assert!(input.is_high());
|
assert!(input.is_high());
|
||||||
|
out.into_floating_input();
|
||||||
|
assert!(input.is_low());
|
||||||
}
|
}
|
||||||
TestCase::TestMask => {
|
TestCase::TestMask => {
|
||||||
// Tie PORTA[0] to PORTA[1] for these tests!
|
// Tie PORTA[0] to PORTA[1] for these tests!
|
||||||
// Need to test this low-level..
|
let mut input = pinsa.pa1.into_pull_down_input();
|
||||||
/*
|
|
||||||
let mut input = Input::new_with_pull(pinsa.pa1, Pull::Down);
|
|
||||||
input.clear_datamask();
|
input.clear_datamask();
|
||||||
assert!(!input.datamask());
|
assert!(!input.datamask());
|
||||||
let mut out = pinsa.pa0.into_push_pull_output();
|
let mut out = pinsa.pa0.into_push_pull_output();
|
||||||
out.clear_datamask();
|
out.clear_datamask();
|
||||||
assert!(input.is_low_masked().is_err());
|
assert!(input.is_low_masked().is_err());
|
||||||
assert!(out.set_high_masked().is_err());
|
assert!(out.set_high_masked().is_err());
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
TestCase::PortB => {
|
TestCase::PortB => {
|
||||||
// Tie PORTB[22] to PORTB[23] for these tests!
|
// Tie PORTB[22] to PORTB[23] for these tests!
|
||||||
let mut out = Output::new(pinsb.pb22, PinState::Low);
|
let mut out = pinsb.pb22.into_readable_push_pull_output();
|
||||||
let input = Input::new_floating(pinsb.pb23);
|
let input = pinsb.pb23.into_floating_input();
|
||||||
out.set_high();
|
out.set_high();
|
||||||
assert!(input.is_high());
|
assert!(input.is_high());
|
||||||
out.set_low();
|
out.set_low();
|
||||||
assert!(input.is_low());
|
assert!(input.is_low());
|
||||||
}
|
}
|
||||||
TestCase::Perid => {
|
TestCase::Perid => {
|
||||||
let mmio_porta = Gpio::new_mmio(Port::A);
|
assert_eq!(PinsA::get_perid(), 0x004007e1);
|
||||||
assert_eq!(mmio_porta.read_perid(), 0x004007e1);
|
assert_eq!(PinsB::get_perid(), 0x004007e1);
|
||||||
let mmio_porta = Gpio::new_mmio(Port::B);
|
|
||||||
assert_eq!(mmio_porta.read_perid(), 0x004007e1);
|
|
||||||
}
|
}
|
||||||
TestCase::Pulse => {
|
TestCase::Pulse => {
|
||||||
let mut output_pulsed = Output::new(pinsa.pa0, PinState::Low);
|
let mut output_pulsed = pinsa.pa0.into_push_pull_output();
|
||||||
output_pulsed.configure_pulse_mode(true, PinState::Low);
|
output_pulsed.configure_pulse_mode(true, PinState::Low);
|
||||||
defmt::info!("Pulsing high 10 times..");
|
rprintln!("Pulsing high 10 times..");
|
||||||
output_pulsed.set_low();
|
output_pulsed.set_low();
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
output_pulsed.set_high();
|
output_pulsed.set_high();
|
||||||
cortex_m::asm::delay(25_000_000);
|
cortex_m::asm::delay(25_000_000);
|
||||||
}
|
}
|
||||||
output_pulsed.configure_pulse_mode(true, PinState::High);
|
output_pulsed.configure_pulse_mode(true, PinState::High);
|
||||||
defmt::info!("Pulsing low 10 times..");
|
rprintln!("Pulsing low 10 times..");
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
output_pulsed.set_low();
|
output_pulsed.set_low();
|
||||||
cortex_m::asm::delay(25_000_000);
|
cortex_m::asm::delay(25_000_000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TestCase::DelayGpio => {
|
TestCase::DelayGpio => {
|
||||||
let mut out_0 = Output::new(pinsa.pa0, PinState::Low);
|
let mut out_0 = pinsa.pa0.into_readable_push_pull_output();
|
||||||
out_0.configure_delay(true, false);
|
out_0.configure_delay(true, false);
|
||||||
let mut out_1 = Output::new(pinsa.pa1, PinState::Low);
|
let mut out_1 = pinsa.pa1.into_readable_push_pull_output();
|
||||||
out_1.configure_delay(false, true);
|
out_1.configure_delay(false, true);
|
||||||
let mut out_2 = Output::new(pinsa.pa3, PinState::Low);
|
let mut out_2 = pinsa.pa3.into_readable_push_pull_output();
|
||||||
out_2.configure_delay(true, true);
|
out_2.configure_delay(true, true);
|
||||||
for _ in 0..20 {
|
for _ in 0..20 {
|
||||||
out_0.toggle();
|
out_0.toggle();
|
||||||
@ -152,8 +148,22 @@ fn main() -> ! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
TestCase::DelayMs => {
|
TestCase::DelayMs => {
|
||||||
let mut delay_timer = CountdownTimer::new(dp.tim1, 50.MHz());
|
let mut ms_timer = set_up_ms_tick(
|
||||||
let mut pa0 = Output::new(pinsa.pa0, PinState::Low);
|
InterruptConfig::new(pac::Interrupt::OC0, true, true),
|
||||||
|
&mut dp.sysconfig,
|
||||||
|
Some(&mut dp.irqsel),
|
||||||
|
50.MHz(),
|
||||||
|
dp.tim0,
|
||||||
|
);
|
||||||
|
for _ in 0..5 {
|
||||||
|
led1.toggle();
|
||||||
|
ms_timer.delay_ms(500);
|
||||||
|
led1.toggle();
|
||||||
|
ms_timer.delay_ms(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut delay_timer = CountdownTimer::new(&mut dp.sysconfig, 50.MHz(), dp.tim1);
|
||||||
|
let mut pa0 = pinsa.pa0.into_readable_push_pull_output();
|
||||||
for _ in 0..5 {
|
for _ in 0..5 {
|
||||||
led1.toggle();
|
led1.toggle();
|
||||||
delay_timer.delay_ms(500);
|
delay_timer.delay_ms(500);
|
||||||
@ -162,23 +172,30 @@ fn main() -> ! {
|
|||||||
}
|
}
|
||||||
let ahb_freq: Hertz = 50.MHz();
|
let ahb_freq: Hertz = 50.MHz();
|
||||||
let mut syst_delay = cortex_m::delay::Delay::new(cp.SYST, ahb_freq.raw());
|
let mut syst_delay = cortex_m::delay::Delay::new(cp.SYST, ahb_freq.raw());
|
||||||
// Release image should be used to verify timings for pin PA0
|
// Test usecond delay using both TIM peripheral and SYST. Use the release image if you
|
||||||
for _ in 0..5 {
|
// want to verify the timings!
|
||||||
pa0.toggle();
|
loop {
|
||||||
syst_delay.delay_us(50);
|
|
||||||
pa0.toggle();
|
|
||||||
syst_delay.delay_us(50);
|
|
||||||
pa0.toggle();
|
pa0.toggle();
|
||||||
delay_timer.delay_us(50);
|
delay_timer.delay_us(50);
|
||||||
pa0.toggle();
|
pa0.toggle();
|
||||||
delay_timer.delay_us(50);
|
delay_timer.delay_us(50);
|
||||||
|
pa0.toggle();
|
||||||
|
syst_delay.delay_us(50);
|
||||||
|
pa0.toggle();
|
||||||
|
syst_delay.delay_us(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defmt::info!("Test success");
|
rprintln!("Test success");
|
||||||
loop {
|
loop {
|
||||||
led1.toggle();
|
led1.toggle();
|
||||||
cortex_m::asm::delay(25_000_000);
|
cortex_m::asm::delay(25_000_000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[interrupt]
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
fn OC0() {
|
||||||
|
default_ms_irq_handler()
|
||||||
|
}
|
||||||
|
@ -12,8 +12,8 @@ The bootloader uses the following memory map:
|
|||||||
| 0x0 | Bootloader start | code up to 0x2FFE bytes |
|
| 0x0 | Bootloader start | code up to 0x2FFE bytes |
|
||||||
| 0x2FFE | Bootloader CRC | half-word |
|
| 0x2FFE | Bootloader CRC | half-word |
|
||||||
| 0x3000 | App image A start | code up to 0xE7F4 (~59K) bytes |
|
| 0x3000 | App image A start | code up to 0xE7F4 (~59K) bytes |
|
||||||
| 0x117F4 | App image A CRC check length | word |
|
| 0x117F8 | App image A CRC check length | word |
|
||||||
| 0x117F8 | App image A CRC check value | word |
|
| 0x117FC | App image A CRC check value | word |
|
||||||
| 0x117FC | App image B start | code up to 0xE7F4 (~59K) bytes |
|
| 0x117FC | App image B start | code up to 0xE7F4 (~59K) bytes |
|
||||||
| 0x1FFF0 | App image B CRC check length | word |
|
| 0x1FFF0 | App image B CRC check length | word |
|
||||||
| 0x1FFF4 | App image B CRC check value | word |
|
| 0x1FFF4 | App image B CRC check value | word |
|
||||||
|
@ -5,9 +5,9 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cfg-if = "1"
|
cfg-if = "1"
|
||||||
# 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"
|
||||||
# embedded-hal = "1"
|
embedded-hal = "1"
|
||||||
embedded-hal-async = "1"
|
embedded-hal-async = "1"
|
||||||
embedded-io = "0.6"
|
embedded-io = "0.6"
|
||||||
embedded-io-async = "0.6"
|
embedded-io-async = "0.6"
|
||||||
@ -19,7 +19,7 @@ defmt-rtt = "0.4"
|
|||||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||||
|
|
||||||
critical-section = "1"
|
critical-section = "1"
|
||||||
# portable-atomic = { version = "1", features = ["unsafe-assume-single-core"]}
|
portable-atomic = { version = "1", features = ["unsafe-assume-single-core"]}
|
||||||
|
|
||||||
embassy-sync = "0.6"
|
embassy-sync = "0.6"
|
||||||
embassy-time = "0.4"
|
embassy-time = "0.4"
|
||||||
@ -30,13 +30,10 @@ embassy-executor = { version = "0.7", features = [
|
|||||||
]}
|
]}
|
||||||
|
|
||||||
va108xx-hal = { version = "0.11", path = "../../va108xx-hal", features = ["defmt"] }
|
va108xx-hal = { version = "0.11", path = "../../va108xx-hal", features = ["defmt"] }
|
||||||
va108xx-embassy = { version = "0.2", path = "../../va108xx-embassy" }
|
va108xx-embassy = { version = "0.2" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["ticks-hz-1_000", "va108xx-embassy/irq-oc30-oc31"]
|
default = ["ticks-hz-1_000", "va108xx-embassy/irq-oc30-oc31"]
|
||||||
custom-irqs = []
|
custom-irqs = []
|
||||||
ticks-hz-1_000 = ["embassy-time/tick-hz-1_000"]
|
ticks-hz-1_000 = ["embassy-time/tick-hz-1_000"]
|
||||||
ticks-hz-32_768 = ["embassy-time/tick-hz-32_768"]
|
ticks-hz-32_768 = ["embassy-time/tick-hz-32_768"]
|
||||||
|
|
||||||
[package.metadata.cargo-machete]
|
|
||||||
ignored = ["cortex-m-rt"]
|
|
||||||
|
@ -59,10 +59,16 @@ static CHANNEL_PB22_TO_PB23: Channel<ThreadModeRawMutex, GpioCmd, 3> = Channel::
|
|||||||
async fn main(spawner: Spawner) {
|
async fn main(spawner: Spawner) {
|
||||||
defmt::println!("-- VA108xx Async GPIO Demo --");
|
defmt::println!("-- VA108xx Async GPIO Demo --");
|
||||||
|
|
||||||
let dp = pac::Peripherals::take().unwrap();
|
let mut dp = pac::Peripherals::take().unwrap();
|
||||||
|
|
||||||
// Safety: Only called once here.
|
// Safety: Only called once here.
|
||||||
va108xx_embassy::init(dp.tim23, dp.tim22, SYSCLK_FREQ);
|
va108xx_embassy::init(
|
||||||
|
&mut dp.sysconfig,
|
||||||
|
&dp.irqsel,
|
||||||
|
SYSCLK_FREQ,
|
||||||
|
dp.tim23,
|
||||||
|
dp.tim22,
|
||||||
|
);
|
||||||
|
|
||||||
let porta = PinsA::new(dp.porta);
|
let porta = PinsA::new(dp.porta);
|
||||||
let portb = PinsB::new(dp.portb);
|
let portb = PinsB::new(dp.portb);
|
||||||
|
@ -52,10 +52,16 @@ static CONSUMER_UART_B: Mutex<RefCell<Option<Consumer<u8, 256>>>> = Mutex::new(R
|
|||||||
async fn main(spawner: Spawner) {
|
async fn main(spawner: Spawner) {
|
||||||
defmt::println!("-- VA108xx Async UART RX Demo --");
|
defmt::println!("-- VA108xx Async UART RX Demo --");
|
||||||
|
|
||||||
let dp = pac::Peripherals::take().unwrap();
|
let mut dp = pac::Peripherals::take().unwrap();
|
||||||
|
|
||||||
// Safety: Only called once here.
|
// Safety: Only called once here.
|
||||||
va108xx_embassy::init(dp.tim23, dp.tim22, SYSCLK_FREQ);
|
va108xx_embassy::init(
|
||||||
|
&mut dp.sysconfig,
|
||||||
|
&dp.irqsel,
|
||||||
|
SYSCLK_FREQ,
|
||||||
|
dp.tim23,
|
||||||
|
dp.tim22,
|
||||||
|
);
|
||||||
|
|
||||||
let porta = PinsA::new(dp.porta);
|
let porta = PinsA::new(dp.porta);
|
||||||
let mut led0 = Output::new(porta.pa10, PinState::Low);
|
let mut led0 = Output::new(porta.pa10, PinState::Low);
|
||||||
|
@ -39,10 +39,16 @@ const STR_LIST: &[&str] = &[
|
|||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
defmt::println!("-- VA108xx Async UART TX Demo --");
|
defmt::println!("-- VA108xx Async UART TX Demo --");
|
||||||
|
|
||||||
let dp = pac::Peripherals::take().unwrap();
|
let mut dp = pac::Peripherals::take().unwrap();
|
||||||
|
|
||||||
// Safety: Only called once here.
|
// Safety: Only called once here.
|
||||||
va108xx_embassy::init(dp.tim23, dp.tim22, SYSCLK_FREQ);
|
va108xx_embassy::init(
|
||||||
|
&mut dp.sysconfig,
|
||||||
|
&dp.irqsel,
|
||||||
|
SYSCLK_FREQ,
|
||||||
|
dp.tim23,
|
||||||
|
dp.tim22,
|
||||||
|
);
|
||||||
|
|
||||||
let porta = PinsA::new(dp.porta);
|
let porta = PinsA::new(dp.porta);
|
||||||
|
|
||||||
|
@ -26,21 +26,23 @@ const SYSCLK_FREQ: Hertz = Hertz::from_raw(50_000_000);
|
|||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
defmt::println!("-- VA108xx Embassy Demo --");
|
defmt::println!("-- VA108xx Embassy Demo --");
|
||||||
|
|
||||||
let dp = pac::Peripherals::take().unwrap();
|
let mut dp = pac::Peripherals::take().unwrap();
|
||||||
|
|
||||||
// Safety: Only called once here.
|
// Safety: Only called once here.
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(not(feature = "custom-irqs"))] {
|
if #[cfg(not(feature = "custom-irqs"))] {
|
||||||
va108xx_embassy::init(
|
va108xx_embassy::init(
|
||||||
|
&mut dp.sysconfig,
|
||||||
|
&dp.irqsel,
|
||||||
|
SYSCLK_FREQ,
|
||||||
dp.tim23,
|
dp.tim23,
|
||||||
dp.tim22,
|
dp.tim22,
|
||||||
SYSCLK_FREQ,
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
va108xx_embassy::init_with_custom_irqs(
|
va108xx_embassy::init_with_custom_irqs(
|
||||||
|
SYSCLK_FREQ,
|
||||||
dp.tim23,
|
dp.tim23,
|
||||||
dp.tim22,
|
dp.tim22,
|
||||||
SYSCLK_FREQ,
|
|
||||||
pac::Interrupt::OC23,
|
pac::Interrupt::OC23,
|
||||||
pac::Interrupt::OC24,
|
pac::Interrupt::OC24,
|
||||||
);
|
);
|
||||||
|
@ -5,12 +5,22 @@ edition = "2021"
|
|||||||
|
|
||||||
[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"
|
||||||
|
embedded-hal = "1"
|
||||||
embedded-io = "0.6"
|
embedded-io = "0.6"
|
||||||
defmt-rtt = "0.4"
|
defmt-rtt = "0.4"
|
||||||
defmt = "1"
|
defmt = "1"
|
||||||
panic-probe = { version = "1", features = ["defmt"] }
|
panic-probe = { version = "1", features = ["defmt"] }
|
||||||
|
|
||||||
|
# Even though we do not use this directly, we need to activate this feature explicitely
|
||||||
|
# so that RTIC compiles because thumv6 does not have CAS operations natively.
|
||||||
|
portable-atomic = { version = "1", features = ["unsafe-assume-single-core"]}
|
||||||
|
|
||||||
rtic = { version = "2", features = ["thumbv6-backend"] }
|
rtic = { version = "2", features = ["thumbv6-backend"] }
|
||||||
rtic-monotonics = { version = "2", features = ["cortex-m-systick"] }
|
rtic-monotonics = { version = "2", features = ["cortex-m-systick"] }
|
||||||
|
rtic-sync = { version = "1.3", features = ["defmt-03"] }
|
||||||
|
|
||||||
|
once_cell = {version = "1", default-features = false, features = ["critical-section"]}
|
||||||
ringbuf = { version = "0.4.7", default-features = false, features = ["portable-atomic"] }
|
ringbuf = { version = "0.4.7", default-features = false, features = ["portable-atomic"] }
|
||||||
|
|
||||||
va108xx-hal = { version = "0.11", path = "../../va108xx-hal" }
|
va108xx-hal = { version = "0.11", path = "../../va108xx-hal" }
|
||||||
|
@ -7,15 +7,21 @@ edition = "2021"
|
|||||||
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"
|
||||||
panic-halt = "1"
|
panic-halt = "1"
|
||||||
|
critical-section = "1"
|
||||||
defmt-rtt = "0.4"
|
defmt-rtt = "0.4"
|
||||||
defmt = "1"
|
defmt = "1"
|
||||||
panic-probe = { version = "1", features = ["defmt"] }
|
panic-probe = { version = "1", features = ["defmt"] }
|
||||||
embedded-hal = "1"
|
embedded-hal = "1"
|
||||||
embedded-hal-nb = "1"
|
embedded-hal-nb = "1"
|
||||||
embedded-io = "0.6"
|
embedded-io = "0.6"
|
||||||
|
cortex-m-semihosting = "0.5.0"
|
||||||
portable-atomic = { version = "1", features = ["unsafe-assume-single-core"] }
|
portable-atomic = { version = "1", features = ["unsafe-assume-single-core"] }
|
||||||
|
|
||||||
[dependencies.va108xx-hal]
|
[dependencies.va108xx-hal]
|
||||||
version = "0.11"
|
version = "0.11"
|
||||||
path = "../../va108xx-hal"
|
path = "../../va108xx-hal"
|
||||||
features = ["defmt"]
|
features = ["defmt"]
|
||||||
|
|
||||||
|
[dependencies.vorago-reb1]
|
||||||
|
path = "../../vorago-reb1"
|
||||||
|
version = "0.8"
|
||||||
|
@ -10,6 +10,7 @@ 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,
|
||||||
@ -31,6 +32,7 @@ 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 => {
|
||||||
@ -65,10 +67,10 @@ fn main() -> ! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LibType::Hal => {
|
LibType::Hal => {
|
||||||
let mut ms_timer = CountdownTimer::new(dp.tim0, 50.MHz());
|
let mut ms_timer = CountdownTimer::new(dp.tim0, get_sys_clock().unwrap());
|
||||||
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, 50.MHz());
|
let mut second_timer = CountdownTimer::new(dp.tim1, get_sys_clock().unwrap());
|
||||||
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());
|
||||||
}
|
}
|
||||||
|
@ -4,16 +4,20 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = { version = "0.7", features = ["critical-section-single-core"]}
|
cortex-m = "0.7"
|
||||||
cortex-m-rt = "0.7"
|
cortex-m-rt = "0.7"
|
||||||
|
embedded-hal = "1"
|
||||||
|
embedded-hal-nb = "1"
|
||||||
embedded-io = "0.6"
|
embedded-io = "0.6"
|
||||||
defmt = "1"
|
defmt = "1"
|
||||||
defmt-rtt = { version = "0.4" }
|
defmt-rtt = { version = "0.4" }
|
||||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||||
num_enum = { version = "0.7", default-features = false }
|
num_enum = { version = "0.7", default-features = false }
|
||||||
|
crc = "3"
|
||||||
cobs = { version = "0.3", default-features = false }
|
cobs = { version = "0.3", default-features = false }
|
||||||
satrs = { version = "0.2", default-features = false }
|
satrs = { version = "0.2", default-features = false }
|
||||||
ringbuf = { version = "0.4.7", default-features = false, features = ["portable-atomic"] }
|
ringbuf = { version = "0.4.7", default-features = false, features = ["portable-atomic"] }
|
||||||
|
once_cell = { version = "1", default-features = false, features = ["critical-section"] }
|
||||||
spacepackets = { version = "0.11", default-features = false, features = ["defmt"] }
|
spacepackets = { version = "0.11", default-features = false, features = ["defmt"] }
|
||||||
# Even though we do not use this directly, we need to activate this feature explicitely
|
# Even though we do not use this directly, we need to activate this feature explicitely
|
||||||
# so that RTIC compiles because thumv6 does not have CAS operations natively.
|
# so that RTIC compiles because thumv6 does not have CAS operations natively.
|
||||||
@ -21,6 +25,7 @@ portable-atomic = {version = "1", features = ["unsafe-assume-single-core"]}
|
|||||||
|
|
||||||
rtic = { version = "2", features = ["thumbv6-backend"] }
|
rtic = { version = "2", features = ["thumbv6-backend"] }
|
||||||
rtic-monotonics = { version = "2", features = ["cortex-m-systick"] }
|
rtic-monotonics = { version = "2", features = ["cortex-m-systick"] }
|
||||||
|
rtic-sync = {version = "1", features = ["defmt-03"]}
|
||||||
|
|
||||||
[dependencies.va108xx-hal]
|
[dependencies.va108xx-hal]
|
||||||
version = "0.11"
|
version = "0.11"
|
||||||
@ -29,6 +34,3 @@ features = ["defmt"]
|
|||||||
|
|
||||||
[dependencies.vorago-reb1]
|
[dependencies.vorago-reb1]
|
||||||
version = "0.8"
|
version = "0.8"
|
||||||
|
|
||||||
[package.metadata.cargo-machete]
|
|
||||||
ignored = ["portable-atomic", "cortex-m-rt"]
|
|
||||||
|
@ -9,8 +9,9 @@ edition = "2021"
|
|||||||
cortex-m-rt = "0.7"
|
cortex-m-rt = "0.7"
|
||||||
panic-rtt-target = { version = "0.1.3" }
|
panic-rtt-target = { version = "0.1.3" }
|
||||||
rtt-target = { version = "0.5" }
|
rtt-target = { version = "0.5" }
|
||||||
|
cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
|
||||||
embedded-hal = "1"
|
embedded-hal = "1"
|
||||||
va108xx-hal = { version = "0.11" }
|
va108xx-hal = { version = "0.10.0" }
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use embedded_hal::delay::DelayNs;
|
use embedded_hal::{delay::DelayNs, digital::StatefulOutputPin};
|
||||||
use panic_rtt_target as _;
|
use panic_rtt_target as _;
|
||||||
use rtt_target::{rprintln, rtt_init_print};
|
use rtt_target::{rprintln, rtt_init_print};
|
||||||
use va108xx_hal::{gpio::PinsA, pac, prelude::*, timer::CountdownTimer};
|
use va108xx_hal::{gpio::PinsA, pac, prelude::*, timer::CountdownTimer};
|
||||||
@ -15,11 +15,11 @@ fn main() -> ! {
|
|||||||
|
|
||||||
let mut dp = pac::Peripherals::take().unwrap();
|
let mut dp = pac::Peripherals::take().unwrap();
|
||||||
let mut timer = CountdownTimer::new(&mut dp.sysconfig, 50.MHz(), dp.tim0);
|
let mut timer = CountdownTimer::new(&mut dp.sysconfig, 50.MHz(), dp.tim0);
|
||||||
let porta = PinsA::new(&mut dp.sysconfig, dp.porta);
|
let porta = PinsA::new(&mut dp.sysconfig, Some(dp.ioconfig), dp.porta);
|
||||||
let mut led1 = porta.pa10.into_readable_push_pull_output();
|
let mut led1 = porta.pa10.into_readable_push_pull_output();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
led1.toggle();
|
led1.toggle().ok();
|
||||||
timer.delay_ms(500);
|
timer.delay_ms(500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,9 @@ edition = "2021"
|
|||||||
cortex-m-rt = "0.7"
|
cortex-m-rt = "0.7"
|
||||||
panic-rtt-target = { version = "0.1.3" }
|
panic-rtt-target = { version = "0.1.3" }
|
||||||
rtt-target = { version = "0.5" }
|
rtt-target = { version = "0.5" }
|
||||||
|
cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
|
||||||
embedded-hal = "1"
|
embedded-hal = "1"
|
||||||
va108xx-hal = { version = "0.11" }
|
va108xx-hal = { version = "0.10.0" }
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use embedded_hal::delay::DelayNs;
|
use embedded_hal::{delay::DelayNs, digital::StatefulOutputPin};
|
||||||
use panic_rtt_target as _;
|
use panic_rtt_target as _;
|
||||||
use rtt_target::{rprintln, rtt_init_print};
|
use rtt_target::{rprintln, rtt_init_print};
|
||||||
use va108xx_hal::{gpio::PinsA, pac, prelude::*, timer::CountdownTimer};
|
use va108xx_hal::{gpio::PinsA, pac, prelude::*, timer::CountdownTimer};
|
||||||
@ -15,11 +15,11 @@ fn main() -> ! {
|
|||||||
|
|
||||||
let mut dp = pac::Peripherals::take().unwrap();
|
let mut dp = pac::Peripherals::take().unwrap();
|
||||||
let mut timer = CountdownTimer::new(&mut dp.sysconfig, 50.MHz(), dp.tim0);
|
let mut timer = CountdownTimer::new(&mut dp.sysconfig, 50.MHz(), dp.tim0);
|
||||||
let porta = PinsA::new(&mut dp.sysconfig, dp.porta);
|
let porta = PinsA::new(&mut dp.sysconfig, Some(dp.ioconfig), dp.porta);
|
||||||
let mut led2 = porta.pa7.into_readable_push_pull_output();
|
let mut led2 = porta.pa7.into_readable_push_pull_output();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
led2.toggle();
|
led2.toggle().ok();
|
||||||
timer.delay_ms(1000);
|
timer.delay_ms(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 = { version = "0.1", path = "../../vorago-shared-periphs" }
|
||||||
va108xx-hal = { path = "../va108xx-hal" }
|
va108xx-hal = { path = "../va108xx-hal" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -88,9 +88,9 @@ embassy_time_driver_irqs!(timekeeper_irq = OC29, alarm_irq = OC28);
|
|||||||
/// default case.
|
/// default case.
|
||||||
#[cfg(feature = "irqs-in-lib")]
|
#[cfg(feature = "irqs-in-lib")]
|
||||||
pub fn init<TimekeeperTim: TimMarker, AlarmTim: TimMarker>(
|
pub fn init<TimekeeperTim: TimMarker, AlarmTim: TimMarker>(
|
||||||
|
sysclk: Hertz,
|
||||||
timekeeper_tim: TimekeeperTim,
|
timekeeper_tim: TimekeeperTim,
|
||||||
alarm_tim: AlarmTim,
|
alarm_tim: AlarmTim,
|
||||||
sysclk: Hertz,
|
|
||||||
) {
|
) {
|
||||||
time_driver().__init(sysclk, timekeeper_tim, alarm_tim, TIMEKEEPER_IRQ, ALARM_IRQ)
|
time_driver().__init(sysclk, timekeeper_tim, alarm_tim, TIMEKEEPER_IRQ, ALARM_IRQ)
|
||||||
}
|
}
|
||||||
@ -99,9 +99,9 @@ pub fn init<TimekeeperTim: TimMarker, AlarmTim: TimMarker>(
|
|||||||
///
|
///
|
||||||
/// Requires an explicit [pac::Interrupt] argument for the timekeeper and alarm IRQs.
|
/// Requires an explicit [pac::Interrupt] argument for the timekeeper and alarm IRQs.
|
||||||
pub fn init_with_custom_irqs<TimekeeperTim: TimMarker, AlarmTim: TimMarker>(
|
pub fn init_with_custom_irqs<TimekeeperTim: TimMarker, AlarmTim: TimMarker>(
|
||||||
|
sysclk: Hertz,
|
||||||
timekeeper_tim: TimekeeperTim,
|
timekeeper_tim: TimekeeperTim,
|
||||||
alarm_tim: AlarmTim,
|
alarm_tim: AlarmTim,
|
||||||
sysclk: Hertz,
|
|
||||||
timekeeper_irq: pac::Interrupt,
|
timekeeper_irq: pac::Interrupt,
|
||||||
alarm_irq: pac::Interrupt,
|
alarm_irq: pac::Interrupt,
|
||||||
) {
|
) {
|
||||||
|
@ -12,10 +12,28 @@ 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"]}
|
||||||
vorago-shared-periphs = { git = "https://egit.irs.uni-stuttgart.de/rust/vorago-shared-periphs.git", features = ["vor1x"] }
|
cortex-m-rt = "0.7"
|
||||||
|
nb = "1"
|
||||||
|
paste = "1"
|
||||||
|
#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"] }
|
||||||
|
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]
|
||||||
@ -26,11 +44,8 @@ portable-atomic = "1"
|
|||||||
[features]
|
[features]
|
||||||
default = ["rt"]
|
default = ["rt"]
|
||||||
rt = ["va108xx/rt"]
|
rt = ["va108xx/rt"]
|
||||||
defmt = ["dep:defmt", "vorago-shared-periphs/defmt"]
|
defmt = ["dep:defmt", "fugit/defmt", "embedded-hal/defmt-03", "vorago-shared-periphs/defmt"]
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
rustdoc-args = ["--generate-link-to-definition"]
|
rustdoc-args = ["--generate-link-to-definition"]
|
||||||
|
|
||||||
[package.metadata.cargo-machete]
|
|
||||||
ignored = ["cortex-m"]
|
|
||||||
|
@ -1,9 +1,29 @@
|
|||||||
//! # 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 => (),
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
//! API for the SPI peripheral.
|
//! API for the SPI peripheral.
|
||||||
//!
|
//!
|
||||||
//! The main abstraction provided by this module is the [Spi] an structure.
|
//! The main abstraction provided by this module is the [Spi] an structure.
|
||||||
//! It provides the [SpiBus trait](https://docs.rs/embedded-hal/latest/embedded_hal/spi/trait.SpiBus.html),
|
//! It provides the [embedded_hal::spi] traits, but also offer a low level interface
|
||||||
//! but also offer a low level interface via the [SpiLowLevel] trait.
|
//! via the [SpiLowLevel] trait.
|
||||||
//!
|
//!
|
||||||
//! ## Examples
|
//! ## Examples
|
||||||
//!
|
//!
|
||||||
|
Reference in New Issue
Block a user