Skip to content

Commit 03c810f

Browse files
add all files of lcd_i2c module
1 parent cd6a050 commit 03c810f

File tree

4 files changed

+751
-1
lines changed

4 files changed

+751
-1
lines changed

lcd_i2c/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
from .version import __version__
55

6-
from .blink import flash_led
6+
from .lcd_i2c import LCD

lcd_i2c/const.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: UTF-8 -*-
3+
4+
from micropython import const
5+
6+
# commands
7+
#: Clear display command
8+
LCD_CLEARDISPLAY = const(0x01)
9+
#: Return to home position command
10+
LCD_RETURNHOME = const(0x02)
11+
#: Set entry mode command
12+
LCD_ENTRYMODESET = const(0x04)
13+
#: Control display command
14+
LCD_DISPLAYCONTROL = const(0x08)
15+
#: Shift cursor command
16+
LCD_CURSORSHIFT = const(0x10)
17+
#: Set function command
18+
LCD_FUNCTIONSET = const(0x20)
19+
#: Set CGRAM address command
20+
LCD_SETCGRAMADDR = const(0x40)
21+
#: Set DDRAM address command
22+
LCD_SETDDRAMADDR = const(0x80)
23+
24+
# flags for display entry mode
25+
#: Set display entry mode as right command
26+
LCD_ENTRYRIGHT = const(0x00)
27+
#: Set display entry mode as left command
28+
LCD_ENTRYLEFT = const(0x02)
29+
#: Set display entry mode as shift increment command
30+
LCD_ENTRYSHIFTINCREMENT = const(0x01)
31+
#: Set display entry mode as shift decrement command
32+
LCD_ENTRYSHIFTDECREMENT = const(0x00)
33+
34+
# flags for display on/off control
35+
#: Turn display on command
36+
LCD_DISPLAYON = const(0x04)
37+
#: Turn display off command
38+
LCD_DISPLAYOFF = const(0x00)
39+
#: Turn cursor on command
40+
LCD_CURSORON = const(0x02)
41+
#: Turn cursor off command
42+
LCD_CURSOROFF = const(0x00)
43+
#: Set curor blink command
44+
LCD_BLINKON = const(0x01)
45+
#: Set curor no blink command
46+
LCD_BLINKOFF = const(0x00)
47+
48+
# flags for display/cursor shift
49+
#: Display move command
50+
LCD_DISPLAYMOVE = const(0x08)
51+
#: Move cursor command
52+
LCD_CURSORMOVE = const(0x00)
53+
#: Move display shift right command
54+
LCD_MOVERIGHT = const(0x04)
55+
#: Move display shift left command
56+
LCD_MOVELEFT = const(0x00)
57+
58+
# flags for function set
59+
#: 8 bit mode command
60+
LCD_8BITMODE = const(0x10)
61+
#: 4 bit mode command
62+
LCD_4BITMODE = const(0x00)
63+
#: 2 line command
64+
LCD_2LINE = const(0x08)
65+
#: 1 line command
66+
LCD_1LINE = const(0x00)
67+
#: 5x10 dots display command
68+
LCD_5x10DOTS = const(0x04)
69+
#: 5x8 dots display command
70+
LCD_5x8DOTS = const(0x00)
71+
72+
# flags for backlight control
73+
#: Activate backlight command
74+
LCD_BACKLIGHT = const(0x08)
75+
#: Deactivate backlight command
76+
LCD_NOBACKLIGHT = const(0x00)
77+
78+
# other
79+
#: Enable bit
80+
EN = const(0b00000100)
81+
#: Read/Write bit
82+
RW = const(0b00000010)
83+
#: Register select bit
84+
RS = const(0b00000001)

0 commit comments

Comments
 (0)