PaulStoffregen
Well-known member
Opps, it is I who deleted something. What an embarrasing mistake.
I'm packaging up 1.20-rc4 right now.....
I'm packaging up 1.20-rc4 right now.....
but I have noticed they have been out of stock for a little while now. Are you going to restock them?
On the board you mention that the Reset pin needs to be tied to 3.3v. I assume from this that the pin is not 5v tolerant?
// remove this to use software SPI
#define ILI9341_USE_HW_SPI
In case anyone is interested, I want to use some of these ILI9341/0 displays on both Teensy based stuff as well as Arduino (actually an Atmega644 based board) based system, and I still want the ability to read pixels. In particular where I am wanting this is for Debug text output where I can scroll the text...
So for the fun of it, I added the functions (readPixel, readRect, writeRect) which I added to the ILI9341_t3 library to the Adafruit_ILI9341 library. I think I now have them working, however they are a lot slower than they are in the ILI9341_t3 library, especially on an 16mhz 8 bit Atmega processor.
I adapted the read pixel test program mentioned earlier in this thread (could not use printf on stream, change library name...) and so far it appears to work on a Teensy 3.1 with PJRC ILI9341 display as well as on an Arbotix-M board (Atmega 644p) using Adafruit 2.2" TFT display (ILI9340). So should work fine on Atmega328p based systems as well. I have not tested it on an Arduino Due yet. I have one buried around here somewhere![]()
I should do another pass through the code to cleanup some stuff, I added some commands like: writecommand_cont, writedata_cont that leave the CS line selected, which is needed in these cases. Like the _t3 library I also had to spilit up setAddrWindow and setAddr. Currently I just have the setAddrWindow calling off to setAddr, where in the T3, I believe that setAddr in inline. Always an interesting question of trade off for speed versus size... Also wondering about taking pass through such that most of the commands have the CS pin selected through the command, as compared to current version where in most cases CS line is selected/deselected on each byte (or two bytes in cases of things like X or Y position).
Again I believe the pixel reading is working. If anyone wishes to play with it, I uploaded my changes to my fork on github: https://github.com/KurtE/Adafruit_ILI9341
Note: My fork was forked yesterday with all of the previous stuff that I believe matches what is downloaded with the 1.20rc5
Kurt
Arduino Due's SPI port lacks a FIFO, so DMA transfers are the only way to sustain high speed.
Teensy 3.0 & 3.1 have a 4 word FIFO build into the SPI port. With programming that leverages the FIFO, it's pretty easy to sustain maximum speed without the overhead of configuring and manipulating the DMA controller.
I have not tried to use the SD card on that display. What I noticed was that there are IO pins on the other edge of the board which appear to be associated with the SD card. My guess is you would need to setup those IO pins to connect to your teensy. Again I am guessing but for sure you probably need to hook up the CS pin. Not sure if the etch on the board connects the MOSI on one edge to the other or if you need to connect those up as well. My guess is that you will need to connect those up as well.Quick question: How to setup ILI9341_t3, Teensy 3.1,SD card on the TFT and audio board?
followed: http://www.pjrc.com/store/display_ili9341.html but no SD card reading.
void ILI9341_t3::drawPixel(int16_t x, int16_t y, uint16_t color) {
if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return;
SPI.beginTransaction(SPISettings(SPICLOCK, MSBFIRST, SPI_MODE0));
setAddr(x, y, x, y);
writecommand_cont(ILI9341_RAMWR);
writedata16_last(color);
SPI.endTransaction();
}
void Adafruit_ILI9341::drawPixel(int16_t x, int16_t y, uint16_t color) {
if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return;
if (hwSPI) spi_begin();
setAddrWindow(x,y,x+1,y+1);
//digitalWrite(_dc, HIGH);
*dcport |= dcpinmask;
//digitalWrite(_cs, LOW);
*csport &= ~cspinmask;
spiwrite(color >> 8);
spiwrite(color);
*csport |= cspinmask;
//digitalWrite(_cs, HIGH);
if (hwSPI) spi_end();
}
void Adafruit_RA8875::drawPixel(int16_t x, int16_t y, uint16_t color)
{
writeReg(RA8875_CURH0, x);
writeReg(RA8875_CURH1, x >> 8);
writeReg(RA8875_CURV0, y);
writeReg(RA8875_CURV1, y >> 8);
writeCommand(RA8875_MRWC);
digitalWrite(_cs, LOW);
SPI.transfer(RA8875_DATAWRITE);
SPI.transfer(color >> 8);
SPI.transfer(color);
digitalWrite(_cs, HIGH);
}
Also, unless something else changed I believe the same code will work for the ILI9340 as I did not find any real functional differences in the code bases
It has been awhile since I played with this display, but if I remember correctly I had better luck with this one when I hooked up reset pin and told the program to use it...