pub struct LedMatrixOptions(/* private fields */);
Expand description
Options related to the LED matrix, like rows/cols/HW mapping
Implementations§
Source§impl LedMatrixOptions
impl LedMatrixOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new LedMatrixOptions
struct with the default parameters.
use rpi_led_matrix::{LedMatrix,LedMatrixOptions};
let mut options = LedMatrixOptions::new();
options.set_hardware_mapping("adafruit-hat-pwm");
let matrix = LedMatrix::new(Some(options), None).unwrap();
§Panics
If for some reason the conversion from constant literal strings to CString
fails.
It should never fail but we do .unwrap()
it.
Sourcepub fn set_hardware_mapping(&mut self, mapping: &str)
pub fn set_hardware_mapping(&mut self, mapping: &str)
Sets the type of GPIO mapping used (e.g., “adafruit-hat-pwm”).
§Panics
If the given mapping
string fails to convert to a CString
. This can
occur when there is a null character mid way in the string.
Sourcepub fn set_rows(&mut self, rows: u32)
pub fn set_rows(&mut self, rows: u32)
Sets the number of rows on the panels being used. Typically 8, 16, 32 or 64.
Sourcepub fn set_cols(&mut self, cols: u32)
pub fn set_cols(&mut self, cols: u32)
Sets the number of columns on the panels being used. Typically 32 or 64.
Sourcepub fn set_chain_length(&mut self, chain_length: u32)
pub fn set_chain_length(&mut self, chain_length: u32)
Sets the number of panels daisy-chained together.
Sourcepub fn set_parallel(&mut self, parallel: u32)
pub fn set_parallel(&mut self, parallel: u32)
Sets the number of parallel chains. Valid range: [1,3].
Sourcepub fn set_pwm_bits(&mut self, pwm_bits: u8) -> Result<(), &'static str>
pub fn set_pwm_bits(&mut self, pwm_bits: u8) -> Result<(), &'static str>
Sets the number of PWM bits to use. Valid range: [0,11].
§Errors
If the given pwm_bits
is outside the valid range
Sourcepub fn set_pwm_lsb_nanoseconds(&mut self, pwm_lsb_nanoseconds: u32)
pub fn set_pwm_lsb_nanoseconds(&mut self, pwm_lsb_nanoseconds: u32)
Sets the number of nanoseconds of delay for our LSB
Sourcepub fn set_scan_mode(&mut self, scan_mode: u32)
pub fn set_scan_mode(&mut self, scan_mode: u32)
Sets the scan mode. 0: progressive, 1: interlaced.
Sourcepub fn set_led_rgb_sequence(&mut self, sequence: &str)
pub fn set_led_rgb_sequence(&mut self, sequence: &str)
Sets the ordering of the LEDs on your panel.
§Panics
If the given sequence
string fails to convert to a CString
. This can
occur when there is a null character mid way in the string.
Sourcepub fn set_pixel_mapper_config(&mut self, mapper: &str)
pub fn set_pixel_mapper_config(&mut self, mapper: &str)
Semicolon-separated list of pixel-mappers to arrange pixels (e.g. “U-mapper;Rotate:90”).
Valid mapping options
Mirror
Rotate:<Angle>
U-mapper
V-mapper
§Panics
If the given mapper
string fails to convert to a CString
. This can
occur when there is a null character mid way in the string.
Sourcepub fn set_hardware_pulsing(&mut self, enable: bool)
pub fn set_hardware_pulsing(&mut self, enable: bool)
Sets if hardware pin-pulse generation should be used.
Sourcepub fn set_refresh_rate(&mut self, enable: bool)
pub fn set_refresh_rate(&mut self, enable: bool)
Configures if the current refresh rate should be printed by the C++ library.
Sourcepub fn set_inverse_colors(&mut self, enable: bool)
pub fn set_inverse_colors(&mut self, enable: bool)
If set, invert the color displayed.
Sourcepub fn set_multiplexing(&mut self, multiplexing: u32)
pub fn set_multiplexing(&mut self, multiplexing: u32)
Sets the type of multiplexing used.
direct
Stripe
Checkered
Spiral
ZStripe
ZnMirrorZStripe
coreman
Kaler2Scan
ZStripeUneven
P10-128x4-Z
QiangLiQ8
InversedZStripe
P10Outdoor1R1G1-1
P10Outdoor1R1G1-2
P10Outdoor1R1G1-3
P10CoremanMapper
P8Outdoor1R1G1
Sourcepub fn set_row_addr_type(&mut self, row_addr_type: u32)
pub fn set_row_addr_type(&mut self, row_addr_type: u32)
Sets the type of row addressing to be used.
- default
- AB-addressed panels
- direct row select
- ABC-addressed panels
- ABC Shift + DE direct
Sourcepub fn set_limit_refresh(&mut self, limit_refresh: u32)
pub fn set_limit_refresh(&mut self, limit_refresh: u32)
Limit refresh rate to this frequency in Hz. (0 = no limit)
Useful to keep a constant refresh rate on loaded system.
Sourcepub fn set_pwm_dither_bits(&mut self, pwm_dither_bits: u32)
pub fn set_pwm_dither_bits(&mut self, pwm_dither_bits: u32)
Configures how many bits to use for time-based dithering.
Sourcepub fn set_panel_type(&mut self, panel_type: &str)
pub fn set_panel_type(&mut self, panel_type: &str)
Needed to initialize special panels. Supported: ‘FM6126A’, ‘FM6127’
§Panics
If the given panel_type
string fails to convert to a CString
. This can
occur when there is a null character mid way in the string.