Struct LedMatrixOptions

Source
pub struct LedMatrixOptions(/* private fields */);
Expand description

Options related to the LED matrix, like rows/cols/HW mapping

Implementations§

Source§

impl LedMatrixOptions

Source

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.

Source

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.

Source

pub fn set_rows(&mut self, rows: u32)

Sets the number of rows on the panels being used. Typically 8, 16, 32 or 64.

Source

pub fn set_cols(&mut self, cols: u32)

Sets the number of columns on the panels being used. Typically 32 or 64.

Source

pub fn set_chain_length(&mut self, chain_length: u32)

Sets the number of panels daisy-chained together.

Source

pub fn set_parallel(&mut self, parallel: u32)

Sets the number of parallel chains. Valid range: [1,3].

Source

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

Source

pub fn set_pwm_lsb_nanoseconds(&mut self, pwm_lsb_nanoseconds: u32)

Sets the number of nanoseconds of delay for our LSB

Source

pub fn set_brightness(&mut self, brightness: u8) -> Result<(), &'static str>

Sets the panel brightness in percent.

§Errors

If the given brightness is not in the range [1,100].

Source

pub fn set_scan_mode(&mut self, scan_mode: u32)

Sets the scan mode. 0: progressive, 1: interlaced.

Source

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.

Source

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.

Source

pub fn set_hardware_pulsing(&mut self, enable: bool)

Sets if hardware pin-pulse generation should be used.

Source

pub fn set_refresh_rate(&mut self, enable: bool)

Configures if the current refresh rate should be printed by the C++ library.

Source

pub fn set_inverse_colors(&mut self, enable: bool)

If set, invert the color displayed.

Source

pub fn set_multiplexing(&mut self, multiplexing: u32)

Sets the type of multiplexing used.

  1. direct
  2. Stripe
  3. Checkered
  4. Spiral
  5. ZStripe
  6. ZnMirrorZStripe
  7. coreman
  8. Kaler2Scan
  9. ZStripeUneven
  10. P10-128x4-Z
  11. QiangLiQ8
  12. InversedZStripe
  13. P10Outdoor1R1G1-1
  14. P10Outdoor1R1G1-2
  15. P10Outdoor1R1G1-3
  16. P10CoremanMapper
  17. P8Outdoor1R1G1
Source

pub fn set_row_addr_type(&mut self, row_addr_type: u32)

Sets the type of row addressing to be used.

  1. default
  2. AB-addressed panels
  3. direct row select
  4. ABC-addressed panels
  5. ABC Shift + DE direct
Source

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.

Source

pub fn set_pwm_dither_bits(&mut self, pwm_dither_bits: u32)

Configures how many bits to use for time-based dithering.

Source

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.

Trait Implementations§

Source§

impl Debug for LedMatrixOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LedMatrixOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for LedMatrixOptions

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

OverflowingCasts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

UnwrappedCasts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

WrappingCasts the value.