Skip to content
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

Son 2159 support C pins #2

Merged
merged 87 commits into from
May 16, 2024
Merged
Changes from 1 commit
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
3dfd7f9
Added VOS0 support for stm32h7a3/7b3/7b0
Orange-Murker Apr 7, 2023
52dc19f
Merge branch 'master' into master
Orange-Murker Apr 13, 2023
db37459
Removed the space before MHz
Orange-Murker Apr 13, 2023
bedd5ae
fix vscode rust-analazer
burrbull Apr 16, 2023
4e3210b
Merge #430
bors[bot] Apr 18, 2023
721cb65
IntoAF
burrbull Apr 5, 2022
3ab88f0
usb_serial example
burrbull Aug 17, 2022
9d7e788
Expand vos0 example to support rm0455 parts
richardeoin Jul 1, 2023
a6ccc61
replace bors with merge queue
richardeoin Jul 1, 2023
03e45d8
Merge pull request #437 from stm32-rs/merge-queue
richardeoin Jul 1, 2023
f8d721f
Merge pull request #429 from Orange-Murker/master
richardeoin Jul 1, 2023
723c332
Remove unnecessary borrows in unsafe register write expressions
richardeoin Jul 1, 2023
258e5c8
Simplify cfg expressions
richardeoin Jul 1, 2023
adbe62d
Use new default syntax
richardeoin Jul 1, 2023
8b0cf3f
Elide unnecessary explicit lifetime
richardeoin Jul 1, 2023
d900ece
Add additional possibility for WWDG1RSTF to WindowWatchdogReset arm.
Jun 17, 2023
2d47a4a
Merge pull request #346 from burrbull/gpio
richardeoin Jul 1, 2023
1978fe7
Update smoltcp dependency to 0.10.0
richardeoin Jul 1, 2023
11c5eba
Use MaybeUninit to solve UB in ethernet-rtic examples
richardeoin Jul 4, 2023
24ebea4
Bump embedded-sdmmc from 0.4 to 0.5
richardeoin Jul 22, 2023
79af0ad
Bump fdcan from 0.1 to 0.2
richardeoin Jul 22, 2023
de1da6c
Bump embedded-graphics from 0.7 to 0.8
richardeoin Jul 22, 2023
4864cde
Update [[example]] targets
richardeoin Jul 22, 2023
a91052c
rm bitflags
burrbull Jul 26, 2023
c221c51
Move ethernet DMA reset slightly earlier to eliminate freeze on h723
jlogan03 Aug 5, 2023
6b21ffc
add example that brings up the ethernet link on the nucleo-h723zg
jlogan03 Aug 5, 2023
2c835a2
run cargo fmt
jlogan03 Aug 5, 2023
0acd636
update example docstring
jlogan03 Aug 5, 2023
e8269a3
add feature overrides for new example
jlogan03 Aug 6, 2023
8f57225
Merge branch 'stm32-rs:master' into h723_ethernet
jlogan03 Aug 21, 2023
ff7efaa
update example for compatibility with smoltcp 0.10.x
jlogan03 Aug 21, 2023
5e3e87e
Change incorrect link from I2C to I2S in mod.rs
JosefUtbult Aug 22, 2023
d2a215e
remove defunct comment
jlogan03 Aug 23, 2023
a5b1b59
Merge pull request #445 from jlogan03/h723_ethernet
richardeoin Aug 23, 2023
fd567a9
Revert "Move ethernet DMA reset slightly earlier to eliminate freeze …
richardeoin Sep 11, 2023
741e37c
Merge pull request #450 from richardeoin/revert-eth-dma-reset
richardeoin Sep 12, 2023
d9af4a6
Replace casts of &T to &mut T with UnsafeCell
richardeoin Sep 11, 2023
6950bac
Fix invalid read test logic in sdmmc example
phoracek Sep 18, 2023
600969f
Introduce SDMMC write_blocks
phoracek Sep 18, 2023
8515770
Optimize SDMMC FAT writting speeds
phoracek Sep 19, 2023
a15c64f
fix typo in sdmmc.rs
olback Sep 21, 2023
9c596cd
v0.15.0
richardeoin Oct 9, 2023
1b9e46e
usb: On rm0455/rm0468 parts, pins PA11/PA12 can be in analog mode
richardeoin Oct 22, 2023
d452052
v0.15.1
richardeoin Nov 3, 2023
725b99d
Update usb examples after #464
richardeoin Nov 3, 2023
f6b4c89
Expose QSPI control register for the QSPI struct
ElouanPetereau Sep 1, 2023
1c9d968
Add enums and traits for Bank switch
ElouanPetereau Sep 1, 2023
fd28a83
Expose BankSelect and related error
ElouanPetereau Sep 1, 2023
0665248
Rename QUADSPI change_bank and check for business
ElouanPetereau Oct 5, 2023
1605840
Add documentation for Quad-SPI
ElouanPetereau Oct 6, 2023
b238769
Updating usb crates
ryan-summers Nov 20, 2023
26d9ca0
Updating examples
ryan-summers Nov 20, 2023
63cdc5f
Fixing format
ryan-summers Nov 20, 2023
a5fde4b
Fixing passthrough example
ryan-summers Nov 20, 2023
88f1568
Update actions/checkout v2 -> v4; actions/cache v2 -> v3
richardeoin Nov 22, 2023
28acb6c
Migrate actions-rs/toolchain -> dtolnay/rust-toolchain
richardeoin Nov 22, 2023
82df2cb
Migrate actions-rs/clippy-check@v1 -> clechasseur/rs-clippy-check@v3
richardeoin Nov 22, 2023
c2a4c0e
Remove bors badge from README
richardeoin Nov 23, 2023
cd7c125
Update clippy to 1.74.0 . Tidy clippy lints
richardeoin Nov 26, 2023
7e8664a
Implement DSI HAL.
romixlab Dec 1, 2023
1553cdc
Merge branch 'stm32-rs:master' into dsi-display
romixlab Dec 1, 2023
2dfc919
Update dependencies to git links.
romixlab Dec 1, 2023
d33298a
This is an example of controlling LEDs using GPIOs on STM32H747i-Disco.
youndong-lg Jan 18, 2024
7ae2df5
Update blinky-stm32h747i-disco.rs
youndong Jan 24, 2024
cf8701e
Update embedded-display-controller to 0.2. Use otm8009a from crates. …
romixlab Jan 24, 2024
e6f6065
remove trailing whitespaces
youndong-lg Jan 24, 2024
ae2c504
Move display related utility functions to utilities_display mod. Clar…
romixlab Jan 27, 2024
7f67fe5
Add attributes to utilities::init_mpu fn.
romixlab Jan 27, 2024
c90484c
dsi: revert unneeded change to delay.rs
richardeoin Jan 27, 2024
34841e4
dsi: add to ci; dsi is only available on rm0399 parts
richardeoin Jan 27, 2024
aea2aa8
Merge pull request #480 from youndong/blinky_on_stm32h747i_disco
richardeoin Jan 27, 2024
891d9f5
dsi: increase MSRV to 1.66.1
richardeoin Jan 27, 2024
9bfd5b1
Merge pull request #473 from romixlab/dsi-display
richardeoin Jan 27, 2024
7146759
Remove references to `static mut`
richardeoin Jan 20, 2024
c79922c
Tidy clippy lints
richardeoin Jan 20, 2024
4586b6f
examples/i2c4_bdma: Initialise target buffer
richardeoin Jan 31, 2024
2bcf2af
Add note where TARGET_BUFFER should be initialised (but is not)
richardeoin Jan 31, 2024
a2ef40c
Add support for TIM23 and TIM24 found on RM0468 parts
richardeoin Jan 20, 2024
03b8dcf
Tidy `cargo doc` warnings, fix links in rcc
richardeoin Jan 20, 2024
fcd495e
Upgrade smoltcp to 0.11.0
richardeoin Feb 4, 2024
a317101
Tidy redundant imports
richardeoin Mar 3, 2024
6c76647
v0.16.0
richardeoin Mar 6, 2024
749a8d5
Merge commit '6c76647ed912a8606b18adcbaa6d90a854b088c2' into sonair
endresonair May 14, 2024
4a3db61
adc: Remove hack for yango
endresonair May 15, 2024
b2d98b0
gpio: Add support for CPins (ADC analog input pins)
endresonair May 15, 2024
c455210
adc: Add support for C pins
endresonair May 15, 2024
6f13b8f
adc: Need some restrictions to pass CI (builds for a ton of platforms)
endresonair May 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 75 additions & 6 deletions src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
use core::marker::PhantomData;

