-
Notifications
You must be signed in to change notification settings - Fork 62
Support for the STM32L0x0 subfamily #146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 13 commits
4ef5590
fface70
87cfaf1
8105d90
55fce3b
d419425
db94619
230f99c
d2ca540
67cc695
9325d5e
785197b
da2b070
480c488
2fec383
9386d31
1ae9c7b
f6426c0
9ae6f98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
MEMORY | ||
{ | ||
FLASH : ORIGIN = 0x08000000, LENGTH = 128K | ||
RAM : ORIGIN = 0x20000000, LENGTH = 20K | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ use crate::{ | |
rcc::Rcc, | ||
}; | ||
|
||
#[cfg(any(feature = "io-STM32L051", feature = "io-STM32L071"))] | ||
#[cfg(all(not(feature = "stm32l0x0"), any(feature = "io-STM32L051", feature = "io-STM32L071")))] | ||
use crate::pac::USART1; | ||
|
||
#[cfg(any( | ||
|
@@ -37,9 +37,16 @@ use crate::pac::USART1; | |
))] | ||
use crate::{ | ||
i2c, | ||
pac::{I2C1, I2C2, I2C3, USART2}, | ||
pac::{I2C1, USART2}, | ||
serial, | ||
}; | ||
#[cfg(not(feature = "stm32l0x0"))] | ||
use crate::{ | ||
pac::{ | ||
I2C2, | ||
I2C3 | ||
}, | ||
}; | ||
|
||
#[cfg(feature = "stm32l082")] | ||
use crate::aes; | ||
|
@@ -324,14 +331,14 @@ macro_rules! impl_channel { | |
handle: &mut Handle, | ||
address: u32, | ||
) { | ||
handle.dma.$chfield.par.write(|w| w.pa().bits(address)); | ||
unsafe { handle.dma.$chfield.par.write(|w| w.pa().bits(address)); } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This confuses me. Wouldn't the |
||
} | ||
|
||
fn set_memory_address(&self, | ||
handle: &mut Handle, | ||
address: u32, | ||
) { | ||
handle.dma.$chfield.mar.write(|w| w.ma().bits(address)); | ||
unsafe { handle.dma.$chfield.mar.write(|w| w.ma().bits(address)); } | ||
} | ||
|
||
fn set_transfer_len(&self, handle: &mut Handle, len: u16) { | ||
|
@@ -504,7 +511,7 @@ impl_target!( | |
adc::DmaToken, Channel2, 0; | ||
); | ||
|
||
#[cfg(any(feature = "io-STM32L051", feature = "io-STM32L071"))] | ||
#[cfg(all(not(feature = "stm32l0x0"), any(feature = "io-STM32L051", feature = "io-STM32L071")))] | ||
impl_target!( | ||
// USART1 | ||
serial::Tx<USART1>, Channel2, 3; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -469,7 +469,7 @@ macro_rules! gpio { | |
} | ||
|
||
#[allow(dead_code)] | ||
pub(crate) fn set_alt_mode(&self, mode: AltMode) { | ||
pub fn set_alt_mode(&self, mode: AltMode) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there any reason not to make this public? I looked at other hal crates, they made this a private function, but referenced all the pin modes as function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see a reason, but I'm not very familiar with that code. I also don't know why the |
||
let mode = mode as u32; | ||
let offset = 2 * $i; | ||
let offset2 = 4 * $i; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that enough, or do we need to add more features flags (thinking about the ones @dbrgn auto-generated from CubeMX).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably yes. I only have a l0x0RBT to test against, which is a class 5. I keep finding more things to fix; basically it's similar to the features of L020 class 5 with a lot of stuff cut out.