mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
CHORE reformat PR
I...could swear there was no merge warning when I clicked merge. why is this failing to check now?
This commit is contained in:
parent
92e501ec01
commit
053c55c254
2 changed files with 12 additions and 31 deletions
|
|
@ -2,10 +2,11 @@
|
||||||
#![cfg_attr(target_os = "none", no_main)]
|
#![cfg_attr(target_os = "none", no_main)]
|
||||||
|
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
|
use std::sync::mpsc::{self, Receiver, Sender};
|
||||||
|
|
||||||
use graphics_server::api::GlyphStyle;
|
use graphics_server::api::GlyphStyle;
|
||||||
use graphics_server::{DrawStyle, Gid, PixelColor, Point, Rectangle, TextBounds, TextView};
|
use graphics_server::{DrawStyle, Gid, PixelColor, Point, Rectangle, TextBounds, TextView};
|
||||||
use num_traits::*;
|
use num_traits::*;
|
||||||
use std::sync::mpsc::{self, Receiver, Sender};
|
|
||||||
use usb_device_xous::UsbHid;
|
use usb_device_xous::UsbHid;
|
||||||
|
|
||||||
pub(crate) const SERVER_NAME_HIDV2: &str = "_HIDv2_";
|
pub(crate) const SERVER_NAME_HIDV2: &str = "_HIDv2_";
|
||||||
|
|
@ -68,18 +69,9 @@ impl HIDv2Demo {
|
||||||
.expect("Could not register GAM UX")
|
.expect("Could not register GAM UX")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let content = gam
|
let content = gam.request_content_canvas(gam_token).expect("Could not get content canvas");
|
||||||
.request_content_canvas(gam_token)
|
let screensize = gam.get_canvas_bounds(content).expect("Could not get canvas dimensions");
|
||||||
.expect("Could not get content canvas");
|
Self { gam, _gam_token: gam_token, content, screensize }
|
||||||
let screensize = gam
|
|
||||||
.get_canvas_bounds(content)
|
|
||||||
.expect("Could not get canvas dimensions");
|
|
||||||
Self {
|
|
||||||
gam,
|
|
||||||
_gam_token: gam_token,
|
|
||||||
content,
|
|
||||||
screensize,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clear the entire screen.
|
/// Clear the entire screen.
|
||||||
|
|
@ -90,11 +82,7 @@ impl HIDv2Demo {
|
||||||
Rectangle::new_with_style(
|
Rectangle::new_with_style(
|
||||||
Point::new(0, 0),
|
Point::new(0, 0),
|
||||||
self.screensize,
|
self.screensize,
|
||||||
DrawStyle {
|
DrawStyle { fill_color: Some(PixelColor::Light), stroke_color: None, stroke_width: 0 },
|
||||||
fill_color: Some(PixelColor::Light),
|
|
||||||
stroke_color: None,
|
|
||||||
stroke_width: 0,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.expect("can't clear content area");
|
.expect("can't clear content area");
|
||||||
|
|
@ -123,9 +111,7 @@ impl HIDv2Demo {
|
||||||
write!(text_view.text, "{}", "Echoing whatever on HID USB stack...")
|
write!(text_view.text, "{}", "Echoing whatever on HID USB stack...")
|
||||||
.expect("Could not write to text view");
|
.expect("Could not write to text view");
|
||||||
|
|
||||||
self.gam
|
self.gam.post_textview(&mut text_view).expect("Could not render text view");
|
||||||
.post_textview(&mut text_view)
|
|
||||||
.expect("Could not render text view");
|
|
||||||
self.gam.redraw().expect("Could not redraw screen");
|
self.gam.redraw().expect("Could not redraw screen");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -140,9 +126,7 @@ fn main() -> ! {
|
||||||
let mut allow_redraw = true;
|
let mut allow_redraw = true;
|
||||||
|
|
||||||
// Register the server with xous
|
// Register the server with xous
|
||||||
let sid = xns
|
let sid = xns.register_name(SERVER_NAME_HIDV2, None).expect("can't register server");
|
||||||
.register_name(SERVER_NAME_HIDV2, None)
|
|
||||||
.expect("can't register server");
|
|
||||||
|
|
||||||
let mut hidv2_demo = HIDv2Demo::new(&xns, sid);
|
let mut hidv2_demo = HIDv2Demo::new(&xns, sid);
|
||||||
|
|
||||||
|
|
@ -201,11 +185,9 @@ fn start_hid_thread() -> Sender<bool> {
|
||||||
|
|
||||||
let usbd = UsbHid::new();
|
let usbd = UsbHid::new();
|
||||||
|
|
||||||
usbd.connect_hid_app(FIDO_REPORT_DESCRIPTOR.to_vec())
|
usbd.connect_hid_app(FIDO_REPORT_DESCRIPTOR.to_vec()).unwrap();
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
usbd.switch_to_core(usb_device_xous::UsbDeviceType::HIDv2)
|
usbd.switch_to_core(usb_device_xous::UsbDeviceType::HIDv2).unwrap();
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
loop {
|
loop {
|
||||||
|
|
@ -227,8 +209,7 @@ fn start_hid_thread() -> Sender<bool> {
|
||||||
std::thread::sleep(std::time::Duration::from_millis(50));
|
std::thread::sleep(std::time::Duration::from_millis(50));
|
||||||
}
|
}
|
||||||
|
|
||||||
usbd.switch_to_core(usb_device_xous::UsbDeviceType::Debug)
|
usbd.switch_to_core(usb_device_xous::UsbDeviceType::Debug).unwrap();
|
||||||
.unwrap();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return tx;
|
return tx;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ use spinal_udc::*;
|
||||||
#[cfg(all(any(feature = "precursor", feature = "renode"), feature = "mass-storage"))]
|
#[cfg(all(any(feature = "precursor", feature = "renode"), feature = "mass-storage"))]
|
||||||
mod apps_block_device;
|
mod apps_block_device;
|
||||||
|
|
||||||
#[cfg(any(feature="precursor", feature="renode"))]
|
#[cfg(any(feature = "precursor", feature = "renode"))]
|
||||||
mod hid;
|
mod hid;
|
||||||
#[cfg(not(target_os = "xous"))]
|
#[cfg(not(target_os = "xous"))]
|
||||||
mod hosted;
|
mod hosted;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue