Struct max7219::MAX7219 [−][src]
pub struct MAX7219<CONNECTOR> { /* 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. The actual connection interface is selected via constructor functions.
Implementations
impl<CONNECTOR> MAX7219<CONNECTOR> where
CONNECTOR: Connector,
[src]
impl<CONNECTOR> MAX7219<CONNECTOR> where
CONNECTOR: Connector,
[src]pub fn power_on(&mut self) -> Result<(), DataError>
[src]
pub fn power_on(&mut self) -> Result<(), DataError>
[src]Powers on all connected displays
Errors
DataError
- returned in case there was an error during data transfer
pub fn power_off(&mut self) -> Result<(), DataError>
[src]
pub fn power_off(&mut self) -> Result<(), DataError>
[src]Powers off all connected displays
Errors
DataError
- returned in case there was an error during data transfer
pub fn clear_display(&mut self, addr: usize) -> Result<(), DataError>
[src]
pub fn clear_display(&mut self, addr: usize) -> Result<(), DataError>
[src]pub fn set_intensity(
&mut self,
addr: usize,
intensity: u8
) -> Result<(), DataError>
[src]
pub fn set_intensity(
&mut self,
addr: usize,
intensity: u8
) -> Result<(), DataError>
[src]pub fn set_decode_mode(
&mut self,
addr: usize,
mode: DecodeMode
) -> Result<(), DataError>
[src]
pub fn set_decode_mode(
&mut self,
addr: usize,
mode: DecodeMode
) -> Result<(), DataError>
[src]pub fn write_str(
&mut self,
addr: usize,
string: &[u8; 8],
dots: u8
) -> Result<(), DataError>
[src]
pub fn write_str(
&mut self,
addr: usize,
string: &[u8; 8],
dots: u8
) -> Result<(), DataError>
[src]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
DataError
- returned in case there was an error during data transfer
pub fn write_bcd(&mut self, addr: usize, bcd: &[u8; 8]) -> Result<(), DataError>
[src]
pub fn write_bcd(&mut self, addr: usize, bcd: &[u8; 8]) -> Result<(), DataError>
[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
DataError
- returned in case there was an error during data transfer
impl<DATA, CS, SCK> MAX7219<PinConnector<DATA, CS, SCK>> where
DATA: OutputPin,
CS: OutputPin,
SCK: OutputPin,
[src]
impl<DATA, CS, SCK> MAX7219<PinConnector<DATA, CS, SCK>> where
DATA: OutputPin,
CS: OutputPin,
SCK: OutputPin,
[src]pub fn from_pins(
displays: usize,
data: DATA,
cs: CS,
sck: SCK
) -> Result<Self, DataError>
[src]
pub fn from_pins(
displays: usize,
data: DATA,
cs: CS,
sck: SCK
) -> Result<Self, DataError>
[src]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
DataError
- returned in case there was an error during data transfer
impl<SPI> MAX7219<SpiConnector<SPI>> where
SPI: Write<u8>,
[src]
impl<SPI> MAX7219<SpiConnector<SPI>> where
SPI: Write<u8>,
[src]pub fn from_spi(displays: usize, spi: SPI) -> Result<Self, DataError>
[src]
pub fn from_spi(displays: usize, spi: SPI) -> Result<Self, DataError>
[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
DataError
- returned in case there was an error during data transfer
impl<SPI, CS> MAX7219<SpiConnectorSW<SPI, CS>> where
SPI: Write<u8>,
CS: OutputPin,
[src]
impl<SPI, CS> MAX7219<SpiConnectorSW<SPI, CS>> where
SPI: Write<u8>,
CS: OutputPin,
[src]pub fn from_spi_cs(displays: usize, spi: SPI, cs: CS) -> Result<Self, DataError>
[src]
pub fn from_spi_cs(displays: usize, spi: SPI, cs: CS) -> Result<Self, DataError>
[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
DataError
- returned in case there was an error during data transfer
Auto Trait Implementations
impl<CONNECTOR> Send for MAX7219<CONNECTOR> where
CONNECTOR: Send,
CONNECTOR: Send,
impl<CONNECTOR> Sync for MAX7219<CONNECTOR> where
CONNECTOR: Sync,
CONNECTOR: Sync,
impl<CONNECTOR> Unpin for MAX7219<CONNECTOR> where
CONNECTOR: Unpin,
CONNECTOR: Unpin,