generated from melfely/embassy-template-rp2350
USB test that works! It parrots.
I mostly just wanted to save this state of the project
This commit is contained in:
+39
-20
@@ -4,34 +4,53 @@
|
||||
use defmt::*;
|
||||
use defmt_rtt as _;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_rp::{
|
||||
bind_interrupts,
|
||||
peripherals::USB,
|
||||
usb::{Driver as UsbDriver, InterruptHandler as UsbInterruptHandler},
|
||||
};
|
||||
use embassy_time::Timer;
|
||||
use panic_probe as _;
|
||||
|
||||
use crate::usb::handle_usb;
|
||||
|
||||
mod usb;
|
||||
|
||||
bind_interrupts!(struct Irqs{
|
||||
USBCTRL_IRQ => UsbInterruptHandler<USB>;
|
||||
});
|
||||
|
||||
#[embassy_executor::main(
|
||||
executor = "embassy_rp::executor::Executor",
|
||||
entry = "cortex_m_rt::entry"
|
||||
)]
|
||||
async fn main(spawner: Spawner) {
|
||||
let p = embassy_rp::init(Default::default());
|
||||
|
||||
let usb_driver = UsbDriver::new(p.USB, Irqs);
|
||||
|
||||
spawner.spawn(handle_usb(usb_driver).unwrap());
|
||||
|
||||
let led_future = async {
|
||||
loop {
|
||||
info!("led on!");
|
||||
Timer::after_millis(500).await;
|
||||
|
||||
info!("led off!");
|
||||
Timer::after_millis(500).await;
|
||||
}
|
||||
};
|
||||
|
||||
led_future.await;
|
||||
}
|
||||
|
||||
// Program metadata for `picotool info`.
|
||||
// This isn't needed, but it's recommended to have these minimal entries.
|
||||
#[unsafe(link_section = ".bi_entries")]
|
||||
#[used]
|
||||
pub static PICOTOOL_ENTRIES: [embassy_rp::binary_info::EntryAddr; 4] = [
|
||||
embassy_rp::binary_info::rp_program_name!(c"Blinky Example"),
|
||||
embassy_rp::binary_info::rp_program_description!(
|
||||
c"This example tests the RP Pico on board LED, connected to gpio 25"
|
||||
),
|
||||
embassy_rp::binary_info::rp_program_name!(c"USB-Communication"),
|
||||
embassy_rp::binary_info::rp_program_description!(c"USB-Communication System"),
|
||||
embassy_rp::binary_info::rp_cargo_version!(),
|
||||
embassy_rp::binary_info::rp_program_build_attribute!(),
|
||||
];
|
||||
|
||||
#[embassy_executor::main(
|
||||
executor = "embassy_rp::executor::Executor",
|
||||
entry = "cortex_m_rt::entry"
|
||||
)]
|
||||
async fn main(_spawner: Spawner) {
|
||||
let p = embassy_rp::init(Default::default());
|
||||
|
||||
loop {
|
||||
info!("led on!");
|
||||
Timer::after_millis(500).await;
|
||||
|
||||
info!("led off!");
|
||||
Timer::after_millis(500).await;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user