[][src]Struct nanohat_oled::Oled

pub struct Oled { /* fields omitted */ }

Represents the NanoHat OLED device

Methods

impl Oled
[src]

pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self>
[src]

Opens the device from its entry in the dev filesystem.

Example:

let mut oled = Oled::from_path("/dev/i2c-0");

pub fn init(&mut self) -> OledResult
[src]

Initial low-level setup for the display, per SSD1306 and NanoHat OLED datasheets.

pub fn send_command<B: Into<u8>>(&mut self, byte: B) -> OledResult
[src]

Sends a command or command argument to the display's command parser

pub fn send_data<B: Into<u8>>(&mut self, byte: B) -> OledResult
[src]

Sends a data byte to the display RAM.

Display RAM is divided into 8-row pages. When writing bytes to display RAM, values are set at the current page and column pointer location. Pixels are set vertically, meaning that for a single byte, the LSB will be written to the top row of the current page, and the MSB will be written to the bottom row. Once the byte is written, pointers will advance, depending on the AddressingMode.

pub fn send_array_data<'a, B: Into<&'a [u8]>>(&mut self, data: B) -> OledResult
[src]

Sends a set of data all at once into the display RAM. Data is always written in chunks of 31 bytes (plus a byte to set data mode). See send_data() for more details on RAM layout

pub fn set_text_xy(&mut self, column: u8, row: u8) -> OledResult
[src]

Sets the cursor position for writing text to display RAM.

pub fn clear_display(&mut self) -> OledResult
[src]

Completely clears the display of text and images

pub fn draw_image(&mut self, image: &Image, threshold: u8) -> OledResult
[src]

Writes an image bitmap to the screen. The bitmap must be the same dimensions as the display. Anything greater than or equal to the threshold will be interpreted as a 1 pixel; anything under will be interpreted as a 0.

pub fn put_char(&mut self, char: char) -> OledResult
[src]

Writes a single character to the display at the current X,Y location (as set by set_text_xy() and incremented by the AddressingMode). Note: only printable ASCII is supported. Other characters will output as an empty square.

pub fn put_string(&mut self, string: &str) -> OledResult
[src]

Writes a string to the display, starting at the current X, Y location (as set by set_text_xy and incremented by the AddressingMode). None: only printable ASCII is supported

pub fn set_addressing_mode(&mut self, mode: AddressingMode) -> OledResult
[src]

Sets the addressing mode to the supplied AddressingMode. See AddressingMode for more details. Default is AddressingMode::Horizontal.

Auto Trait Implementations

impl Send for Oled

impl Sync for Oled

Blanket Implementations

impl<T> From for T
[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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