[Solved]blue pill and ILI9341 tft

Post here all questions related to STM32 core if you can't find a relevant section!
svod616
Posts: 9
Joined: Mon Mar 16, 2020 5:10 pm
Location: Ukraine

Re: blue pill and ILI9341 tft

Post by svod616 »

Yes it really works! library
ag123 wrote: Tue Mar 17, 2020 11:37 am https://github.com/adafruit/Adafruit_ILI9341
came up beautifully, thank you very much!
I used the following initialization command:

Code: Select all

Adafruit_ILI9341 tft = Adafruit_ILI9341(PA4,PB1,PA7,PA5,PB10,PA6);
and it worked, the connection is as follows:

TFT_CS - PA4, TFT_DC - PB1, TFT_MOSI - PA7, TFT_CLK - PA5, TFT_RST - PB10, TFT_MISO - PA6

but I have one more question: Could you point me to the documentation for this library with a list of commands and arguments for them?
and there is still a question on increasing FPS: is this possible?
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: blue pill and ILI9341 tft

Post by ag123 »

run the examples
stas2z
Posts: 131
Joined: Mon Feb 24, 2020 8:17 pm
Answers: 8

Re: blue pill and ILI9341 tft

Post by stas2z »

svod616 wrote: Tue Mar 17, 2020 2:52 pm and there is still a question on increasing FPS: is this possible?
by using constructor for hardware spi
Adafruit_ILI9341(int8_t _CS, int8_t _DC, int8_t _RST = -1);

now you are using software bitbanging
svod616
Posts: 9
Joined: Mon Mar 16, 2020 5:10 pm
Location: Ukraine

Re: blue pill and ILI9341 tft

Post by svod616 »

stas2z wrote: Tue Mar 17, 2020 9:13 pm
svod616 wrote: Tue Mar 17, 2020 2:52 pm and there is still a question on increasing FPS: is this possible?
by using constructor for hardware spi
Adafruit_ILI9341(int8_t _CS, int8_t _DC, int8_t _RST = -1);
Thank you, this really doubled the FPS.
After mega8 looks impressive.
svod616
Posts: 9
Joined: Mon Mar 16, 2020 5:10 pm
Location: Ukraine

Re: blue pill and ILI9341 tft

Post by svod616 »

ag123 wrote: Tue Mar 17, 2020 4:46 pmrun the examples
yes, I ran an example. I was able to easily replace the displayed text, its color and position in the example. However, when I try to modify the code called in the example like this

Code: Select all

Serial.println(testLines(ILI9341_CYAN));

Code: Select all

unsigned long testLines(uint16_t color) {
  unsigned long start, t;
  int           x1, y1, x2, y2,
                w = tft.width(),
                h = tft.height();

  tft.fillScreen(ILI9341_BLACK);
  yield();
  
  x1 = y1 = 0;
  y2    = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t     = micros() - start; // fillScreen doesn't count against timing

  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();

  x1    = w - 1;
  y1    = 0;
  y2    = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;

  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();

  x1    = 0;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;

  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();

  x1    = w - 1;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);

  yield();
  return micros() - start;
}
To get started, I wanted to change the calculation of coordinates here. But when you try to change at least something related to tft.drawLine () in this code, the compiler gives a lot of errors.
(there was a power failure, so I lost this part of the code. I will continue today, so I will quickly give an example of my code modification and copy the compiler errors)
maybe there is some kind of documentation like this: https://github.com/dgolda/UTFT/blob/master/UTFT.pdf
Kenjutsu
Posts: 27
Joined: Tue Apr 07, 2020 10:58 am
Answers: 2

Re: blue pill and ILI9341 tft

Post by Kenjutsu »

stas2z wrote: Tue Mar 17, 2020 9:13 pm by using constructor for hardware spi
Adafruit_ILI9341(int8_t _CS, int8_t _DC, int8_t _RST = -1);
Thank you for this, and just to confirm that I could only get hardware SPI working using the three parameter constructor with RST specified, and not the two parameter constructor with only CS and DC. ;)
Pieter

OSX: 11.6.8
Arduino IDE: 1.8.19
PlatformIO: 6.1.4
STM32 Core: 2.3.0
Get a $5 off coupon on your first purchase at Kaiweets
Kaiweets Affordable & Smart Electrical Testing Tools
Post Reply

Return to “General discussion”