[][src]Module charlcd::custom_char

Create custom characters by defining their pixels.

A custom character is considered as a 8x5 pixel array.

You can declare a custom character by defining an array of type [u8; 8] where:

  • each byte represents a line;
  • each bit in the byte represent a pixel.

Only the 5 lower bits of the byte are used, because the character width is 5 pixels.

Example

/// ▸
#[cfg_attr(rustfmt, rustfmt_skip)]
pub const RIGHT_TRIANGLE: [u8; 8] = [
    0b00000,
    0b01000,
    0b01100,
    0b01110,
    0b01100,
    0b01000,
    0b00000,
    0b00000,
];

The #[cfg_attr(rustfmt, rustfmt_skip)] part is required in order to avoid rustfmt put each item after the next one so that we cannot see the visual pixel representation of the custom character anymore.

The custom character can then be put into the screen's memory by using the Screen::custom_char function.

Constants

DOWN_TRIANGLE

LEFT_TRIANGLE

RIGHT_TRIANGLE

UP_TRIANGLE

Functions

mirror_x

X axis mirror of a custom LCD character

mirror_y

Y axis mirror of a custom LCD character