adafruit / Adafruit_ILI9341

Library for Adafruit ILI9341 displays
410 stars 283 forks source link

ESP8266 fix and speed-ups (up to 57% faster) #11

Closed WereCatf closed 8 years ago

WereCatf commented 8 years ago

The original code has the line _mosi = _sclk = 0; when using HWSPI, but that breaks things on the ESP8266 where GPIO0 is actually useable, so I set _mosi and _sclk to -1 instead.

As for the speed-ups: define USE_FAST_PINIO for the ESP8266, use faster SPI-clock and add a new function called spiwrite16, which on non-ESP8266 just does two spiwrite()-calls, just like the code already does, but on the ESP8266 uses the proper SPI.write16()-call, which results in major speed-ups. This way also allows any other devices that implement a similar call to benefit from speed-ups, all you have to do is modify the spiwrite16()-call.

Original ILI9341: Screen fill 1545712 Text 100791 Lines 995059 Horiz/Vert Lines 126297 Rectangles (outline) 81350 Rectangles (filled) 3200299 Circles (filled) 502262 Circles (outline) 434495 Triangles (outline) 315384 Triangles (filled) 1067558 Rounded rects (outline) 186570 Rounded rects (filled) 3498914

Faster SPI-clock: Screen fill 1228514 Text 86081 Lines 855910 Horiz/Vert Lines 100460 Rectangles (outline) 64933 Rectangles (filled) 2542491 Circles (filled) 412466 Circles (outline) 373598 Triangles (outline) 271226 Triangles (filled) 854875 Rounded rects (outline) 156747 Rounded rects (filled) 2783075

SPI-clock + FAST_PINIO: Screen fill 1228612 Text 80858 Lines 795018 Horiz/Vert Lines 99815 Rectangles (outline) 64314 Rectangles (filled) 2542452 Circles (filled) 398574 Circles (outline) 347017 Triangles (outline) 251978 Triangles (filled) 844978 Rounded rects (outline) 148596 Rounded rects (filled) 2775610

SPI-clock + FAST_PINIO + spiwrite16: Screen fill 661778 Text 72879 Lines 760434 Horiz/Vert Lines 55280 Rectangles (outline) 36734 Rectangles (filled) 1366593 Circles (filled) 284821 Circles (outline) 331897 Triangles (outline) 241019 Triangles (filled) 494629 Rounded rects (outline) 123757 Rounded rects (filled) 1516511

Screen fill improvement: ~57% Text improvement: ~28% Lines improvement: ~24% Horiz/Vert lines improvement: ~56% Rectangles (outline) improvement: ~55% Rectangles (filled) improvement: ~57%

And so on.