teensy tft display free sample

/home/bruce/Apps/arduino-1.8.19/arduino-builder -dump-prefs -logger=machine -hardware /home/bruce/Apps/arduino-1.8.19/hardware -hardware /home/bruce/.arduino15/packages -tools /home/bruce/Apps/arduino-1.8.19/tools-builder -tools /home/bruce/Apps/arduino-1.8.19/hardware/tools/avr -tools /home/bruce/.arduino15/packages -built-in-libraries /home/bruce/Apps/arduino-1.8.19/libraries -libraries /home/bruce/Arduino/libraries -fqbn=teensy:avr:teensy41:usb=serial,speed=600,opt=o2std,keys=en-us -vid-pid=16C0_0483 -ide-version=10819 -build-path /tmp/arduino_build_231348 -warnings=none -build-cache /tmp/arduino_cache_429760 -verbose /home/bruce/Arduino/ILI9341_t3_Menu_TouchInput_myteensy/ILI9341_t3_Menu_TouchInput_myteensy.ino
/home/bruce/Apps/arduino-1.8.19/arduino-builder -compile -logger=machine -hardware /home/bruce/Apps/arduino-1.8.19/hardware -hardware /home/bruce/.arduino15/packages -tools /home/bruce/Apps/arduino-1.8.19/tools-builder -tools /home/bruce/Apps/arduino-1.8.19/hardware/tools/avr -tools /home/bruce/.arduino15/packages -built-in-libraries /home/bruce/Apps/arduino-1.8.19/libraries -libraries /home/bruce/Arduino/libraries -fqbn=teensy:avr:teensy41:usb=serial,speed=600,opt=o2std,keys=en-us -vid-pid=16C0_0483 -ide-version=10819 -build-path /tmp/arduino_build_231348 -warnings=none -build-cache /tmp/arduino_cache_429760 -verbose /home/bruce/Arduino/ILI9341_t3_Menu_TouchInput_myteensy/ILI9341_t3_Menu_TouchInput_myteensy.ino
/home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 /tmp/arduino_build_231348/sketch/ILI9341_t3_Menu_TouchInput_myteensy.ino.cpp -o /dev/null
/home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 -I/home/bruce/Arduino/libraries/ILI9341_t3_Menu-main /tmp/arduino_build_231348/sketch/ILI9341_t3_Menu_TouchInput_myteensy.ino.cpp -o /dev/null
/home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 -I/home/bruce/Arduino/libraries/ILI9341_t3_Menu-main -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3 /tmp/arduino_build_231348/sketch/ILI9341_t3_Menu_TouchInput_myteensy.ino.cpp -o /dev/null
/home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 -I/home/bruce/Arduino/libraries/ILI9341_t3_Menu-main -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3 -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/SPI /tmp/arduino_build_231348/sketch/ILI9341_t3_Menu_TouchInput_myteensy.ino.cpp -o /dev/null
/home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 -I/home/bruce/Arduino/libraries/ILI9341_t3_Menu-main -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3 -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/SPI -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/XPT2046_Touchscreen /tmp/arduino_build_231348/sketch/ILI9341_t3_Menu_TouchInput_myteensy.ino.cpp -o /dev/null
/home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 -I/home/bruce/Arduino/libraries/ILI9341_t3_Menu-main -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3 -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/SPI -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/XPT2046_Touchscreen /home/bruce/Arduino/libraries/ILI9341_t3_Menu-main/ILI9341_t3_Menu.cpp -o /dev/null
/home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 -I/home/bruce/Arduino/libraries/ILI9341_t3_Menu-main -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3 -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/SPI -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/XPT2046_Touchscreen /home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3/ILI9341_t3.cpp -o /dev/null
/home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 -I/home/bruce/Arduino/libraries/ILI9341_t3_Menu-main -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3 -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/SPI -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/XPT2046_Touchscreen /home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3/font_Arial.c -o /dev/null
/home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 -I/home/bruce/Arduino/libraries/ILI9341_t3_Menu-main -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3 -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/SPI -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/XPT2046_Touchscreen /home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3/font_ArialBold.c -o /dev/null
/home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 -I/home/bruce/Arduino/libraries/ILI9341_t3_Menu-main -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3 -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/SPI -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/XPT2046_Touchscreen /home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3/glcdfont.c -o /dev/null
/home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 -I/home/bruce/Arduino/libraries/ILI9341_t3_Menu-main -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3 -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/SPI -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/XPT2046_Touchscreen /home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/SPI/SPI.cpp -o /dev/null
/home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 -I/home/bruce/Arduino/libraries/ILI9341_t3_Menu-main -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3 -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/SPI -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/XPT2046_Touchscreen /home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/XPT2046_Touchscreen/XPT2046_Touchscreen.cpp -o /dev/null
/home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 -I/home/bruce/Arduino/libraries/ILI9341_t3_Menu-main -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3 -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/SPI -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/XPT2046_Touchscreen /tmp/arduino_build_231348/sketch/ILI9341_t3_Menu_TouchInput_myteensy.ino.cpp -o /tmp/arduino_build_231348/preproc/ctags_target_for_gcc_minus_e.cpp
/home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/precompile_helper /home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 /tmp/arduino_build_231348 /home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -x c++-header -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 /tmp/arduino_build_231348/pch/Arduino.h -o /tmp/arduino_build_231348/pch/Arduino.h.gch
/home/bruce/Apps/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/tmp/arduino_build_231348/pch -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 -I/home/bruce/Arduino/libraries/ILI9341_t3_Menu-main -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/ILI9341_t3 -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/SPI -I/home/bruce/Apps/arduino-1.8.19/hardware/teensy/avr/libraries/XPT2046_Touchscreen /tmp/arduino_build_231348/sketch/ILI9341_t3_Menu_TouchInput_myteensy.ino.cpp -o /tmp/arduino_build_231348/sketch/ILI9341_t3_Menu_TouchInput_myteensy.ino.cpp.o

