mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2024-12-27 06:11:31 +11:00
e3be4f8025
Bring in line with atsamd-hal GPIO v2 Copied as much as possible. Docs lifted mostly as-is. Also add sample BSP for the Feather RP2040 in boards/feather_rp2040 May include a few random fixes from currently futile attempt to get doctests working.
39 lines
955 B
Rust
39 lines
955 B
Rust
//! Blinks the LED on a Pico board
|
|
//!
|
|
//! This will blink an LED attached to GP25, which is the pin the Pico uses for the on-board LED.
|
|
#![no_std]
|
|
#![no_main]
|
|
|
|
use cortex_m_rt::entry;
|
|
use embedded_hal::digital::v2::OutputPin;
|
|
use hal::pac;
|
|
use hal::sio::Sio;
|
|
use panic_halt as _;
|
|
use rp2040_hal as hal;
|
|
|
|
#[link_section = ".boot2"]
|
|
#[used]
|
|
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER;
|
|
|
|
#[entry]
|
|
fn main() -> ! {
|
|
let mut pac = pac::Peripherals::take().unwrap();
|
|
|
|
let sio = Sio::new(pac.SIO);
|
|
let pins = hal::gpio::Pins::new(
|
|
pac.IO_BANK0,
|
|
pac.PADS_BANK0,
|
|
sio.gpio_bank0,
|
|
&mut pac.RESETS,
|
|
);
|
|
let mut led_pin = pins.gpio25.into_push_pull_output();
|
|
|
|
loop {
|
|
led_pin.set_high().unwrap();
|
|
// TODO: Replace with proper 1s delays once we have clocks working
|
|
cortex_m::asm::delay(500_000);
|
|
led_pin.set_low().unwrap();
|
|
cortex_m::asm::delay(500_000);
|
|
}
|
|
}
|