libconfig: make default IP/MAC depend on board
This commit is contained in:
parent
4dd8c93729
commit
80d12d5780
@ -11,5 +11,7 @@ fatfs = { version = "0.3", features = ["core_io"], default-features = false }
|
||||
log = "0.4"
|
||||
|
||||
[features]
|
||||
target_zc706 = []
|
||||
target_cora_z7_10 = []
|
||||
target_redpitaya = []
|
||||
ipv6 = []
|
||||
|
||||
|
@ -31,8 +31,18 @@ impl fmt::Display for NetAddresses {
|
||||
}
|
||||
|
||||
pub fn get_adresses(cfg: &Config) -> NetAddresses {
|
||||
#[cfg(feature = "target_zc706")]
|
||||
let mut hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x52]);
|
||||
#[cfg(feature = "target_zc706")]
|
||||
let mut ipv4_addr = IpAddress::v4(192, 168, 1, 52);
|
||||
#[cfg(feature = "target_cora_z7_10")]
|
||||
let mut hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x54]);
|
||||
#[cfg(feature = "target_cora_z7_10")]
|
||||
let mut ipv4_addr = IpAddress::v4(192, 168, 1, 54);
|
||||
#[cfg(feature = "target_redpitaya")]
|
||||
let mut hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x55]);
|
||||
#[cfg(feature = "target_redpitaya")]
|
||||
let mut ipv4_addr = IpAddress::v4(192, 168, 1, 55);
|
||||
|
||||
if let Ok(Ok(addr)) = cfg.read_str("mac").map(|s| s.parse()) {
|
||||
hardware_addr = addr;
|
||||
|
@ -6,8 +6,8 @@ authors = ["M-Labs"]
|
||||
edition = "2018"
|
||||
|
||||
[features]
|
||||
target_zc706 = ["libboard_zynq/target_zc706", "libsupport_zynq/target_zc706"]
|
||||
target_redpitaya = ["libboard_zynq/target_redpitaya", "libsupport_zynq/target_redpitaya"]
|
||||
target_zc706 = ["libboard_zynq/target_zc706", "libsupport_zynq/target_zc706", "libconfig/target_zc706"]
|
||||
target_redpitaya = ["libboard_zynq/target_redpitaya", "libsupport_zynq/target_redpitaya", "libconfig/target_redpitaya"]
|
||||
default = ["target_zc706"]
|
||||
|
||||
[dependencies]
|
||||
|
Loading…
Reference in New Issue
Block a user