diff options
| author | sodo <[email protected]> | 2024-01-02 01:37:00 +0900 |
|---|---|---|
| committer | sodo <[email protected]> | 2024-01-02 13:34:22 +0900 |
| commit | 6ee153a3e2eec284c0d9d87f31801265c0604f74 (patch) | |
| tree | 8b801cbd15f9ad5052d5942c731e75736dc9d7eb /examples/stm32f7/src | |
| parent | b7cd7952c890f585ff876c622482534e5d58d4a4 (diff) | |
| parent | 0be9b0599aaf2e425d76ec7852ff4b3535defddf (diff) | |
Merge remote-tracking branch 'origin'
Diffstat (limited to 'examples/stm32f7/src')
| -rw-r--r-- | examples/stm32f7/src/bin/adc.rs | 1 | ||||
| -rw-r--r-- | examples/stm32f7/src/bin/blinky.rs | 1 | ||||
| -rw-r--r-- | examples/stm32f7/src/bin/button.rs | 3 | ||||
| -rw-r--r-- | examples/stm32f7/src/bin/button_exti.rs | 1 | ||||
| -rw-r--r-- | examples/stm32f7/src/bin/can.rs | 8 | ||||
| -rw-r--r-- | examples/stm32f7/src/bin/eth.rs | 14 | ||||
| -rw-r--r-- | examples/stm32f7/src/bin/flash.rs | 1 | ||||
| -rw-r--r-- | examples/stm32f7/src/bin/hello.rs | 1 | ||||
| -rw-r--r-- | examples/stm32f7/src/bin/sdmmc.rs | 1 | ||||
| -rw-r--r-- | examples/stm32f7/src/bin/usart_dma.rs | 1 | ||||
| -rw-r--r-- | examples/stm32f7/src/bin/usb_serial.rs | 1 |
11 files changed, 14 insertions, 19 deletions
diff --git a/examples/stm32f7/src/bin/adc.rs b/examples/stm32f7/src/bin/adc.rs index 48c59eaf0..f8d7b691f 100644 --- a/examples/stm32f7/src/bin/adc.rs +++ b/examples/stm32f7/src/bin/adc.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | 3 | ||
| 5 | use defmt::*; | 4 | use defmt::*; |
| 6 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
diff --git a/examples/stm32f7/src/bin/blinky.rs b/examples/stm32f7/src/bin/blinky.rs index 4bfc5a50d..31cce8225 100644 --- a/examples/stm32f7/src/bin/blinky.rs +++ b/examples/stm32f7/src/bin/blinky.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | 3 | ||
| 5 | use defmt::*; | 4 | use defmt::*; |
| 6 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
diff --git a/examples/stm32f7/src/bin/button.rs b/examples/stm32f7/src/bin/button.rs index b13e64531..ad30a56a2 100644 --- a/examples/stm32f7/src/bin/button.rs +++ b/examples/stm32f7/src/bin/button.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | 3 | ||
| 5 | use cortex_m_rt::entry; | 4 | use cortex_m_rt::entry; |
| 6 | use defmt::*; | 5 | use defmt::*; |
| @@ -13,7 +12,7 @@ fn main() -> ! { | |||
| 13 | 12 | ||
| 14 | let p = embassy_stm32::init(Default::default()); | 13 | let p = embassy_stm32::init(Default::default()); |
| 15 | 14 | ||
| 16 | let button = Input::new(p.PC13, Pull::Down); | 15 | let mut button = Input::new(p.PC13, Pull::Down); |
| 17 | let mut led1 = Output::new(p.PB0, Level::High, Speed::Low); | 16 | let mut led1 = Output::new(p.PB0, Level::High, Speed::Low); |
| 18 | let _led2 = Output::new(p.PB7, Level::High, Speed::Low); | 17 | let _led2 = Output::new(p.PB7, Level::High, Speed::Low); |
| 19 | let mut led3 = Output::new(p.PB14, Level::High, Speed::Low); | 18 | let mut led3 = Output::new(p.PB14, Level::High, Speed::Low); |
diff --git a/examples/stm32f7/src/bin/button_exti.rs b/examples/stm32f7/src/bin/button_exti.rs index dfe587d41..67751187d 100644 --- a/examples/stm32f7/src/bin/button_exti.rs +++ b/examples/stm32f7/src/bin/button_exti.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | 3 | ||
| 5 | use defmt::*; | 4 | use defmt::*; |
| 6 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
diff --git a/examples/stm32f7/src/bin/can.rs b/examples/stm32f7/src/bin/can.rs index 78b21ceaa..bcfdb67a8 100644 --- a/examples/stm32f7/src/bin/can.rs +++ b/examples/stm32f7/src/bin/can.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | 3 | ||
| 5 | use defmt::*; | 4 | use defmt::*; |
| 6 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| @@ -12,6 +11,7 @@ use embassy_stm32::can::{ | |||
| 12 | }; | 11 | }; |
| 13 | use embassy_stm32::gpio::{Input, Pull}; | 12 | use embassy_stm32::gpio::{Input, Pull}; |
| 14 | use embassy_stm32::peripherals::CAN3; | 13 | use embassy_stm32::peripherals::CAN3; |
| 14 | use static_cell::StaticCell; | ||
| 15 | use {defmt_rtt as _, panic_probe as _}; | 15 | use {defmt_rtt as _, panic_probe as _}; |
| 16 | 16 | ||
| 17 | bind_interrupts!(struct Irqs { | 17 | bind_interrupts!(struct Irqs { |
| @@ -43,7 +43,8 @@ async fn main(spawner: Spawner) { | |||
| 43 | let rx_pin = Input::new(&mut p.PA15, Pull::Up); | 43 | let rx_pin = Input::new(&mut p.PA15, Pull::Up); |
| 44 | core::mem::forget(rx_pin); | 44 | core::mem::forget(rx_pin); |
| 45 | 45 | ||
| 46 | let can: &'static mut Can<'static, CAN3> = static_cell::make_static!(Can::new(p.CAN3, p.PA8, p.PA15, Irqs)); | 46 | static CAN: StaticCell<Can<'static, CAN3>> = StaticCell::new(); |
| 47 | let can = CAN.init(Can::new(p.CAN3, p.PA8, p.PA15, Irqs)); | ||
| 47 | can.as_mut() | 48 | can.as_mut() |
| 48 | .modify_filters() | 49 | .modify_filters() |
| 49 | .enable_bank(0, Fifo::Fifo0, Mask32::accept_all()); | 50 | .enable_bank(0, Fifo::Fifo0, Mask32::accept_all()); |
| @@ -56,7 +57,8 @@ async fn main(spawner: Spawner) { | |||
| 56 | 57 | ||
| 57 | let (tx, mut rx) = can.split(); | 58 | let (tx, mut rx) = can.split(); |
| 58 | 59 | ||
| 59 | let tx: &'static mut CanTx<'static, 'static, CAN3> = static_cell::make_static!(tx); | 60 | static CAN_TX: StaticCell<CanTx<'static, 'static, CAN3>> = StaticCell::new(); |
| 61 | let tx = CAN_TX.init(tx); | ||
| 60 | spawner.spawn(send_can_message(tx)).unwrap(); | 62 | spawner.spawn(send_can_message(tx)).unwrap(); |
| 61 | 63 | ||
| 62 | loop { | 64 | loop { |
diff --git a/examples/stm32f7/src/bin/eth.rs b/examples/stm32f7/src/bin/eth.rs index dd0069447..5bff48197 100644 --- a/examples/stm32f7/src/bin/eth.rs +++ b/examples/stm32f7/src/bin/eth.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | 3 | ||
| 5 | use defmt::*; | 4 | use defmt::*; |
| 6 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| @@ -15,7 +14,7 @@ use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; | |||
| 15 | use embassy_time::Timer; | 14 | use embassy_time::Timer; |
| 16 | use embedded_io_async::Write; | 15 | use embedded_io_async::Write; |
| 17 | use rand_core::RngCore; | 16 | use rand_core::RngCore; |
| 18 | use static_cell::make_static; | 17 | use static_cell::StaticCell; |
| 19 | use {defmt_rtt as _, panic_probe as _}; | 18 | use {defmt_rtt as _, panic_probe as _}; |
| 20 | 19 | ||
| 21 | bind_interrupts!(struct Irqs { | 20 | bind_interrupts!(struct Irqs { |
| @@ -64,8 +63,9 @@ async fn main(spawner: Spawner) -> ! { | |||
| 64 | 63 | ||
| 65 | let mac_addr = [0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF]; | 64 | let mac_addr = [0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF]; |
| 66 | 65 | ||
| 66 | static PACKETS: StaticCell<PacketQueue<16, 16>> = StaticCell::new(); | ||
| 67 | let device = Ethernet::new( | 67 | let device = Ethernet::new( |
| 68 | make_static!(PacketQueue::<16, 16>::new()), | 68 | PACKETS.init(PacketQueue::<16, 16>::new()), |
| 69 | p.ETH, | 69 | p.ETH, |
| 70 | Irqs, | 70 | Irqs, |
| 71 | p.PA1, | 71 | p.PA1, |
| @@ -89,11 +89,13 @@ async fn main(spawner: Spawner) -> ! { | |||
| 89 | //}); | 89 | //}); |
| 90 | 90 | ||
| 91 | // Init network stack | 91 | // Init network stack |
| 92 | let stack = &*make_static!(Stack::new( | 92 | static STACK: StaticCell<Stack<Device>> = StaticCell::new(); |
| 93 | static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new(); | ||
| 94 | let stack = &*STACK.init(Stack::new( | ||
| 93 | device, | 95 | device, |
| 94 | config, | 96 | config, |
| 95 | make_static!(StackResources::<2>::new()), | 97 | RESOURCES.init(StackResources::<2>::new()), |
| 96 | seed | 98 | seed, |
| 97 | )); | 99 | )); |
| 98 | 100 | ||
| 99 | // Launch network task | 101 | // Launch network task |
diff --git a/examples/stm32f7/src/bin/flash.rs b/examples/stm32f7/src/bin/flash.rs index 06a94f1c8..885570478 100644 --- a/examples/stm32f7/src/bin/flash.rs +++ b/examples/stm32f7/src/bin/flash.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | 3 | ||
| 5 | use defmt::{info, unwrap}; | 4 | use defmt::{info, unwrap}; |
| 6 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
diff --git a/examples/stm32f7/src/bin/hello.rs b/examples/stm32f7/src/bin/hello.rs index a2a287110..3c295612c 100644 --- a/examples/stm32f7/src/bin/hello.rs +++ b/examples/stm32f7/src/bin/hello.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | 3 | ||
| 5 | use defmt::info; | 4 | use defmt::info; |
| 6 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
diff --git a/examples/stm32f7/src/bin/sdmmc.rs b/examples/stm32f7/src/bin/sdmmc.rs index 990de0ab1..6d36ef518 100644 --- a/examples/stm32f7/src/bin/sdmmc.rs +++ b/examples/stm32f7/src/bin/sdmmc.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | 3 | ||
| 5 | use defmt::*; | 4 | use defmt::*; |
| 6 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
diff --git a/examples/stm32f7/src/bin/usart_dma.rs b/examples/stm32f7/src/bin/usart_dma.rs index ba064081e..fb604b34f 100644 --- a/examples/stm32f7/src/bin/usart_dma.rs +++ b/examples/stm32f7/src/bin/usart_dma.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | 3 | ||
| 5 | use core::fmt::Write; | 4 | use core::fmt::Write; |
| 6 | 5 | ||
diff --git a/examples/stm32f7/src/bin/usb_serial.rs b/examples/stm32f7/src/bin/usb_serial.rs index 4991edbf0..97daf6bd1 100644 --- a/examples/stm32f7/src/bin/usb_serial.rs +++ b/examples/stm32f7/src/bin/usb_serial.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | 3 | ||
| 5 | use defmt::{panic, *}; | 4 | use defmt::{panic, *}; |
| 6 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
