pub struct Max7219<SPI> {
pub spi: SPI,
}
Expand description
A MAX7219 chip.
Currently, this driver does not support daisy-chaining multiple MAX7219 chips.
Fields§
§spi: SPI
Implementations§
Source§impl<SPI> Max7219<SPI>where
SPI: SpiDevice,
impl<SPI> Max7219<SPI>where
SPI: SpiDevice,
Sourcepub async fn clear(&mut self) -> Result<(), SPI::Error>
pub async fn clear(&mut self) -> Result<(), SPI::Error>
Clear the display by setting all digits to empty.
Sourcepub async fn set_intensity(&mut self, intensity: u8) -> Result<(), SPI::Error>
pub async fn set_intensity(&mut self, intensity: u8) -> Result<(), SPI::Error>
Set intensity level on the display,from 0x00
(dimmest) to 0x0F
(brightest).
Sourcepub async fn set_decode_mode(
&mut self,
mode: DecodeMode,
) -> Result<(), SPI::Error>
pub async fn set_decode_mode( &mut self, mode: DecodeMode, ) -> Result<(), SPI::Error>
Set decode mode to be used on input sent to the display chip.
See DecodeMode
for more information.
Sourcepub async fn write_digit_bytes(
&mut self,
digit: u8,
value: u8,
) -> Result<(), SPI::Error>
pub async fn write_digit_bytes( &mut self, digit: u8, value: u8, ) -> Result<(), SPI::Error>
Write a byte to a digit on the display.
A typical 7-segment display has the following layout:
A
---
F | | B
| G |
---
E | | C
| D |
--- . DP
Byte | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
Segment | DP | A | B | C | D | E | F | G |
To display the number 5
, for example, the byte 0b0101_1011
would be
sent to the display.
Sourcepub async fn write_str(
&mut self,
string: &[u8; 8],
dots: u8,
) -> Result<(), SPI::Error>
pub async fn write_str( &mut self, string: &[u8; 8], dots: u8, ) -> Result<(), SPI::Error>
Write byte string to the display
§Arguments
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)
Sourcepub async fn write_integer(&mut self, value: i32) -> Result<(), SPI::Error>
pub async fn write_integer(&mut self, value: i32) -> Result<(), SPI::Error>
Write a right justified integer with sign.
Sourcepub async fn write_hex(&mut self, value: u32) -> Result<(), SPI::Error>
pub async fn write_hex(&mut self, value: u32) -> Result<(), SPI::Error>
Write a right justified hex formatted integer with sign.
Sourcepub async fn write_raw(&mut self, raw: &[u8; 8]) -> Result<(), SPI::Error>
pub async fn write_raw(&mut self, raw: &[u8; 8]) -> Result<(), SPI::Error>
Write a raw value to the display.
Sourcepub async fn set_test(&mut self, enable: bool) -> Result<(), SPI::Error>
pub async fn set_test(&mut self, enable: bool) -> Result<(), SPI::Error>
Enable or disable the display test mode.
Sourcepub const fn new(spi: SPI) -> Self
pub const fn new(spi: SPI) -> Self
Create a new instance of the MAX7219 driver.
After creating a new instance, you should call the Max7219::init
method to initialize the display.