Skip to content

Commit 690a9d1

Browse files
committed
Add PPS pin implementations for H7
Fix up MII examples
1 parent df931cc commit 690a9d1

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

examples/arp.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#![no_main]
99

1010
use defmt_rtt as _;
11+
use ieee802_3_miim::{phy::BarePhy, Phy};
1112
use panic_probe as _;
1213

1314
use core::cell::RefCell;
@@ -16,14 +17,13 @@ use cortex_m_rt::{entry, exception};
1617

1718
use cortex_m::interrupt::Mutex;
1819
use stm32_eth::{
19-
dma::{RxDescriptor, TxDescriptor},
2020
stm32::{interrupt, CorePeripherals, Peripherals, SYST},
21-
Parts, MTU,
21+
Parts,
2222
};
2323

2424
pub mod common;
2525

26-
use stm32_eth::dma::{RxDescriptorRing, TxDescriptorRing, TxError};
26+
use stm32_eth::dma::TxError;
2727

2828
const PHY_ADDR: u8 = 0;
2929

@@ -55,16 +55,11 @@ fn main() -> ! {
5555

5656
let mut last_link_up = false;
5757

58-
#[cfg(feature = "f-series")]
59-
let mut bare_phy = BarePhy::new(_mac.with_mii(mdio, mdc), PHY_ADDR, Default::default());
58+
let mut bare_phy = BarePhy::new(mac.with_mii(mdio, mdc), PHY_ADDR, Default::default());
6059

6160
loop {
62-
#[cfg(feature = "f-series")]
6361
let link_up = bare_phy.phy_link_up();
6462

65-
#[cfg(feature = "stm32h7xx-hal")]
66-
let link_up = true;
67-
6863
if link_up != last_link_up {
6964
if link_up {
7065
defmt::info!("Ethernet: link detected");

examples/rtic-timestamp.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,10 @@ mod app {
4343
use systick_monotonic::Systick;
4444

4545
use stm32_eth::{
46-
dma::{
47-
EthernetDMA, PacketId, RxDescriptor, RxDescriptorRing, TxDescriptor, TxDescriptorRing,
48-
},
46+
dma::{EthernetDMA, PacketId},
4947
mac::Speed,
5048
ptp::{EthernetPTP, Timestamp},
51-
Parts, MTU,
49+
Parts,
5250
};
5351

5452
#[local]
@@ -84,7 +82,6 @@ mod app {
8482
let Parts { dma, mac, mut ptp } =
8583
stm32_eth::new_with_mii(ethernet, rx_ring, tx_ring, clocks, pins, mdio, mdc).unwrap();
8684

87-
#[cfg(not(feature = "stm32h7xx-hal"))]
8885
ptp.enable_pps(pps);
8986

9087
defmt::info!("Enabling interrupts");

src/ptp/pps_pin.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,10 @@ mod impl_pps_pin {
6363
}
6464
}
6565
}
66+
67+
#[cfg(feature = "stm32h7xx-hal")]
68+
mod impl_pps_pin {
69+
use crate::hal::gpio::{Alternate, Output, PushPull, PB5, PG8};
70+
71+
impl_pps_pin!([PG8<Output<PushPull>>, PG8<Alternate<11>>], [PB5<Output<PushPull>>, PB5<Alternate<11>>]);
72+
}

0 commit comments

Comments
 (0)