[][src]Struct ssd1306::properties::DisplayProperties

pub struct DisplayProperties<DI, DSIZE> { /* fields omitted */ }

Display properties struct

Implementations

impl<DI, DSIZE> DisplayProperties<DI, DSIZE> where
    DSIZE: DisplaySize
[src]

pub fn new(
    iface: DI,
    size: DSIZE,
    display_rotation: DisplayRotation
) -> DisplayProperties<DI, DSIZE>
[src]

Create new DisplayProperties instance

impl<DI, DSIZE> DisplayProperties<DI, DSIZE>[src]

pub fn release(self) -> DI[src]

Releases the display interface

impl<DI, DSIZE> DisplayProperties<DI, DSIZE> where
    DI: WriteOnlyDataCommand,
    DSIZE: DisplaySize
[src]

pub fn init_column_mode(&mut self) -> Result<(), DisplayError>[src]

Initialise the display in column mode (i.e. a byte walks down a column of 8 pixels) with column 0 on the left and column (display_width - 1) on the right.

pub fn init_with_mode(&mut self, mode: AddrMode) -> Result<(), DisplayError>[src]

Initialise the display in one of the available addressing modes

pub fn change_mode(&mut self, mode: AddrMode) -> Result<(), DisplayError>[src]

Change the addressing mode

pub fn set_draw_area(
    &mut self,
    start: (u8, u8),
    end: (u8, u8)
) -> Result<(), DisplayError>
[src]

Set the position in the framebuffer of the display limiting where any sent data should be drawn. This method can be used for changing the affected area on the screen as well as (re-)setting the start point of the next draw call. Only works in Horizontal or Vertical addressing mode

pub fn set_column(&mut self, column: u8) -> Result<(), DisplayError>[src]

Set the column address in the framebuffer of the display where any sent data should be drawn. Only works in Page addressing mode.

pub fn set_row(&mut self, row: u8) -> Result<(), DisplayError>[src]

Set the page address (row 8px high) in the framebuffer of the display where any sent data should be drawn. Note that the parameter is in pixels, but the page will be set to the start of the 8px row which contains the passed-in row. Only works in Page addressing mode.

pub fn draw(&mut self, buffer: &[u8]) -> Result<(), DisplayError>[src]

Send the data to the display for drawing at the current position in the framebuffer and advance the position accordingly. Cf. set_draw_area to modify the area affected by this method in horizontal / vertical mode.

pub fn bounded_draw(
    &mut self,
    buffer: &[u8],
    disp_width: usize,
    upper_left: (u8, u8),
    lower_right: (u8, u8)
) -> Result<(), DisplayError>
[src]

Send the data to the display for drawing at the current position in the framebuffer and advance the position accordingly. Cf. set_draw_area to modify the affected area by this method.

This method takes advantage of a bounding box for faster writes.

pub fn get_dimensions(&self) -> (u8, u8)[src]

Get display dimensions, taking into account the current rotation of the display

use ssd1306::prelude::*;
let disp = DisplayProperties::new(
    interface,
    DisplaySize128x64,
    DisplayRotation::Rotate0,
);
assert_eq!(disp.get_dimensions(), (128, 64));

let rotated_disp = DisplayProperties::new(
    interface,
    DisplaySize128x64,
    DisplayRotation::Rotate90,
);
assert_eq!(rotated_disp.get_dimensions(), (64, 128));

pub fn get_rotation(&self) -> DisplayRotation[src]

Get the display rotation

pub fn set_rotation(
    &mut self,
    display_rotation: DisplayRotation
) -> Result<(), DisplayError>
[src]

Set the display rotation

pub fn display_on(&mut self, on: bool) -> Result<(), DisplayError>[src]

Turn the display on or off. The display can be drawn to and retains all of its memory even while off.

pub fn set_brightness(
    &mut self,
    brightness: Brightness
) -> Result<(), DisplayError>
[src]

Change the display brightness.

pub fn into<NMODE: DisplayModeTrait<DI, DSIZE>>(self) -> NMODE where
    DI: WriteOnlyDataCommand
[src]

Change into any mode implementing DisplayModeTrait

use ssd1306::{mode::GraphicsMode, prelude::*, Builder, I2CDIBuilder};

let interface = I2CDIBuilder::new().init(i2c);
let di: GraphicsMode<_, _> = Builder::new()
    .size(DisplaySize128x32)
    .connect(interface)
    .into();

Auto Trait Implementations

impl<DI, DSIZE> Send for DisplayProperties<DI, DSIZE> where
    DI: Send,
    DSIZE: Send
[src]

impl<DI, DSIZE> Sync for DisplayProperties<DI, DSIZE> where
    DI: Sync,
    DSIZE: Sync
[src]

impl<DI, DSIZE> Unpin for DisplayProperties<DI, DSIZE> where
    DI: Unpin,
    DSIZE: Unpin
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.