]>
vault307.fbx.one Git - lcdTracker.git/blob - groveLCD.py
6 # this device has two I2C addresses
7 DISPLAY_RGB_ADDR
= 0x62
8 DISPLAY_TEXT_ADDR
= 0x3e
19 def reg_write(i2c
,addr
,reg
,data
):
22 i2c
.writeto_mem(addr
,reg
,msg
)
24 # set backlight to (R,G,B) (values from 0..255 for each)
26 reg_write(i2c
,DISPLAY_RGB_ADDR
,RGB_REG0
,0)
27 reg_write(i2c
,DISPLAY_RGB_ADDR
,RGB_REG1
,0)
28 reg_write(i2c
,DISPLAY_RGB_ADDR
,RGB_REG5
,0xaa)
29 reg_write(i2c
,DISPLAY_RGB_ADDR
,RGB_REGR
,r
)
30 reg_write(i2c
,DISPLAY_RGB_ADDR
,RGB_REGG
,g
)
31 reg_write(i2c
,DISPLAY_RGB_ADDR
,RGB_REGB
,b
)
34 reg_write(i2c
,DISPLAY_TEXT_ADDR
,0x80,cmd
)
39 textCommand(0x08 |
0x04)
45 if c
== '\n' or count
== 16:
54 reg_write(i2c
,DISPLAY_TEXT_ADDR
,0x40,ord(c
))
56 def setText_norefresh(text
):
57 textCommand(0x02) # return home
59 textCommand(0x08 |
0x04) # display on, no cursor
60 textCommand(0x28) # 2 lines
64 while len(text
) < 32: #clears the rest of the screen
67 if c
== '\n' or count
== 16:
76 reg_write(i2c
,DISPLAY_TEXT_ADDR
,0x40,ord(c
))