use crate::rcc::ResetEnable;
// EB: Todo: If making PR upstream, this should only be include for some boards (see pwr.rs)
use crate::stm32::SYSCFG;
// EB: Todo: If making PR upstream, check which boards has relevant Pxy_C pins and update

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this involves going through the data sheets for all the supported MCUs (there are at least 13) and the package information for each of those (probably 3-5 for each MCU) to see which have these pins (and then add feature flags in the right places), so it is a rather big undertaking...

// EB: adc_pins! macros accordingly

mod convert;
pub use convert::PinMode;
Expand Down Expand Up @@ -257,6 +261,28 @@ af!(
15: AF15
);

/// Joined state
pub struct Joined;

/// Split state
pub struct Split;

/// C pin type
///
/// This type is used to specify ADC analog input pins (typically named PA0_C or PC2_C).
/// These pins can be connected to corresponding GPIO pins (PA0 or PC2) through an
/// analog switch.
/// - `MODE` is one of Joined (connected to gpio pin (e.g. PA0 and PA0_C are
/// connected)) or Split (PA0 and PA0_C are not connected)
pub struct CPin<const P: char, const N: u8, Mode> {
_mode: PhantomData<Mode>,
}
impl<const P: char, const N: u8, MODE> CPin<P, N, MODE> {
const fn new() -> Self {
Self { _mode: PhantomData }
}
}

