zxfr / Pixels

Graphics library for TFT displays
20 stars 12 forks source link

ili9341 hardware spi #1

Closed sinrab closed 8 years ago

sinrab commented 10 years ago

I have a TFT01-2.2SP display. The LCD in the TFT01 is ILI9341. It's a 240 * 320 (resolution). In the software SPI with Pixels library it works. Is it possible to use hardware SPI? How to do it?

zxfr commented 10 years ago

In an ideal case it would be sufficient to substitute

include <Pixels_SPIsw.h>

with

include <Pixels_SPIhw.h>

Does it work for you?

sinrab commented 10 years ago

I did it! It works! My simple test code


include "Pixels_SPIhw.h"

include "Pixels_ILI9341.h"

Pixels pxs(240, 320);

void setup() { pxs.setSpiPins(13, 11, 7, 5, 6); // TFT01-2.2SP display ILI9341(SCK, MOSI, CS, RESET, DC) pxs.init(); pxs.setBackground(0, 0, 0); pxs.setColor(0, 255, 0); pxs.clear(); pxs.fillRectangle(10, 10, 100, 100); }

void loop() {

}

After loading the sketch does not work, but after the switch-off and turn on Arduino sketch works! Probably because the Arduino is powered by 3.3 volts.