PDA

View Full Version : Teensyduino 1.23 Beta #2 Available



Paul
05-07-2015, 02:01 PM
Here is a first beta test for Teensyduino 1.23:



Edit: old beta test linkes removed. Full non-beta release is here:
http://www.pjrc.com/teensy/td_download.html



Please give this a try and report any bugs. Try to include a sample program that reproduces the problem!

These are the changes since Teensyduino 1.23-beta1 (https://forum.pjrc.com/threads/28499-Teensyduino-1-23-Beta-1-Available):



Support for Arduino 1.6.4
Update OSC library
analogWriteFrequency() now allow precise sub-1 Hz input
Fix SPI FIFO bug in ILI9341_t3

HWGuy
05-07-2015, 02:35 PM
I can't install Teensyduino over a new Arduino 1.6.4 installation. (win 7 64 bit, install dir: C:\Program Files (x86)\Arduino, teensyduino installer with admin rights)
According to the Help window from the Teensyduino installer, only Arduino 1.6.3 and older are supported.


Directory: C:/Program Files (x86)/Arduino/libraries/
Checking Arduino 1.0.6:
file: "arduino.exe" missing
Does not match Arduino 1.0.6
Checking Arduino 1.6.1-j7:
file: "arduino.exe" missing
Does not match Arduino 1.6.1-j7
Checking Arduino 1.6.1:
file: "arduino.exe" missing
Does not match Arduino 1.6.1
Checking Arduino 1.6.2:
file: "arduino.exe" missing
Does not match Arduino 1.6.2
Checking Arduino 1.6.3:
file: "arduino.exe" missing
Does not match Arduino 1.6.3

edit: The download links for windows and mac are for beta 1 and not beta 2

Mac OS-X:
http://www.pjrc.com/teensy/td_123-beta2/teensyduino.dmg

Windows:
http://www.pjrc.com/teensy/td_123-beta2/teensyduino.exe

nrsf
05-07-2015, 02:46 PM
Same here...

Paul
05-07-2015, 02:51 PM
Opps, copy & paste error! I've edited the links.

infomaniac50
05-08-2015, 01:06 AM
Is support for unofficial board files in the works?
https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls
https://learn.adafruit.com/add-boards-arduino-v164

PaulStoffregen
05-08-2015, 05:32 AM
Maybe someday Teensy will use their installer, but currently Teensy requires many features which are not officially part of the Arduino IDE and can't be installed by their Boards Manager.

defragster
05-08-2015, 06:15 AM
Pulled IDE.zip 1.6.4 and TD_1.23b2 and installed on Win8.1x64 and got a working verify. Moved my Teensy's to other computers so didn't run anything - four piled up here. Will drag one back or open another and post if trouble.

Is "unofficial board" just a .cc way (part) of excluding boards such as the .org units? Making them register as 'unreal'?

infomaniac50
05-08-2015, 04:26 PM
Maybe someday Teensy will use their installer, but currently Teensy requires many features which are not officially part of the Arduino IDE and can't be installed by their Boards Manager.

I wondered if that was the case. I copied the teensy and tools folder with just the teensy additions to the hardware folder in my sketchbook. I fired up the IDE and it was recognized right away. It compiled the code but it failed when it tried to define the rtc symbol. I've always used the __DATE__ __TIME__ macros to set the clock for my DS1307 chips.

There have been quite a few updates to the IDE recently and with every update do I need to rerun the Teensy Installer. Does the Teensy Installer replace core jar files or just drop a few extra ones in the lib folder. Is the source code available for the installer? Then I could find out myself.

BTW I'm using Ubuntu 14.04 LTS w/Xfce4. It originally had Unity but I quickly grew tired of it's lack of customization options.

The Teensyduino 1.23-Beta-2 works like a champ. I have yet to solder any headers to the board and so far I have only played with the built-in LED. Basic functionality is there, it compiles, launches the loader, and uploads when compilation is done. It's a little annoying to press the reset button every time I want to reprogram it but I've been spoiled by the Uno's auto reset. The Micro has reset functionality with a quick open and close at 1200 baud but I'm not sure if that could be done on the Teensy. I'm not familiar with the chip so my opinion is mostly ranting. It's a very nice board and very compact considering the amount of functionality on the little thing. The board I have is the Teensy 3.1 and I think it's a cheaper alternative to the Due and as I said before a lot smaller.


java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)



3.13.0-52-generic #86-Ubuntu SMP Mon May 4 04:32:59 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

pierrotm777
05-11-2015, 04:19 PM
This for this new version !!!

Koromix
05-11-2015, 04:40 PM
The Micro has reset functionality with a quick open and close at 1200 baud but I'm not sure if that could be done on the Teensy.

You can reset the Teensy the same way (assuming it's running in serial mode, and not HID) but 134 is the speed you need to trigger it.

Nantonos
05-11-2015, 05:26 PM
There have been quite a few updates to the IDE recently and with every update do I need to rerun the Teensy Installer.
Yes, you need to run the appropriate installer for the version of the IDE you are upgrading to Teensyduino. Each time.


Does the Teensy Installer replace core jar files or just drop a few extra ones in the lib folder.
It modifies jar files.

Nantonos
05-11-2015, 05:37 PM
Is "unofficial board" just a .cc way (part) of excluding boards such as the .org units? Making them register as 'unreal'?

It looks that way. Specifically, if you are using a board made by Adafruit or Sparkfun or Seedstudio or whatever, it is not an "unofficial board". Likewise none of the teensies are flagged as "unofficial". If you bought an Arduino-branded board from one of their many authorised distributors and it happens to have hardware with the Arduino.org new USB VID/PID then it gets flagged as "unofficial". A great way to penalize their users who purchased in good faith while not impacting at all Arduino.org who already have the money for the boards they made and sold.

Sorry, bit off topic for this thread. I haven't installed the beta, I went back to using Arduino 1.0.6 which is stable and solid. 1.5.x may have "come out of beta" with 1.6.x but it still feels like beta-quality to me. I lost a lot of confidence in Arduino.cc when they pulled that trick with a ton of months-old but hidden Github changes plus a release, all within a day or two. They need to get their act together.

PaulStoffregen
05-12-2015, 01:20 PM
Something isn't quite right with your installation:


It's a little annoying to press the reset button every time I want to reprogram it but I've been spoiled by the Uno's auto reset. The Micro has reset functionality with a quick open and close at 1200 baud but I'm not sure if that could be done on the Teensy.


Teensy does auto reset. Or it's supposed to. If Teensy is running one of the USB Types with Serial, the auto reset command it a baud rate set of 134. It's pretty much the same as Micro using 1200... except 134 baud is a much less common setting that most program don't offer from their menus.

If Teensy is running one of the non-Serial settings (eg, you chose it in Tools > USB Type before uploading), the auto-reset is done by sending a HID feature report.

Linux is tough to support, because there's so many distros with slightly different setups. I really only test Ubuntu 12.04 and 14.04. But this stuff should "just work" on modern udev-based systems.

PaulStoffregen
05-12-2015, 01:31 PM
If you bought an Arduino-branded board from one of their many authorised distributors and it happens to have hardware with the Arduino.org new USB VID/PID then it gets flagged as "unofficial". A great way to penalize their users who purchased in good faith while not impacting at all Arduino.org who already have the money for the boards they made and sold.


Arduino LLC (the real Arduino) removed all that code from 1.6.4.

Some time ago, they pushed a commit that disabled it. Just before the 1.6.4 release, they made a commit that completely removed every last line of that code, even though they'd already disabled it.

Several days ago, they mentioned 1.6.4 would be released quickly. I asked them to consider asking the community to do more beta testFederico Fissore wrote:



Unfortunately this is not yet the time for such a wide feedback period. Legal stuff urges us to make a release. But we have spread the word on social networks [1] (https://www.facebook.com/official.arduino/posts/1112103058816012) [2] (https://twitter.com/arduino/status/595522160183144450)

Hopefully, next time we won't have urgencies, thus allowing for a longer user testing.

This is really just a guess on my part, but I have a hunch "legal stuff urges us to make a release" likely means they lost some legal battle and a court (perhaps in Italy where court records aren't public) ordered them to take that out? Maybe? Really, this is just sheer speculation on my part.

But I can tell you, and I believe anyone who's worked much with the Arduino IDE's java code would agree, fully removing stuff that's already disabled, so there's no leftover cruft laying around, is VERY uncharacteristic of Arduino's normal coding, ugh... style. Yeah, that's it, let's use the word "style". ;)

Nantonos
05-12-2015, 05:08 PM
Installed fine over a fresh Arduino 1.6.4. I notice that the secondary menus are now persistent and don't constantly reset to Serial, US English, etc which is good.

I also see duplicate library alerts, such as

Multiple libraries were found for "MIDI.h"
Used: D:\Arduino\sketches\libraries\MIDI
Not used: D:\Arduino\arduino-1.6.4-td123-b2\hardware\teensy\avr\libraries\MIDI
which is also good. No issues found after a small number of tests. Edit: Windows 7

defragster
05-12-2015, 06:11 PM
It's a little annoying to press the reset button every time I want to reprogram it

Unless you have multiple active Teensy units online - as Paul notes 'Sketch >> Verify/Compile' does auto-Upload with Ctrl+R. With Multiples the problem is selecting which one gets uploaded.

wizard69
05-13-2015, 12:11 AM
Hi Paul;

A modest suggestion if I can. Would it be possible to get you to embedded version numbers into the downloads file names? It removes confusion as to what I have locally, in this case on a Mac OS system but I think it is fair to say it applies to other platforms. Of course on the mac you could embedded a file into the DMG to identify the version but that wouldn't be as handy on other systems.

I noticed you had a linking error earlier, embedded version numbers in the filenames might have helped here.

fretless_kb
05-13-2015, 11:33 AM
Hello,

I was working through various examples this weekend and found something interesting specifically with the graphics display. I have the display (http://pjrc.com/store/display_ili9341.html)sold by pjrc as well as the adafruit 2.8" touch screen (http://www.adafruit.com/products/2090) In one case I have the touch display connected to a T3 with a pjrc audio shield using alternate wiring described on the pjrc website for the graphics display.

My observable, if I use the graphics test example for adafruit I see the display working, if I use the graphics test example for the 'highly optimized t3 library I get no response from the display.

Obviously there is a difference in the libraries. My quick questions would be:
Is anyone else using the T3 specific libraries and having success? or should I just use the Adafruit version?
Is there any major difference in the Adafruit vs T3 library related to performance? or have the changes Paul made been incorporated into the adafruit library?

I started out testing with a clean install of 1.6.4 along with the teensyduino from the links above. after I determined the above behavior. I tried on my Arduino 1.6.3 installation with similar results and found an older 1.6.1 version, and got the same results.

here's the code that works with the display, it is the 'adafruit' example with some pinout changes to accommodate the audiocard being used.

Note that I also tested with a T3_0 no audio card but still using these alternate pin selections

Here's the T3 example: I only modified pin assignments, and the changes are the same to both the examples:


/************************************************** *
This is our GFX example for the Adafruit ILI9341 Breakout and Shield
----> http://www.adafruit.com/products/1651

Check out the links above for our tutorials and wiring diagrams
These displays use SPI to communicate, 4 or 5 pins are required to
interface (RST is optional)
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
************************************************** **/


#include "SPI.h"
#include "ILI9341_t3.h"

// For the Adafruit shield, these are the default.
#define TFT_DC 20
#define TFT_CS 21

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);

void setup() {
SPI.setMOSI(7);
SPI.setSCK(14);

tft.begin();
tft.fillScreen(ILI9341_BLACK);
tft.setTextColor(ILI9341_YELLOW);
tft.setTextSize(2);
tft.println("Waiting for Arduino Serial Monitor...");

Serial.begin(9600);
while (!Serial) ; // wait for Arduino Serial Monitor
Serial.println("ILI9341 Test!");

// read diagnostics (optional but can help debug problems)
uint8_t x = tft.readcommand8(ILI9341_RDMODE);
Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDMADCTL);
Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDPIXFMT);
Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDIMGFMT);
Serial.print("Image Format: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDSELFDIAG);
Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX);

Serial.println(F("Benchmark Time (microseconds)"));

Serial.print(F("Screen fill "));
Serial.println(testFillScreen());
delay(200);

Serial.print(F("Text "));
Serial.println(testText());
delay(600);

Serial.print(F("Lines "));
Serial.println(testLines(ILI9341_CYAN));
delay(200);

Serial.print(F("Horiz/Vert Lines "));
Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE));
delay(200);

