9. API - LCD Module

9.1. Regular Classes

The following classes are intended for general use with the devices they represent. All classes in this section are concrete (not abstract).

9.1.1. LCM

class lannerpsp.LCM(check_platform: bool = False)[source]

LCD Module.

Parameters:

check_platform (bool) – Set to True to check if the platform supports this feature. Defaults to False for better compatibility.

Raises:
search_port() str[source]

Get the LCM current connected port and speed.

Returns:

the port and speed the LCM is currently connected to

Return type:

str

Raises:
reset() None[source]

Reset the LCD module.

Note

Support only UART type.

Raises:
set_backlight(enable: bool) None[source]

Set LCD module light on/off status.

Example:

>>> lcm = LCM()
>>> lcm.set_backlight(True)
Parameters:

enable (bool) – set True to enable backlight, otherwise False

Raises:
set_cursor(row: int, column: int = 1) None[source]

Set LCM cursor.

Example:

>>> lcm = LCM()
>>> lcm.set_cursor(2, 6)
Parameters:
  • row (int) – row value of LCM display cursor

  • column (int) – column value of LCM display cursor

Raises:
write(msg: str) None[source]

Write string to LCD module.

Note

The maximum string length depends on the LCD module, normally 40 characters.

Example:

>>> lcm = LCM()
>>> lcm.write("Hello World")
Parameters:

msg (str) – message string to LCM display

Raises:
clear() None[source]

Clear LCM display.

Example:

>>> lcm = LCM()
>>> lcm.clear()
Raises:
get_keys_status() int[source]

Get LCM keys status.

bit 0 means Key 1, bit 1 means Key2, bit 2 means Key 3, bit 3 means Key4

1: pressed , 0: released

  • 0 (0000): key1 -> off, key2 -> off, key3 -> off, key4 -> off

  • 1 (0001): key1 -> on, key2 -> off, key3 -> off, key4 -> off

  • 2 (0010): key1 -> off, key2 -> on, key3 -> off, key4 -> off

  • 4 (0100): key1 -> off, key2 -> off, key3 -> on, key4 -> off

  • 8 (1000): key1 -> off, key2 -> off, key3 -> off, key4 -> on

Example:

>>> lcm = LCM()
>>> lcm.get_keys_status()
2
Returns:

LCM keys status

Return type:

int

Raises:
exec_callback() None[source]

Use callback function to detect LCM Keys status.

Example:

>>> lcm = LCM()
>>> lcm.exec_callback()
----> hook LCM Keys Callback OK <----
===> pause !!! hit <enter> to end <===
<Callback> LCM Item = 0x08, Status = 0x08, time is 2022/08/02 16:48:28
<Callback> LCM Item = 0x08, Status = 0x00, time is 2022/08/02 16:48:28
<Callback> LCM Item = 0x04, Status = 0x04, time is 2022/08/02 16:48:29
<Callback> LCM Item = 0x04, Status = 0x00, time is 2022/08/02 16:48:29
<Callback> LCM Item = 0x08, Status = 0x08, time is 2022/08/02 16:48:30
<Callback> LCM Item = 0x08, Status = 0x00, time is 2022/08/02 16:48:30
<Callback> LCM Item = 0x02, Status = 0x02, time is 2022/08/02 16:48:31
<Callback> LCM Item = 0x02, Status = 0x00, time is 2022/08/02 16:48:31
<Callback> LCM Item = 0x01, Status = 0x01, time is 2022/08/02 16:48:31
<Callback> LCM Item = 0x01, Status = 0x00, time is 2022/08/02 16:48:31
<Callback> LCM Item = 0x08, Status = 0x08, time is 2022/08/02 16:48:32
<Callback> LCM Item = 0x08, Status = 0x00, time is 2022/08/02 16:48:32

----> hook LCM Keys Callback Disable OK <----

9.2. Supported Platforms

The following platforms have been verified and confirmed to be supported: