diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-03-01 01:59:41 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-03-01 01:59:41 +0100 |
| commit | 66ca57312f62bdf83cd30a9d2449962416fcd99c (patch) | |
| tree | d84accfcb94bae68b3983a8a2518689cf868bcc1 /examples/stm32f4 | |
| parent | 711ce1014552b715190b1ee6780cafc92fe54240 (diff) | |
| parent | 6dbb631f1ecb75361ee70da91f50779c29f23482 (diff) | |
Merge pull request #1251 from embassy-rs/fix-examples
Example fixes.
Diffstat (limited to 'examples/stm32f4')
| -rw-r--r-- | examples/stm32f4/Cargo.toml | 6 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/usb_ethernet.rs | 11 |
2 files changed, 4 insertions, 13 deletions
diff --git a/examples/stm32f4/Cargo.toml b/examples/stm32f4/Cargo.toml index e2b17bfcb..7a7bab5bb 100644 --- a/examples/stm32f4/Cargo.toml +++ b/examples/stm32f4/Cargo.toml | |||
| @@ -10,7 +10,7 @@ embassy-executor = { version = "0.1.0", path = "../../embassy-executor", feature | |||
| 10 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-hz-32_768"] } | 10 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-hz-32_768"] } |
| 11 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "unstable-traits", "defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-any", "exti"] } | 11 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "unstable-traits", "defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-any", "exti"] } |
| 12 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } | 12 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } |
| 13 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "nightly"], optional = true } | 13 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "nightly"] } |
| 14 | 14 | ||
| 15 | defmt = "0.3" | 15 | defmt = "0.3" |
| 16 | defmt-rtt = "0.4" | 16 | defmt-rtt = "0.4" |
| @@ -27,9 +27,5 @@ embedded-storage = "0.3.0" | |||
| 27 | micromath = "2.0.0" | 27 | micromath = "2.0.0" |
| 28 | static_cell = "1.0" | 28 | static_cell = "1.0" |
| 29 | 29 | ||
| 30 | [[bin]] | ||
| 31 | name = "usb_ethernet" | ||
| 32 | required-features = ["embassy-net"] | ||
| 33 | |||
| 34 | [profile.release] | 30 | [profile.release] |
| 35 | debug = 2 | 31 | debug = 2 |
diff --git a/examples/stm32f4/src/bin/usb_ethernet.rs b/examples/stm32f4/src/bin/usb_ethernet.rs index 4a16aac07..db9e18393 100644 --- a/examples/stm32f4/src/bin/usb_ethernet.rs +++ b/examples/stm32f4/src/bin/usb_ethernet.rs | |||
| @@ -100,8 +100,8 @@ async fn main(spawner: Spawner) { | |||
| 100 | let (runner, device) = class.into_embassy_net_device::<MTU, 4, 4>(singleton!(NetState::new()), our_mac_addr); | 100 | let (runner, device) = class.into_embassy_net_device::<MTU, 4, 4>(singleton!(NetState::new()), our_mac_addr); |
| 101 | unwrap!(spawner.spawn(usb_ncm_task(runner))); | 101 | unwrap!(spawner.spawn(usb_ncm_task(runner))); |
| 102 | 102 | ||
| 103 | let config = embassy_net::ConfigStrategy::Dhcp; | 103 | let config = embassy_net::Config::Dhcp(Default::default()); |
| 104 | //let config = embassy_net::ConfigStrategy::Static(embassy_net::Config { | 104 | //let config = embassy_net::Config::Static(embassy_net::StaticConfig { |
| 105 | // address: Ipv4Cidr::new(Ipv4Address::new(10, 42, 0, 61), 24), | 105 | // address: Ipv4Cidr::new(Ipv4Address::new(10, 42, 0, 61), 24), |
| 106 | // dns_servers: Vec::new(), | 106 | // dns_servers: Vec::new(), |
| 107 | // gateway: Some(Ipv4Address::new(10, 42, 0, 1)), | 107 | // gateway: Some(Ipv4Address::new(10, 42, 0, 1)), |
| @@ -114,12 +114,7 @@ async fn main(spawner: Spawner) { | |||
| 114 | let seed = u64::from_le_bytes(seed); | 114 | let seed = u64::from_le_bytes(seed); |
| 115 | 115 | ||
| 116 | // Init network stack | 116 | // Init network stack |
| 117 | let stack = &*singleton!(Stack::new( | 117 | let stack = &*singleton!(Stack::new(device, config, singleton!(StackResources::<2>::new()), seed)); |
| 118 | device, | ||
| 119 | config, | ||
| 120 | singleton!(StackResources::<1, 2, 8>::new()), | ||
| 121 | seed | ||
| 122 | )); | ||
| 123 | 118 | ||
| 124 | unwrap!(spawner.spawn(net_task(stack))); | 119 | unwrap!(spawner.spawn(net_task(stack))); |
| 125 | 120 | ||
