def __init__(self): self.lcd_device = i2c_lib.i2c_device(ADDRESS) self.lcd_write(0x03) self.lcd_write(0x03) self.lcd_write(0x03) self.lcd_write(0x02) self.lcd_write(LCD_FUNCTIONSET | LCD_2LINE | LCD_5x8DOTS | LCD_4BITMODE) self.lcd_write(LCD_DISPLAYCONTROL | LCD_DISPLAYON) self.lcd_write(LCD_CLEARDISPLAY) self.lcd_write(LCD_ENTRYMODESET | LCD_ENTRYLEFT) sleep(0.2)
def __init__(self, i2c_address): self.lcd_device = i2c_lib.i2c_device(i2c_address) self._backlight = LCD_NOBACKLIGHT self.lcd_write(0x03) self.lcd_write(0x03) self.lcd_write(0x03) self.lcd_write(0x02) self.lcd_write(LCD_FUNCTIONSET | LCD_2LINE | LCD_5x8DOTS | LCD_4BITMODE) self.lcd_write(LCD_DISPLAYCONTROL | LCD_DISPLAYON) self.lcd_write(LCD_CLEARDISPLAY) self.lcd_write(LCD_ENTRYMODESET | LCD_ENTRYLEFT) sleep(0.2)
def __init__(self): """Setup the display, turn on backlight and text display + ...?""" self.device = i2c_lib.i2c_device(ADDRESS,BUS) self.write(0x03) self.write(0x03) self.write(0x03) self.write(0x02) self.write(LCD_FUNCTIONSET | LCD_2LINE | LCD_5x8DOTS | LCD_4BITMODE) self.write(LCD_DISPLAYCONTROL | LCD_DISPLAYON) self.write(LCD_CLEARDISPLAY) self.write(LCD_ENTRYMODESET | LCD_ENTRYLEFT) sleep(0.2)
def __init__(self): """Setup the display, turn on backlight and text display + ...?""" self.device = i2c_lib.i2c_device(ADDRESS, 1) self.write(0x03) self.write(0x03) self.write(0x03) self.write(0x02) self.write(LCD_FUNCTIONSET | LCD_2LINE | LCD_5x8DOTS | LCD_4BITMODE) self.write(LCD_DISPLAYCONTROL | LCD_DISPLAYON) self.write(LCD_CLEARDISPLAY) self.write(LCD_ENTRYMODESET | LCD_ENTRYLEFT) sleep(0.2)
def __init__(self, state): self.lcd_device = i2c_lib.i2c_device(ADDRESS) self.backLightState = state # it has to be bool self.lcd_write(0x03) self.lcd_write(0x03) self.lcd_write(0x03) self.lcd_write(0x02) self.lcd_write(LCD_FUNCTIONSET | LCD_2LINE | LCD_5x8DOTS | LCD_4BITMODE) self.lcd_write(LCD_DISPLAYCONTROL | LCD_DISPLAYON) self.lcd_write(LCD_CLEARDISPLAY) self.lcd_write(LCD_ENTRYMODESET | LCD_ENTRYLEFT) sleep(0.2)
def __init__(self, port=1, tmap=None): self.lcd_device = i2c_lib.i2c_device(ADDRESS, port) self.tmap = tmap if tmap else {} self.lcd_write(0x03) self.lcd_write(0x03) self.lcd_write(0x03) self.lcd_write(0x02) self.lcd_write(LCD_FUNCTIONSET | LCD_2LINE | LCD_5x8DOTS | LCD_4BITMODE) self.lcd_write(LCD_DISPLAYCONTROL | LCD_DISPLAYON) self.lcd_write(LCD_CLEARDISPLAY) self.lcd_write(LCD_ENTRYMODESET | LCD_ENTRYLEFT) sleep(0.2)
def __init__(self, clear=1, bl=1): self.lcd_device = i2c_lib.i2c_device(ADDRESS) self.lcd_write(0x03, bl=bl) self.lcd_write(0x03, bl=bl) self.lcd_write(0x03, bl=bl) self.lcd_write(0x02, bl=bl) self.lcd_write(LCD_FUNCTIONSET | LCD_2LINE | LCD_5x8DOTS | LCD_4BITMODE, bl=bl) self.lcd_write(LCD_DISPLAYCONTROL | LCD_DISPLAYON, bl=bl) if clear == 1: self.lcd_write(LCD_CLEARDISPLAY, bl=bl) self.lcd_write(LCD_ENTRYMODESET | LCD_ENTRYLEFT, bl=bl) sleep(0.2)
def __init__(self, backlight=True, ranges=DEF_RANGES): self._device = i2c_lib.i2c_device(ADDRESS) self._bl = LCD_BACKLIGHT if backlight else LCD_NOBACKLIGHT self._ranges = ranges self._fb = _mkfb(self._ranges) self._valid = True # since we send a CLEAR command during initialization self.write(0x03) self.write(0x03) self.write(0x03) self.write(0x02) self.write(LCD_FUNCTIONSET | LCD_2LINE | LCD_5x8DOTS | LCD_4BITMODE) self.write(LCD_DISPLAYCONTROL | LCD_DISPLAYON) self.write(LCD_CLEARDISPLAY) self.write(LCD_ENTRYMODESET | LCD_ENTRYLEFT) sleep(0.2)
def __init__(self, address, num_gpios, busnum=0): assert num_gpios >= 0 and num_gpios <= 16, "Number of GPIOs must be between 0 and 16" self.i2c = i2c_lib.i2c_device( address, busnum) # Adafruit_I2C(address=address, busnum=busnum) self.address = address self.num_gpios = num_gpios # set defaults if num_gpios <= 8: self.i2c.write8(MCP23017_IODIRA, 0xFF) # all inputs on port A self.direction = self.i2c.readU8(MCP23017_IODIRA) self.i2c.write8(MCP23008_GPPUA, 0x00) elif num_gpios > 8 and num_gpios <= 16: self.i2c.write8(MCP23017_IODIRA, 0xFF) # all inputs on port A self.i2c.write8(MCP23017_IODIRB, 0xFF) # all inputs on port B self.direction = self.i2c.readU8(MCP23017_IODIRA) self.direction |= self.i2c.readU8(MCP23017_IODIRB) << 8 self.i2c.write8(MCP23017_GPPUA, 0x00) self.i2c.write8(MCP23017_GPPUB, 0x00)
def __init__(self,address): self.address = address self.lcdbacklight = LCD_BACKLIGHT #default status self.line1= ""; self.line2= ""; self.line3= ""; self.line4= ""; self.lcd_device = i2c_lib.i2c_device(self.address) self.lcd_write(0x03) self.lcd_write(0x03) self.lcd_write(0x03) self.lcd_write(0x02) self.lcd_write(LCD_FUNCTIONSET | LCD_2LINE | LCD_5x8DOTS | LCD_4BITMODE) self.lcd_write(LCD_DISPLAYCONTROL | LCD_DISPLAYON) self.lcd_write(LCD_CLEARDISPLAY) self.lcd_write(LCD_ENTRYMODESET | LCD_ENTRYLEFT) sleep(0.2)
def __init__(self): """Setup the display, turn on backlight and text display + ...?""" ok = False while not ok: try: self.device = i2c_lib.i2c_device(ADDRESS, BUS) ok = True except Exception as e: print("Erreur i2c " + str(e)) self.write(0x03) self.write(0x03) self.write(0x03) self.write(0x02) self.write(LCD_FUNCTIONSET | LCD_2LINE | LCD_5x8DOTS | LCD_4BITMODE) self.write(LCD_DISPLAYCONTROL | LCD_DISPLAYON) self.write(LCD_CLEARDISPLAY) self.write(LCD_ENTRYMODESET | LCD_ENTRYLEFT) sleep(0.3)
def __init__(self): self.matrix_device = i2c_lib.i2c_device(ADDRESS_MATRIX) self.matrix_device.write_cmd(MATRIX_FULLINPUT) sleep(0.0005) self.data = 0