1#![no_std]
6
7#[macro_use]
8extern crate log;
9
10#[doc(no_inline)]
11pub use ax_driver::prelude::DisplayInfo;
12use ax_driver::{AxDeviceContainer, prelude::*};
13use ax_lazyinit::LazyInit;
14use ax_sync::Mutex;
15
16static MAIN_DISPLAY: LazyInit<Mutex<AxDisplayDevice>> = LazyInit::new();
17
18pub fn init_display(mut display_devs: AxDeviceContainer<AxDisplayDevice>) {
20 info!("Initialize display subsystem...");
21
22 if let Some(dev) = display_devs.take_one() {
23 info!(" use display device 0: {:?}", dev.device_name());
24 MAIN_DISPLAY.init_once(Mutex::new(dev));
25 } else {
26 warn!(" No display device found!");
27 }
28}
29
30pub fn has_display() -> bool {
32 MAIN_DISPLAY.is_inited()
33}
34
35pub fn framebuffer_info() -> DisplayInfo {
37 MAIN_DISPLAY.lock().info()
38}
39
40pub fn framebuffer_flush() -> bool {
42 MAIN_DISPLAY.lock().flush().is_ok()
43}