Skip to content

Commit

Permalink
Merge pull request #51 from Xila-Project/Feature/Graphical_shell
Browse files Browse the repository at this point in the history
Feature/Graphical shell
  • Loading branch information
AlixANNERAUD authored Dec 26, 2024
2 parents 5e6856a + fc4c208 commit 3e979d7
Show file tree
Hide file tree
Showing 70 changed files with 3,740 additions and 1,197 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ members = [
"Modules/Executables/Shell/Command_line",
"Modules/Executable",
"Modules/Executables/WASM",
"Modules/Executables/Shell/Graphical",
"Modules/Executables/Terminal",
]
exclude = [
"Modules/Virtual_machine/Tests/WASM_test",
Expand Down Expand Up @@ -81,4 +83,4 @@ WASM = ["dep:WASM_bindings"]
[[example]]
name = "Native"
path = "Examples/Native.rs"
required-features = ["Host"]
required-features = ["Host"]
22 changes: 12 additions & 10 deletions Modules/Bindings/Host/Tests/Graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Drivers::Native::{Time_driver_type, Window_screen};
use File_system::{Create_device, Create_file_system, Memory_device_type};
use Graphics::{lvgl, Get_recommended_buffer_size, Point_type};
use Graphics::{Get_minimal_buffer_size, Point_type, LVGL};
use Time::Duration_type;

#[ignore]
Expand Down Expand Up @@ -45,23 +45,25 @@ fn Integration_test() {

const Resolution: Point_type = Point_type::New(800, 480);

const Buffer_size: usize = Get_recommended_buffer_size(&Resolution);
const Buffer_size: usize = Get_minimal_buffer_size(&Resolution);

let (Screen_device, Pointer_device) = Window_screen::New(Resolution).unwrap();
let (Screen_device, Pointer_device, _) = Window_screen::New(Resolution).unwrap();

let _Task = Task_instance.Get_current_task_identifier().unwrap();

Graphics::Initialize();
Graphics::Initialize(
Screen_device,
Pointer_device,
Graphics::Input_type_type::Pointer,
Buffer_size,
true,
);

let Graphics_manager = Graphics::Get_instance();

let Display = Graphics_manager
.Create_display::<Buffer_size>(Screen_device, Pointer_device, false)
.unwrap();

let Screen_object = Display.Get_object();
let Window = Graphics_manager.Create_window().unwrap();

let _Calendar = unsafe { lvgl::lv_calendar_create(Screen_object) };
let _Calendar = unsafe { LVGL::lv_calendar_create(Window.Into_raw()) };

let Standard_in = Virtual_file_system::Get_instance()
.Open(
Expand Down
4 changes: 2 additions & 2 deletions Modules/Bindings/Host/src/Graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{
os::raw::c_void,
};

pub use Graphics::lvgl;
pub use Graphics::LVGL;

use Task::Task_identifier_type;
use Virtual_machine::{
Expand All @@ -13,7 +13,7 @@ use Virtual_machine::{
};

mod Generated_bindings {
use super::{lvgl::*, Pointer_table_type, Task_identifier_type};
use super::{Pointer_table_type, Task_identifier_type, LVGL::*};
use Virtual_machine::{Environment_type, WASM_pointer_type, WASM_usize_type};

include!(concat!(env!("OUT_DIR"), "/Bindings.rs"));
Expand Down
9 changes: 5 additions & 4 deletions Modules/Bindings/Utilities/src/Additional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ pub fn Get() -> TokenStream {

pub unsafe fn Window_create() -> *mut lv_obj_t {
Graphics::Get_instance().Create_window().unwrap().Into_raw()

}

pub unsafe fn Window_get_event_code(Window: *mut lv_obj_t) -> lv_event_code_t {
pub unsafe fn Window_get_event_code(Window: *mut lv_obj_t) -> u32 {
let Window = Graphics::Window_type::From_raw(Window);

let Code = if let Some(Event) = Window.Peek_event() {
Event.Code
Event.Get_code() as u32
} else {
lv_event_code_t_LV_EVENT_ALL
Graphics::Event_code_type::All as u32
};

core::mem::forget(Window);
Expand All @@ -32,7 +33,7 @@ pub fn Get() -> TokenStream {
let Window = Graphics::Window_type::From_raw(Window);

let Target = if let Some(Event) = Window.Peek_event() {
Event.Target
Event.Get_target()
} else {
core::ptr::null_mut()
};
Expand Down
Loading

0 comments on commit 3e979d7

Please sign in to comment.