This library supports ST7735 and ST7789 with and without a CS pin, such as https://www.amazon.com/gp/product/B07P9X3L7M/?pldnSite=1 which is a ST7789 240x240 display.
NOTE: If the Teensy has more than one SPI buss. And the IO pins are all on a different SPI buss then that buss will be used. (i.e. you can use SPI1 or SPI2). With this, on a board such as a T4 or T3.5 or T3.6 you can potentially have three displays all on different SPI busses and using the Async updates you can have all three of them updating their display at the same time.
The teensy 4.x, 3.6 and 3.5 have a lot more memory than previous Teensy processors, so on these boards, we borrowed some ideas from the ILI9341_t3DMA library and added code to be able to use a logical Frame Buffer.
Since the smaller ST7735 and maybe ST7789 displays have fewer pixels, you can on some of them enable a frame buffer on a T3.2 as well. I believe in this case I did add support for Async updates as well.

This library implements a SPI driver for the ILI9341 screen controller providing the ability to display memory framebuffers onto the screen very efficiently.
The library can work with any SPI bus. Multiples instances of the driver can manage multiple displays on different SPI buses. A significant speedup is possible when the DC pin from the ILI9341 screen is connected to a hardware CS (chip select) capable pin on the Teensy... Yes, this requirement may seems weird at first ! In that case, the library will use the SPI FIFO and DMA to their full capabilities which increases the framerate (around 35% faster) while reducing CPU usage (by around 20%).
ADVICE: Set DC to a hardware chip select capable pin of the Teensy whenever possible (the CS pin from the screen can be connected to any pin on the Teensy, it does not matter...)
On teensy 4/4.1, one can use either SPI0 or SPI1 (SPI2 should also work but is not readily accessible and untested). Here are possible wirings in both cases:
When the library is working in double buffering mode, it can take advantage of the fact that the last internal buffer uploaded to the screen mirrors the screen content. Therefore, when a new framebuffer is to be uploaded, the library can quickly check which pixels have changed and only upload those. This provides a huge speed bump when only a fraction of pixels changes at each frame (which is common when displaying a user interface for instance). The library is said to use differential updates in that case. When performing differential updates, the library first creates a diff log of all the changes between the new framebuffer and the previous one. Once this is accomplished, it can overwrite the internal frame buffer containing the old frame with the new one and, when an update is needed, just read the diff to select the pixels that must be pushed onto the screen. Updates can be carried away asynchronously while the user code draws the next frame.
The template parameter above specifies the size (in bytes) of the buffer. It should range from 1K to 10K depending on the kind of content displayed. The method diff1.printStats() can be used to check the diff buffer memory consumption at runtime to help choose its correct size.
The constructor of the main ILI9341Driver object tft does not initialize anything. We must do that when ready by calling the ubiquitous arduino begin() method (usually within setup()) like so:
This method returns true if the screen was correctly initialized. Note that there is no corresponding end() method so begin() should normally be called only once (but it can still be called again to issue a hard reset). The SPI_WRITE_SPEED and SPI_READ_SPEED parameters can be omitted so default speeds for write/read SPI will be used. The SPI read speed does not really matter and should not be changed. On the other hand, the maximum possible framerate is proportional to the SPI write speed so it should be set as high as possible while still keeping a stable connexion. With short wires, many displays will easily accept speeds upward of 60Mhz...
There are 4 possible orientations for the display (matching, of course, to the four physical orientations). Each one is obtained from the previous one by rotating the screen 90 degrees clockwise. Orientation 0 and 2 are in portrait mode 240x320 whereas orientation 1 and 3 are in landscape mode 320x240. In all cases, the framebuffer layout is in row-major format: if the screen has size LX x LY, then
The refreshrate is the number of times per second that the display redraws the pixels on the screen. Each screen refresh starts from the top-left corner and progresses along horizontal lines toward the bottom-right corner (with the display held in 240x320 portrait orientation mode 0). The row of pixels currently being refreshed is referred to as the scanline.
The framerate on the other hand is the number of times the screen content is actually updated by the driver every second. When pixel upload and pixel refresh are not synchronized, we end up with the screen displaying part of the old and the new frame simultaneously which create a visual defect called screen tearing.
The first condition depends heavily on the SPI speed. For example, with SPI set at 60Mhz, it is possible to upload up to 45 full frames per second. Being cautious, we can set a refresh rate at 80Hz and a framerate at 40Hz = (80/2) to obtain tear free frames on the screen. However, this computation is a worst case scenario: for most usage, differential updates boost the upload speed tremendously so it is often possible to get "tear free" display at 60Hz framerate (and 120Hz refresh rate) with only 20Mhz SPI speed !
The exact refresh rate varies from display to display. The driver will select the closest refresh rate available for this particular display. The actual refresh rate can subsequently be queried with the getRefreshRate() method.
Now, we must tell the driver the actual framerate/vsync method that we want. This is done with the tft.setVsyncSpacing() method. It takes as input a vsync_spacing parameter (what a surprise!) which has the following meaning:
vsync_spacing = -1. Do not synchronize display updates with screen refreshes (no vsync). Each new frame is drawn immediately onto the screen or saved into the internal framebuffer to be drawn asap if there is already an update in progress. If the internal framebuffer is in use, the frame is simply dropped...
vsync_spacing = 0. Do not synchronize display updates with screen refreshes (no vsync). Each new frame is drawn immediately onto the screen or saved into the internal framebuffer to be drawn asap if there is already an update in progress. If the internal framebuffer is in use, the method waits for a buffer to become available before returning (same as above but no frame is ever dropped).
What actually happens when the method is called depends on the buffering and vsync mode but, as a general rule, the method will try to return to the caller as soon as possible. It will use its internal framebuffer (if present) to save a copy of fb and return while uploading the frame asynchronously via DMA. So, when the method returns, fb may, or not, already be displayed on the screen but, in any case, the framebuffer can be immediately reused for drawing the next frame, changing its content will not affect the display on the screen !.
Drawing text on the framebuffer The overlayText() method can be used to draw some text onto the framebuffer. This is useful for displaying basic informations or debugging. Similarly, the method overlayFPS() draws the current instantaneous framerate onto a given framebuffer. Both methods overlayText() and overlayFPS() are typically called just before calling update().

