Skip to content

Commit

Permalink
phy_config: minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
occheung committed Jan 28, 2021
1 parent 4ae6e82 commit e66d916
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/enc424j600_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,7 @@ pub fn setup(mut enc424j600: EthSpiInterface, settings: &BoosterSettings) -> Eth
use enc424j600::EthController;
use smoltcp as net;

match enc424j600.init_dev() {
Ok(_) => {}
Err(_) => {
panic!("ENC424J600 PHY initialization failed");
}
}

enc424j600.init_dev().expect("PHY initialization failed");
enc424j600
.write_mac_address(settings.mac().as_bytes())
.unwrap();
Expand All @@ -69,7 +63,6 @@ pub fn setup(mut enc424j600: EthSpiInterface, settings: &BoosterSettings) -> Eth
let eth_iface = unsafe {
let device = enc424j600::smoltcp_phy::SmoltcpDevice::new(enc424j600);

// TODO: Restore IP config from EEPROM
NET_STORE.ip_addrs[0] = {
let ip = settings.ip().octets();
let subnet = settings.subnet().octets();
Expand All @@ -82,9 +75,7 @@ pub fn setup(mut enc424j600: EthSpiInterface, settings: &BoosterSettings) -> Eth
};

let routes = {
// TODO: Restore gateway config from EEPROM
let gateway = net::wire::Ipv4Address::from_bytes(&settings.gateway().octets());

let mut routes = net::iface::Routes::new(&mut NET_STORE.routes_cache[..]);
routes.add_default_ipv4_route(gateway).unwrap();
routes
Expand Down

0 comments on commit e66d916

Please sign in to comment.