Giter VIP home page Giter VIP logo

esp-idf-ili9340's People

Contributors

alimoal avatar botbench avatar nopnop2002 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

esp-idf-ili9340's Issues

Slow loading speed

I was testing this on the st7735 lcd display 128x128 but the loading speed is too slow , i have used the esp32s3 module for this drawing fill circle is comming as line by line.

Guide how to use as esp-idf component

Hello!

Can you provide instructions on how to use this properly as a component in another idf project? I was able to run your demo, but wasn't able to integrate your code into another project. Even if I copy all the stuff into the main folder of my app, I ran into linker errors because it can't find the lcd* functions.

Any help would be appreciated!

Thanks in advance!

not able to show icons on the display.

Hello, i am using esp32-s2 and interface ili9341. If i run the whole main file, then there is not output on the display. But if i run some commands from the function like from fill rectangle it will show output. Now i want to display icon on the display. Can you tell which arguments i have to pass the function so that it will shoe icon image on display.

A question.

I wanna know that what is the difference between the "DC GPIO" and "BACKLIGHT GPIO"?

Often crashing on lcdDrawFillRect

Example:
lcdDrawFillRect(&dev, 67, 120, 79, 132, 0);
Display is st7735s 80x160

ESP-IDF 4.2.1, your code(esp-idf-ili9340-master) is from 25-5-2021

Any idea what is the problem and how to fix it
Thanks

assertion "ret_trans == trans_desc" failed: file "D:/ESP2_8/esp-idf/components/driver/spi_master.c", line 835, function: spi_device_transmit
assertion "ret_trans == trans_desc" failed: file "
abort() was called at PC 0x4014fc07 on core 0
0x4014fc07: __assert_func at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdlib/assert.c:62 (discriminator 8)

Backtrace:0x40088ecb:0x3ffcc840 0x40089575:0x3ffcc860 0x40090456:0x3ffcc880 0x4014fc07:0x3ffcc8f0 0x4010b1d5:0x3ffcc920 0x400d9ccd:0x3ffcc950 0x400d9d05:0x3ffcc9a0 0x400da7b9:0x3ffcc9c0 0x400d90b5:0x3ffcc9f0 0x4008957d:0x3ffcca60
0x40088ecb: panic_abort at D:/ESP2_8/esp-idf/components/esp_system/panic.c:330

0x40089575: esp_system_abort at D:/ESP2_8/esp-idf/components/esp_system/system_api.c:106

0x40090456: abort at D:/ESP2_8/esp-idf/components/newlib/abort.c:46

0x4014fc07: __assert_func at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdlib/assert.c:62 (discriminator 8)

0x4010b1d5: spi_device_transmit at D:/ESP2_8/esp-idf/components/driver/spi_master.c:835 (discriminator 1)

0x400d9ccd: spi_master_write_byte at D:\W21\ESP\VS2\scanapp15N\build/../components/ili9340/driver/ili9340.c:106

0x400d9d05: spi_master_write_comm_byte at D:\W21\ESP\VS2\scanapp15N\build/../components/ili9340/driver/ili9340.c:122

0x400da7b9: lcdDrawFillRect at D:\W21\ESP\VS2\scanapp15N\build/../components/ili9340/driver/ili9340.c:624

0x400d90b5: http_get_task at D:\W21\ESP\VS2\scanapp15N\build/../main/http_sntp1.c:215

0x4008957d: vPortTaskWrapper at D:/ESP2_8/esp-idf/components/freertos/xtensa/port.c:143

Blank Display

Hi, I'm trying to use the library but I can't make it work. I already did the configuration as you show in the pictures, the program compile and runs well but never shows anything on the display. I also test the display with and Arduino library and works perfect. Could you give some idea to make it work? Thanks.

xpt2046 issue

Hi
i have downloaded and compiled sucessfully.
TFT ili9341 works fine all graphics and pics.
The touch calibrates but when i am in Touchtest it does not do any thing out.
when i press the touch from right or left edges it draws a line across whole screnn.
Not working elsewhere except edges.
Plz help in this regard
20211223_195336_001

How to display jpeg or rgb565 from memory buffer ?

I want to display images from camera frame buffer captured by esp32-cam. Following is the code snippet.

