rp-hal-boards/boards/feather_rp2040/examples/feather_blinky.rs
9names 0e7abdc705
Make BSPs provide boot2 as a default feature (#153)
* Add boot2 feature. Add boot2 linkage into each BSP optional on feature

* Enable boot2 feature in BSPs by default. Remove boot2 decl from all BSP examples

* Add EXTERN in memory.x for BOOT2_FIRMWARE, rename bootloader static slice to BOOT2_FIRMWARE

* Update new examples and itsy_bitsy BSP to use boot2 feature

* Remove boot2 as a dev-dependency for the BSPs, no longer needed

* Add no_mangle BOOT2_FIRMWARE to adafruit_macropad

* Fix itsy-bitsy blinky - it wasn't using the BSP, so it didn't get BOOT2_FIRMWARE linked in
2021-12-05 01:00:09 +11:00

58 lines
1.3 KiB
Rust

//! Blinks the LED on a Adafruit Feather RP2040 board
//!
//! This will blink on-board LED.
#![no_std]
#![no_main]
use cortex_m_rt::entry;
use embedded_hal::digital::v2::OutputPin;
use embedded_time::rate::*;
use feather_rp2040::{
hal::{
clocks::{init_clocks_and_plls, Clock},
pac,
sio::Sio,
watchdog::Watchdog,
},
Pins, XOSC_CRYSTAL_FREQ,
};
use panic_halt as _;
#[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(
XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().integer());
let sio = Sio::new(pac.SIO);
let pins = Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
let mut led_pin = pins.d13.into_push_pull_output();
loop {
led_pin.set_high().unwrap();
delay.delay_ms(1500);
led_pin.set_low().unwrap();
delay.delay_ms(1500);
}
}