Skip to content

Commit b5f8ac2

Browse files
committed
g4/f3/f0 init
1 parent d058a22 commit b5f8ac2

39 files changed

+3727
-403
lines changed

.lapce/settings.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[lapce-rust]
22
check.allTargets = false
33
check.targets = "thumbv7em-none-eabihf"
4-
cargo.features = ["rtic", "stm32f745"]
4+
cargo.features = ["rtic", "stm32l475"]

Cargo.toml

Lines changed: 99 additions & 45 deletions
Large diffs are not rendered by default.

src/adc/l4.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
use core::{
44
convert::Infallible,
55
marker::PhantomData,
6-
ops::DerefMut,
7-
sync::atomic::{self, Ordering},
6+
//ops::DerefMut,
7+
//sync::atomic::{self, Ordering},
88
};
9-
9+
#[cfg(feature = "dma")]
1010
use stable_deref_trait::StableDeref;
1111

12+
#[cfg(feature = "dma")]
1213
use crate::{
1314
dma::{dma1, Event as DMAEvent, RxDma, Transfer, TransferPayload, W},
1415
dmamux::{DmaInput, DmaMux},
16+
};
17+
use crate::{
1518
gpio::{self, Analog},
1619
hal::{
1720
adc::{Channel as EmbeddedHalChannel, OneShot},
@@ -279,6 +282,7 @@ where
279282
}
280283
}
281284

285+
#[cfg(feature = "dma")]
282286
impl TransferPayload for RxDma<Adc<ADC1>, dma1::C1> {
283287
fn start(&mut self) {
284288
self.channel.start();
@@ -289,13 +293,15 @@ impl TransferPayload for RxDma<Adc<ADC1>, dma1::C1> {
289293
}
290294
}
291295

296+
#[cfg(feature = "dma")]
292297
impl RxDma<Adc<ADC1>, dma1::C1> {
293298
pub fn split(mut self) -> (Adc<ADC1>, dma1::C1) {
294299
self.stop();
295300
(self.payload, self.channel)
296301
}
297302
}
298303

304+
#[cfg(feature = "dma")]
299305
impl<BUFFER, const N: usize> Transfer<W, BUFFER, RxDma<Adc<ADC1>, dma1::C1>>
300306
where
301307
BUFFER: Sized + StableDeref<Target = [u16; N]> + DerefMut + 'static,
@@ -675,15 +681,7 @@ macro_rules! adc {
675681
delay: &mut impl DelayUs<u32>,
676682
) -> Self {
677683
// Select system clock as ADC clock source
678-
ccipr.ccipr().modify(|_, w| {
679-
// This is sound, as `0b11` is a valid value for this field.
680-
unsafe {
681-
// TODO: Switch to enum once https://github.com/stm32-rs/stm32-rs/pull/720 is released.
682-
w.adcsel().bits(0b11);
683-
}
684-
685-
w
686-
});
684+
ccipr.ccipr().modify(|_, w| w.adcsel().sysclk());
687685

688686
// Initialize the ADC, according to the STM32L4xx Reference Manual,
689687
// section 16.4.6.

src/dma/traits.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,22 +293,22 @@ pub use f3::*;
293293
mod f4;
294294
#[cfg(feature = "f4")]
295295
pub use f4::*;
296-
/*
296+
297297
#[cfg(feature = "f7")]
298298
mod f7;
299299
#[cfg(feature = "f7")]
300300
pub use f7::*;
301-
301+
/*
302302
#[cfg(feature = "g0")]
303303
mod g0;
304304
#[cfg(feature = "g0")]
305305
pub use g0::*;
306-
306+
*/
307307
#[cfg(feature = "g4")]
308308
mod g4;
309309
#[cfg(feature = "g4")]
310310
pub use g4::*;
311-
311+
/*
312312
#[cfg(feature = "h7")]
313313
mod h7;
314314
#[cfg(feature = "h7")]

src/dma/traits/f7.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

src/dma/traits/g4.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

src/gpio/alt.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -514,11 +514,11 @@ pub trait QuadSpiBanks {
514514
}
515515
#[cfg(feature = "quadspi")]
516516
pub trait QuadSpiBank {
517-
type Io0;
518-
type Io1;
519-
type Io2;
520-
type Io3;
521-
type Ncs;
517+
type Io0: crate::gpio::PinSpeed;
518+
type Io1: crate::gpio::PinSpeed;
519+
type Io2: crate::gpio::PinSpeed;
520+
type Io3: crate::gpio::PinSpeed;
521+
type Ncs: crate::gpio::PinSpeed;
522522
}
523523

524524
// SAI pins

src/gpio/alt/c0.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
use super::*;
2-
use crate::gpio::{self, Edge, ExtiPin};
3-
use crate::gpio::{marker, Alternate, NoPin, OpenDrain, PinMode, PushPull};
4-
use crate::pac::EXTI;
5-
use crate::syscfg::SysCfg;
2+
use crate::gpio::{self, NoPin, OpenDrain, PushPull};
63

74
pub mod debug {
85
use super::*;

src/gpio/alt/f0.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
use super::*;
2+
use crate::gpio::{self, NoPin, OpenDrain, PushPull};
3+
14
#[cfg(any(feature = "gpio-f042", feature = "gpio-f052", feature = "gpio-f091"))]
25
pub mod can {
36
use super::*;

src/gpio/alt/f2.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
use super::*;
2-
use crate::gpio::{self, Edge, ExtiPin};
3-
use crate::gpio::{marker, Alternate, NoPin, OpenDrain, PinMode, PushPull};
4-
use crate::pac::EXTI;
5-
use crate::syscfg::SysCfg;
2+
use crate::gpio::{self, NoPin, OpenDrain, PushPull};
63

74
pub mod can1 {
85
use super::*;

0 commit comments

Comments
 (0)