diff options
Diffstat (limited to 'examples/mimxrt6/src')
| -rw-r--r-- | examples/mimxrt6/src/bin/blinky.rs | 29 | ||||
| -rw-r--r-- | examples/mimxrt6/src/bin/hello.rs | 17 | ||||
| -rw-r--r-- | examples/mimxrt6/src/lib.rs | 20 |
3 files changed, 66 insertions, 0 deletions
diff --git a/examples/mimxrt6/src/bin/blinky.rs b/examples/mimxrt6/src/bin/blinky.rs new file mode 100644 index 000000000..e40e71e6f --- /dev/null +++ b/examples/mimxrt6/src/bin/blinky.rs | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | extern crate embassy_imxrt_examples; | ||
| 5 | |||
| 6 | use defmt::info; | ||
| 7 | use embassy_executor::Spawner; | ||
| 8 | use embassy_imxrt::gpio; | ||
| 9 | |||
| 10 | #[embassy_executor::main] | ||
| 11 | async fn main(_spawner: Spawner) { | ||
| 12 | let p = embassy_imxrt::init(Default::default()); | ||
| 13 | |||
| 14 | info!("Initializing GPIO"); | ||
| 15 | |||
| 16 | let mut led = gpio::Output::new( | ||
| 17 | p.PIO0_26, | ||
| 18 | gpio::Level::Low, | ||
| 19 | gpio::DriveMode::PushPull, | ||
| 20 | gpio::DriveStrength::Normal, | ||
| 21 | gpio::SlewRate::Standard, | ||
| 22 | ); | ||
| 23 | |||
| 24 | loop { | ||
| 25 | info!("Toggling LED"); | ||
| 26 | led.toggle(); | ||
| 27 | cortex_m::asm::delay(5_000_000); | ||
| 28 | } | ||
| 29 | } | ||
diff --git a/examples/mimxrt6/src/bin/hello.rs b/examples/mimxrt6/src/bin/hello.rs new file mode 100644 index 000000000..c640241ce --- /dev/null +++ b/examples/mimxrt6/src/bin/hello.rs | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | extern crate embassy_imxrt_examples; | ||
| 5 | |||
| 6 | use defmt::info; | ||
| 7 | use embassy_executor::Spawner; | ||
| 8 | use {defmt_rtt as _, panic_probe as _}; | ||
| 9 | |||
| 10 | #[embassy_executor::main] | ||
| 11 | async fn main(_spawner: Spawner) -> ! { | ||
| 12 | let _p = embassy_imxrt::init(Default::default()); | ||
| 13 | loop { | ||
| 14 | info!("Hello"); | ||
| 15 | cortex_m::asm::delay(5_000_000); | ||
| 16 | } | ||
| 17 | } | ||
diff --git a/examples/mimxrt6/src/lib.rs b/examples/mimxrt6/src/lib.rs new file mode 100644 index 000000000..da6e14427 --- /dev/null +++ b/examples/mimxrt6/src/lib.rs | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #![no_std] | ||
| 2 | |||
| 3 | use mimxrt600_fcb::FlexSPIFlashConfigurationBlock; | ||
| 4 | use {defmt_rtt as _, panic_probe as _}; | ||
| 5 | |||
| 6 | // auto-generated version information from Cargo.toml | ||
| 7 | include!(concat!(env!("OUT_DIR"), "/biv.rs")); | ||
| 8 | |||
| 9 | #[link_section = ".otfad"] | ||
| 10 | #[used] | ||
| 11 | static OTFAD: [u8; 256] = [0; 256]; | ||
| 12 | |||
| 13 | #[rustfmt::skip] | ||
| 14 | #[link_section = ".fcb"] | ||
| 15 | #[used] | ||
| 16 | static FCB: FlexSPIFlashConfigurationBlock = FlexSPIFlashConfigurationBlock::build(); | ||
| 17 | |||
| 18 | #[link_section = ".keystore"] | ||
| 19 | #[used] | ||
| 20 | static KEYSTORE: [u8; 2048] = [0; 2048]; | ||