TickType_t realtime_image_test(TFT_t * dev, camera_fb_t * fb, int width, int height) {

	TickType_t startTick, endTick, diffTick;
	startTick = xTaskGetTickCount();

	// lcdFillScreen(dev, BLACK);  // not filling can make it look better

	int _width = width;
	if (width > 240) _width = 240;
	int _height = height;
	if (height > 320) _height = 320;

	int image_width = fb->width;
	int image_height = fb->height;

	uint16_t jpegWidth = width;
	uint16_t offsetX = 0;
	if (width > image_width) {
		jpegWidth = image_width;
		offsetX = (width - image_width) / 2;
	}
	ESP_LOGD(__FUNCTION__, "jpegWidth=%d offsetX=%d", jpegWidth, offsetX);

	uint16_t jpegHeight = height;
	uint16_t offsetY = 0;
	if (height > image_height) {
		jpegHeight = image_height;
		offsetY = (height - image_height) / 2;
	}
	ESP_LOGD(__FUNCTION__, "jpegHeight=%d offsetY=%d", jpegHeight, offsetY);

	// when the buffer itself is in rgb888 format
	// uint8_t *pixels = fb->buf;  

	// when the buffer is in jpeg format
	uint8_t *pixels = malloc(fb->width * fb->height * 3);
	if (!fmt2rgb888(fb->buf, fb->len, fb->format, pixels)) {
		ESP_LOGE(TAG, "Conversion from jpeg to rgb888 failed");
	}

	uint16_t *colors = (uint16_t*)malloc(sizeof(uint16_t) * jpegWidth);
	uint8_t r,g,b;
	for(int y = 0; y < jpegHeight; y++){
		for(int x = 0;x < jpegWidth; x++){
			r = pixels[y*jpegWidth + x*3];
			g = pixels[y*jpegWidth + x*3 + 1];
			b = pixels[y*jpegWidth + x*3 + 2];
			colors[x] = rgb565(r,g,b); // convert rgb888 to rgb565
		}
		lcdDrawMultiPixels(dev, offsetX, y+offsetY, jpegWidth, colors);
		vTaskDelay(1);
	}
	free(colors);
	free(pixels); // no need to free when the original buffer of camera is used

	endTick = xTaskGetTickCount();
	diffTick = endTick - startTick;
	ESP_LOGI(__FUNCTION__, "elapsed time[ms]:%"PRIu32,diffTick*portTICK_PERIOD_MS);
	return diffTick;
}

What this code does is convert the image present as jpeg in buffer to rgb888 format and reformats it as rgb565 which is presume is the one used by tft display. The exact display is st7735.

The problem is that, the image displayed isn't correct. What am I doing wrong ?
image

Turn DMA off

I need to use SPI without DMA for some purposes. But when I turn it off for SPI, LCD shows wrong data. what should I do?

License

Hi,

I'm looking into using your library but I noticed that most files don't have any licensing information, would you mind adding a top level COPYING or LICENSE file with the license of your choice. Two files are already MIT licensed so that would make sense but it's really up to you.

Thanks!

Use this library with platformio

Hi guys,

First of all: Thanks for this great library!

I am pretty new to the esp idf and just arrived from Arduino world. Could someone help to get it working as a library inside my platformio esp32-idf project?

I know I have to adjust the src/CMakeLists.txt in order to make the lib work.

Thanks in advance!

I already added the build flags to the platform.ini:

 
build_flags = 
    -std=c++17
    -D CONFIG_ILI9341
    -D CONFIG_MOSI_GPIO=1
    -D CONFIG_SCLK_GPIO=1
    -D CONFIG_CS_GPIO=1
    -D CONFIG_DC_GPIO=1
    -D CONFIG_RESET_GPIO=1
    -D CONFIG_BL_GPIO=1
    -D CONFIG_WIDTH=240
    -D CONFIG_HEIGHT=320
    -D CONFIG_OFFSETX=0
    -D CONFIG_OFFSETY=0

About coordinate systems

There are two coordinate systems, physical and logical coordinates.
Logical coordinates are the positions of pixels on the TFT screen.
For a 240x320 TFT, the logical X coordinates range from 0 to 239, and the logical Y coordinates range from 0 to 319.
Logical coordinates can be changed according to the memory access control settings.

Physical coordinates are coordinates provided by hardware.
You can get the physical coordinates from XPT2046.

By performing calibration, you will get the conversion factor that will be converted from physical coordinates to logical coordinates.

Converts from physical coordinates to logical coordinates using the conversion factor.

  • When you touch the location of A:
    physical coordinates from XPT2046 are x=134 y=114.
    Physical coordinates are different values ​​for each TFT.
    The logical coordinates after conversion using the conversion factor are X = 239 and Y = 0.
    The logical coordinates depend on the maximum resolution of the TFT.

  • When you touch the location of B:
    physical coordinates from XPT2046 are x=1809 y=1772.
    Logical coordinates after conversion are X=0,Y=319.

  • The conversion coefficient is as follows.
    X=fx(134)=239
    Y=fy(114)=0
    X=fx(1809)=0
    Y=fy(1772)=319

+----------------------+
|                    B |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
| A                    |
+----------------------+

When you move the touch pen from A to a, only the X coordinate is updated.

+----------------------+
|                    B |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
|                      |
| A----------------->a |
+----------------------+

When you move the touch pen from A to a, only the Y coordinate is updated.

+----------------------+
| a                  B |
| ^                    |
| |                    |
| |                    |
| |                    |
| |                    |
| |                    |
| |                    |
| |                    |
| |                    |
| |                    |
| |                    |
| |                    |
| |                    |
| |                    |
| |                    |
| A                    |
+----------------------+

Cant display ascii>127

Tried with couple fonts incl. provided with your exampe Gothic and the last ASCII char that could be displayed is 127 (some tall rectangle in your Gothic font) next characters with ascii > 127 are not displayed?

	strcpy((char *)ascii, "127: \x7f\x81\xa1\xa2\xa6\xa7");  // only symbol for 0x7f (127) displayed (rectangle)
	lcdDrawString(&dev, fx16G, xpos, ypos, ascii, color);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.