Trait kernel::hil::text_screen::TextScreen
source · pub trait TextScreen<'a> {
// Required methods
fn set_client(&self, client: Option<&'a dyn TextScreenClient>);
fn get_size(&self) -> (usize, usize);
fn print(
&self,
buffer: &'static mut [u8],
len: usize,
) -> Result<(), (ErrorCode, &'static mut [u8])>;
fn set_cursor(
&self,
x_position: usize,
y_position: usize,
) -> Result<(), ErrorCode>;
fn hide_cursor(&self) -> Result<(), ErrorCode>;
fn show_cursor(&self) -> Result<(), ErrorCode>;
fn blink_cursor_on(&self) -> Result<(), ErrorCode>;
fn blink_cursor_off(&self) -> Result<(), ErrorCode>;
fn display_on(&self) -> Result<(), ErrorCode>;
fn display_off(&self) -> Result<(), ErrorCode>;
fn clear(&self) -> Result<(), ErrorCode>;
}
Required Methods§
fn set_client(&self, client: Option<&'a dyn TextScreenClient>)
sourcefn get_size(&self) -> (usize, usize)
fn get_size(&self) -> (usize, usize)
Returns a tuple (width, height) with the resolution of the screen that is being used. This function is synchronous as the resolution is known by the driver at any moment.
The resolution is constant.
sourcefn print(
&self,
buffer: &'static mut [u8],
len: usize,
) -> Result<(), (ErrorCode, &'static mut [u8])>
fn print( &self, buffer: &'static mut [u8], len: usize, ) -> Result<(), (ErrorCode, &'static mut [u8])>
Sends a write command to the driver, and the buffer to write from
and the len are sent as arguments. When the write
operation is
finished, the driver will call the write_complete()
callback.
Return values:
Ok(())
: The write command is valid and will be sent to the driver.BUSY
: The driver is busy with another command.
sourcefn set_cursor(
&self,
x_position: usize,
y_position: usize,
) -> Result<(), ErrorCode>
fn set_cursor( &self, x_position: usize, y_position: usize, ) -> Result<(), ErrorCode>
Sends to the driver a command to set the cursor at a given position
(x_position, y_position). When finished, the driver will call the
command_complete()
callback.
Return values:
Ok(())
: The command is valid and will be sent to the driver.BUSY
: Another command is in progress.
sourcefn hide_cursor(&self) -> Result<(), ErrorCode>
fn hide_cursor(&self) -> Result<(), ErrorCode>
Sends to the driver a command to hide the cursor. When finished,
the driver will call the command_complete()
callback.
Return values:
Ok(())
: The command is valid and will be sent to the driver.BUSY
: Another command is in progress.
sourcefn show_cursor(&self) -> Result<(), ErrorCode>
fn show_cursor(&self) -> Result<(), ErrorCode>
Sends to the driver a command to show the cursor. When finished,
the driver will call the command_complete()
callback.
Return values:
Ok(())
: The command is valid and will be sent to the driver.BUSY
: Another command is in progress.
sourcefn blink_cursor_on(&self) -> Result<(), ErrorCode>
fn blink_cursor_on(&self) -> Result<(), ErrorCode>
Sends to the driver a command to turn on the blinking cursor. When finished,
the driver will call the command_complete()
callback.
Return values:
Ok(())
: The command is valid and will be sent to the driver.BUSY
: Another command is in progress.
sourcefn blink_cursor_off(&self) -> Result<(), ErrorCode>
fn blink_cursor_off(&self) -> Result<(), ErrorCode>
Sends to the driver a command to turn off the blinking cursor. When finished,
the driver will call the command_complete()
callback.
Return values:
Ok(())
: The command is valid and will be sent to the driver.BUSY
: Another command is in progress.
sourcefn display_on(&self) -> Result<(), ErrorCode>
fn display_on(&self) -> Result<(), ErrorCode>
Sends to the driver a command to turn on the display of the screen.
When finished, the driver will call the command_complete()
callback.
Return values:
Ok(())
: The command is valid and will be sent to the driver.BUSY
: Another command is in progress.
sourcefn display_off(&self) -> Result<(), ErrorCode>
fn display_off(&self) -> Result<(), ErrorCode>
Sends to the driver a command to turn off the display of the screen.
When finished, the driver will call the command_complete()
callback.
Return values:
Ok(())
: The command is valid and will be sent to the driver.BUSY
: Another command is in progress.