[][src]Trait kernel::hil::screen::Screen

pub trait Screen {
    fn get_resolution(&self) -> (usize, usize);
fn get_pixel_format(&self) -> ScreenPixelFormat;
fn get_rotation(&self) -> ScreenRotation;
fn set_write_frame(
        &self,
        x: usize,
        y: usize,
        width: usize,
        height: usize
    ) -> ReturnCode;
fn write(&self, buffer: &'static mut [u8], len: usize) -> ReturnCode;
fn write_continue(
        &self,
        buffer: &'static mut [u8],
        len: usize
    ) -> ReturnCode;
fn set_client(&self, client: Option<&'static dyn ScreenClient>);
fn set_brightness(&self, brightness: usize) -> ReturnCode;
fn invert_on(&self) -> ReturnCode;
fn invert_off(&self) -> ReturnCode; }

Required methods

fn get_resolution(&self) -> (usize, usize)

Returns a tuple (width, height) with the current resolution (in pixels) This function is synchronous as the driver should know this value without requesting it from the screen.

note that width and height may change due to rotation

fn get_pixel_format(&self) -> ScreenPixelFormat

Returns the current pixel format This function is synchronous as the driver should know this value without requesting it from the screen.

fn get_rotation(&self) -> ScreenRotation

Returns the current rotation. This function is synchronous as the driver should know this value without requesting it from the screen.

fn set_write_frame(
    &self,
    x: usize,
    y: usize,
    width: usize,
    height: usize
) -> ReturnCode

Sets the video memory frame. This function has to be called before the first call to the write function. This will generate a command_complete() callback when finished.

Return values:

  • SUCCESS: The write frame is valid.
  • EINVAL: The parameters of the write frame are not valid.
  • EBUSY: Unable to set the write frame on the device.

fn write(&self, buffer: &'static mut [u8], len: usize) -> ReturnCode

Sends a write command to write data in the selected video memory frame. When finished, the driver will call the write_complete() callback.

Return values:

  • SUCCESS: Write is valid and will be sent to the screen.
  • EINVAL: Write is invalid or length is wrong.
  • EBUSY: Another write is in progress.

fn write_continue(&self, buffer: &'static mut [u8], len: usize) -> ReturnCode

Sends a write command to write data in the selected video memory frame without resetting the video memory frame position. It "continues" the write from the previous position. This allows using buffers that are smaller than the video mameory frame. When finished, the driver will call the write_complete() callback.

Return values:

  • SUCCESS: Write is valid and will be sent to the screen.
  • EINVAL: Write is invalid or length is wrong.
  • EBUSY: Another write is in progress.

fn set_client(&self, client: Option<&'static dyn ScreenClient>)

Set the object to receive the asynchronous command callbacks.

fn set_brightness(&self, brightness: usize) -> ReturnCode

Sets the display brightness and/or powers it off Screens must implement this function for at least two brightness values (in percent) 0 - power off, otherwise - on, set brightness (if available)

fn invert_on(&self) -> ReturnCode

Inverts the colors.

fn invert_off(&self) -> ReturnCode

Reverts the colors to normal.

Loading content...

Implementors

Loading content...