def deinit(self): print("Deinitializing XPT2046...") if self.spi: # Pop all pending transaction results ret = 0 while ret == 0: ret = esp.spi_device_get_trans_result(self.spi, self.trans_result_ptr, 1) # Remove device esp.spi_bus_remove_device(self.spi) # Free SPI bus esp.spi_bus_free(self.spihost)
def deinit(self): print('Deinitializing {}..'.format(self.display_name)) self.disp_drv.remove() # Prevent callbacks to lvgl, which refer to the buffers we are about to delete if not self.asynchronous: import lvesp32 lvesp32.deinit() if self.spi: # Pop all pending transaction results ret = 0 while ret == 0: ret = esp.spi_device_get_trans_result(self.spi, self.trans_result_ptr, 1) # Remove device esp.spi_bus_remove_device(self.spi) self.spi = None # Free SPI bus esp.spi_bus_free(self.spihost) self.spihost = None # Free RAM if self.buf1: esp.heap_caps_free(self.buf1) self.buf1 = None if self.buf2: esp.heap_caps_free(self.buf2) self.buf2 = None if self.trans_buffer: esp.heap_caps_free(self.trans_buffer) self.trans_buffer = None
def deinit(self): print('Deinitializing ILI9341..') # Prevent callbacks to lvgl, which refer to the buffers we are about to delete lvesp32.deinit() if self.spi: # Pop all pending transaction results ret = 0 while ret == 0: ret = esp.spi_device_get_trans_result(self.spi, self.trans_result_ptr, 1) # Remove device esp.spi_bus_remove_device(self.spi) self.spi = None # Free SPI bus esp.spi_bus_free(self.spihost) self.spihost = None # Free RAM if self.buf1: esp.heap_caps_free(self.buf1) self.buf1 = None if self.buf2: esp.heap_caps_free(self.buf2) self.buf2 = None if self.trans_buffer: esp.heap_caps_free(self.trans_buffer) self.trans_buffer = None