Library to control smlcd Automation Card
Project description
sm_lcd
This is the python library to control the Six-in-one LCD Adapter Kit Using 2004 or 1602 LCDs for Raspberry Pi.
Install
sudo pip install SMlcd
Usage
~$ python
Python 3.10.7 (main, Nov 7 2022, 22:59:03) [GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sm_lcd
>>> lcd = sm_lcd.SMlcd()
>>> lcd.bl_single(50)
>>> lcd.display_init()
>>> lcd.text_write_at(1, 1, 'Hello world')
>>>
More usage example in the examples folder
Functions prototypes
sm-lcd libray documentation
class sm_lcd.SMlcd(i2c = 1)
- Description
- Init the SMlcd object and check the card presence
- Parameters
- i2c : I2C port number, 1 - Raspberry default, 7 - rock pi 4, etc.
- Returns
- card object
busy()
- Description
- Get the LCD Display busy flag
- Parameters
- none
- Returns
- 1 if the LCD is busy; 0 otherwise
cmd(value)
- Description
- Send a command to the LCD Display
- Parameters
- value: command value, for example, Clear Display command value is 0x01
- Returns
- none
display_init()
- Description
- Default initialization for two or more lines display, not show cursor, no blinking cursor, no shifting. For custom initialization use cmd() function.
- Parameters
- none
- Returns
- none
data_write(value)
- Description
- Write one byte of data to the display
- Parameters
- value: The byte that will be sent to the LCD display
- Returns
- none
data_read()
- Description
- Read one byte of data from the display
- Parameters
- none
- Returns
- One byte of data
cursor_set(line, column)
- Description
- Set cursor position, this function works for multiline display, with a maximum of 4 lines and 20 columns
- Parameters
- line: line number [1..4]
- column: column number [1..20]
- Returns
- none
text_write(text)
- Description
- Write a text at the cursor's current position. The function does not check the text length
- Parameters
- text: the string to be displayed
- Returns
- none
text_write_at(line, column, text):
- Description
- Write a text at the specified position. The function does not check the text length
- Parameters
- line display line number [1..4]
- column display column number [1..20]
- text the string to be displayed
- Returns
- none
bl_single(val)
- Description
- Set the single-color display backlight intensity
- Parameters
- val: intensity in precentage [0..100]
- Returns
- none
bl_rgb(red, green, blue)
- Description
- Set the RGB display backlight intensity by color
- Parameters
- red: red color intensity [0..100]
- green: green color intensity [0..100]
- blue: blue color intensity [0..100]
- Returns
- none
get_button(button)
- Description
- Get one pushbutton current state
- Parameters
- button: button number [1..6]
- Returns
- button state: 1 - button is pressed; 0 - otherwise
get_all_buttons()
- Description
- Returns the state of all 6 buttons as a bitmap
- Parameters
- none
- Returns
- all buttons state [0x00..0x3f]
get_button_int(button)
- Description
- Return 1 if a button has been pushed since the last call of this function. This function tells you if a button has generated an interrupt.
- Parameters
- button: button number [1..6]
- Returns
- 1 - the button has been pushed since last read; 0 - if not
get_all_buttons_int()
- Description
- Returns the interrupt flag for all buttons and the rotary encoder as a bitmap, buttons bits 0..5, encoder change interrupt bot 7.
- Parameters
- none
- Returns
- Interrupt flags
get_encoder_int()
- Description
- Get the encoder on change interrupt flag
- Parameters
- none
- Returns
- 1 - encoder value has been changed; 0 - if not
get_encoder_val()
- Description
- Get the encoder accumulated value as a 16 bits signed integer
- Parameters
- none
- Returns
- encoder value (-32767..32767)
reset_encoder()
- Description
- Reset the encoder value
- Parameters
- none
- Returns
- none
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
smlcd-1.0.1.tar.gz
(5.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smlcd-1.0.1.tar.gz.
File metadata
- Download URL: smlcd-1.0.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15c672cd97680aea3ad69b8631812dcc97bbab9a2349011802a40c9a5b58ee9c
|
|
| MD5 |
7031e820e2a308668c9f66c19067c5f6
|
|
| BLAKE2b-256 |
c9c596534f06c4e9102870e0d5ccd8f71eb4930eaeeba31dd8b9f1b7e5f1e04a
|
File details
Details for the file smlcd-1.0.1-py2.py3-none-any.whl.
File metadata
- Download URL: smlcd-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2863fb44dfb6858c9242e20759e8c181afba0fdb1145aec406f7e7149df628bf
|
|
| MD5 |
62bc6557d283606d6909fe740841a498
|
|
| BLAKE2b-256 |
2f0cbd6518e9e24efec1514dcbe8ce70edac9b889878d61ed1e3d371de282e31
|