This new library is a standalone library that contains the TFT driver as well as the graphics functions and fonts that were in the GFX library. This library has significant performance improvements when used with an UNO (or ATmega328 based Arduino) and MEGA.
Examples are included with the library, including graphics test programs. The example sketch TFT_Rainbow_one shows different ways of using the font support functions. This library now supports the "print" library so the formatting features of the "print" library can be used, for example to print to the TFT in Hexadecimal, for example:
To use the F_AS_T performance option the ILI9341 based display must be connected to an MEGA as follows:MEGA +5V to display pin 1 (VCC) and pin 8 (LED) UNO 0V (GND) to display pin 2 (GND)
TFT_ILI9341 library updated on 1st July 2015 to version 12, this latest version is attached here to step 8:Minor bug when rendering letter "T" in font 4 without background fixed

In this guide we’re going to show you how you can use the 1.8 TFT display with the Arduino. You’ll learn how to wire the display, write text, draw shapes and display images on the screen.
The 1.8 TFT is a colorful display with 128 x 160 color pixels. The display can load images from an SD card – it has an SD card slot at the back. The following figure shows the screen front and back view.
This module uses SPI communication – see the wiring below . To control the display we’ll use the TFT library, which is already included with Arduino IDE 1.0.5 and later.
The TFT display communicates with the Arduino via SPI communication, so you need to include the SPI library on your code. We also use the TFT library to write and draw on the display.
In which “Hello, World!” is the text you want to display and the (x, y) coordinate is the location where you want to start display text on the screen.
The 1.8 TFT display can load images from the SD card. To read from the SD card you use the SD library, already included in the Arduino IDE software. Follow the next steps to display an image on the display:
Note: some people find issues with this display when trying to read from the SD card. We don’t know why that happens. In fact, we tested a couple of times and it worked well, and then, when we were about to record to show you the final result, the display didn’t recognized the SD card anymore – we’re not sure if it’s a problem with the SD card holder that doesn’t establish a proper connection with the SD card. However, we are sure these instructions work, because we’ve tested them.
In this guide we’ve shown you how to use the 1.8 TFT display with the Arduino: display text, draw shapes and display images. You can easily add a nice visual interface to your projects using this display.

The Teensy is a breadboard-friendly development board with a large number of features in a small package. Each Teensy 3.6 comes pre-flashed with a bootloader allowing to program it through the onboard USB connection; there is no need for an external programmer.
Users can program the Teensy working with their favorite program editor using C, or they can install the Teensyduino add-on for the Arduino IDE and develop Arduino sketches.

Spice up your Arduino project with a beautiful large touchscreen display shield with built in microSD card connection. This TFT display is big (7" diagonal) bright (18 white-LED backlight) and colorfu 1024x600 pixels with individual pixel control. As a bonus, this display has a optional capacitive touch panel attached on screen by default.
This display shield has a controller built into it with RAM buffering, so that almost no work is done by the microcontroller. You can connect more sensors, buttons and LEDs.

The arduino due is an excellent board, however very few libraries are really optimized to get the best out of it. The best SPI display would be the 3.2" ILI9341 using the ILI9341_due library.
Larger displays require extra power to properly handle the backlight. This aspect is vital to ensure the stability of the TFT on the arduino due. Another aspect is the accessibility to the pins of the MCU to connect other devices. The shield_TFT covers all and limits their use.

The Teensy 4.0 Triple CAN Bus Board with 240x240 IPS LCD And MicroSD is a Teensy 4.0 board with triple CAN Bus connections, two Classical CAN 2.0B, and one CAN FD. It can be powered by an external +12 VDC power supply with reverse voltage protection. Also included isa 240x240 wide-angle IPS TFT LCD display with microSD holder.
The Teensy 4.0 is an Arduino-compatible board with an Arm Cortex-M7 microcontroller running at 600 MHz. The board is compatible with theand the Arduino library. In most cases, code written for another Arduino board works with a minimum of changes on a Teensy. As the name implies, the board is tiny. For example, the current form factor is only about 18 by 36 millimeters. However, do not let the size mislead you; these boards pack a ton of functionality. For example, the new Teensy 4.0 features a megabyte of RAM, two megabytes of Flash, a bevy of I/O options, cryptographic support, a hardware floating-point processor (FPU), and a built-in real-time clock (RTC).

Hi guys, welcome to today’s tutorial. Today, we will look on how to use the 1.8″ ST7735 colored TFT display with Arduino. The past few tutorials have been focused on how to use the Nokia 5110 LCD display extensively but there will be a time when we will need to use a colored display or something bigger with additional features, that’s where the 1.8″ ST7735 TFT display comes in.
The ST7735 TFT display is a 1.8″ display with a resolution of 128×160 pixels and can display a wide range of colors ( full 18-bit color, 262,144 shades!). The display uses the SPI protocol for communication and has its own pixel-addressable frame buffer which means it can be used with all kinds of microcontroller and you only need 4 i/o pins. To complement the display, it also comes with an SD card slot on which colored bitmaps can be loaded and easily displayed on the screen.
The schematics for this project is fairly easy as the only thing we will be connecting to the Arduino is the display. Connect the display to the Arduino as shown in the schematics below.
Due to variation in display pin out from different manufacturers and for clarity, the pin connection between the Arduino and the TFT display is mapped out below:
We will use two example sketches to demonstrate the use of the ST7735 TFT display. The first example is the lightweight TFT Display text example sketch from the Adafruit TFT examples. It can be accessed by going to examples -> TFT -> Arduino -> TFTDisplaytext. This example displays the analog value of pin A0 on the display. It is one of the easiest examples that can be used to demonstrate the ability of this display.
The second example is the graphics test example from the more capable and heavier Adafruit ST7735 Arduino library. I will explain this particular example as it features the use of the display for diverse purposes including the display of text and “animated” graphics. With the Adafruit ST7735 library installed, this example can be accessed by going to examples -> Adafruit ST7735 library -> graphics test.
Next, we move to the void setup function where we initialize the screen and call different test functions to display certain texts or images. These functions can be edited to display what you want based on your project needs.
Uploading the code to the Arduino board brings a flash of different shapes and text with different colors on the display. I captured one and its shown in the image below.
That’s it for this tutorial guys, what interesting thing are you going to build with this display? Let’s get the conversation started. Feel free to reach me via the comment section if you have any questions as regards this project.

"In the TFTLCD Library folder, you will need to edit TFTLCD.h. On about line 12, you will see "#define USE_ADAFRUIT_SHIELD_PINOUT". Comment out this line and save the file."
I have done this, saved the file, reopened arduino.exe, loaded the graphicstest example that comes with the TFT LCD library and tried to verify/compile it, but here I get errors:
"Start at the end of the TFT (other side than the power pins) and in order connect the pins to digital 7 thru 2. If you"re using a mega, connect the TFT Data Pins #0-7 to Mega pins #22-29, in that order. Those Mega pins are on the "double" header.
It should be possible to modify "pin_magic.h" to add definitions for the Teensy. You will need to understand the Port/Pin mappings on the Teensy. A good understanding of C++ macros is essential as well.
When I run either the graphicstest or the tftbmp example, the identification part works now, but the screen doesnt display anything other than the backlight, and a quick flicker (<20ms or so) at the exact moment something is drawn to the screen.
I have browsed 70 pages of forum searchresults on "2.8 TFT", but pretty much everyone who had this issue has gotten an offer for a replacement, so I am unsure how to move forward from here.
adafruit_support wrote:Do you have access to a standard Arduino (Duemilanove, UNO)? If you can run on that with the unmodified software then you know the display is good.
Here is a youtube vid I made (30+ sec. long) displaying a project I"m working on, but it shows quite nice how accurate the display/touch sensitivity is
I do not think that the code used for Teensy support in pin_magic.h can/will be optimized any further except maybe change the pins to a more grouped section of pins, mine are all over the board now...
I haven"t heard back from Paul Stoffregen yet, he has enough on his mind already, so as far as I"m concerned you can add it to the library for general Teensy 3.0 support.

The ST7789 TFT module contains a display controller with the same name: ST7789. It’s a color display that uses SPI interface protocol and requires 3, 4 or 5 control pins, it’s low cost and easy to use. This display is an IPS display, it comes in different sizes (1.3″, 1.54″ …) but all of them should have the same resolution of 240×240 pixel, this means it has 57600 pixels. This module works with 3.3V only and it doesn’t support 5V (not 5V tolerant).
The ST7789 display module shown in project circuit diagram has 7 pins: (from right to left): GND (ground), VCC, SCL (serial clock), SDA (serial data), RES (reset), DC (or D/C: data/command) and BLK (back light).
As mentioned above, the ST7789 TFT display controller works with 3.3V only (power supply and control lines). The display module is supplied with 3.3V (between VCC and GND) which comes from the Arduino board.
To connect the Arduino to the display module, I used voltage divider for each line which means there are 4 voltage dividers. Each voltage divider consists of 2.2k and 3.3k resistors, this drops the 5V into 3V which is sufficient.
The first library is a driver for the ST7789 TFT display which can be installed from Arduino IDE library manager (Sketch —> Include Library —> Manage Libraries …, in the search box write “st7789” and install the one from Adafruit).

Creating a good real-time simulation of a music speaker cabinet generally requires an FIR filter with a large number of taps—more than was possible with the Teensy 3.6. In this project article, Brian builds one using the Teensy 4.1 module, making use of its large memory, faster speed and added features.
In my article “Fancy Filtering with the Teensy 3.6” (Circuit Cellar 346, May 2019) [1], I introduced convolution filtering, which can be used for guitar cabinet simulation, among many other things. By using FFT routines, you can convert a time-domain-based convolution filter into one that is implemented in the frequency domain. As I explained in that article, this allows the filtering to be performed much more quickly. For example, the Teensy 3.6 board that I used at the time could easily handle a 512-tap FIR filter in real time, without taxing the MCU too much.
However, for guitar speaker cabinet simulation it turns out that getting a really good simulation generally requires an FIR filter with a much larger number of taps. Although the Teensy 3.6 board’s microcontroller (MCU) had enough “horsepower” to handle a filter with more than 512 taps, there are other complications. The larger the number of taps in the filter, the larger the RAM memory requirements are. When I started using the Teensy 3.6 board, its 256KB of SRAM seemed huge, but it turns out it’s not enough to handle FIR filters (implemented using floating-point FFT methods) a lot larger than 512 taps.
When the Teensy 4.0 board became available, it sported 1MB of SRAM, which would seem to solve the memory problem. It also ran at 600MHz (more than 3 times the speed of the MCU used on the Teensy 3.6), so it looked like execution time might not be an issue. However, another issue seemed to me to be unsolvable.
The 128-point partition size is not a random choice. The Teensy Audio Library deals exclusively with 128-sample blocks. That is, it buffers the incoming audio samples from the NXP Semiconductor SGTL5000’s ADC into 128-sample blocks, and uses DMA to move these blocks among the other buffers used by the various audio library functions. To provide steady, uninterrupted sound output, any Teensy Audio Library routine must accept a 128-sample block every 2.9ms, and output a processed 128-sample block at the same rate.
The idea of the uniformly partitioned convolution filter previously described sounds easy, and I implemented it in less than 100 lines of code in my library routine. However, that small size was largely due to my extensive use of CMSIS (Common Microcontroller Software Interface Standard) DSP routines, and it wasn’t easy to come up with that code. Frank spent a lot of time studying Warren Pratt’s code to adapt it to a form that would compile with the Teensy’s Arduino-based compiler. I played a small role in this. My contribution was in porting his code into a C++ Teensy Audio Library class, optimizing it a bit and performing some testing.
The Arm CMSIS DSP routines perform many different matrix-style operations, such as complex FFT, iFFT and time-domain convolution routines. These routines make heavy use of the Arm DSP-like instructions that are available on the NXP (formerly Freescale) MIMXRT1062 Cortex M7 MCU used on the Teensy board. The FFT and iFFT routines contain large tables (related to the size of the FFT you are performing) that are used as look-up tables to speed up the FFT operation. I believe these tables are used to eliminate the bit-twiddling operation (swapping all bits MSB to LSB) that is a part of the FFT routine. It would be impossible to independently write code for such routines that ran as fast as the CMSIS ones do!
Every 2.9ms, a 128-sample block of 16-bit audio data (for both Left and Right channels) is made available by the Teensy Audio Library. Since the CMSIS complex FFT routine expects both I (in-phase) and Q (quadrature) values, the Left and Right channels’ samples are used for I and Q, respectively, and are processed independently. For this project, only a monaural guitar signal is available, so the Q channel processing is basically wasted.
The 256-sample audio signal block is then converted into the frequency domain by a complex 256-point FFT. So, we now have both the Filter Mask and the incoming audio signal in the frequency domain. These frequency domain data blocks are stored in a circular buffer in memory, which implements a frequency domain delay line. The convolution process, if performed in the time domain, is a math-intensive process. Its execution time is linearly related to the number of taps in the Filter Mask. Even the very fast Cortex M7 MCU on the Teensy 4.1 board couldn’t handle time domain convolutions (in real time) using Filter Masks with the number of taps in the 2,000+ range. However, in the frequency domain, convolution is reduced to multiplication, and the execution time is now proportional to the log of the number of Filter Mask taps. The Teensy 4.1 probably has enough processing “horsepower” to handle Filter Masks of >50,000 taps. However, the Teensy 4.1 RAM memory is not large enough to accommodate the large arrays needed for such a large number of FIR filter taps.
Figure 2a: I patched my program to pass along the incoming 128-sample audio blocks to the SGTL5000 DAC with the convolution filter routine patched out. The latency here was 6.4ms. This is the minimum latency you could ever achieve, using the Teensy Audio Library with no processing blocks added.
In the Teensy Audio Library, the ADC signals are accumulated into a 128-sample buffer before they are processed. This results in a 2.9ms delay at 44,100 sample rate.
These files must be added to the folder containing the Teensy Audio Library. This folder will be located under whatever folder you have installed the Arduino/Teensyduino IDE. The path is as follows:
Please refer to the schematic shown in Figure 5. The Teensy 4.1 module used for this project contains the NXP (formerly Freescale) MIMXRT1062 Arm Cortex M7 MCU running at 600MHz. This MCU contains 1MB of RAM storage, which is necessary to handle the long impulse files that I mentioned earlier. Unlike the Teensy 4.0 module used in my earlier project article, the Teensy 4.1 contains extra on-board features, some of which are used in this project:
I use the SD card socket on the Teensy 4.1 to store the impulse files. It is connected to the MCU via a high speed SDIO port. The Teensy Audio Adapter [4] also contains an SD card socket, but it is interfaced via SPI, so it is a lot slower. Using the SDIO-connected SD card socket on the Teensy 4.1, the amount of time it takes to load a 22,500-sample impulse file (the maximum size this project will handle) is about 150ms. This is as fast as you can stomp on the switch to advance from one impulse to the next, so there is no noticeable delay.
The power for the Teensy 4.1 can be provided either by plugging a USB 5V adapter into the micro-USB socket on the Teensy 4.1 module, or supplying 5V to the VIN pin. I supply 5V using a USB 5V adapter. This 5V also feeds out through the Teensy’s VIN pin and that supplies 5V to the FET preamplifier through an LC filter.
There is a Texas Instruments (TI) TLV75733 LDO regulator on the Teensy 4.1. It provides a regulated 3.3V for the MIMXRT1062 MCU, and makes this 3.3V power available for external circuitry, using the “3.3V” pin. The Teensy Audio Adapter board is powered by this 3.3V supply.
In this project, I make no use of the dedicated DSP, though I have used it successfully in earlier projects. The SGTL5000 datasheet doesn’t specifically mention how many bits of resolution the codec supports, but in any case, the Teensy Audio Library supports only 16-bits.
Unfortunately, I found that the noise level that I got using these two devices was more than I preferred. I was using a protoboard with reasonably sized ground and VCC tracks, and did the hand-wiring as carefully as I could. I guess that there was too much noise on the ground bus, or picked up from the MIMXRT1062, but I wasn’t able to reduce it enough for my liking. So, out came my solder sucker, and the ADC/DAC circuitry was replaced by the Teensy Audio Adapter board.
Although the Teensy Audio Adapter board contains most of the mixed-signal circuitry needed for the project, there is one issue. The Line Inputs have enough gain to handle a guitar’s signal properly; in fact, I set the input amplifier for a full-scale amplitude of 560mV. (Its most sensitive setting is 240mV.) However, the Line In input impedance is only 29kΩ. Most guitars, apart from those with an internal pre-amplifier, have a high source impedance. Their tone will be seriously degraded if the input impedance of the amplifier they are plugged into is less than 100kΩ. Commercial guitar amplifiers have an input impedance of 500kΩ to 1MΩ.
I was planning on using the left channel Line Out for the output signal. As I was building/programing the unit, I simply had been plugging headphones into the Teensy Audio Adapter’s headphone output. This had provided an acceptable signal-to-noise ratio. However, when I tried to feed the Line Out signal into my studio mixer, I found significantly more noise. I attributed the difference between the two outputs to ground noise introduced into the Line Output signal.
I used a common 2.8” SPI-based color TFT touchscreen display for the unit. Initially I didn’t plan on having any graphics requirements, but I wanted to be able to display the impulse name in a medium-sized font, and also display an impulse number in a large (72pt) font that could be seen at a distance. The touchscreen display works fine for this, and is only slightly more expensive than common alphanumeric LCD displays, which are not particularly readable in the dark or at any distance.
I wanted to have a descriptive impulse name displayed on the TFT screen. However, the SD card library that I have used in the past could handle only the old DOS-standard 8.3 filenames. It wouldn’t be much use to display only the 8 characters that made up the primary file name. Therefore, I wired up the touchscreen controller and added a feature to the program that would allow the user to enter a descriptive name for each loaded impulse file, using the touchscreen for initial data entry. This descriptive name would be linked to the impulse file name, and stored in the MCU’s EEPROM space (which is emulated in flash memory).
Just after I finished doing this, I read on the PJRC (Teensy) Forum that the latest beta version of the Teensyduino Arduino add-in contained support for long filenames, as part of the new SD card library. Incorporating that feature seemed like a much better solution, since one could merely rename each impulse file with a longer file name that was more descriptive. That eliminated the need to store descriptive impulse names in EEPROM and the use of the touchscreen to enter those names.
I realized, after looking at the mostly empty TFT screen (just an impulse name and a large font impulse #), that it would be interesting to display a picture of the guitar amplifier (or speaker cabinet) that was being simulated. It’s pretty easy to find such images on the Internet, snip them off the screen and format them in a picture editor.
My Windows 10 snipper program saves its screen captures in jpg or png format. I bring this file into Corel PhotoPaint, and resample it so that it is no larger than 250×184 pixels—the space that I have allocated for the image on the TFT screen. Then I export it in bmp format, giving it the same primary filename as the impulse file that it represents (and a .bmp extension). Luckily, a routine in the Teensy library takes bmp files from an SD card and displays them on the same TFT display that I use in this project. I load these image files on the same SD card that the impulse files are stored on. These images require about 200ms to load/display.
To allow me to quickly sequence through the various impulse files (by repeatedly pressing the footswitch on the unit), I delay the display of this image for a few seconds. So, if you keep pressing the footswitch, each impulse will be loaded almost immediately (150ms delay maximum), and will not be slowed down by the image load/display time, since this image won’t show up until a few seconds after you have settled upon a particular impulse file. The unit’s display with a Fender amplifier is shown in Figure 6.
I should mention that the Teensy Audio Adapter is currently available in two versions, Rev. C and Rev. D. Originally, the C revision module was designed to piggy-back on top of the Teensy 3.2 module; that is, the pins matched the pinout of the Teensy 3.2. The Teensy 4.0/4.1 MCU modules have a somewhat similar pinout to that of the Teensy 3.2, but the I2S pins are different. This explains the two versions of the Teensy Adapter. Rev. C matches the pinout of the Teensy 3.2, and Rev. D matches the Teensy 4.0/4.1.
I don’t mount the Teensy Audio Adapter on top of the Teensy MCU module, because it makes it too bulky vertically. Since I am hand-wiring the two modules together, I’ve kept only Rev. C modules, and use them with whatever Teensy module I am using for the project. However, if you are using a Rev. C board with the much faster Teensy 4.0/4.1, you have to place a 100Ω resistor in series with the MCLK line, as shown in the Figure 5 schematic. Table 1 shows the wiring for each of the two revisions (sourced from the PJRC Teensy website).
The last thing I’ll mention about the SGTL5000 CODEC contained on the Teensy Audio Adapter, is that it requires an I2C connection to receive its configuration commands from the MCU. You won’t see the normal pull-up resistors on the SCL and SDA lines in the schematic, since there are 2.2kΩ resistors on the Teensy Audio Adapter module, itself. Figure 7 is a photo of the circuit board, and Figure 6 shows the completed unit in its enclosure.
I have built many music/audio-related projects with various members of the Teensy MCU family of boards. Apart from the powerful MCU that can now be found on the Teensy 4.x modules, the huge number of Arduino libraries that work with these modules is a major consideration. Also, the easy-to-use Teensy Audio Library contains the most comprehensive collection of audio functions that I have found among the four MCU product lines that I routinely use.
That said, I am still amazed that it is possible to do a 22,000-point FIR filter routine in real time on an Arm MCU with a latency in the 10-15ms range. This can be attributed to the fact that the routine is performed in the frequency domain, as mentioned earlier. However, the elegant coding found in the CMSIS DSP routines, together with the high usage of DMA data transfers in the Teensy Audio Library, also contribute to this high performance.
Although I designed this unit to perform only guitar-cabinet simulations, the Teensy MCU is nowhere near fully utilized with that task. The FFT-convolution routine, which is performed for each audio block (occurring every 2.9ms), takes a bit less than 1ms to execute, so about 60% of MCU capacity is free. Using other blocks in the Teensy Audio Library, it would be possible to add effects such as tremolo, reverb, chorus or even a guitar tuner (using the notefreq block).
The firmware for this project can be found on the Circuit Cellar’s article code and files webpage. Note that I used Arduino version 1.8.13 and Teensyduino Beta 1.54. These newest versions are needed to compile the code. My uniformly partitioned convolution filter library is available with the rest of the firmware on the article code and files webpage. It must be added to the Teensy Library as described earlier in the article.
Ms.Josey
Ms.Josey