Skip to content

Commit

Permalink
Remove commented-out code and inline some static variables
Browse files Browse the repository at this point in the history
  • Loading branch information
rleh committed Feb 4, 2021
1 parent 8c4b2f9 commit 10a4cff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 27 deletions.
2 changes: 1 addition & 1 deletion examples/nucleo_f767zi/ethernet/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<module>modm:build:scons</module>
<module>modm:freertos:tcp</module>
<module>modm:platform:eth</module>
<module>modm:processing:rtos</module>
<module>modm:processing:rtos</module>
</modules>
</library>
18 changes: 4 additions & 14 deletions src/modm/platform/eth/stm32/eth.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,16 +369,6 @@ class Eth : public eth
using Configurator = GpioConfigurator<Peripheral::Eth, Signals...>;
using Connector = GpioConnector<Peripheral::Eth, Signals...>;

// Ethernet::RMII_Ref_Clk::configure(modm::platform::Gpio::OutputType::PushPull, modm::platform::Gpio::OutputSpeed::VeryHigh);
// Ethernet::RMII_Mdc::configure(modm::platform::Gpio::OutputType::PushPull, modm::platform::Gpio::OutputSpeed::VeryHigh);
// Ethernet::RMII_Mdio::configure(modm::platform::Gpio::OutputType::PushPull, modm::platform::Gpio::OutputSpeed::VeryHigh);
// Ethernet::RMII_Crs_Dv::configure(modm::platform::Gpio::OutputType::PushPull, modm::platform::Gpio::OutputSpeed::VeryHigh);
// Ethernet::RMII_Tx_En::configure(modm::platform::Gpio::OutputType::PushPull, modm::platform::Gpio::OutputSpeed::VeryHigh);
// Ethernet::RMII_Tx_D0::configure(modm::platform::Gpio::OutputType::PushPull, modm::platform::Gpio::OutputSpeed::VeryHigh);
// Ethernet::RMII_Tx_D1::configure(modm::platform::Gpio::OutputType::PushPull, modm::platform::Gpio::OutputSpeed::VeryHigh);
// Ethernet::RMII_Rx_D0::configure(modm::platform::Gpio::OutputType::PushPull, modm::platform::Gpio::OutputSpeed::VeryHigh);
// Ethernet::RMII_Rx_D1::configure(modm::platform::Gpio::OutputType::PushPull, modm::platform::Gpio::OutputSpeed::VeryHigh);

Configurator::configure();
Connector::connect();
}
Expand Down Expand Up @@ -688,13 +678,13 @@ class Eth : public eth
static bool
readPhyRegister(uint16_t reg, uint32_t &value);

static DuplexMode duplexMode;
static Speed speed;
static LinkStatus linkStatus;
static inline DuplexMode duplexMode = eth::DuplexMode::Full;
static inline Speed speed = eth::Speed::Speed100M;
static inline LinkStatus linkStatus = eth::LinkStatus::Down;

using MacAddress = std::array<uint8_t, 6>;
using MacAddresses = std::array<MacAddress, 4>;
static MacAddresses macAddresses;
static inline MacAddresses macAddresses;
};

}
Expand Down
12 changes: 0 additions & 12 deletions src/modm/platform/eth/stm32/eth_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@

namespace modm::platform {

template <class PHY>
eth::LinkStatus Eth<PHY>::linkStatus = eth::LinkStatus::Down;
template <class PHY>
eth::DuplexMode Eth<PHY>::duplexMode = eth::DuplexMode::Full;
template <class PHY>
eth::Speed Eth<PHY>::speed = eth::Speed::Speed100M;
template <class PHY>
Eth<PHY>::MacAddresses Eth<PHY>::macAddresses;

template <class PHY>
void
Expand Down Expand Up @@ -89,10 +81,8 @@ Eth<PHY>::configureMacAddresses()
continue;

uint32_t tmp_register = (macAddress[5] << 8) | macAddress[4];
// (*(__IO uint32_t *)(uint32_t(ETH_MAC_ADDR_HBASE + i * 0x08))) = tmp_register;
*reinterpret_cast<__IO uint32_t *>(ETH_MAC_ADDR_HBASE + i * 0x08) = tmp_register;
tmp_register = (macAddress[3] << 24) | (macAddress[2] << 16) | (macAddress[1] << 8) | macAddress[0];
// (*(__IO uint32_t *)(uint32_t(ETH_MAC_ADDR_LBASE + i * 0x08))) = tmp_register;
*reinterpret_cast<__IO uint32_t *>(ETH_MAC_ADDR_LBASE + i * 0x08) = tmp_register;
}
}
Expand Down Expand Up @@ -145,6 +135,4 @@ Eth<PHY>::writePhyRegister(uint16_t reg, uint32_t value)
return false;
}



}

0 comments on commit 10a4cff

Please sign in to comment.