Screen

Struct Screen 

Source
pub struct Screen { /* private fields */ }

Implementations§

Source§

impl Screen

Source

pub fn find_port() -> Result<String, Error>

Automagically finds the port the screen is connected to. If the screen is not found, an empty string is returned. If the screen is found, the port name is returned.

Source

pub fn new(port_name: String) -> Result<Screen, Error>

Creates a new Screen instance. Requires the port name as a parameter. It can be obtained by calling the find_port() function.

Source§

impl Screen

Source

pub fn orientation( &mut self, orientation: Orientation, ) -> Result<(), ScreenError>

Sets the screens orientation

Source

pub fn clear(&mut self) -> Result<(), ScreenError>

Clears the screen to white. Does not work correctly in landscape mode, switch to Portrait mode before using this function.

Source

pub fn to_black(&mut self) -> Result<(), ScreenError>

Clears the screen to black. Does not work correctly in landscape mode, switch to Portrait mode before using this function.

Source

pub fn brightness(&mut self, level: u8) -> Result<(), ScreenError>

Sets the brightness of the screen. Level must be between 0 and 255. 0 is the brightest, 255 is the darkest.

Source

pub fn screen_off(&mut self) -> Result<(), ScreenError>

Turns the screen off. It will still be powered on, but the screen will be black. To turn the screen back on, use the screen_on() function. Retains the current image.

Source

pub fn screen_on(&mut self) -> Result<(), ScreenError>

Turns the screen on. The screen will display the last image that was drawn.

Source

pub fn draw( &mut self, img: ImageBuffer<Rgb<u8>, Vec<u8>>, ) -> Result<(), ScreenError>

Draws an ImageBuffer to the screen. The image must be 320x480 or 480x320. Although not checked, the orientation of the image should match the orientation of the screen. Otherwise the screen will still interpret the image as if it were in the wrong orientation, part of the image may be cut off and the screen will wrap around to the start in rendering.

Auto Trait Implementations§

§

impl Freeze for Screen

§

impl !RefUnwindSafe for Screen

§

impl Send for Screen

§

impl !Sync for Screen

§

impl Unpin for Screen

§

impl !UnwindSafe for Screen

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.