From 93ca674f93ddeb44561cf4394470186d60f82119 Mon Sep 17 00:00:00 2001 From: Benjamin Tayehanpour Date: Sat, 26 Sep 2026 20:44:44 +0000 Subject: [PATCH] stuff --- LCD.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/LCD.py b/LCD.py index fedf338..c2ca19a 100644 --- a/LCD.py +++ b/LCD.py @@ -42,14 +42,14 @@ class LCD: raise ValueError('pi_rev param must be 1 or 2') # Initialise display - await self.lcd_byte(0x33, self.LCD_CMD) # 110011 Initialise - await self.lcd_byte(0x32, self.LCD_CMD) # 110010 Initialise - await self.lcd_byte(0x06, self.LCD_CMD) # 000110 Cursor move direction - await self.lcd_byte(0x0C, self.LCD_CMD) # 001100 Display On,Cursor Off, Blink Off - await self.lcd_byte(0x28, self.LCD_CMD) # 101000 Data length, number of lines, font size - await self.lcd_byte(0x01, self.LCD_CMD) # 000001 Clear display + self.lcd_byte(0x33, self.LCD_CMD) # 110011 Initialise + self.lcd_byte(0x32, self.LCD_CMD) # 110010 Initialise + 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 + 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 - async def lcd_byte(self, bits, mode): + def lcd_byte(self, bits, mode): # Send byte to data pins # bits = data # mode = 1 for data, 0 for command @@ -59,18 +59,18 @@ class LCD: # High bits self.bus.write_byte(self.I2C_ADDR, bits_high) - await self.toggle_enable(bits_high) + self.toggle_enable(bits_high) # Low bits self.bus.write_byte(self.I2C_ADDR, bits_low) - await self.toggle_enable(bits_low) + self.toggle_enable(bits_low) - async def toggle_enable(self, bits): - await asyncio.sleep(self.E_DELAY) + def toggle_enable(self, bits): + asyncio.sleep(self.E_DELAY) self.bus.write_byte(self.I2C_ADDR, (bits | self.ENABLE)) - await asyncio.sleep(self.E_PULSE) + asyncio.sleep(self.E_PULSE) self.bus.write_byte(self.I2C_ADDR,(bits & ~self.ENABLE)) - await asyncio.sleep(self.E_DELAY) + asyncio.sleep(self.E_DELAY) async def async_message(self, string, line = 1): async with lock: @@ -96,6 +96,6 @@ class LCD: for i in range(self.LCD_WIDTH): self.lcd_byte(ord(string[i]), self.LCD_CHR) - async def clear(self): + def clear(self): # clear LCD display self.lcd_byte(0x01, self.LCD_CMD)