Skip to content

Commit 35b3fec

Browse files
committed
Add set_pps_freq to h7 as well
1 parent 3b4d04e commit 35b3fec

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/ptp/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,6 @@ impl EthernetPTP {
415415
is_tsint
416416
}
417417

418-
#[cfg(feature = "f-series")]
419418
/// Configure the PPS output frequency.
420419
///
421420
/// The PPS output frequency becomes `2 ^ pps_freq`. `pps_freq` is
@@ -426,10 +425,19 @@ impl EthernetPTP {
426425
// SAFETY: we atomically write to the PTPPPSCR register, which is
427426
// not read or written to anywhere else. The SVD files are incorrectly
428427
// saying that the bits in this register are read-only.
428+
#[cfg(feature = "f-series")]
429429
unsafe {
430430
let ptpppscr = self.eth_ptp.ptpppscr.as_ptr() as *mut u32;
431431
core::ptr::write_volatile(ptpppscr, pps_freq as u32);
432432
}
433+
434+
#[cfg(feature = "stm32h7xx-hal")]
435+
{
436+
// SAFETY: we only access and modify the `macppscr` (PPS Control register)
437+
let macppscr = unsafe { &self.mac().macppscr };
438+
439+
macppscr.modify(|_, w| w.ppsctrl().variant(pps_freq));
440+
}
433441
}
434442
}
435443

0 commit comments

Comments
 (0)