mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
clean up warnings
This commit is contained in:
parent
50b521266f
commit
313f12acbb
15 changed files with 46 additions and 56 deletions
10
Cargo.lock
generated
10
Cargo.lock
generated
|
|
@ -534,6 +534,7 @@ dependencies = [
|
||||||
"heapless",
|
"heapless",
|
||||||
"log",
|
"log",
|
||||||
"log-server",
|
"log-server",
|
||||||
|
"rkyv",
|
||||||
"ticktimer-server",
|
"ticktimer-server",
|
||||||
"utralib",
|
"utralib",
|
||||||
"xous",
|
"xous",
|
||||||
|
|
@ -547,6 +548,7 @@ dependencies = [
|
||||||
"heapless",
|
"heapless",
|
||||||
"log",
|
"log",
|
||||||
"log-server",
|
"log-server",
|
||||||
|
"rkyv",
|
||||||
"ticktimer-server",
|
"ticktimer-server",
|
||||||
"utralib",
|
"utralib",
|
||||||
"xous",
|
"xous",
|
||||||
|
|
@ -559,6 +561,14 @@ version = "0.4.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "kernel-test"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"utralib",
|
||||||
|
"xous",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "keyboard"
|
name = "keyboard"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
use xous::{Message, ScalarMessage};
|
use xous::{Message, ScalarMessage};
|
||||||
use graphics_server::api::{Point, Rectangle, TextView, TextViewResult, Gid, Line, RoundedRectangle, Circle};
|
use graphics_server::api::{Rectangle, TextView, Gid, Line, RoundedRectangle, Circle};
|
||||||
use blitstr_ref as blitstr;
|
|
||||||
use blitstr::{GlyphStyle, Cursor};
|
|
||||||
|
|
||||||
#[derive(Debug, rkyv::Archive, rkyv::Unarchive, Copy, Clone)]
|
#[derive(Debug, rkyv::Archive, rkyv::Unarchive, Copy, Clone)]
|
||||||
pub enum GamObjectType {
|
pub enum GamObjectType {
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,10 @@
|
||||||
use core::cmp::Ordering;
|
use core::cmp::Ordering;
|
||||||
use heapless::binary_heap::{BinaryHeap, Max};
|
use heapless::binary_heap::{BinaryHeap, Max};
|
||||||
use heapless::FnvIndexMap;
|
use heapless::FnvIndexMap;
|
||||||
use heapless::Vec;
|
|
||||||
use heapless::consts::*;
|
use heapless::consts::*;
|
||||||
use graphics_server::*;
|
use graphics_server::*;
|
||||||
use log::{error, info};
|
use log::{error, info};
|
||||||
|
|
||||||
use crate::api::*;
|
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||||
pub enum CanvasState {
|
pub enum CanvasState {
|
||||||
// the initial state of every Canvas. Not drawable.
|
// the initial state of every Canvas. Not drawable.
|
||||||
|
|
@ -41,6 +38,8 @@ pub struct Canvas {
|
||||||
// enables scroll/pan of objects within a region
|
// enables scroll/pan of objects within a region
|
||||||
pan_offset: Point,
|
pan_offset: Point,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
impl Canvas {
|
impl Canvas {
|
||||||
pub fn new(clip_rect: Rectangle, trust_level: u8,
|
pub fn new(clip_rect: Rectangle, trust_level: u8,
|
||||||
trng_conn: xous::CID, pan_offset: Option<Point>) -> Result<Canvas, xous::Error> {
|
trng_conn: xous::CID, pan_offset: Option<Point>) -> Result<Canvas, xous::Error> {
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,17 @@ use api::*;
|
||||||
|
|
||||||
use rkyv::Write;
|
use rkyv::Write;
|
||||||
use rkyv::Unarchive;
|
use rkyv::Unarchive;
|
||||||
use graphics_server::api::{TextOp, TextView, TextViewResult};
|
use graphics_server::api::{TextOp, TextView};
|
||||||
|
|
||||||
use graphics_server::api::{Rectangle, Point, Gid, TextBounds, Line};
|
use graphics_server::api::{Point, Gid, Line};
|
||||||
use log::{error, info};
|
use log::info;
|
||||||
|
|
||||||
/// this "posts" a textview -- it's not a "draw" as the update is neither guaranteed nor instantaneous
|
/// this "posts" a textview -- it's not a "draw" as the update is neither guaranteed nor instantaneous
|
||||||
/// the GAM first has to check that the textview is allowed to be updated, and then it will decide when
|
/// the GAM first has to check that the textview is allowed to be updated, and then it will decide when
|
||||||
/// the actual screen update is allowed
|
/// the actual screen update is allowed
|
||||||
pub fn post_textview(gam_cid: xous::CID, tv: &mut TextView) -> Result<(), xous::Error> {
|
pub fn post_textview(gam_cid: xous::CID, tv: &mut TextView) -> Result<(), xous::Error> {
|
||||||
tv.set_op(TextOp::Render);
|
tv.set_op(TextOp::Render);
|
||||||
let mut rkyv_tv = api::Opcode::RenderTextView(*tv);
|
let rkyv_tv = api::Opcode::RenderTextView(*tv);
|
||||||
let mut writer = rkyv::ArchiveBuffer::new(xous::XousBuffer::new(4096));
|
let mut writer = rkyv::ArchiveBuffer::new(xous::XousBuffer::new(4096));
|
||||||
let pos = writer.archive(&rkyv_tv).expect("GAM_API: couldn't archive textview");
|
let pos = writer.archive(&rkyv_tv).expect("GAM_API: couldn't archive textview");
|
||||||
let mut xous_buffer = writer.into_inner();
|
let mut xous_buffer = writer.into_inner();
|
||||||
|
|
@ -39,14 +39,14 @@ pub fn post_textview(gam_cid: xous::CID, tv: &mut TextView) -> Result<(), xous::
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw_line(gam_cid: xous::CID, gid: Gid, line: Line) -> Result<(), xous::Error> {
|
pub fn draw_line(gam_cid: xous::CID, gid: Gid, line: Line) -> Result<(), xous::Error> {
|
||||||
let mut rkyv_tv = api::Opcode::RenderObject(
|
let rkyv_tv = api::Opcode::RenderObject(
|
||||||
GamObject {
|
GamObject {
|
||||||
canvas: gid,
|
canvas: gid,
|
||||||
obj: GamObjectType::Line(line),
|
obj: GamObjectType::Line(line),
|
||||||
});
|
});
|
||||||
let mut writer = rkyv::ArchiveBuffer::new(xous::XousBuffer::new(4096));
|
let mut writer = rkyv::ArchiveBuffer::new(xous::XousBuffer::new(4096));
|
||||||
let pos = writer.archive(&rkyv_tv).expect("GAM_API: couldn't archive GamObject");
|
let pos = writer.archive(&rkyv_tv).expect("GAM_API: couldn't archive GamObject");
|
||||||
let mut xous_buffer = writer.into_inner();
|
let xous_buffer = writer.into_inner();
|
||||||
|
|
||||||
xous_buffer.lend(gam_cid, pos as u32).expect("GAM_API: GamObject operation failure");
|
xous_buffer.lend(gam_cid, pos as u32).expect("GAM_API: GamObject operation failure");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,13 @@ mod canvas;
|
||||||
use canvas::*;
|
use canvas::*;
|
||||||
|
|
||||||
use blitstr_ref as blitstr;
|
use blitstr_ref as blitstr;
|
||||||
use blitstr::{Cursor, GlyphStyle};
|
use blitstr::GlyphStyle;
|
||||||
use com::*;
|
|
||||||
use graphics_server::*;
|
use graphics_server::*;
|
||||||
|
|
||||||
use log::{error, info};
|
use log::info;
|
||||||
use xous::String;
|
|
||||||
|
|
||||||
use core::convert::TryFrom;
|
use core::convert::TryFrom;
|
||||||
|
|
||||||
use heapless::binary_heap::{BinaryHeap, Max};
|
|
||||||
use heapless::FnvIndexMap;
|
use heapless::FnvIndexMap;
|
||||||
use heapless::consts::*;
|
use heapless::consts::*;
|
||||||
|
|
||||||
|
|
@ -139,17 +136,17 @@ fn xmain() -> ! {
|
||||||
xous::create_thread_simple(status_thread, chatlayout.status.gid()).expect("GAM: couldn't create status thread");
|
xous::create_thread_simple(status_thread, chatlayout.status.gid()).expect("GAM: couldn't create status thread");
|
||||||
|
|
||||||
// connect to the IME front end, and set its canvas
|
// connect to the IME front end, and set its canvas
|
||||||
|
/*
|
||||||
info!("GAM: acquiring connection to IMEF...");
|
info!("GAM: acquiring connection to IMEF...");
|
||||||
let imef_conn = xous_names::request_connection_blocking(xous::names::SERVER_NAME_IME_FRONT).expect("GAM: can't connect to the IME front end");
|
let imef_conn = xous_names::request_connection_blocking(xous::names::SERVER_NAME_IME_FRONT).expect("GAM: can't connect to the IME front end");
|
||||||
ime_frontend::set_canvas(imef_conn, chatlayout.input.gid()).expect("GAM: couldn't set IMEF canvas");
|
ime_frontend::set_canvas(imef_conn, chatlayout.input).expect("GAM: couldn't set IMEF canvas");
|
||||||
|
*/
|
||||||
let mut last_time: u64 = ticktimer_server::elapsed_ms(ticktimer_conn).unwrap();
|
let mut last_time: u64 = ticktimer_server::elapsed_ms(ticktimer_conn).unwrap();
|
||||||
info!("GAM: entering main loop");
|
info!("GAM: entering main loop");
|
||||||
loop {
|
loop {
|
||||||
// /*
|
|
||||||
let maybe_env = xous::try_receive_message(gam_sid).unwrap();
|
let maybe_env = xous::try_receive_message(gam_sid).unwrap();
|
||||||
match maybe_env {
|
match maybe_env {
|
||||||
Some(envelope) => { // */
|
Some(envelope) => {
|
||||||
// let envelope = xous::receive_message(gam_sid).unwrap();
|
// let envelope = xous::receive_message(gam_sid).unwrap();
|
||||||
if debug1 {info!("GAM: Message: {:?}", envelope); }
|
if debug1 {info!("GAM: Message: {:?}", envelope); }
|
||||||
if let Ok(opcode) = Opcode::try_from(&envelope.body) {
|
if let Ok(opcode) = Opcode::try_from(&envelope.body) {
|
||||||
|
|
@ -227,9 +224,6 @@ fn xmain() -> ! {
|
||||||
// silently fail if a bogus Gid is given???
|
// silently fail if a bogus Gid is given???
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
TextOp::ComputeBounds => {
|
|
||||||
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
_ => panic!("GAM: invalid mutable borrow message"),
|
_ => panic!("GAM: invalid mutable borrow message"),
|
||||||
|
|
@ -249,16 +243,16 @@ fn xmain() -> ! {
|
||||||
if canvas.is_drawable() {
|
if canvas.is_drawable() {
|
||||||
match obj.obj {
|
match obj.obj {
|
||||||
GamObjectType::Line(line) => {
|
GamObjectType::Line(line) => {
|
||||||
graphics_server::draw_line(gfx_conn, line);
|
graphics_server::draw_line(gfx_conn, line).expect("GAM: couldn't draw line");
|
||||||
},
|
},
|
||||||
GamObjectType::Circ(circ) => {
|
GamObjectType::Circ(circ) => {
|
||||||
graphics_server::draw_circle(gfx_conn, circ);
|
graphics_server::draw_circle(gfx_conn, circ).expect("GAM: couldn't draw circle");
|
||||||
},
|
},
|
||||||
GamObjectType::Rect(rect) => {
|
GamObjectType::Rect(rect) => {
|
||||||
graphics_server::draw_rectangle(gfx_conn, rect);
|
graphics_server::draw_rectangle(gfx_conn, rect).expect("GAM: couldn't draw rectangle");
|
||||||
},
|
},
|
||||||
GamObjectType::RoundRect(rr) => {
|
GamObjectType::RoundRect(rr) => {
|
||||||
graphics_server::draw_rounded_rectangle(gfx_conn, rr);
|
graphics_server::draw_rounded_rectangle(gfx_conn, rr).expect("GAM: couldn't draw rounded rectangle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -278,13 +272,13 @@ fn xmain() -> ! {
|
||||||
},
|
},
|
||||||
_ => xous::yield_slice(),
|
_ => xous::yield_slice(),
|
||||||
// envelope implements Drop(), which includes a call to syscall::return_memory(self.sender, message.buf)
|
// envelope implements Drop(), which includes a call to syscall::return_memory(self.sender, message.buf)
|
||||||
} // */
|
}
|
||||||
//graphics_server::flush(gfx_conn).expect("GAM: couldn't flush buffer to screen");
|
|
||||||
///*
|
|
||||||
if let Ok(elapsed_time) = ticktimer_server::elapsed_ms(ticktimer_conn) {
|
if let Ok(elapsed_time) = ticktimer_server::elapsed_ms(ticktimer_conn) {
|
||||||
if elapsed_time - last_time > 33 { // rate limit updates to 30fps
|
if elapsed_time - last_time > 33 { // rate limit updates to 30fps
|
||||||
|
last_time = elapsed_time;
|
||||||
graphics_server::flush(gfx_conn).expect("GAM: couldn't flush buffer to screen");
|
graphics_server::flush(gfx_conn).expect("GAM: couldn't flush buffer to screen");
|
||||||
}
|
}
|
||||||
}//*/
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
use crate::api::*;
|
|
||||||
|
|
||||||
use log::{error, info};
|
use log::{error, info};
|
||||||
use com::api::BattStats;
|
use com::api::BattStats;
|
||||||
use graphics_server::*;
|
use graphics_server::*;
|
||||||
|
|
@ -18,7 +16,6 @@ pub fn status_thread(canvas_gid: [u32; 4]) {
|
||||||
|
|
||||||
let ticktimer_conn = xous::connect(xous::SID::from_bytes(b"ticktimer-server").unwrap()).unwrap();
|
let ticktimer_conn = xous::connect(xous::SID::from_bytes(b"ticktimer-server").unwrap()).unwrap();
|
||||||
let com_conn = xous_names::request_connection_blocking(xous::names::SERVER_NAME_COM).expect("GAM|status: can't connect to COM");
|
let com_conn = xous_names::request_connection_blocking(xous::names::SERVER_NAME_COM).expect("GAM|status: can't connect to COM");
|
||||||
let gfx_conn = xous_names::request_connection_blocking(xous::names::SERVER_NAME_GFX).expect("GAM|status: can't connect to COM");
|
|
||||||
let gam_conn = xous_names::request_connection_blocking(xous::names::SERVER_NAME_GAM).expect("GAM|status: can't connect to GAM");
|
let gam_conn = xous_names::request_connection_blocking(xous::names::SERVER_NAME_GAM).expect("GAM|status: can't connect to GAM");
|
||||||
|
|
||||||
if debug1{info!("GAM|status: getting screen size");}
|
if debug1{info!("GAM|status: getting screen size");}
|
||||||
|
|
@ -46,7 +43,7 @@ pub fn status_thread(canvas_gid: [u32; 4]) {
|
||||||
battstats_tv.draw_border = false;
|
battstats_tv.draw_border = false;
|
||||||
battstats_tv.margin = Point::new(0, 0);
|
battstats_tv.margin = Point::new(0, 0);
|
||||||
|
|
||||||
let mut stats: BattStats = BattStats::default();
|
let mut stats: BattStats;
|
||||||
let mut last_time: u64 = ticktimer_server::elapsed_ms(ticktimer_conn).unwrap();
|
let mut last_time: u64 = ticktimer_server::elapsed_ms(ticktimer_conn).unwrap();
|
||||||
let mut stats_phase: usize = 0;
|
let mut stats_phase: usize = 0;
|
||||||
let mut last_seconds: usize = ((last_time / 1000) % 60) as usize;
|
let mut last_seconds: usize = ((last_time / 1000) % 60) as usize;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use crate::op::{HEIGHT, WIDTH};
|
||||||
use crate::api::{Point, DrawStyle};
|
use crate::api::{Point, DrawStyle};
|
||||||
use blitstr_ref as blitstr;
|
use blitstr_ref as blitstr;
|
||||||
use blitstr::{ClipRect};
|
use blitstr::{ClipRect};
|
||||||
use core::{cmp::{max, min}, ops::Add};
|
use core::{cmp::{max, min}};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, rkyv::Archive, rkyv::Unarchive)]
|
#[derive(Debug, Clone, Copy, rkyv::Archive, rkyv::Unarchive)]
|
||||||
pub struct Rectangle {
|
pub struct Rectangle {
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@ use crate::api::{Point, Rectangle, Gid};
|
||||||
use blitstr_ref as blitstr;
|
use blitstr_ref as blitstr;
|
||||||
use blitstr::{GlyphStyle, Cursor};
|
use blitstr::{GlyphStyle, Cursor};
|
||||||
|
|
||||||
use log::info;
|
|
||||||
|
|
||||||
/// coordinates are local to the canvas, not absolute to the screen
|
/// coordinates are local to the canvas, not absolute to the screen
|
||||||
#[derive(Debug, Copy, Clone, rkyv::Archive, rkyv::Unarchive)]
|
#[derive(Debug, Copy, Clone, rkyv::Archive, rkyv::Unarchive)]
|
||||||
pub enum TextBounds {
|
pub enum TextBounds {
|
||||||
|
|
@ -46,12 +44,6 @@ impl From<usize> for TextOp {
|
||||||
// roughly 168 bytes to represent the rest of the struct, and we want to fill out the 4096 byte page with text
|
// roughly 168 bytes to represent the rest of the struct, and we want to fill out the 4096 byte page with text
|
||||||
const TEXTVIEW_LEN: usize = 3072;
|
const TEXTVIEW_LEN: usize = 3072;
|
||||||
|
|
||||||
#[derive(Copy, Clone, rkyv::Archive, Debug, rkyv::Unarchive)]
|
|
||||||
pub struct TextViewResult {
|
|
||||||
pub bounds_computed: Option<Rectangle>,
|
|
||||||
pub cursor: Cursor,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, rkyv::Archive, rkyv::Unarchive)]
|
#[derive(Copy, Clone, rkyv::Archive, rkyv::Unarchive)]
|
||||||
pub struct TextView {
|
pub struct TextView {
|
||||||
// this is the operation as specified for the GAM. Note this is different from the "op" when sent to graphics-server
|
// this is the operation as specified for the GAM. Note this is different from the "op" when sent to graphics-server
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ pub fn draw_textview(cid: CID, tv: &mut TextView) -> Result<(), xous::Error> {
|
||||||
use rkyv::Write;
|
use rkyv::Write;
|
||||||
use rkyv::Unarchive;
|
use rkyv::Unarchive;
|
||||||
|
|
||||||
let mut rkyv_tv = api::Opcode::DrawTextView(*tv);
|
let rkyv_tv = api::Opcode::DrawTextView(*tv);
|
||||||
let mut writer = rkyv::ArchiveBuffer::new(xous::XousBuffer::new(4096));
|
let mut writer = rkyv::ArchiveBuffer::new(xous::XousBuffer::new(4096));
|
||||||
let pos = writer.archive(&rkyv_tv).expect("couldn't archive textview");
|
let pos = writer.archive(&rkyv_tv).expect("couldn't archive textview");
|
||||||
let mut xous_buffer = writer.into_inner();
|
let mut xous_buffer = writer.into_inner();
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ use api::Opcode;
|
||||||
|
|
||||||
use core::pin::Pin;
|
use core::pin::Pin;
|
||||||
use rkyv::{archived_value, Unarchive, archived_value_mut};
|
use rkyv::{archived_value, Unarchive, archived_value_mut};
|
||||||
use core::convert::TryInto;
|
|
||||||
|
|
||||||
mod backend;
|
mod backend;
|
||||||
use backend::XousDisplay;
|
use backend::XousDisplay;
|
||||||
|
|
@ -163,13 +162,13 @@ fn xmain() -> ! {
|
||||||
TextBounds::BoundingBox(r) => {
|
TextBounds::BoundingBox(r) => {
|
||||||
tv.bounds_computed = Some(r);
|
tv.bounds_computed = Some(r);
|
||||||
},
|
},
|
||||||
TextBounds::GrowableFromBr(br, width) => {
|
TextBounds::GrowableFromBr(_br, _width) => {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
},
|
},
|
||||||
TextBounds::GrowableFromTl(tl, width) => {
|
TextBounds::GrowableFromTl(_tl, _width) => {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
},
|
},
|
||||||
TextBounds::GrowableFromBl(bl, width) => {
|
TextBounds::GrowableFromBl(_bl, _width) => {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
use crate::api::{Circle, DrawStyle, Line, Pixel, PixelColor, Point, Rectangle, TextView, RoundedRectangle};
|
use crate::api::{Circle, DrawStyle, Line, Pixel, PixelColor, Point, Rectangle, RoundedRectangle};
|
||||||
use log::info;
|
|
||||||
use blitstr_ref as blitstr;
|
|
||||||
|
|
||||||
/// LCD Frame buffer bounds
|
/// LCD Frame buffer bounds
|
||||||
pub const LCD_WORDS_PER_LINE: usize = 11;
|
pub const LCD_WORDS_PER_LINE: usize = 11;
|
||||||
|
|
@ -456,7 +454,7 @@ impl Iterator for RoundedRectangleIterator {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn rounded_rectangle(fb: &mut LcdFB, rr: RoundedRectangle) {
|
pub fn rounded_rectangle(fb: &mut LcdFB, rr: RoundedRectangle) {
|
||||||
/// left off: compute the four quadrants
|
// compute the four quadrants
|
||||||
// call the rr iterator on the rectangle
|
// call the rr iterator on the rectangle
|
||||||
// then call it on one each of the four circle quadrants
|
// then call it on one each of the four circle quadrants
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ ticktimer-server = { path = "../ticktimer-server" }
|
||||||
xous-names = { path = "../xous-names" }
|
xous-names = { path = "../xous-names" }
|
||||||
graphics-server = {path = "../graphics-server"}
|
graphics-server = {path = "../graphics-server"}
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
rkyv = { version = "0.3.1", default_features = false }
|
||||||
|
|
||||||
|
|
||||||
[target.'cfg(not(any(windows,unix)))'.dependencies]
|
[target.'cfg(not(any(windows,unix)))'.dependencies]
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ pub enum Opcode {
|
||||||
SetCanvas(Gid),
|
SetCanvas(Gid),
|
||||||
|
|
||||||
/// set prediction. Must be a String of the name of a server that is loaded in the system.
|
/// set prediction. Must be a String of the name of a server that is loaded in the system.
|
||||||
SetPrediction(xous::String),
|
SetPrediction(xous::String<256>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl core::convert::TryFrom<& Message> for Opcode {
|
impl core::convert::TryFrom<& Message> for Opcode {
|
||||||
|
|
@ -17,7 +17,7 @@ impl core::convert::TryFrom<& Message> for Opcode {
|
||||||
fn try_from(message: & Message) -> Result<Self, Self::Error> {
|
fn try_from(message: & Message) -> Result<Self, Self::Error> {
|
||||||
match message {
|
match message {
|
||||||
Message::Scalar(m) => match m.id {
|
Message::Scalar(m) => match m.id {
|
||||||
0 => Ok(Opcode::GetTrng(m.arg1)),
|
0 => Ok(Opcode::SetCanvas(Gid::new([m.arg1 as _, m.arg2 as _, m.arg3 as _, m.arg4 as _]))),
|
||||||
_ => Err("IMEF api: unknown Scalar ID"),
|
_ => Err("IMEF api: unknown Scalar ID"),
|
||||||
},
|
},
|
||||||
_ => Err("IMEF api: unhandled message type"),
|
_ => Err("IMEF api: unhandled message type"),
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,5 @@ use xous::{CID, send_message};
|
||||||
|
|
||||||
pub fn set_canvas(cid: CID, g: graphics_server::Gid) -> Result<(), xous::Error> {
|
pub fn set_canvas(cid: CID, g: graphics_server::Gid) -> Result<(), xous::Error> {
|
||||||
send_message(cid, api::Opcode::SetCanvas(g).into())?;
|
send_message(cid, api::Opcode::SetCanvas(g).into())?;
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ log-server = { path = "../log-server" }
|
||||||
ticktimer-server = { path = "../ticktimer-server" }
|
ticktimer-server = { path = "../ticktimer-server" }
|
||||||
xous-names = { path = "../xous-names" }
|
xous-names = { path = "../xous-names" }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
rkyv = { version = "0.3.1", default_features = false }
|
||||||
|
|
||||||
|
|
||||||
[target.'cfg(not(any(windows,unix)))'.dependencies]
|
[target.'cfg(not(any(windows,unix)))'.dependencies]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue