[][src]Struct max7219::MAX7219

pub struct MAX7219<DATA, CS, CLK> { /* fields omitted */ }

Handles communication with the MAX7219 chip for segmented displays. Each display can be connected in series with another and controlled via a single connection.

Methods

impl<DATA, CS, CLK> MAX7219<DATA, CS, CLK> where
    DATA: OutputPin,
    CS: OutputPin,
    CLK: OutputPin,
    PinError: From<<DATA as OutputPin>::Error>,
    PinError: From<<CS as OutputPin>::Error>,
    PinError: From<<CLK as OutputPin>::Error>, 
[src]

pub fn new(
    devices: usize,
    data: DATA,
    cs: CS,
    clk: CLK
) -> Result<Self, PinError>
[src]

Returns a new MAX7219 handler for the displays Each display starts blanked, with power and test mode turned off

Arguments

  • devices - number of displays connected in series
  • data - the MOSI/DATA PIN previously set to Output mode
  • cs - the CS/SS PIN previously set to Output mode
  • clk - the CLK PIN previously set to Output mode

Errors

  • PinError - returned in case there was an error setting a PIN on the device

pub fn power_on(&mut self) -> Result<(), PinError>[src]

Powers on all connected displays

Errors

  • PinError - returned in case there was an error setting a PIN on the device

pub fn power_off(&mut self) -> Result<(), PinError>[src]

Powers off all connected displays

Errors

  • PinError - returned in case there was an error setting a PIN on the device

pub fn clear_display(&mut self, addr: usize) -> Result<(), PinError>[src]

Clears display by settings all digits to empty

Arguments

  • addr - display to address as connected in series

Errors

  • PinError - returned in case there was an error setting a PIN on the device

pub fn set_intensity(
    &mut self,
    addr: usize,
    intensity: u8
) -> Result<(), PinError>
[src]

Sets intensity level on the display

Arguments

  • addr - display to address as connected in series
  • intensity - intensity value to set to 0x00 to 0x0F`

Errors

  • PinError - returned in case there was an error setting a PIN on the device

pub fn set_decode_mode(
    &mut self,
    addr: usize,
    mode: DecodeMode
) -> Result<(), PinError>
[src]

Sets decode mode to be used on input sent to the display chip.

Arguments

  • addr - display to address as connected in series
  • mode - the decode mode to set

Errors

  • PinError - returned in case there was an error setting a PIN on the device

pub fn write_data(
    &mut self,
    addr: usize,
    command: Command,
    data: u8
) -> Result<(), PinError>
[src]

Writes data to given register as described by command

Arguments

  • addr - display to address as connected in series
  • command - the command/register on the display to write to
  • data - the data byte value

Errors

  • PinError - returned in case there was an error setting a PIN on the device

pub fn write_str(&mut self, addr: usize, bcd: &[u8; 8]) -> Result<(), PinError>[src]

Writes byte string to the display

Arguments

  • addrs - list of devices over which to write the total bcd string (left to right)
  • bcd - the byte string to send 8 bytes long. Unknown characters result in question mark.

Errors

  • PinError - returned in case there was an error setting a PIN on the device

pub fn write_bcd(&mut self, addr: usize, bcd: &[u8; 8]) -> Result<(), PinError>[src]

Writes BCD encoded string to the display

Arguments

  • addrs - list of devices over which to write the total bcd string (left to right)
  • bcd - the bcd encoded string slice consisting of [0-9,-,E,L,H,P] where upper case input for alphabetic characters results in dot being set. Length of string is always 8 bytes, use spaces for blanking.

Errors

  • PinError - returned in case there was an error setting a PIN on the device

pub fn test(&mut self, addr: usize, is_on: bool) -> Result<(), PinError>[src]

Set test mode on/off

Arguments

  • addr - display to address as connected in series
  • is_on - whether to turn test mode on or off

Errors

  • PinError - returned in case there was an error setting a PIN on the device

Auto Trait Implementations

impl<DATA, CS, CLK> Send for MAX7219<DATA, CS, CLK> where
    CLK: Send,
    CS: Send,
    DATA: Send

impl<DATA, CS, CLK> Sync for MAX7219<DATA, CS, CLK> where
    CLK: Sync,
    CS: Sync,
    DATA: Sync

Blanket Implementations

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> Into<U> for T where
    U: From<T>, 
[src]

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

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.

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

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

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