diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/nrf52840/src/bin/usb_ethernet.rs | 23 | ||||
| -rw-r--r-- | examples/nrf5340/Cargo.toml | 23 | ||||
| -rw-r--r-- | examples/stm32f4/Cargo.toml | 6 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/usb_ethernet.rs | 11 | ||||
| -rw-r--r-- | examples/stm32l4/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/stm32l5/Cargo.toml | 2 |
6 files changed, 11 insertions, 56 deletions
diff --git a/examples/nrf52840/src/bin/usb_ethernet.rs b/examples/nrf52840/src/bin/usb_ethernet.rs index 430468adf..979780896 100644 --- a/examples/nrf52840/src/bin/usb_ethernet.rs +++ b/examples/nrf52840/src/bin/usb_ethernet.rs | |||
| @@ -46,31 +46,8 @@ async fn net_task(stack: &'static Stack<Device<'static, MTU>>) -> ! { | |||
| 46 | stack.run().await | 46 | stack.run().await |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | #[inline(never)] | ||
| 50 | pub fn test_function() -> (usize, u32, [u32; 2]) { | ||
| 51 | let mut array = [3; 2]; | ||
| 52 | |||
| 53 | let mut index = 0; | ||
| 54 | let mut result = 0; | ||
| 55 | |||
| 56 | for x in [1, 2] { | ||
| 57 | if x == 1 { | ||
| 58 | array[1] = 99; | ||
| 59 | } else { | ||
| 60 | index = if x == 2 { 1 } else { 0 }; | ||
| 61 | |||
| 62 | // grabs value from array[0], not array[1] | ||
| 63 | result = array[index]; | ||
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | (index, result, array) | ||
| 68 | } | ||
| 69 | |||
| 70 | #[embassy_executor::main] | 49 | #[embassy_executor::main] |
| 71 | async fn main(spawner: Spawner) { | 50 | async fn main(spawner: Spawner) { |
| 72 | info!("{:?}", test_function()); | ||
| 73 | |||
| 74 | let p = embassy_nrf::init(Default::default()); | 51 | let p = embassy_nrf::init(Default::default()); |
| 75 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; | 52 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; |
| 76 | 53 | ||
diff --git a/examples/nrf5340/Cargo.toml b/examples/nrf5340/Cargo.toml index eed493012..e88ddf2f7 100644 --- a/examples/nrf5340/Cargo.toml +++ b/examples/nrf5340/Cargo.toml | |||
| @@ -4,24 +4,13 @@ name = "embassy-nrf5340-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | license = "MIT OR Apache-2.0" | 5 | license = "MIT OR Apache-2.0" |
| 6 | 6 | ||
| 7 | [features] | ||
| 8 | default = ["nightly"] | ||
| 9 | nightly = [ | ||
| 10 | "embassy-executor/nightly", | ||
| 11 | "embassy-nrf/nightly", | ||
| 12 | "embassy-net/nightly", | ||
| 13 | "embassy-nrf/unstable-traits", | ||
| 14 | "embassy-usb", | ||
| 15 | "embedded-io/async", | ||
| 16 | "embassy-net", | ||
| 17 | ] | ||
| 18 | |||
| 19 | [dependencies] | 7 | [dependencies] |
| 20 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 8 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } |
| 21 | embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = [ | 9 | embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = [ |
| 22 | "defmt", | 10 | "defmt", |
| 23 | ] } | 11 | ] } |
| 24 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = [ | 12 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = [ |
| 13 | "nightly", | ||
| 25 | "defmt", | 14 | "defmt", |
| 26 | "integrated-timers", | 15 | "integrated-timers", |
| 27 | ] } | 16 | ] } |
| @@ -30,6 +19,8 @@ embassy-time = { version = "0.1.0", path = "../../embassy-time", features = [ | |||
| 30 | "defmt-timestamp-uptime", | 19 | "defmt-timestamp-uptime", |
| 31 | ] } | 20 | ] } |
| 32 | embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = [ | 21 | embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = [ |
| 22 | "nightly", | ||
| 23 | "unstable-traits", | ||
| 33 | "defmt", | 24 | "defmt", |
| 34 | "nrf5340-app-s", | 25 | "nrf5340-app-s", |
| 35 | "time-driver-rtc1", | 26 | "time-driver-rtc1", |
| @@ -37,16 +28,16 @@ embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = [ | |||
| 37 | "unstable-pac", | 28 | "unstable-pac", |
| 38 | ] } | 29 | ] } |
| 39 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = [ | 30 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = [ |
| 31 | "nightly", | ||
| 40 | "defmt", | 32 | "defmt", |
| 41 | "tcp", | 33 | "tcp", |
| 42 | "dhcpv4", | 34 | "dhcpv4", |
| 43 | "medium-ethernet", | 35 | "medium-ethernet", |
| 44 | ], optional = true } | 36 | ] } |
| 45 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = [ | 37 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = [ |
| 46 | "defmt", | 38 | "defmt", |
| 47 | ], optional = true } | 39 | ] } |
| 48 | embedded-io = "0.4.0" | 40 | embedded-io = { version = "0.4.0", features = [ "async" ]} |
| 49 | |||
| 50 | 41 | ||
| 51 | defmt = "0.3" | 42 | defmt = "0.3" |
| 52 | defmt-rtt = "0.4" | 43 | defmt-rtt = "0.4" |
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 | ||
diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml index 5627760ef..644c90b1a 100644 --- a/examples/stm32l4/Cargo.toml +++ b/examples/stm32l4/Cargo.toml | |||
| @@ -4,8 +4,6 @@ name = "embassy-stm32l4-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | license = "MIT OR Apache-2.0" | 5 | license = "MIT OR Apache-2.0" |
| 6 | 6 | ||
| 7 | [features] | ||
| 8 | |||
| 9 | [dependencies] | 7 | [dependencies] |
| 10 | embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } | 8 | embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } | 9 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } |
diff --git a/examples/stm32l5/Cargo.toml b/examples/stm32l5/Cargo.toml index c0accb0d6..f880328dc 100644 --- a/examples/stm32l5/Cargo.toml +++ b/examples/stm32l5/Cargo.toml | |||
| @@ -4,8 +4,6 @@ name = "embassy-stm32l5-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | license = "MIT OR Apache-2.0" | 5 | license = "MIT OR Apache-2.0" |
| 6 | 6 | ||
| 7 | [features] | ||
| 8 | |||
| 9 | [dependencies] | 7 | [dependencies] |
| 10 | embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } | 8 | embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } | 9 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } |
