Skip to content

Commit

Permalink
Add an example echo bot using the USB Gecko
Browse files Browse the repository at this point in the history
This program repeats every byte it is fed.
  • Loading branch information
linkmauve committed Dec 15, 2024
1 parent 11b8584 commit cb2236c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/bin/echo-bot.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//! This is an example of how to communicate with an USB Gecko using Luma.
#![no_std]

extern crate luma_core;
extern crate luma_runtime;

use luma_core::exi::usb_gecko::UsbGecko;
use luma_core::exi::Exi;

fn main() {
let exi = Exi::init();
let gecko = UsbGecko::new(&exi).unwrap();
loop {
// TODO: use interrupts here, instead of a busy loop.
let buf = match gecko.receive() {
Ok(buf) => buf,
Err(_) => continue,
};
gecko.send(&buf).unwrap();
}
}

0 comments on commit cb2236c

Please sign in to comment.