Merge branch 'master' into rs/hal-update

master
Ryan Summers 2020-11-05 08:09:45 +01:00
commit bab9fbf5ac
1 changed files with 11 additions and 0 deletions

View File

@ -39,7 +39,10 @@ use hal::{
ethernet::{self, PHY},
rcc::rec::ResetEnable,
};
use smoltcp as net;
use smoltcp::iface::Routes;
use smoltcp::wire::Ipv4Address;
use heapless::{consts::*, String};
@ -79,6 +82,7 @@ mod build_info {
pub struct NetStorage {
ip_addrs: [net::wire::IpCidr; 1],
neighbor_cache: [Option<(net::wire::IpAddress, net::iface::Neighbor)>; 8],
routes_storage: [Option<(smoltcp::wire::IpCidr, smoltcp::iface::Route)>; 1],
}
static mut NET_STORE: NetStorage = NetStorage {
@ -88,6 +92,8 @@ static mut NET_STORE: NetStorage = NetStorage {
)],
neighbor_cache: [None; 8],
routes_storage: [None; 1],
};
const SCALE: f32 = ((1 << 15) - 1) as f32;
@ -705,6 +711,10 @@ const APP: () = {
24,
);
let default_v4_gw = Ipv4Address::new(10, 0, 16, 1);
let mut routes = Routes::new(&mut store.routes_storage[..]);
routes.add_default_ipv4_route(default_v4_gw).unwrap();
let neighbor_cache =
net::iface::NeighborCache::new(&mut store.neighbor_cache[..]);
@ -712,6 +722,7 @@ const APP: () = {
.ethernet_addr(mac_addr)
.neighbor_cache(neighbor_cache)
.ip_addrs(&mut store.ip_addrs[..])
.routes(routes)
.finalize();
(interface, lan8742a)