Crate logitech_lcd [] [src]

logitech-lcd provides binding for the Logitech Gaming LCD/Gamepanel SDK.

Overview

The Logitech LCD/GamePanel SDK introduces second screen capability that allows GamePanel-enabled Logitech gaming keyboards to display in-game info, system statistics, and more. The SDK enables integration of GamePanel functionality within your code.

Lcd Interface

The SDK interface is implemented by the Lcd struct. Create a new Lcd at start of program. Update the screen with the provided methods. The Lcd will automatically disconnect when the Lcd is dropped.

Examples

Monochrome:

let mut lcd = logitech_lcd::Lcd::init_mono("My Glorious Monochrome App").unwrap();

for i in 0..{
    lcd.set_mono_text(0, &format!("update:{}", i)[..]).unwrap();

    lcd.update();

    std::thread::sleep(std::time::Duration::from_millis(15));
}

Color:

let mut lcd = logitech_lcd::Lcd::init_color("My Glorious Color App").unwrap();

for i in 0..{
    lcd.set_color_text(0, &format!("update:{}", i)[..], i as u8,
        (i >> 8) as u8, (i >> 16) as u8).unwrap();

    lcd.update();

    std::thread::sleep(std::time::Duration::from_millis(15));
}

Monochrome and Color:

let mut lcd = logitech_lcd::Lcd::init_either("My Glorious App").unwrap();

for i in 0..{
    lcd.set_mono_text(0,  &format!("update:{}", i)[..]).unwrap();

    lcd.set_color_text(0, &format!("update:{}", i)[..], i as u8,
        (i >> 8) as u8, (i >> 16) as u8).unwrap();

    lcd.update();

    std::thread::sleep(std::time::Duration::from_millis(15));
}

Error Handling

The underling Logitech LCD/GamePanel SDK does unfortunately not return any info on error. We therefore only able report what function failed, but not why. See Error

Do’s and Don’ts

These are a few guidelines that may help you implement 'better' support in your application:

  • For color use a splash screen when the application starts up.
  • For color have a nice background image to take full advantage of the RGBA LCD.
  • Don’t just display information on the LCD that is already being displayed on main view of your application. Instead display information he can only see when hitting tab or going to the menu.
  • Use the LCD to unclutter the main view.
  • Write support for both the color and monochrome LCDs, as both have an important user base.
  • Text displayed on the LCD is fixed-width, so you can easily create multiple columns that always align correctly.
  • If you want to create custom screens, draw your own bitmaps and update the background LCD bitmap up to 60 times/second.
  • Use the buttons to create multiple pages or add functionality to the LCD.

Structs

Lcd

Main LCD interface

LcdButton

Lcd Button bitmap.

Enums

Error

Runtime LCD error

Constants

COLOR_HEIGHT

Color screen hight in pixels.

COLOR_WIDTH

Color screen witdh in pixels.

MONO_HEIGHT

Monochrome screen hight in pixels.

MONO_WIDTH

Monochrome screen width in pixels.