hub.lcd

The hub’s screen.

Turn the backlight on and off or change its brightness. To draw on the screen use the lvgl module, which is ready as soon as your program starts. While your program runs, call lvgl.timer_handler() regularly (for example every 5 ms in your main loop) so the screen keeps updating.

Functions marked Advanced talk to the screen hardware directly and are only needed for testing or new screen types.

Functions

backlight(duty) → None

Set the screen brightness from 0 (off) to 255 (brightest).

cmd(cmd[, data]) → None

Advanced: send a raw command (and optional data bytes) to the screen chip.

fill(rgb565) → None

Advanced: fill the whole screen with one color, skipping LVGL.

init() → None

Advanced: restart the screen's drawing system (LVGL).

loop() → None

Advanced: run one screen update step.

off() → None

Turn the screen's backlight off.

on() → None

Turn the screen's backlight fully on.

reset() → None

Advanced: restart the screen hardware.

setInvert(on) → None

Advanced: swap all screen colors for their opposites.

setMadctl(byte) → None

Advanced: set the screen's orientation/mirroring register (MADCTL).

setOffset(x, y) → None

Advanced: shift the picture on the panel by x columns and y rows.

Module Contents

hub.lcd.backlight(duty: int) → None[source]

Set the screen brightness from 0 (off) to 255 (brightest).

hub.lcd.cmd(cmd: int, data: bytes = b'') → None[source]

Advanced: send a raw command (and optional data bytes) to the screen chip.

hub.lcd.fill(rgb565: int) → None[source]

Advanced: fill the whole screen with one color, skipping LVGL.

The color is a 16-bit RGB565 number, e.g. 0xF800 is red, 0x07E0 green and 0x001F blue. Handy to test the screen.

hub.lcd.init() → None[source]

Advanced: restart the screen’s drawing system (LVGL).

Not needed normally — it is already running when your program starts. Only use it if you shut LVGL down yourself.

hub.lcd.loop() → None[source]

Advanced: run one screen update step.

Call this repeatedly (about every 5 ms) if you drive LVGL from your own thread. Most programs use lvgl.timer_handler() in their main loop instead.

hub.lcd.off() → None[source]

Turn the screen’s backlight off.

hub.lcd.on() → None[source]

Turn the screen’s backlight fully on.

hub.lcd.reset() → None[source]

Advanced: restart the screen hardware.

hub.lcd.setInvert(on: bool) → None[source]

Advanced: swap all screen colors for their opposites.

hub.lcd.setMadctl(byte: int) → None[source]

Advanced: set the screen’s orientation/mirroring register (MADCTL).

Bits: MY(0x80) MX(0x40) MV(0x20) ML(0x10) BGR(0x08).

hub.lcd.setOffset(x: int, y: int) → None[source]

Advanced: shift the picture on the panel by x columns and y rows.

Some screen variants need this to line up, e.g. (2, 3) or (26, 1).