stm32/eth: add set_poll_interval

This commit is contained in:
xoviat 2023-07-15 12:02:08 -05:00
parent 975a780efe
commit 17d5e1c470
6 changed files with 13 additions and 7 deletions

View file

@ -49,8 +49,10 @@ pub struct GenericSMI {
impl GenericSMI {
#[cfg(feature = "time")]
pub fn new(poll_interval: Duration) -> Self {
Self { poll_interval }
pub fn new() -> Self {
Self {
poll_interval: Duration::from_millis(500),
}
}
#[cfg(not(feature = "time"))]
@ -100,6 +102,10 @@ unsafe impl PHY for GenericSMI {
/// Public functions for the PHY
impl GenericSMI {
pub fn set_poll_interval(&mut self, poll_interval: Duration) {
self.poll_interval = poll_interval
}
// Writes a value to an extended PHY register in MMD address space
fn smi_write_ext<S: StationManagement>(&mut self, sm: &mut S, reg_addr: u16, reg_data: u16) {
sm.smi_write(PHY_REG_CTL, 0x0003); // set address

View file

@ -56,7 +56,7 @@ async fn main(spawner: Spawner) -> ! {
p.PG13,
p.PB13,
p.PG11,
GenericSMI::new(Duration::from_millis(500)),
GenericSMI::new(),
mac_addr,
0,
);

View file

@ -57,7 +57,7 @@ async fn main(spawner: Spawner) -> ! {
p.PG13,
p.PB13,
p.PG11,
GenericSMI::new(Duration::from_millis(500)),
GenericSMI::new(),
mac_addr,
0,
);

View file

@ -76,7 +76,7 @@ async fn main(spawner: Spawner) -> ! {
p.PG13,
p.PB15,
p.PG11,
GenericSMI::new(Duration::from_millis(500)),
GenericSMI::new(),
mac_addr,
0,
);

View file

@ -58,7 +58,7 @@ async fn main(spawner: Spawner) -> ! {
p.PG13,
p.PB13,
p.PG11,
GenericSMI::new(Duration::from_millis(500)),
GenericSMI::new(),
mac_addr,
0,
);

View file

@ -59,7 +59,7 @@ async fn main(spawner: Spawner) -> ! {
p.PG13,
p.PB13,
p.PG11,
GenericSMI::new(Duration::from_millis(500)),
GenericSMI::new(),
mac_addr,
0,
);