[−][src]Struct max7219::MAX7219
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]
DATA: OutputPin,
CS: OutputPin,
CLK: OutputPin,
PinError: From<<DATA as OutputPin>::Error>,
PinError: From<<CS as OutputPin>::Error>,
PinError: From<<CLK as OutputPin>::Error>,
pub fn new(
devices: usize,
data: DATA,
cs: CS,
clk: CLK
) -> Result<Self, PinError>
[src]
devices: usize,
data: DATA,
cs: CS,
clk: CLK
) -> Result<Self, PinError>
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 seriesdata
- the MOSI/DATA PIN previously set to Output modecs
- the CS/SS PIN previously set to Output modeclk
- 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]
&mut self,
addr: usize,
intensity: u8
) -> Result<(), PinError>
Sets intensity level on the display
Arguments
addr
- display to address as connected in seriesintensity
- intensity value to set to0x00
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]
&mut self,
addr: usize,
mode: DecodeMode
) -> Result<(), PinError>
Sets decode mode to be used on input sent to the display chip.
Arguments
addr
- display to address as connected in seriesmode
- 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]
&mut self,
addr: usize,
command: Command,
data: u8
) -> Result<(), PinError>
Writes data to given register as described by command
Arguments
addr
- display to address as connected in seriescommand
- the command/register on the display to write todata
- 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]
Auto Trait Implementations
impl<DATA, CS, CLK> Send for MAX7219<DATA, CS, CLK> where
CLK: Send,
CS: Send,
DATA: Send,
CLK: Send,
CS: Send,
DATA: Send,
impl<DATA, CS, CLK> Sync for MAX7219<DATA, CS, CLK> where
CLK: Sync,
CS: Sync,
DATA: Sync,
CLK: Sync,
CS: Sync,
DATA: Sync,
Blanket Implementations
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,