pub trait ScreenSetup<'a> {
    // Required methods
    fn set_client(&self, client: &'a dyn ScreenSetupClient);
    fn set_resolution(
        &self,
        resolution: (usize, usize)
    ) -> Result<(), ErrorCode>;
    fn set_pixel_format(
        &self,
        format: ScreenPixelFormat
    ) -> Result<(), ErrorCode>;
    fn set_rotation(&self, rotation: ScreenRotation) -> Result<(), ErrorCode>;
    fn get_num_supported_resolutions(&self) -> usize;
    fn get_supported_resolution(&self, index: usize) -> Option<(usize, usize)>;
    fn get_num_supported_pixel_formats(&self) -> usize;
    fn get_supported_pixel_format(
        &self,
        index: usize
    ) -> Option<ScreenPixelFormat>;
}
Expand description

Interface to configure the screen.

Required Methods§

source

fn set_client(&self, client: &'a dyn ScreenSetupClient)

source

fn set_resolution(&self, resolution: (usize, usize)) -> Result<(), ErrorCode>

Set the screen resolution in pixels with (X, Y).

Returns Ok(()) if the request is registered and will be sent to the screen. A command_complete callback function will be triggered when the resolution change is finished and will provide a Result<(), ErrorCode> to indicate if the resolution change was successful.

Returns Err(NOSUPPORT) if the resolution is not supported. No callback will be triggered.

source

fn set_pixel_format(&self, format: ScreenPixelFormat) -> Result<(), ErrorCode>

Set the pixel format.

Returns Ok(()) if the request is registered and will be sent to the screen. A command_complete callback function will be triggered when the pixel format change is finished and will provide a Result<(), ErrorCode> to indicate if the pixel format change was successful.

Returns Err(NOSUPPORT) if the pixel format is not supported.

source

fn set_rotation(&self, rotation: ScreenRotation) -> Result<(), ErrorCode>

Set the rotation of the display.

Returns Ok(()) if the request is registered and will be sent to the screen. A command_complete callback function will be triggered when the rotation update is finished and will provide a Result<(), ErrorCode> to indicate if the rotation change was successful.

Note that Rotated90 or Rotated270 will swap the width and height.

source

fn get_num_supported_resolutions(&self) -> usize

Get the number of supported resolutions.

This must return at least one (the current resolution).

This function is synchronous as the driver should know this value without requesting it from the screen (most screens do not support such a request, resolutions are described in the data sheet).

source

fn get_supported_resolution(&self, index: usize) -> Option<(usize, usize)>

Get the resolution specified by the given index.

index is from 0..get_num_supported_resolutions()-1 and this returns a tuple (width, height) of the associated resolution (in pixels). Note that width and height may change due to rotation. Returns None if index is invalid.

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

source

fn get_num_supported_pixel_formats(&self) -> usize

Get the number of the pixel formats supported.

This function is synchronous as the driver should know this value without requesting it from the screen (most screens do not support such a request, pixel formats are described in the data sheet).

source

fn get_supported_pixel_format(&self, index: usize) -> Option<ScreenPixelFormat>

Get the pixel format specified by the given index.

index is from 0..get_num_supported_pixel_formats()-1 and this returns the associated pixel format. Returns None if index is invalid.

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

Implementors§