Flashes the on-board LED as 3, 1, 4, 1, 5 with pauses between digits and a longer pause before repeating. The pattern is stepped from the hardware timer rather than blocking sleeps, so the USB serial port stays responsive and can reset the board back into BOOTSEL on request. Includes the original plain 250 ms blink under alt/ and prebuilt .uf2 images. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FrCPgv2NGSEcyuN9KKQKHc
48 lines
1.1 KiB
Rust
48 lines
1.1 KiB
Rust
#![no_std]
|
|
#![no_main]
|
|
|
|
use cortex_m::delay::Delay;
|
|
use embedded_hal::digital::OutputPin;
|
|
use panic_halt as _;
|
|
use rp_pico::entry;
|
|
use rp_pico::hal::{clocks::init_clocks_and_plls, pac, watchdog::Watchdog, Clock, Sio};
|
|
|
|
#[entry]
|
|
fn main() -> ! {
|
|
let mut pac = pac::Peripherals::take().unwrap();
|
|
let core = pac::CorePeripherals::take().unwrap();
|
|
let mut watchdog = Watchdog::new(pac.WATCHDOG);
|
|
|
|
let clocks = init_clocks_and_plls(
|
|
rp_pico::XOSC_CRYSTAL_FREQ,
|
|
pac.XOSC,
|
|
pac.CLOCKS,
|
|
pac.PLL_SYS,
|
|
pac.PLL_USB,
|
|
&mut pac.RESETS,
|
|
&mut watchdog,
|
|
)
|
|
.ok()
|
|
.unwrap();
|
|
|
|
let mut delay = Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());
|
|
|
|
let sio = Sio::new(pac.SIO);
|
|
let pins = rp_pico::Pins::new(
|
|
pac.IO_BANK0,
|
|
pac.PADS_BANK0,
|
|
sio.gpio_bank0,
|
|
&mut pac.RESETS,
|
|
);
|
|
|
|
let mut led = pins.led.into_push_pull_output();
|
|
|
|
loop {
|
|
led.set_high().unwrap();
|
|
delay.delay_ms(250);
|
|
led.set_low().unwrap();
|
|
delay.delay_ms(250);
|
|
}
|
|
}
|
|
|