/// Generic pin type
///
/// - `MODE` is one of the pin modes (see [Modes](crate::gpio#modes) section).
Expand Down Expand Up @@ -520,7 +546,8 @@ where

macro_rules! gpio {
($GPIOX:ident, $gpiox:ident, $Rec:ident, $PEPin:ident, $port_id:expr, $PXn:ident, [
$($PXi:ident: ($pxi:ident, $i:expr, [$($A:literal),*] $(, $MODE:ty)?),)+
$($PXi:ident: ($pxi:ident, $i:expr, [$($A:literal),*] $(, $MODE:ty)?)
$(, ($CPIN:ident, $cpin:ident, $creg:ident))?,)+
]) => {
#[doc=concat!("Port ", $port_id)]
pub mod $gpiox {
Expand All @@ -533,6 +560,9 @@ macro_rules! gpio {
/// Pin
pub $pxi: $PXi $(<$MODE>)?,
)+
$(
$(pub $cpin: $CPIN,)?
)*
}

impl super::GpioExt for $GPIOX {
Expand All @@ -546,6 +576,10 @@ macro_rules! gpio {
$(
$pxi: $PXi::new(),
)+
$(
$($cpin: $CPIN::new(),)?
)*

}
}

Expand All @@ -556,6 +590,10 @@ macro_rules! gpio {
$(
$pxi: $PXi::new(),
)+
$(
$($cpin: $CPIN::new(),)?
)*

}
}
}
Expand All @@ -572,9 +610,40 @@ macro_rules! gpio {
)*
)+

$(
$(
#[doc=concat!("P", $port_id, $i, "_C pin")]
#[allow(non_camel_case_types)]
pub type $CPIN<MODE = super::Joined> = super::CPin<$port_id, $i, MODE>;
)?
)*

}

pub use $gpiox::{ $($PXi,)+ };
pub use $gpiox::{ $($PXi,)+ $($($CPIN,)?)* };

$(
$(
impl<MODE> CPin<$port_id, $i, MODE> {
#[doc=concat!("Configures the pin to split mode (P", $port_id, $i," and P", $port_id, $i,"_C are not connected)")]
pub fn into_split(self) -> CPin<$port_id, $i, Split> {
unsafe {
(*SYSCFG::ptr()).pmcr.modify(|_, w| w.$creg().set_bit());
}
CPin::new()
}
#[doc=concat!("Configures the pin to joined mode (P", $port_id, $i," and P", $port_id, $i,"_C are connected)")]
pub fn into_joined(self) -> CPin<$port_id, $i, Joined> {
unsafe {
(*SYSCFG::ptr()).pmcr.modify(|_, w| w.$creg().clear_bit());
}

CPin::new()
}
}
)?
)*

}
}

Expand Down Expand Up @@ -755,8 +824,8 @@ gpio!(GPIOK, gpiok, Gpiok, PK, 'K', PKn, [

#[cfg(feature = "gpio-h747")]
gpio!(GPIOA, gpioa, Gpioa, PA, 'A', PAn, [
PA0: (pa0, 0, [1, 2, 3, 4, 7, 8, 9, 10, 11, 15]),
PA1: (pa1, 1, [1, 2, 3, 4, 7, 8, 9, 10, 11, 14, 15]),
PA0: (pa0, 0, [1, 2, 3, 4, 7, 8, 9, 10, 11, 15]), (PA0_C, pa0_c, pa0so),
PA1: (pa1, 1, [1, 2, 3, 4, 7, 8, 9, 10, 11, 14, 15]), (PA1_C, pa1_c, pa1so),
PA2: (pa2, 2, [1, 2, 3, 4, 7, 8, 11, 12, 14, 15]),
PA3: (pa3, 3, [1, 2, 3, 4, 7, 9, 10, 11, 14, 15]),
PA4: (pa4, 4, [2, 5, 6, 7, 8, 12, 13, 14, 15]),
Expand Down Expand Up @@ -797,8 +866,8 @@ gpio!(GPIOB, gpiob, Gpiob, PB, 'B', PBn, [
gpio!(GPIOC, gpioc, Gpioc, PC, 'C', PCn, [
PC0: (pc0, 0, [3, 6, 8, 10, 12, 14, 15]),
PC1: (pc1, 1, [0, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 15]),
PC2: (pc2, 2, [3, 5, 6, 10, 11, 12, 15]),
PC3: (pc3, 3, [3, 5, 10, 11, 12, 15]),
PC2: (pc2, 2, [3, 5, 6, 10, 11, 12, 15]), (PC2_C, pc2_c, pc2so),
PC3: (pc3, 3, [3, 5, 10, 11, 12, 15]), (PC3_C, pc3_c, pc3so),
PC4: (pc4, 4, [3, 5, 9, 11, 12, 15]),
PC5: (pc5, 5, [2, 3, 9, 10, 11, 12, 13, 15]),
PC6: (pc6, 6, [1, 2, 3, 4, 5, 7, 8, 9, 10, 12, 13, 14, 15]),
Expand Down