[−][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. The actual connection interface is selected via constructor functions.
Methods
impl<CONNECTOR> MAX7219<CONNECTOR> where
CONNECTOR: Connector,
[src]
CONNECTOR: Connector,
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 (0 -> last)
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 series (0 -> last)intensity
- 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 series (0 -> last)mode
- the decode mode to set
Errors
PinError
- returned in case there was an error setting a PIN on the device
pub fn write_str(
&mut self,
addr: usize,
string: &[u8; 8],
dots: u8
) -> Result<(), PinError>
[src]
&mut self,
addr: usize,
string: &[u8; 8],
dots: u8
) -> Result<(), PinError>
Writes byte string to the display
Arguments
addr
- display to address as connected in series (0 -> last)string
- the byte string to send 8 bytes long. Unknown characters result in question mark.dots
- u8 bit array specifying where to put dots in the string (1 = dot, 0 = not)
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
addr
- display to address as connected in series (0 -> last)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]
impl<DATA, CS, SCK> MAX7219<PinConnector<DATA, CS, SCK>> where
DATA: OutputPin,
CS: OutputPin,
SCK: OutputPin,
PinError: From<DATA::Error>,
PinError: From<CS::Error>,
PinError: From<SCK::Error>,
[src]
DATA: OutputPin,
CS: OutputPin,
SCK: OutputPin,
PinError: From<DATA::Error>,
PinError: From<CS::Error>,
PinError: From<SCK::Error>,
pub fn from_pins(
displays: usize,
data: DATA,
cs: CS,
sck: SCK
) -> Result<Self, PinError>
[src]
displays: usize,
data: DATA,
cs: CS,
sck: SCK
) -> Result<Self, PinError>
Construct a new MAX7219 driver instance from DATA, CS and SCK pins.
Arguments
displays
- number of displays connected in seriesdata
- the MOSI/DATA PIN used to send data through to the display set to output modecs
- the CS PIN used to LOAD register on the display set to output modesck
- the SCK clock PIN used to drive the clock set to output mode
Errors
PinError
- returned in case there was an error setting a PIN on the device
impl<SPI> MAX7219<SpiConnector<SPI>> where
SPI: Write<u8>,
PinError: From<()>,
PinError: From<SPI::Error>,
[src]
SPI: Write<u8>,
PinError: From<()>,
PinError: From<SPI::Error>,
pub fn from_spi(displays: usize, spi: SPI) -> Result<Self, PinError>
[src]
Construct a new MAX7219 driver instance from pre-existing SPI in full hardware mode. The SPI will control CS (LOAD) line according to it's internal mode set. If you need the CS line to be controlled manually use MAX7219::from_spi_cs
NOTE
- make sure the SPI is initialized in MODE_0 with max 10 Mhz frequency.
Arguments
displays
- number of displays connected in seriesspi
- the SPI interface initialized with MOSI, MISO(unused) and CLK
Errors
PinError
- returned in case there was an error setting a PIN on the device
impl<SPI, CS> MAX7219<SpiConnectorSW<SPI, CS>> where
SPI: Write<u8>,
CS: OutputPin,
PinError: From<()>,
PinError: From<SPI::Error>,
PinError: From<CS::Error>,
[src]
SPI: Write<u8>,
CS: OutputPin,
PinError: From<()>,
PinError: From<SPI::Error>,
PinError: From<CS::Error>,
pub fn from_spi_cs(displays: usize, spi: SPI, cs: CS) -> Result<Self, PinError>
[src]
Construct a new MAX7219 driver instance from pre-existing SPI and CS pin set to output. This version of the connection uses the CS pin manually to avoid issues with how the CS mode is handled in hardware SPI implementations.
NOTE
- make sure the SPI is initialized in MODE_0 with max 10 Mhz frequency.
Arguments
displays
- number of displays connected in seriesspi
- the SPI interface initialized with MOSI, MISO(unused) and CLKcs
- the CS PIN used to LOAD register on the display set to output mode
Errors
PinError
- returned in case there was an error setting a PIN on the device
Auto Trait Implementations
impl<CONNECTOR> Unpin for MAX7219<CONNECTOR> where
CONNECTOR: Unpin,
CONNECTOR: Unpin,
impl<CONNECTOR> Send for MAX7219<CONNECTOR> where
CONNECTOR: Send,
CONNECTOR: Send,
impl<CONNECTOR> Sync for MAX7219<CONNECTOR> where
CONNECTOR: Sync,
CONNECTOR: 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,