stuff
This commit is contained in:
parent
320eea6faa
commit
b88fb8b436
1 changed files with 8 additions and 8 deletions
16
LCD.py
16
LCD.py
|
|
@ -42,12 +42,12 @@ class LCD:
|
||||||
raise ValueError('pi_rev param must be 1 or 2')
|
raise ValueError('pi_rev param must be 1 or 2')
|
||||||
|
|
||||||
# Initialise display
|
# Initialise display
|
||||||
self.lcd_byte(0x33, self.LCD_CMD) # 110011 Initialise
|
await self.lcd_byte(0x33, self.LCD_CMD) # 110011 Initialise
|
||||||
self.lcd_byte(0x32, self.LCD_CMD) # 110010 Initialise
|
await self.lcd_byte(0x32, self.LCD_CMD) # 110010 Initialise
|
||||||
self.lcd_byte(0x06, self.LCD_CMD) # 000110 Cursor move direction
|
await self.lcd_byte(0x06, self.LCD_CMD) # 000110 Cursor move direction
|
||||||
self.lcd_byte(0x0C, self.LCD_CMD) # 001100 Display On,Cursor Off, Blink Off
|
await self.lcd_byte(0x0C, self.LCD_CMD) # 001100 Display On,Cursor Off, Blink Off
|
||||||
self.lcd_byte(0x28, self.LCD_CMD) # 101000 Data length, number of lines, font size
|
await self.lcd_byte(0x28, self.LCD_CMD) # 101000 Data length, number of lines, font size
|
||||||
self.lcd_byte(0x01, self.LCD_CMD) # 000001 Clear display
|
await self.lcd_byte(0x01, self.LCD_CMD) # 000001 Clear display
|
||||||
|
|
||||||
async def lcd_byte(self, bits, mode):
|
async def lcd_byte(self, bits, mode):
|
||||||
# Send byte to data pins
|
# Send byte to data pins
|
||||||
|
|
@ -59,11 +59,11 @@ class LCD:
|
||||||
|
|
||||||
# High bits
|
# High bits
|
||||||
self.bus.write_byte(self.I2C_ADDR, bits_high)
|
self.bus.write_byte(self.I2C_ADDR, bits_high)
|
||||||
self.toggle_enable(bits_high)
|
await self.toggle_enable(bits_high)
|
||||||
|
|
||||||
# Low bits
|
# Low bits
|
||||||
self.bus.write_byte(self.I2C_ADDR, bits_low)
|
self.bus.write_byte(self.I2C_ADDR, bits_low)
|
||||||
self.toggle_enable(bits_low)
|
await self.toggle_enable(bits_low)
|
||||||
|
|
||||||
async def toggle_enable(self, bits):
|
async def toggle_enable(self, bits):
|
||||||
await asyncio.sleep(self.E_DELAY)
|
await asyncio.sleep(self.E_DELAY)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue