Screen

Struct Screen 

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

Represents the physical display on the V5 Brain.

Implementations§

Source§

impl Screen

Source

pub const MAX_VISIBLE_LINES: usize = 12usize

The maximum number of lines that can be visible on the screen at once.

Source

pub const LINE_HEIGHT: i16 = 20i16

The height of a single line of text on the screen.

Source

pub const HORIZONTAL_RESOLUTION: i16 = 480i16

The horizontal resolution of the display.

Source

pub const VERTICAL_RESOLUTION: i16 = 240i16

The vertical resolution of the writable part of the display.

Source

pub unsafe fn new() -> Self

Create a new screen.

§Safety

Creating new Screens is inherently unsafe due to the possibility of constructing more than one screen at once allowing multiple mutable references to the same hardware device. Prefer using Peripherals to register devices if possible.

Source

pub fn scroll(&mut self, start: i16, offset: i16) -> Result<(), ScreenError>

Scroll the entire display buffer.

This function effectively y-offsets all pixels drawn to the display buffer by a number (offset) of pixels.

Source

pub fn scroll_area( &mut self, x0: i16, y0: i16, x1: i16, y1: i16, offset: i16, ) -> Result<(), ScreenError>

Scroll a region of the screen.

This will effectively y-offset the display buffer in this area by offset pixels.

Source

pub fn fill( &mut self, shape: &impl Fill<Error = ScreenError>, color: impl IntoRgb, ) -> Result<(), ScreenError>

Draw a filled object to the screen.

Source

pub fn stroke( &mut self, shape: &impl Stroke<Error = ScreenError>, color: impl IntoRgb, ) -> Result<(), ScreenError>

Draw an outlined object to the screen.

Source

pub fn erase(color: impl IntoRgb) -> Result<(), ScreenError>

Wipe the entire display buffer, filling it with a specified color.

Source

pub fn draw_pixel(x: i16, y: i16) -> Result<(), ScreenError>

Draw a color to a specified pixel position on the screen.

Source

pub fn draw_buffer<T, I>( &mut self, x0: i16, y0: i16, x1: i16, y1: i16, buf: T, src_stride: i32, ) -> Result<(), ScreenError>
where T: IntoIterator<Item = I>, I: IntoRgb,

Draw a buffer of pixel colors to a specified region of the screen.

Source

pub fn draw_error(&mut self, msg: &str) -> Result<(), ScreenError>

Draw an error box to the screen.

This function is internally used by the pros-rs panic handler for displaying panic messages graphically before exiting.

Source

pub fn touch_status(&self) -> Result<TouchEvent, ScreenError>

Get the current touch status of the screen.

Trait Implementations§

Source§

impl Debug for Screen

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Screen

Source§

fn eq(&self, other: &Screen) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Write for Screen

Source§

fn write_str(&mut self, text: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · Source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more
Source§

impl Eq for Screen

Source§

impl StructuralPartialEq for Screen

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, 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.