Serial.print(F("Rectangles (outline) "));
Serial.println(testRects(ILI9341_GREEN));
delay(200);

Serial.print(F("Rectangles (filled) "));
Serial.println(testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA));
delay(200);

Serial.print(F("Circles (filled) "));
Serial.println(testFilledCircles(10, ILI9341_MAGENTA));

Serial.print(F("Circles (outline) "));
Serial.println(testCircles(10, ILI9341_WHITE));
delay(200);

Serial.print(F("Triangles (outline) "));
Serial.println(testTriangles());
delay(200);

Serial.print(F("Triangles (filled) "));
Serial.println(testFilledTriangles());
delay(200);

Serial.print(F("Rounded rects (outline) "));
Serial.println(testRoundRects());
delay(200);

Serial.print(F("Rounded rects (filled) "));
Serial.println(testFilledRoundRects());
delay(200);

Serial.println(F("Done!"));

}


void loop(void) {
for(uint8_t rotation=0; rotation<4; rotation++) {
tft.setRotation(rotation);
testText();
delay(1000);
}
}

unsigned long testFillScreen() {
unsigned long start = micros();
tft.fillScreen(ILI9341_BLACK);
tft.fillScreen(ILI9341_RED);
tft.fillScreen(ILI9341_GREEN);
tft.fillScreen(ILI9341_BLUE);
tft.fillScreen(ILI9341_BLACK);
return micros() - start;
}

unsigned long testText() {
tft.fillScreen(ILI9341_BLACK);
unsigned long start = micros();
tft.setCursor(0, 0);
tft.setTextColor(ILI9341_WHITE); tft.setTextSize(1);
tft.println("Hello World!");
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2);
tft.println(1234.56);
tft.setTextColor(ILI9341_RED); tft.setTextSize(3);
tft.println(0xDEADBEEF, HEX);
tft.println();
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(5);
tft.println("Groop");
tft.setTextSize(2);
tft.println("I implore thee,");
tft.setTextSize(1);
tft.println("my foonting turlingdromes.");
tft.println("And hooptiously drangle me");
tft.println("with crinkly bindlewurdles,");
tft.println("Or I will rend thee");
tft.println("in the gobberwarts");
tft.println("with my blurglecruncheon,");
tft.println("see if I don't!");
return micros() - start;
}

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);

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

tft.fillScreen(ILI9341_BLACK);

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;

tft.fillScreen(ILI9341_BLACK);

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;

tft.fillScreen(ILI9341_BLACK);

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);

return micros() - start;
}

unsigned long testFastLines(uint16_t color1, uint16_t color2) {
unsigned long start;
int x, y, w = tft.width(), h = tft.height();

tft.fillScreen(ILI9341_BLACK);
start = micros();
for(y=0; y<h; y+=5) tft.drawFastHLine(0, y, w, color1);
for(x=0; x<w; x+=5) tft.drawFastVLine(x, 0, h, color2);

return micros() - start;
}

unsigned long testRects(uint16_t color) {
unsigned long start;
int n, i, i2,
cx = tft.width() / 2,
cy = tft.height() / 2;

tft.fillScreen(ILI9341_BLACK);
n = min(tft.width(), tft.height());
start = micros();
for(i=2; i<n; i+=6) {
i2 = i / 2;
tft.drawRect(cx-i2, cy-i2, i, i, color);
}

return micros() - start;
}

unsigned long testFilledRects(uint16_t color1, uint16_t color2) {
unsigned long start, t = 0;
int n, i, i2,
cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;

tft.fillScreen(ILI9341_BLACK);
n = min(tft.width(), tft.height());
for(i=n; i>0; i-=6) {
i2 = i / 2;
start = micros();
tft.fillRect(cx-i2, cy-i2, i, i, color1);
t += micros() - start;
// Outlines are not included in timing results
tft.drawRect(cx-i2, cy-i2, i, i, color2);
}

return t;
}

unsigned long testFilledCircles(uint8_t radius, uint16_t color) {
unsigned long start;
int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;

tft.fillScreen(ILI9341_BLACK);
start = micros();
for(x=radius; x<w; x+=r2) {
for(y=radius; y<h; y+=r2) {
tft.fillCircle(x, y, radius, color);
}
}

return micros() - start;
}

unsigned long testCircles(uint8_t radius, uint16_t color) {
unsigned long start;
int x, y, r2 = radius * 2,
w = tft.width() + radius,
h = tft.height() + radius;

// Screen is not cleared for this one -- this is
// intentional and does not affect the reported time.
start = micros();
for(x=0; x<w; x+=r2) {
for(y=0; y<h; y+=r2) {
tft.drawCircle(x, y, radius, color);
}
}

return micros() - start;
}

unsigned long testTriangles() {
unsigned long start;
int n, i, cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;

tft.fillScreen(ILI9341_BLACK);
n = min(cx, cy);
start = micros();
for(i=0; i<n; i+=5) {
tft.drawTriangle(
cx , cy - i, // peak
cx - i, cy + i, // bottom left
cx + i, cy + i, // bottom right
tft.color565(0, 0, i));
}

return micros() - start;
}

unsigned long testFilledTriangles() {
unsigned long start, t = 0;
int i, cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;

tft.fillScreen(ILI9341_BLACK);
start = micros();
for(i=min(cx,cy); i>10; i-=5) {
start = micros();
tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
tft.color565(0, i, i));
t += micros() - start;
tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
tft.color565(i, i, 0));
}

return t;
}

unsigned long testRoundRects() {
unsigned long start;
int w, i, i2,
cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;

tft.fillScreen(ILI9341_BLACK);
w = min(tft.width(), tft.height());
start = micros();
for(i=0; i<w; i+=6) {
i2 = i / 2;
tft.drawRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(i, 0, 0));
}

return micros() - start;
}

unsigned long testFilledRoundRects() {
unsigned long start;
int i, i2,
cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;

tft.fillScreen(ILI9341_BLACK);
start = micros();
for(i=min(tft.width(), tft.height()); i>20; i-=6) {
i2 = i / 2;
tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(0, i, 0));
}

return micros() - start;
}


Here's the example I see output on the displays:


/************************************************** *
This is our GFX example for the Adafruit ILI9341 Breakout and Shield
----> http://www.adafruit.com/products/1651

Check out the links above for our tutorials and wiring diagrams
These displays use SPI to communicate, 4 or 5 pins are required to
interface (RST is optional)
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
************************************************** **/


#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

// When using the Audio shield, these are the default.
#define TFT_DC 20
#define TFT_CS 21

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

void setup() {
Serial.begin(9600);
Serial.println("ILI9341 Test!");
SPI.setMOSI(7);
SPI.setSCK(14);

tft.begin();

// read diagnostics (optional but can help debug problems)
uint8_t x = tft.readcommand8(ILI9341_RDMODE);
Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDMADCTL);
Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDPIXFMT);
Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDIMGFMT);
Serial.print("Image Format: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDSELFDIAG);
Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX);

Serial.println(F("Benchmark Time (microseconds)"));

Serial.print(F("Screen fill "));
Serial.println(testFillScreen());
delay(500);

Serial.print(F("Text "));
Serial.println(testText());
delay(3000);

Serial.print(F("Lines "));
Serial.println(testLines(ILI9341_CYAN));
delay(500);

Serial.print(F("Horiz/Vert Lines "));
Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE));
delay(500);

Serial.print(F("Rectangles (outline) "));
Serial.println(testRects(ILI9341_GREEN));
delay(500);

Serial.print(F("Rectangles (filled) "));
Serial.println(testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA));
delay(500);

Serial.print(F("Circles (filled) "));
Serial.println(testFilledCircles(10, ILI9341_MAGENTA));

Serial.print(F("Circles (outline) "));
Serial.println(testCircles(10, ILI9341_WHITE));
delay(500);

Serial.print(F("Triangles (outline) "));
Serial.println(testTriangles());
delay(500);

Serial.print(F("Triangles (filled) "));
Serial.println(testFilledTriangles());
delay(500);

Serial.print(F("Rounded rects (outline) "));
Serial.println(testRoundRects());
delay(500);

Serial.print(F("Rounded rects (filled) "));
Serial.println(testFilledRoundRects());
delay(500);

Serial.println(F("Done!"));

}


void loop(void) {
for(uint8_t rotation=0; rotation<4; rotation++) {
tft.setRotation(rotation);
testText();
delay(1000);
}
}

unsigned long testFillScreen() {
unsigned long start = micros();
tft.fillScreen(ILI9341_BLACK);
tft.fillScreen(ILI9341_RED);
tft.fillScreen(ILI9341_GREEN);
tft.fillScreen(ILI9341_BLUE);
tft.fillScreen(ILI9341_BLACK);
return micros() - start;
}

unsigned long testText() {
tft.fillScreen(ILI9341_BLACK);
unsigned long start = micros();
tft.setCursor(0, 0);
tft.setTextColor(ILI9341_WHITE); tft.setTextSize(1);
tft.println("Hello World!");
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2);
tft.println(1234.56);
tft.setTextColor(ILI9341_RED); tft.setTextSize(3);
tft.println(0xDEADBEEF, HEX);
tft.println();
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(5);
tft.println("Groop");
tft.setTextSize(2);
tft.println("I implore thee,");
tft.setTextSize(1);
tft.println("my foonting turlingdromes.");
tft.println("And hooptiously drangle me");
tft.println("with crinkly bindlewurdles,");
tft.println("Or I will rend thee");
tft.println("in the gobberwarts");
tft.println("with my blurglecruncheon,");
tft.println("see if I don't!");
return micros() - start;
}

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);

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

tft.fillScreen(ILI9341_BLACK);

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;

tft.fillScreen(ILI9341_BLACK);

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;

tft.fillScreen(ILI9341_BLACK);

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);

return micros() - start;
}

unsigned long testFastLines(uint16_t color1, uint16_t color2) {
unsigned long start;
int x, y, w = tft.width(), h = tft.height();

tft.fillScreen(ILI9341_BLACK);
start = micros();
for(y=0; y<h; y+=5) tft.drawFastHLine(0, y, w, color1);
for(x=0; x<w; x+=5) tft.drawFastVLine(x, 0, h, color2);

return micros() - start;
}

unsigned long testRects(uint16_t color) {
unsigned long start;
int n, i, i2,
cx = tft.width() / 2,
cy = tft.height() / 2;

tft.fillScreen(ILI9341_BLACK);
n = min(tft.width(), tft.height());
start = micros();
for(i=2; i<n; i+=6) {
i2 = i / 2;
tft.drawRect(cx-i2, cy-i2, i, i, color);
}

return micros() - start;
}

unsigned long testFilledRects(uint16_t color1, uint16_t color2) {
unsigned long start, t = 0;
int n, i, i2,
cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;

tft.fillScreen(ILI9341_BLACK);
n = min(tft.width(), tft.height());
for(i=n; i>0; i-=6) {
i2 = i / 2;
start = micros();
tft.fillRect(cx-i2, cy-i2, i, i, color1);
t += micros() - start;
// Outlines are not included in timing results
tft.drawRect(cx-i2, cy-i2, i, i, color2);
}

return t;
}

unsigned long testFilledCircles(uint8_t radius, uint16_t color) {
unsigned long start;
int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;

tft.fillScreen(ILI9341_BLACK);
start = micros();
for(x=radius; x<w; x+=r2) {
for(y=radius; y<h; y+=r2) {
tft.fillCircle(x, y, radius, color);
}
}

return micros() - start;
}

unsigned long testCircles(uint8_t radius, uint16_t color) {
unsigned long start;
int x, y, r2 = radius * 2,
w = tft.width() + radius,
h = tft.height() + radius;

// Screen is not cleared for this one -- this is
// intentional and does not affect the reported time.
start = micros();
for(x=0; x<w; x+=r2) {
for(y=0; y<h; y+=r2) {
tft.drawCircle(x, y, radius, color);
}
}

return micros() - start;
}

unsigned long testTriangles() {
unsigned long start;
int n, i, cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;

tft.fillScreen(ILI9341_BLACK);
n = min(cx, cy);
start = micros();
for(i=0; i<n; i+=5) {
tft.drawTriangle(
cx , cy - i, // peak
cx - i, cy + i, // bottom left
cx + i, cy + i, // bottom right
tft.color565(0, 0, i));
}

return micros() - start;
}

unsigned long testFilledTriangles() {
unsigned long start, t = 0;
int i, cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;

tft.fillScreen(ILI9341_BLACK);
start = micros();
for(i=min(cx,cy); i>10; i-=5) {
start = micros();
tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
tft.color565(0, i, i));
t += micros() - start;
tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
tft.color565(i, i, 0));
}

return t;
}

unsigned long testRoundRects() {
unsigned long start;
int w, i, i2,
cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;

tft.fillScreen(ILI9341_BLACK);
w = min(tft.width(), tft.height());
start = micros();
for(i=0; i<w; i+=6) {
i2 = i / 2;
tft.drawRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(i, 0, 0));
}

return micros() - start;
}

unsigned long testFilledRoundRects() {
unsigned long start;
int i, i2,
cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;

tft.fillScreen(ILI9341_BLACK);
start = micros();
for(i=min(tft.width(), tft.height()); i>20; i-=6) {
i2 = i / 2;
tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(0, i, 0));
}

return micros() - start;
}

I am currently using the adafruit library and moving on to try other functionality, but wanted to know if the t3 version should work and if it is supposed to be faster (if it did work.)

Cheers Kb

PaulStoffregen
05-13-2015, 02:09 PM
A modest suggestion if I can. Would it be possible to get you to embedded version numbers into the downloads file names?


Please post this here:

https://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports

For at least the next couple months, I'm concentrating on a number of important features, where the last thing I want to do is also fiddle with changes to how I build and release the software.

But farther out, this probably make good sense. Please post it on that suggestions area. Posted here, it'll never be seen again!

KurtE
05-13-2015, 09:37 PM
Hello,

I was working through various examples this weekend and found something interesting specifically with the graphics display. I have the display (http://pjrc.com/store/display_ili9341.html)sold by pjrc as well as the adafruit 2.8" touch screen (http://www.adafruit.com/products/2090) In one case I have the touch display connected to a T3 with a pjrc audio shield using alternate wiring described on the pjrc website for the graphics display.

My observable, if I use the graphics test example for adafruit I see the display working, if I use the graphics test example for the 'highly optimized t3 library I get no response from the display.
...


/************************************************** *
This is our GFX example for the Adafruit ILI9341 Breakout and Shield
----> http://www.adafruit.com/products/1651

Check out the links above for our tutorials and wiring diagrams
These displays use SPI to communicate, 4 or 5 pins are required to
interface (RST is optional)
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
************************************************** **/


#include "SPI.h"
#include "ILI9341_t3.h"

// For the Adafruit shield, these are the default.
#define TFT_DC 20
#define TFT_CS 21

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);

void setup() {
SPI.setMOSI(7);
SPI.setSCK(14);


tft.begin();
...

I am currently using the adafruit library and moving on to try other functionality, but wanted to know if the t3 version should work and if it is supposed to be faster (if it did work.)

Cheers Kb

Sorry, this is probably an issue with one of the later deltas that I did for the library. In particular I was trying to make it easier to pass in the alternate SPI pins into the constructor and if no spi pins were passed in then it assumes (and sets) the SPI pins to the default pins, which the tft.begin call will do.

A couple of fixes can happen. Use the long form of the constructor and pass in the SPI pins.

Or Could make a updated delta to the ILI9341 library, which if short form constructor, don't assume and set default IO pins. (Not hard). Again this was done to in theory make it easier and also add the ability for attempting to allow it to be used on SPI2 on the TLC, if/when we ever try to merge in TLC support.

Kurt

oric_dan
05-13-2015, 11:59 PM
Does the new version of Teensyduino still support the older IDE versions ok, eg v1.0.5?

I've not updated to anything past v1.0.5 because the installers past that appear to require you to remove "all" previous IDE versions from your HD anymore, and I have many library patches I don't wish to lose.

I've also not seen any "compelling" reason to want to switch IDEs, in any case. The older stuff ain't necessarily broken. The new IDEs always come with multiple new bugs.

KurtE
05-14-2015, 01:00 AM
I believe that Teensyduino still supports the old builds, but I am not sure about 1.0.5. It does support 1.0.6.

Personally I like the updated 1.6.x builds as there have been a few things fixed over the years. But I keep 1.0.6 installed using default install (Windows 7) and I keep the latest 1.6.x build installed using zip file version.

Kurt

PaulStoffregen
05-14-2015, 01:55 AM
Teensyduino 1.21 was the last version to support Arduino 1.0.5.

I decided to drop 1.0.5 because quite a few improvements had been added in my 1.0.6 patches. Backporting to old versions takes a lot of extra work, so I usually drop old versions after a while. 1.0.5 and 1.0.6 are very similar too, so there seemed to be little point in extra effort to keep 1.0.5 support alive.

But I'm planning to keep 1.0.6 and 1.6.1 for quite some time. Obviously 1.0.6 is the last of the 1.0.x series, and 1.6.1 is the last version that will ever support Mac OS-X 10.6.

Nantonos
05-14-2015, 02:41 AM
I've not updated to anything past v1.0.5 because the installers past that appear to require you to remove "all" previous IDE versions from your HD anymore, and I have many library patches I don't wish to lose.

Don't ever use the Arduino installers, on Windows. Use the zip instead. You can have as many Arduino versions as you want (I currently have 7, probably time to cull a few).

fretless_kb
05-14-2015, 03:04 AM
Thanks Kurt I changed to this


ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC,255,7,14,8);
...and It's working again.
I get this weird white screen with one of the test effects. I had that resolved before, I'll need to figure that out again. I should do this more frequently or keep better notes...

Thanks again. Kb

one quick update. The graphic test runs fine on the pjrc (offered) display on a T3.0 but the Ada fruit touch has an issue with the 'lines' test (sort of a inverse mode on the display) the rest of the test work well.

Will post an update If I find out what's up with lines...
Kb

defragster
05-14-2015, 05:57 AM
Nantonos beat me to it - I've had much better IDE behavior on Windows with 1 or more active installs - using the ZIP copy method - and through the flurry of 1.6.0,1,2,3,4 that says a lot on 3 Windows 7&8 mix of machines.

Also the PJRC ILI9341's SD slot has been hacked to work according to this diagram - I haven't tested yet: https://forum.pjrc.com/threads/28106-Display_ili9341?p=72904&viewfull=1#post72904

amundsen
05-14-2015, 11:37 AM
Hello,

Don't know if it's my code or the new Teensy beta applied on Arduino IDE 1.6.4/MacOS X 10.7.5, but I got this error message after my first attempt to compile:

/Applications/Arduino1.6.4+Teensy1.2.3.app/Contents/Java/hardware/teensy/avr/cores/teensy3/Print.h:66:9: note: no known conversion for argument 1 from 'double(double)' to 'long unsigned int'
Erreur lors de la compilation.




#include <Wire.h>

#define DEVICE1 (0x53) // Device address as specified in data sheet (SDO set to GND)
#define DEVICE2 (0x1D) // Second Device address as specified in data sheet (SDO set to +3.3V)

byte _buff[6];
char POWER_CTL = 0x2D; //Power Control Register
char DATA_FORMAT = 0x31;
char DATAX0 = 0x32; //X-Axis Data 0
char DATAX1 = 0x33; //X-Axis Data 1
char DATAY0 = 0x34; //Y-Axis Data 0
char DATAY1 = 0x35; //Y-Axis Data 1
char DATAZ0 = 0x36; //Z-Axis Data 0
char DATAZ1 = 0x37; //Z-Axis Data 1
int x1, y1, z1; // variables to hold final data for accel 1

void setup()
{

Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(19200); // start serial for output. Make sure you set your Serial Monitor to the same!
Serial.println("init");
//Put the ADXL345 1 into +/- 4G range by writing the value 0x01 to the DATA_FORMAT register.
newWriteTo(DATA_FORMAT, 0x01, DEVICE1);
//Put the ADXL345 1 into Measurement Mode by writing 0x08 to the POWER_CTL register.
newWriteTo(POWER_CTL, 0x08, DEVICE1);
//Put the ADXL345 1 into +/- 4G range by writing the value 0x01 to the DATA_FORMAT register.
newWriteTo(DATA_FORMAT, 0x01, DEVICE2);
//Put the ADXL345 1 into Measurement Mode by writing 0x08 to the POWER_CTL register.
newWriteTo(POWER_CTL, 0x08, DEVICE2);
}

void loop()
{
newReadAccel(); // read the x/y/z tilt on accelerometer
delay(50); // read every 50 ms only
}

// function to read accelerometer data from chosen device using Wire library and send them to serial port
void newReadAccel() {
uint8_t howManyBytesToRead = 6;
newReadFrom(DATAX0, howManyBytesToRead, _buff, DEVICE1); //function call to read the acceleration data from the ADXL345
// each axis reading comes in 10 bit resolution, ie 2 bytes. Least Significat Byte first!!
// thus we are converting both bytes in to one int
x1 = (((int)_buff[1]) << 8) | _buff[0];
y1 = (((int)_buff[3]) << 8) | _buff[2];
z1 = (((int)_buff[5]) << 8) | _buff[4];

Serial.print("x1: ");
Serial.print( x1 );
Serial.print(" y1: ");
Serial.print( y1 );
Serial.print(" z1: ");
Serial.print( z1 );

delay(2);
}

// newWriteTo function to write data into I2C devices with chosen device address
void newWriteTo(byte address, byte val, char device) {
Wire.beginTransmission(device); // start transmission to device
Wire.write(address); // send register address
Wire.write(val); // send value to write
Wire.endTransmission(); // end transmission
}

// newReadFrom Function to read num bytes starting from address register on chosen device in to _buff array
void newReadFrom(byte address, int num, byte _buff[], char mydevice) {
Wire.beginTransmission(mydevice); // start transmission to device
Wire.write(address); // sends address to read from
Wire.endTransmission(); // end transmission
Wire.beginTransmission(mydevice); // start transmission to device
Wire.requestFrom(mydevice, num); // request 6 bytes from device
int i = 0;
while(Wire.available()) // device may send less than requested (abnormal)
{
_buff[i] = Wire.read(); // receive a byte
i++;
}
Wire.endTransmission(); // end transmission
}

// low-pass (smooth) function
int smooth(int data, float filterVal, float smoothedVal){


if (filterVal > 1){ // check to make sure param's are within range
filterVal = .99;
}
else if (filterVal <= 0){
filterVal = 0;
}

smoothedVal = (data * (1 - filterVal)) + (smoothedVal * filterVal);

return (int)smoothedVal;
}

amundsen
05-14-2015, 11:56 AM
I have tried to compile the same code on an older IDE (Arduino 1.06 and Teensy 1.213).

The error messages are much more precise:

MebiiiSpring2015-TestAccelerometer.ino:30:9: error: 'int y1' redeclared as different kind of symbol
In file included from /Applications/Arduino106+Teensy121.app/Contents/Resources/Java/hardware/teensy/cores/teensy3/WProgram.h:6:0,
from /Applications/Arduino106+Teensy121.app/Contents/Resources/Java/hardware/teensy/cores/teensy3/Arduino.h:1,
from /Applications/Arduino106+Teensy121.app/Contents/Resources/Java/libraries/Wire/Wire.h:26,
from MebiiiSpring2015-TestAccelerometer.ino:17:
/Applications/Arduino106+Teensy121.app/Contents/Resources/Java/hardware/tools/arm/arm-none-eabi/include/math.h:469:15: error: previous declaration of 'double y1(double)'
extern double y1 _PARAMS((double));
^
MebiiiSpring2015-TestAccelerometer.ino: In function 'void newReadAccel()':
MebiiiSpring2015-TestAccelerometer.ino:57:6: error: assignment of function 'double y1(double)'
MebiiiSpring2015-TestAccelerometer.ino:57:6: error: cannot convert 'int' to 'double(double)' in assignment

The line pointed to is this one:

y1 = (((int)_buff[3]) << 8) | _buff[2];

I still don't know whether it's my code or the IDE, but I am almost sure it ran flawlessly on another board previously (Arduino Pro Mini).

PaulStoffregen
05-14-2015, 01:14 PM
That error seems to say you've also got a function named "y1" in the rest of your code (which you didn't post).

Obviously, if you name a variable the same as a function, that's going to confuse the compiler when you try to use the variable.

amundsen
05-14-2015, 01:42 PM
That error seems to say you've also got a function named "y1" in the rest of your code (which you didn't post).

Obviously, if you name a variable the same as a function, that's going to confuse the compiler when you try to use the variable.

The complete code is in the previous message and I don't see where I define y1 as a function...

???

kpc
05-14-2015, 01:47 PM
Try reading the error message it states where it can be found
previous declaration of 'double y1(double)'
y1 is one of the bessel functions

KurtE
05-14-2015, 01:55 PM
Actually it is defined internal to the compiler. If you look at the error message:

from Test.ino:1:
c:\arduino-1.6.4\hardware\tools\arm\arm-none-eabi\include\math.h:469:15: error: previous declaration of 'double y1(double)'
extern double y1 _PARAMS((double));
^

And if you look at math.h it defines several externs, like:

extern double y0 _PARAMS((double));
extern double y1 _PARAMS((double));
extern double yn _PARAMS((int, double));
extern double j0 _PARAMS((double));
extern double j1 _PARAMS((double));
extern double jn _PARAMS((int, double));

PaulStoffregen
05-14-2015, 01:57 PM
Oh, yes, I didn't catch that. Looks like math.h defines y1.

But avr-libc's math.h doesn't define this (and a LOT of other stuff).

Maybe Teensyduino should trim some of the math.h stuff that's so likely to conflict? The other common conflict seems to be "gamma".

amundsen
05-14-2015, 02:04 PM
Actually it is defined internal to the compiler. If you look at the error message:


And if you look at math.h it defines several externs, like:

So it's just a conflicting variable name ?

By the way why is Arduino IDE 1.0.6 so much more talkative about compilation errors than 1.6.4 ?

PaulStoffregen
05-14-2015, 04:50 PM
1.0.x and 1.6.x use separate prefs. Look at File > Preferences on both. Perhaps you have different settings? Maybe the "verbose info while compiling" setting?