def main(): spi = SPI(1, SPI.MASTER, baudrate=42000000, prescaler=2) print(spi) # configure display tft = st7789.ST7789(spi, 240, 320, reset=Pin('X3', Pin.OUT), cs=Pin('X5', Pin.OUT), dc=Pin('X4', Pin.OUT), backlight=Pin('X2', Pin.OUT), rotation=3) tft.init() tft.fill(st7789.BLACK) start = utime.ticks_ms() tft.text(font, "MicroPython MicroPython MicroPython", 0, 0, st7789.WHITE) tft.text(font, "MicroPython MicroPython MicroPython", 0, 32, st7789.RED) tft.text(font, "MicroPython MicroPython MicroPython", 0, 64, st7789.GREEN) tft.text(font, "MicroPython MicroPython MicroPython", 0, 96, st7789.BLUE) tft.text(font, "MicroPython MicroPython MicroPython", 0, 128, st7789.WHITE) tft.text(font, "MicroPython MicroPython MicroPython", 0, 160, st7789.RED) tft.text(font, "MicroPython MicroPython MicroPython", 0, 192, st7789.GREEN) tft.text(font, "MicroPython MicroPython MicroPython", 0, 224, st7789.BLUE) print("time:", utime.ticks_ms() - start, "ms")
def main(): ''' Draw greetings on display cycling thru hershey fonts and colors ''' tft = st7789.ST7789(SPI(1, SPI.MASTER, baudrate=42000000, prescaler=2), 240, 320, reset=Pin('X3', Pin.OUT), cs=Pin('X5', Pin.OUT), dc=Pin('X4', Pin.OUT), backlight=Pin('X2', Pin.OUT), rotation=3) tft.init() tft.fill(st7789.BLACK) width = tft.width() row = 0 while True: row += 32 color = next(COLORS) tft.fill_rect(0, row - 16, width, 32, st7789.BLACK) tft.draw(next(FONTS), next(GREETINGS), 0, row, color) if row > 192: row = 0 utime.sleep(0.25)
def main(): global tft, spi, axp, touch # try: # Turn power on display power axp = axp202c.PMU() axp.enablePower(axp202c.AXP202_LDO2) # initalize spi port spi = SPI(2, baudrate=32000000, polarity=1, phase=0, bits=8, firstbit=0, sck=Pin(18, Pin.OUT), mosi=Pin(19, Pin.OUT)) # configure display tft = st7789.ST7789(spi, 240, 240, cs=Pin(5, Pin.OUT), dc=Pin(27, Pin.OUT), backlight=Pin(12, Pin.OUT), rotation=0) # enable display tft.init() tft.fill(st7789.BLACK) initTouch()
def main(): # # Draw greetings on display cycling thru hershey fonts and colors # # configure display tft = st7789.ST7789( SPI(2, baudrate=30000000, sck=Pin(18), mosi=Pin(19)), 135, 240, reset=Pin(23, Pin.OUT), cs=Pin(5, Pin.OUT), dc=Pin(16, Pin.OUT), backlight=Pin(4, Pin.OUT), rotation=3) tft.init() tft.fill(st7789.BLACK) width = tft.width() row = 0 while True: row += 32 color = next(COLORS) tft.fill_rect(0, row-16, width, 38, st7789.BLACK) tft.draw(next(FONTS), next(GREETINGS), 0, row, color) print(row) if row == 96: row = 0 utime.sleep(0.25) if button0.value() == 0: exec(open("./main.py").read()) # click button0 renvoi au menu general
def main(): tft = st7789.ST7789(SPI(2, baudrate=30000000, polarity=1, phase=1, sck=Pin(18), mosi=Pin(19)), 135, 240, reset=Pin(23, Pin.OUT), cs=Pin(5, Pin.OUT), dc=Pin(16, Pin.OUT), backlight=Pin(4, Pin.OUT), rotation=3) tft.init() tft.fill(st7789.BLACK) start = utime.ticks_ms() tft.text(font, "MicroPython", 0, 0, st7789.WHITE) tft.text(font, "MicroPython", 0, 32, st7789.RED) tft.text(font, "MicroPython", 0, 64, st7789.GREEN) tft.text(font, "MicroPython", 0, 96, st7789.BLUE) print("time:", utime.ticks_ms() - start, "ms")
def main(): ''' Decode and draw jpg on display ''' try: # Turn on display backlight axp = axp202c.PMU() axp.enablePower(axp202c.AXP202_LDO2) # initialize display spi port spi = SPI( 2, baudrate=32000000, sck=Pin(18, Pin.OUT), mosi=Pin(19, Pin.OUT)) # configure display tft = st7789.ST7789( spi, 240, 240, cs=Pin(5, Pin.OUT), dc=Pin(27, Pin.OUT), backlight=Pin(12, Pin.OUT), rotation=2) # enable display and clear screen tft.init() # display jpg tft.jpg("bigbuckbunny.jpg", 0, 0, st7789.SLOW) finally: # shutdown spi spi.deinit()
def main(): ''' Draw greetings on display cycling thru hershey fonts and colors ''' # configure display tft = st7789.ST7789(SPI(2, baudrate=30000000, sck=Pin(18), mosi=Pin(19)), 135, 240, reset=Pin(23, Pin.OUT), cs=Pin(5, Pin.OUT), dc=Pin(16, Pin.OUT), backlight=Pin(4, Pin.OUT), rotation=3) tft.init() tft.fill(st7789.BLACK) width = tft.width() row = 0 while True: row += 32 color = next(COLORS) tft.fill_rect(0, row - 16, width, 38, st7789.BLACK) tft.draw(next(FONTS), next(GREETINGS), 0, row, color) print(row) if row == 96: row = 0 utime.sleep(0.25)
def main(): tft = st7789.ST7789(SPI(1, baudrate=30000000, sck=Pin(18), mosi=Pin(19)), 135, 240, reset=Pin(23, Pin.OUT), cs=Pin(5, Pin.OUT), dc=Pin(16, Pin.OUT), backlight=Pin(4, Pin.OUT), rotation=3) tft.init() while True: for rotation in range(4): tft.rotation(rotation) tft.fill(0) col_max = tft.width() - font.WIDTH * 6 row_max = tft.height() - font.HEIGHT for _ in range(128): tft.text( font, "Hello!", random.randint(0, col_max), random.randint(0, row_max), st7789.color565(random.getrandbits(8), random.getrandbits(8), random.getrandbits(8)), st7789.color565(random.getrandbits(8), random.getrandbits(8), random.getrandbits(8)))
def main(): ''' Draw greetings on display cycling thru hershey fonts and colors ''' # configure display spi = SPI(1, baudrate=40000000, sck=Pin(14), mosi=Pin(15)) tft = st7789.ST7789(spi, 240, 320, reset=Pin(11, Pin.OUT), cs=Pin(13, Pin.OUT), dc=Pin(12, Pin.OUT), backlight=Pin(10, Pin.OUT), rotation=3) tft.init() tft.fill(st7789.BLACK) width = tft.width() while True: for line in range(1, 7): row = line * 32 color = next(COLORS) tft.fill_rect(0, row - 16, width, 38, st7789.BLACK) tft.draw(next(FONTS), next(GREETINGS), 0, row, color) utime.sleep(0.25)
def main(): tft = st7789.ST7789(SPI(1, SPI.MASTER, baudrate=42000000, prescaler=2), 240, 320, reset=Pin('X3', Pin.OUT), cs=Pin('X5', Pin.OUT), dc=Pin('X4', Pin.OUT), backlight=Pin('X2', Pin.OUT), rotation=3) tft.init() while True: for font in (font1, font2, font3, font4): tft.fill(st7789.BLUE) line = 0 col = 0 for char in range(font.FIRST, font.LAST): tft.text(font, chr(char), col, line, st7789.WHITE, st7789.BLUE) col += font.WIDTH if col > tft.width() - font.WIDTH: col = 0 line += font.HEIGHT if line > tft.height() - font.HEIGHT: utime.sleep(3) tft.fill(st7789.BLUE) line = 0 col = 0 utime.sleep(3)
def main(): ''' Decode and draw jpg on display ''' try: spi = SPI(2, baudrate=30000000, sck=Pin(18), mosi=Pin(19)) tft = st7789.ST7789(spi, 135, 240, reset=Pin(23, Pin.OUT), cs=Pin(5, Pin.OUT), dc=Pin(16, Pin.OUT), backlight=Pin(4, Pin.OUT), rotation=3) # enable display and clear screen tft.init() # display jpg tft.jpg("bigbuckbunny.jpg", 0, 0, st7789.SLOW) finally: # shutdown spi spi.deinit()
def __init__(self): self.tft = st7789.ST7789(SPI(2, baudrate=30000000, polarity=1, phase=1, sck=Pin(18), mosi=Pin(19)), 135, 240, reset=Pin(23, Pin.OUT), cs=Pin(5, Pin.OUT), dc=Pin(16, Pin.OUT), backlight=Pin(4, Pin.OUT), rotation=1) self.tft.text(font, "Bavard Init !", 0, 0) self.btn_up_pin = 0 self.btn_down_pin = 35 self.button_up = Pin(self.btn_up_pin, Pin.IN, Pin.PULL_UP) self.button_down = Pin(self.btn_down_pin, Pin.IN, Pin.PULL_UP) self.page_now = 1 self.page_max = 5 self.page_min = 1 self.tft.text(font, "Ready...", 0, 0)
def main(): tft = st7789.ST7789(SPI(2, baudrate=30000000, sck=Pin(18), mosi=Pin(19)), 135, 240, reset=Pin(23, Pin.OUT), cs=Pin(5, Pin.OUT), dc=Pin(16, Pin.OUT), backlight=Pin(4, Pin.OUT), rotation=3) tft.init() while True: for font in (font1, font2, font3, font4): tft.fill(st7789.BLUE) line = 0 col = 0 for char in range(font.FIRST, font.LAST): tft.text(font, chr(char), col, line, st7789.WHITE, st7789.BLUE) col += font.WIDTH if col > tft.width() - font.WIDTH: col = 0 line += font.HEIGHT if line > tft.height() - font.HEIGHT: utime.sleep(3) tft.fill(st7789.BLUE) line = 0 col = 0 utime.sleep(3)
def __init__(self, font, log=0): # init i2c tft self.back_light = Pin(4, Pin.OUT) self.back_light.value(1) self.display = st7789.ST7789(SPI(2, baudrate=30000000, polarity=1, phase=1, sck=Pin(18), mosi=Pin(19)), 135, 240, reset=Pin(23, Pin.OUT), cs=Pin(5, Pin.OUT), dc=Pin(16, Pin.OUT), rotation=3) self.display.init() self.font = font self.width = self.display.width() self.height = self.display.height() self.max_chars = self.width // self.font.WIDTH self.max_lines = self.height // self.font.HEIGHT self.fg = st7789.WHITE self.bg = st7789.BLUE self.fg_act = st7789.RED self.bg_act = st7789.WHITE self.fg_hdr = st7789.WHITE self.bg_hdr = st7789.RED self.joystick = button.JoyStick()
def main(): ''' Decode and draw jpg on display ''' try: spi = SPI(1, SPI.MASTER, baudrate=42000000, prescaler=2) # initialize display tft = st7789.ST7789(spi, 240, 320, reset=Pin('X3', Pin.OUT), cs=Pin('X5', Pin.OUT), dc=Pin('X4', Pin.OUT), backlight=Pin('X2', Pin.OUT), rotation=3) # enable display and clear screen tft.init() # display jpg tft.jpg("bigbuckbunny.jpg", 0, 0, st7789.SLOW) finally: # shutdown spi spi.deinit()
def main(): spi = SPI(1, baudrate=40000000, sck=Pin(14), mosi=Pin(15)) tft = st7789.ST7789(spi, 240, 320, reset=Pin(11, Pin.OUT), cs=Pin(13, Pin.OUT), dc=Pin(12, Pin.OUT), backlight=Pin(10, Pin.OUT), rotation=3) # enable display and clear screen tft.init() tft.fill(st7789.BLACK) row = 0 tft.write(font_16, "abcdefghijklmnopqrstuvwxyz", 0, row) row += font_16.HEIGHT tft.write(font_32, "abcdefghijklm", 0, row) row += font_32.HEIGHT tft.write(font_32, "nopqrstuvwxy", 0, row) row += font_32.HEIGHT tft.write(font_64, "abcdef", 0, row) row += font_64.HEIGHT tft.write(font_64, "ghijkl", 0, row) row += font_64.HEIGHT
def main(): try: spi = SPI(2, baudrate=30000000, sck=Pin(18), mosi=Pin(19)) tft = st7789.ST7789(spi, 135, 240, reset=Pin(23, Pin.OUT), cs=Pin(5, Pin.OUT), dc=Pin(16, Pin.OUT), backlight=Pin(4, Pin.OUT), rotation=3) # enable display and clear screen tft.init() tft.fill(st7789.BLACK) row = 0 tft.write(font_16, "abcdefghijklmnopqrst", 0, row) row += font_16.HEIGHT tft.write(font_32, "abcdefghij", 0, row) row += font_32.HEIGHT tft.write(font_64, "abcd", 0, row) row += font_64.HEIGHT finally: # shutdown spi if 'spi' in locals(): spi.deinit()
def main(): ''' Decode and draw jpg on display ''' try: spi = SPI(2, baudrate=30000000, sck=Pin(18), mosi=Pin(19)) tft = st7789.ST7789(spi, 135, 240, reset=Pin(23, Pin.OUT), cs=Pin(5, Pin.OUT), dc=Pin(16, Pin.OUT), backlight=Pin(4, Pin.OUT), rotation=3, buffer_size=30 * 30 * 2) # enable display and clear screen tft.init() # display jpg in random locations while True: tft.rotation(random.randint(0, 4)) tft.jpg("alien.jpg", random.randint(0, tft.width() - 30), random.randint(0, tft.height() - 30), st7789.FAST) finally: # shutdown spi spi.deinit()
def main(): tft = st7789.ST7789(SPI(1, SPI.MASTER, baudrate=30000000, polarity=1, phase=0), 240, 320, reset=Pin('X3', Pin.OUT), cs=Pin('X5', Pin.OUT), dc=Pin('X4', Pin.OUT), backlight=Pin('X2', Pin.OUT), rotation=3) tft.init() while True: for rotation in range(4): tft.rotation(rotation) tft.fill(0) col_max = tft.width() - font.WIDTH * 6 row_max = tft.height() - font.HEIGHT for _ in range(250): tft.text( font, "Hello!", random.randint(0, col_max), random.randint(0, row_max), st7789.color565(random.getrandbits(8), random.getrandbits(8), random.getrandbits(8)), st7789.color565(random.getrandbits(8), random.getrandbits(8), random.getrandbits(8)))
def main(): ''' Draw and move sprite ''' try: spi = SPI(1, baudrate=30000000, sck=Pin(18), mosi=Pin(19)) # initialize display tft = st7789.ST7789( spi, 135, 240, reset=Pin(23, Pin.OUT), cs=Pin(5, Pin.OUT), dc=Pin(16, Pin.OUT), backlight=Pin(4, Pin.OUT), rotation=0, buffer_size=64*64*2) # enable display and clear screen tft.init() tft.fill(st7789.BLACK) # create toast spites in random positions sprites = [ toast(TOASTERS, 135-64, 0), toast(TOAST, 135-64*2, 80), toast(TOASTERS, 135-64*4, 160) ] # move and draw sprites while True: for man in sprites: bitmap = man.sprites[man.step] tft.fill_rect( man.x+bitmap.WIDTH-man.speed, man.y, man.speed, bitmap.HEIGHT, st7789.BLACK) man.move() if man.x > 0: tft.bitmap(bitmap, man.x, man.y) else: tft.fill_rect( 0, man.y, bitmap.WIDTH, bitmap.HEIGHT, st7789.BLACK) time.sleep(0.05) finally: # shutdown spi spi.deinit()
def main(): spi = SPI(1, baudrate=40000000, sck=Pin(14), mosi=Pin(15)) tft = st7789.ST7789(spi, 240, 320, reset=Pin(11, Pin.OUT), cs=Pin(13, Pin.OUT), dc=Pin(12, Pin.OUT), backlight=Pin(10, Pin.OUT), rotation=0) colors = cycle([0xe000, 0xece0, 0xe7e0, 0x5e0, 0x00d3, 0x7030]) foreground = next(colors) background = st7789.BLACK tft.init() tft.fill(background) utime.sleep(1) height = tft.height() width = tft.width() last_line = height - font.HEIGHT tfa = 0 # top free area tfb = 0 # bottom free area tft.vscrdef(tfa, height, tfb) scroll = 0 character = font.FIRST while True: # clear top line before scrolling off display tft.fill_rect(0, scroll, width, 1, background) # Write new line when we have scrolled the height of a character if scroll % font.HEIGHT == 0: line = (scroll + last_line) % height # write character hex value as a string tft.text(font, 'x{:02x}'.format(character), 16, line, foreground, background) # write character using a integer (could be > 0x7f) tft.text(font, character, 90, line, foreground, background) # change color for next line foreground = next(colors) # next character with rollover at 256 character += 1 if character > font.LAST: character = font.FIRST # scroll the screen up 1 row tft.vscsad(scroll + tfa) scroll += 1 scroll %= height utime.sleep(0.01)
def main(): try: # Turn on display backlight axp = axp202c.PMU() axp.enablePower(axp202c.AXP202_LDO2) # initialize display spi port spi = SPI( 2, baudrate=32000000, polarity=1, phase=0, bits=8, firstbit=0, sck=Pin(18), mosi=Pin(19)) # configure display tft = st7789.ST7789( spi, 240, 240, cs=Pin(5, Pin.OUT), dc=Pin(27, Pin.OUT), backlight=Pin(12, Pin.OUT), rotation=2) tft.init() while True: for font in (font1, font2, font3, font4): tft.fill(st7789.BLUE) line = 0 col = 0 for char in range(font.FIRST, font.LAST): tft.text(font, chr(char), col, line, st7789.WHITE, st7789.BLUE) col += font.WIDTH if col > tft.width() - font.WIDTH: col = 0 line += font.HEIGHT if line > tft.height()-font.HEIGHT: utime.sleep(3) tft.fill(st7789.BLUE) line = 0 col = 0 utime.sleep(3) finally: # shutdown spi spi.deinit() # turn off display backlight axp.disablePower(axp202c.AXP202_LDO2)
def config(rotation=0, buffer_size=0, options=0): return st7789.ST7789(SPI(1, SPI.MASTER, baudrate=42000000, prescaler=2), 240, 320, reset=Pin('X3', Pin.OUT), cs=Pin('X5', Pin.OUT), dc=Pin('X4', Pin.OUT), backlight=Pin('X2', Pin.OUT), rotation=rotation, options=options, buffer_size=buffer_size)
def config(rotation=0, buffer_size=0, options=0): return st7789.ST7789(SPI(1, baudrate=31250000, sck=Pin(18), mosi=Pin(19)), 240, 320, reset=Pin(4, Pin.OUT), cs=Pin(13, Pin.OUT), dc=Pin(12, Pin.OUT), backlight=Pin(15, Pin.OUT), rotation=rotation, options=options, buffer_size=buffer_size)
def backlight(swt): global tft if swt == 1: tft = st.ST7789(SPI(1, baudrate=30000000, sck=Pin(18), mosi=Pin(19)), 135, 240, reset=Pin(23, Pin.OUT), cs=Pin(5, Pin.OUT), dc=Pin(16, Pin.OUT), backlight=Pin(4, Pin.OUT), rotation=3) if swt == 0: tft = st.ST7789(SPI(1, baudrate=30000000, sck=Pin(18), mosi=Pin(19)), 135, 240, reset=Pin(23, Pin.OUT), cs=Pin(5, Pin.OUT), dc=Pin(16, Pin.OUT), backlight=Pin(4, Pin.IN), rotation=3)
def main(): fast = False def display_font(font): tft.fill(st7789.BLUE) column = 0 row = 0 for char in font.MAP: tft.bitmap(font, column, row, font.MAP.index(char)) column += font.WIDTH if column >= tft.width() - font.WIDTH: row += font.HEIGHT column = 0 if row > tft.height() - font.HEIGHT: row = 0 if not fast: time.sleep(0.05) try: # Turn power on display power axp = axp202c.PMU() axp.enablePower(axp202c.AXP202_LDO2) # initialize spi port spi = SPI(1, baudrate=32000000, sck=Pin(18, Pin.OUT), mosi=Pin(19, Pin.OUT)) # configure display tft = st7789.ST7789(spi, 240, 240, cs=Pin(5, Pin.OUT), dc=Pin(27, Pin.OUT), backlight=Pin(12, Pin.OUT), rotation=2, buffer_size=66 * 32 * 2) tft.init() while True: for font in [font_16, font_32, font_64]: display_font(font) fast = not fast finally: # shutdown spi spi.deinit() # turn off display power axp.disablePower(axp202c.AXP202_LDO2)
def main(): ''' Draw on screen using map_bitarray_to_rgb565 ''' try: # initialize display spi port spi = SPI(1, SPI.MASTER, baudrate=42000000, prescaler=2) # configure display tft = st7789.ST7789(spi, 240, 320, reset=Pin('X3', Pin.OUT), cs=Pin('X5', Pin.OUT), dc=Pin('X4', Pin.OUT), backlight=Pin('X2', Pin.OUT), rotation=3) # enable display and clear screen tft.init() tft.fill(st7789.BLACK) sprite = bytearray(512) # create pacman spites in random positions sprites = [] for man in range(SPRITES): sprites.append( pacman(random.randint(0, tft.width() - SPRITE_WIDTH), random.randint(0, tft.height() - SPRITE_HEIGHT), random.randint(0, SPRITE_STEPS - 1))) # move and draw sprites while True: for man in sprites: # move the sprite man.move() # convert bitmap into rgb565 blitable buffer tft.map_bitarray_to_rgb565(SPRITE_BITMAPS[man.step], sprite, SPRITE_WIDTH, st7789.YELLOW, st7789.BLACK) # blit the buffer to the display tft.blit_buffer(sprite, man.x, man.y, SPRITE_WIDTH, SPRITE_HEIGHT) time.sleep(0.1) finally: # shutdown spi spi.deinit()
def config(rotation=0, buffer_size=0, options=0): return st7789.ST7789( SPI(1, baudrate=62500000, sck=Pin(10), mosi=Pin(11)), 135, 240, reset=Pin(12, Pin.OUT), cs=Pin(9, Pin.OUT), dc=Pin(8, Pin.OUT), backlight=Pin(13, Pin.OUT), rotation=rotation, options=options, buffer_size=buffer_size)
def main(): def center(font, s, row, color=st7789.WHITE): screen = tft.width() # get screen width width = tft.write_len(font, s) # get the width of the string if width and width < screen: # if the string < display col = tft.width() // 2 - width // 2 # find the column to center else: # otherwise col = 0 # left justify tft.write(font, s, col, row, color) # and write the string try: # Turn power on display power axp = axp202c.PMU() axp.enablePower(axp202c.AXP202_LDO2) # initialize spi port spi = SPI(1, baudrate=32000000, sck=Pin(18, Pin.OUT), mosi=Pin(19, Pin.OUT)) # configure display tft = st7789.ST7789(spi, 240, 240, cs=Pin(5, Pin.OUT), dc=Pin(27, Pin.OUT), backlight=Pin(12, Pin.OUT), rotation=2, buffer_size=16 * 32 * 2) # enable display tft.init() tft.fill(st7789.BLACK) # center the name of the first font, using the font row = 16 center(noto_sans, "NotoSans", row, st7789.RED) row += noto_sans.HEIGHT # center the name of the second font, using the font center(noto_serif, "NotoSerif", row, st7789.GREEN) row += noto_serif.HEIGHT # center the name of the third font, using the font center(noto_mono, "NotoSansMono", row, st7789.BLUE) row += noto_mono.HEIGHT finally: # shutdown spi if 'spi' in locals(): spi.deinit()
def main(): ''' Draw greetings on display cycling thru hershey fonts and colors ''' try: # Turn power on display power axp = axp202c.PMU() axp.enablePower(axp202c.AXP202_LDO2) axp.enablePower(axp202c.AXP202_DCDC3) # initialize spi port spi = SoftSPI( 2, baudrate=32000000, polarity=1, phase=0, bits=8, firstbit=0, sck=Pin(18, Pin.OUT), mosi=Pin(19, Pin.OUT)) # configure display tft = st7789.ST7789( spi, 240, 240, cs=Pin(5, Pin.OUT), dc=Pin(27, Pin.OUT), backlight=Pin(12, Pin.OUT), rotation=2) tft.init() tft.fill(st7789.BLACK) height = tft.height() width = tft.width() row = 0 while True: row += 32 color = next(COLORS) tft.fill_rect(0, row-16, width, 32, st7789.BLACK) tft.draw(next(FONTS), next(GREETINGS), 0, row, color) if row > 192: row = 0 utime.sleep(0.25) finally: # shutdown spi if 'spi' in locals(): spi.deinit()