diff options
| author | i509VCB <[email protected]> | 2025-08-06 05:43:58 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-06 05:43:58 +0000 |
| commit | 3a197df07c14873a52e42394ef350152eef60a41 (patch) | |
| tree | 55817c094aea9b9ea7a20faeb6824c7142981296 /examples | |
| parent | fcccbc85fbfabb29604381fc6bfb61c660098559 (diff) | |
| parent | 517714c98e4b5dc4c7ee844527f5d33fdc342125 (diff) | |
Merge pull request #4459 from IrinaCh524/feat/lpc55-time-driver
feat: add RTC time driver
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/lpc55s69/Cargo.toml | 4 | ||||
| -rw-r--r-- | examples/lpc55s69/README.md | 12 | ||||
| -rw-r--r-- | examples/lpc55s69/src/bin/blinky_embassy_time.rs | 26 |
3 files changed, 40 insertions, 2 deletions
diff --git a/examples/lpc55s69/Cargo.toml b/examples/lpc55s69/Cargo.toml index 5faec13da..f9bd409e2 100644 --- a/examples/lpc55s69/Cargo.toml +++ b/examples/lpc55s69/Cargo.toml | |||
| @@ -6,10 +6,10 @@ license = "MIT OR Apache-2.0" | |||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | [dependencies] | 8 | [dependencies] |
| 9 | embassy-nxp = { version = "0.1.0", path = "../../embassy-nxp", features = ["lpc55", "rt", "defmt"] } | 9 | embassy-nxp = { version = "0.1.0", path = "../../embassy-nxp", features = ["lpc55", "rt", "defmt", "time-driver-rtc"] } |
| 10 | embassy-executor = { version = "0.8.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt"] } | 10 | embassy-executor = { version = "0.8.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt"] } |
| 11 | embassy-sync = { version = "0.7.0", path = "../../embassy-sync", features = ["defmt"] } | 11 | embassy-sync = { version = "0.7.0", path = "../../embassy-sync", features = ["defmt"] } |
| 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt"] } | 12 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "tick-hz-32_768"] } |
| 13 | panic-halt = "1.0.0" | 13 | panic-halt = "1.0.0" |
| 14 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } | 14 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } |
| 15 | cortex-m-rt = { version = "0.7.0"} | 15 | cortex-m-rt = { version = "0.7.0"} |
diff --git a/examples/lpc55s69/README.md b/examples/lpc55s69/README.md new file mode 100644 index 000000000..d200f4f99 --- /dev/null +++ b/examples/lpc55s69/README.md | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | # LPC55S69 Examples | ||
| 2 | |||
| 3 | ## Available examples: | ||
| 4 | - blinky_nop: Blink the integrated RED LED using nops as delay. Useful for flashing simple and known-good software on board. | ||
| 5 | - button_executor: Turn on/off an LED by pressing the USER button. Demonstrates how to use the PINT and GPIO drivers. | ||
| 6 | - blinky_embassy_time: Blink the integrated RED LED using `embassy-time`. Demonstrates how to use the time-driver that uses RTC. | ||
| 7 | |||
| 8 | ## Important Notes | ||
| 9 | |||
| 10 | On older version of probe-rs, some examples (such as `blinky_embassy_time`) do not work directly after flashing and the board must be reset after flashing. It is reccomended to update the version of probe-rs to the latest one. | ||
| 11 | |||
| 12 | When developing drivers for this board, probe-rs might not be able to flash the board after entering a fault. Either reset the board to clear the fault, or use NXP's proprietary software `LinkServer`/`LinkFlash` to bring the board back to a known-good state. \ No newline at end of file | ||
diff --git a/examples/lpc55s69/src/bin/blinky_embassy_time.rs b/examples/lpc55s69/src/bin/blinky_embassy_time.rs new file mode 100644 index 000000000..adc3d8bd3 --- /dev/null +++ b/examples/lpc55s69/src/bin/blinky_embassy_time.rs | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | use defmt::*; | ||
| 5 | use embassy_executor::Spawner; | ||
| 6 | use embassy_nxp::gpio::{Level, Output}; | ||
| 7 | use embassy_time::Timer; | ||
| 8 | use {defmt_rtt as _, panic_halt as _}; | ||
| 9 | |||
| 10 | #[embassy_executor::main] | ||
| 11 | async fn main(_spawner: Spawner) { | ||
| 12 | let p = embassy_nxp::init(Default::default()); | ||
| 13 | info!("Initialization complete"); | ||
| 14 | let mut led = Output::new(p.PIO1_6, Level::Low); | ||
| 15 | |||
| 16 | info!("Entering main loop"); | ||
| 17 | loop { | ||
| 18 | info!("led off!"); | ||
| 19 | led.set_high(); | ||
| 20 | Timer::after_millis(500).await; | ||
| 21 | |||
| 22 | info!("led on!"); | ||
| 23 | led.set_low(); | ||
| 24 | Timer::after_millis(500).await; | ||
| 25 | } | ||
| 26 | } | ||
