Skip to content

Commit

Permalink
Add set_pps_freq to h7 as well
Browse files Browse the repository at this point in the history
  • Loading branch information
datdenkikniet committed Feb 5, 2023
1 parent 3b4d04e commit 35b3fec
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ptp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@ impl EthernetPTP {
is_tsint
}

#[cfg(feature = "f-series")]
/// Configure the PPS output frequency.
///
/// The PPS output frequency becomes `2 ^ pps_freq`. `pps_freq` is
Expand All @@ -426,10 +425,19 @@ impl EthernetPTP {
// SAFETY: we atomically write to the PTPPPSCR register, which is
// not read or written to anywhere else. The SVD files are incorrectly
// saying that the bits in this register are read-only.
#[cfg(feature = "f-series")]
unsafe {
let ptpppscr = self.eth_ptp.ptpppscr.as_ptr() as *mut u32;
core::ptr::write_volatile(ptpppscr, pps_freq as u32);
}

#[cfg(feature = "stm32h7xx-hal")]
{
// SAFETY: we only access and modify the `macppscr` (PPS Control register)
let macppscr = unsafe { &self.mac().macppscr };

macppscr.modify(|_, w| w.ppsctrl().variant(pps_freq));
}
}
}

Expand Down

0 comments on commit 35b3fec

Please sign in to comment.