i2c_lcd package

Submodules

i2c_lcd.i2c_lcd module

GPL-licensed code found on GitHub Gists, contained below with some slight adjustments. Taken 2017-3-26.

https://gist.github.com/DenisFromHR/cc863375a6e19dce359d#file-rpi_i2c_driver-py

class i2c_lcd.i2c_lcd.i2c_device(addr=39, port=1)[source]

Class for communicating with I2C devices over SMBus.

Used to help the lcd class communicate with an I2C device via SMBus.

Args:
addr (hex str): Hex address of I2C device port (int): port for SMBus
write_cmd(cmd)[source]

Write a single command.

Args:
cmd (hex str): Hex command.
class i2c_lcd.i2c_lcd.lcd(addr=39)[source]

Class for interfacing with I2C LCD device.

backlight_on(set_to_on)[source]

Define backlight as on/off.

Args:
set_to_on (bool): True sets backlight on, False sets off.
lcd_clear()[source]

Clear lcd and set to home.

lcd_display_string(string, line)[source]

Displays string on lcd screen.

Args:
string (str): String to be displayed. line (int): Line for string to be displayed on. Must be 1-4.
lcd_display_string_pos(string, line, pos)[source]

Display string in precise position/offset.

Args:
string (str): String to be displayed. line (int): Line for string to be displayed on. Must be 1-4. pos (int): Offset for displaying string
lcd_load_custom_chars(fontdata)[source]

Load custom characters from font data.

Args:
fontdata (char[]): font data, max 7 characters.
lcd_strobe(data)[source]

Clocks enable bit to latch command.

Args:
data: data to write
lcd_write(cmd, mode=0)[source]

Write a command to lcd.

Args:
cmd (hex str): Hex command. mode (int): Mode? Defaults to 0.
lcd_write_char(charvalue, mode=1)[source]

Writes char to lcd.

Notes from original:
“write a character to lcd (or character rom) 0x09: backlight | RS=DR<”
Args:
charvalue (int): ordinal value of character to write. mode (int): Mode? Defaults to 1.
lcd_write_four_bits(data)[source]

Write four bits of data to lcd device.

Args:
data: data to write

Module contents

class i2c_lcd.lcd(addr=39)[source]

Class for interfacing with I2C LCD device.

backlight_on(set_to_on)[source]

Define backlight as on/off.

Args:
set_to_on (bool): True sets backlight on, False sets off.
lcd_clear()[source]

Clear lcd and set to home.

lcd_display_string(string, line)[source]

Displays string on lcd screen.

Args:
string (str): String to be displayed. line (int): Line for string to be displayed on. Must be 1-4.
lcd_display_string_pos(string, line, pos)[source]

Display string in precise position/offset.

Args:
string (str): String to be displayed. line (int): Line for string to be displayed on. Must be 1-4. pos (int): Offset for displaying string
lcd_load_custom_chars(fontdata)[source]

Load custom characters from font data.

Args:
fontdata (char[]): font data, max 7 characters.
lcd_strobe(data)[source]

Clocks enable bit to latch command.

Args:
data: data to write
lcd_write(cmd, mode=0)[source]

Write a command to lcd.

Args:
cmd (hex str): Hex command. mode (int): Mode? Defaults to 0.
lcd_write_char(charvalue, mode=1)[source]

Writes char to lcd.

Notes from original:
“write a character to lcd (or character rom) 0x09: backlight | RS=DR<”
Args:
charvalue (int): ordinal value of character to write. mode (int): Mode? Defaults to 1.
lcd_write_four_bits(data)[source]

Write four bits of data to lcd device.

Args:
data: data to write