#![no_std]
#[macro_use]
extern crate log;
#[doc(no_inline)]
pub use ax_driver::prelude::DisplayInfo;
use ax_driver::{AxDeviceContainer, prelude::*};
use ax_lazyinit::LazyInit;
use ax_sync::Mutex;
static MAIN_DISPLAY: LazyInit<Mutex<AxDisplayDevice>> = LazyInit::new();
pub fn init_display(mut display_devs: AxDeviceContainer<AxDisplayDevice>) {
info!("Initialize display subsystem...");
if let Some(dev) = display_devs.take_one() {
info!(" use display device 0: {:?}", dev.device_name());
MAIN_DISPLAY.init_once(Mutex::new(dev));
} else {
warn!(" No display device found!");
}
}
pub fn has_display() -> bool {
MAIN_DISPLAY.is_inited()
}
pub fn framebuffer_info() -> DisplayInfo {
MAIN_DISPLAY.lock().info()
}
pub fn framebuffer_flush() -> bool {
MAIN_DISPLAY.lock().flush().is_ok()
}