skip navigational linksPJRC
Shopping Cart Download Website
Home Products Teensy Blog Forum
You are here: Teensy Reference Arduino Contrib.

PJRC Store
Teensy 4.1, $31.50
Teensy 4.0, $23.80
Teensy
Main Page
Hardware
Getting Started
Tutorial
How-To Tips
Code Library
Projects
Teensyduino
Reference

Arduino Contributions

Many of Teensyduino's improvements are contributed back to Arduino. Often bugs in Arduino are found and fixed while working on Teensyduino, or on behalf of PJRC's customers using Arduino.

Here is a list of contributions to Arduino which have been funded by PJRC from sales of Teensy boards:

Contributions

Allow each platform to customize keywords, and automatically update keyword colors in the editor when changing the Tools > Boards menu.

Improve Examples Menu.

Test Wire library performance issue on Arduino 101 and send test hardware to Intel developers to reproduce the issue.

Fix Madgwick library example and orientation visualizer example.

Improved Adafruit's touchscreen library.

Fix for SD library root dir reopen issue.

Built toolchain for ARM chip support on Raspberry Pi.

Show sub-menu settings in Tools menu. Makes all the settings easy to see at a quick glance of the Tools menu, instead of having to mouse over each sub-menu to see its setting.

Advise of duplicate libraries after compiling

Add library dependency detection, using "gcc -M" to analyze which headers each library really uses. This would allow #include <SD> in a sketch without #include <SPI>, because the fact SD depends on SPI can be discovered automatically.

Add the ability for scaling of fonts and icons, for use on 4K and other higher dots-per-inch displays. This work began on the Arduino forum from forum user "the-fallen".

Improve library name matching (again).

Fixed status bar update when custom menus change.

Resolved startup issue

Add a Copy to Clipboard Button for people to more easily post error messages when requesting help on forums.

Improve Arduino's library name matching from header file includes.

Fixed SPI transaction mismatch in SD library

Fixed memory leak and improved performance in Arduino's Serial Monitor. (final patch)

Published article about SPI bus design, hopefully to encourage all of use to make more interoperable SPI-based shields, breakout boards and libraries.

Patch to fix problems with the VS1053 library

Improved nRF8001 library, to allow using SD card in same project without crashing.

Patch to resolve library conflicts

digitalPinToInterrupt variant macro

SERIAL_* metadata in variants files

Arduino Due using pgmspace compatibility layer, TODO: link to github commit

Add select-paste on Linux

AltSoftSerial library (mostly used on Arduino Uno where no other serial port exists)

Discovered buffer overflow in String on Arduino Due. Reported on mail list, April 19, 2013 04:38 AM (TODO: public archive link?)

Troubleshoot a timing bug using OneWire on Arduino Due. The fix... Arduino Due adopted Teensy 3.0's implementation of delayMicroseconds: http://arduino.cc/forum/index.php/topic,141030.msg1117412.html#msg1117412

http://code.google.com/p/arduino/issues/detail?id=426

Initial porting of the Arduino Test Suite for Arduino Due. Here is the patch.

Automatically create the sketchbook libraries folder, if it is not present, and populate it with a readme file, (Arduino Issue 202 and Arduino Issue 986). This improvement was in collaboration with Limor Fried (LadyADA) and Phillip Torrone of Adafruit, in response to their customers needing to install Arduino libraries. Limor added the readme text. This change will become part of Arduino 1.0.2.

Serial flush() fixed by Michele Mazzucchi, (Arduino Issue 871) using Teensyduino's HardwareSerial implementation.

Fixed mismatched line number bugs between error messages and the editor window. (Arduino Issue 907 and Arduino Issue 281).

Wire library backwards compatibility Arduino Issue 854), allowing pre-1.0 examples to run properly on Arduino 1.0 & later. This patch was rejected. Teensyduino implements this patch for Teensy boards.

Packaged Linux 32 bit and 64 bit toolchains, so Linux users get the same toolchain as Windows and Mac users. (Arduino Issue 300 and Arduino Issue 841). Some Linux distros, notably Gentoo and Arch, have regularly shipped non-functional toolchains, causing tremendous grief for Arduino (and Teensyduino) users on those systems. This contribution makes Arduino a self-contained system that "just works" on Linux, as it has always been on Mac and Windows. Linux users (and distro package maintainers) who want to use their system's toolchain can do so by merely deleting the included toolchain.

Special optimized "Parallel to Serial" sketch, for Philip Burgess and anyone who wants to connect a large number of RGB LEDs to processing or other languages using only normal serial drivers. This awesome DomeStar project used the code.

Speed up Arduino's compile process by reusing previously compiled code, when the source has not changed (Arduino Issue 638). This was considered a very substantial change (first contributed on issue 393), so the Arduino Team was reluctant to include it without extensive testing. It shipped in Teensyduino for over 1 year. As part of the effort to get enough Arduino users to confirm it was beneficial for Arduino, this YouTube video was made. Eventually, this patch was accepted and became part of Arduino 1.0.1.

Debugging digitalWrite interrupt safety, (Arduino Issue 146 and Arduino Issue 33 and numerous topics on the Arduino Forums).

Firmata 2.2 & 2.3, porting Firmata to work on Teensy, Arduino Mega and other boards. Previously, Firmata was hard-coded for only the Arduino Diecimila/Duemilanove/Uno. Arduino Uno and Mega began shipping with Firmata pre-installed shortly after I rewrote Firmata to use hardware abstraction.

Firmata Test - A native cross platform GUI-based program which automatically detects the board type and allows access to all pins. Firmata is often used via libraries high-level languages like Max/MSP, Puredata, and Openframeworks. Firmata Test allows easy testing with a self-contained native application.

Menu cleanup, (Arduino Issue 257). The Arduino developers wanted to shorten the growing list of boards to something more managable, where minor variations of a board would move to another menu. This patch appears to have been abandoned.

Fixed String class buffer overflow bugs, in the mere days before 0019's release, when the Arduino Team announced the String class would become part of Arduino.

String class rewrite, post-0019 (Arduino Issue 468). Even with the buffer overflow bugs fixed, String in Arduino 0019 to 1.0 was terribly buggy. Determined not to subject Teensyduino users to unreliable String, it was completely rewritten in November-December 2010. Eventually, most of this work was merged to Arduino 1.0. The fixes for memory allocation bugs have remained unused, even in Arduino 1.0.1, causing String to remain unreliable on Arduino boards. Hopefully Arduino 1.0.2 will finally use it? Teensyduino has shipped a working String class since December 2010.

Simple hardware abstractions (Arduino Issue 275). Unfortunately, in many ways this was "too little, too late". More comprehensive abstractions, like (Arduino Issue 59) and earlier versions suggested before Arduino started using the issue tracker, never gained any traction... even when Arduino Mega was released. As a result, the Arduino world is filled with libraries and sketches that directly access hardware registers and in many cases aren't even portable to similar AVR chips.

Flash strings F() macro. This was produced in collaboration with Mikal Hart and with input from Brian Cook. Using F("string") causes the string to be allocated in flash memory, saving precious RAM. Many users of Teensyduino have run out of RAM using Keyboard.print("stuff"), because the compiler defaults to allocating strings in RAM, so a mechanism to allow flash-only string was a high priority for Teensyduino. Luckily, after about 1 year and much discussion, F() was accepted to Arduino and became part of Arduino 1.0.

Fixed parseInt & parseFloat bug, (Arduino Issue 624).

Synchronous interface for serialEvent (Arduino Issue 584). This was discussed at length on the Arduino developers mail list. While an interrupt-based serialEvent() gives great performance, it exposes users to complex interrupt-context programming. Variables need to be made volatile, and careful attention to locking and atomic access is required. The String class and several other Arduino functions are not designed to work properly from interrupt context. Even avr-lib malloc/free, used by String, is not thread safe to use from interrupts.

Optimize serialEvent to avoid linking HardwareSerial for sketches with don't use Serial. (Arduino Issue 625).

Simplify serialEvent's usage model (Arduino Issue 626). Prior to this change, serialEvent required the user to consume all available data, because the meaning had been "new data since the last serialEvent() call". This change allows a sketch to consume just 1 character, or whatever amount of data is convenient, and serialEvent() will be called again if more data remains available to read. Previous to this patch, serialEvent() might also be called when no data is actually availble to read, depending on the timing of the user's code in previous call to serialEvent(). With this change, the user can write much simpler serialEvent() code.

Added hardware abstraction, memory checks, string tests and other improvements and bug fixes to the arduino test suite. These changes were submitted via email to Rick Anderson & Mark Sproul, before the test suite became hosted on Arduino's github.

Remove unnecessary write API, (Arduino Issue 607). This minor change saves vtable RAM for every Print or Stream object instance. Every library which optimized block writes was duplicating this same strlen() approach.

Speed up error reporting. This patch was originally written by Bill Westfield, (Arduino Issue 393). It reorganizes the compile process, so the user's sketch is compiled first, causing any errors to be reported sooner. A new version of Bill's patch was written to properly handle building the library include path list. An initial version of the compile speedup was rejected, but later became issue 638 (see the video above) and ultimately was released to Arduino users in version 1.0.1, after approximately 2 years. Of course, Teensyduino used the compile speedup during those 2 years!

Fix Wire.write(0) bug (Arduino Issue 527).

TODO: fill in the rest of this list with explanations and links.... I'm slowly adding them as time permits.

Serial.end issue reported, sample code posted, approx Feb-Mar 2011

OneWire library, version 2.0 - first to fix all/many bugs

investigate linux avrdude issue with 1.0-beta3

fix nullpointer exceptions patch, issue 235

pin change interrupt hardware abstraction macros, newsoftserial became softwareserial in 1.0

LiquidCrystal speedups, LiquidCrystalFast

copy as html fix, issue 29

PS2keyboard library improvements

IRremote library, hardware abstraction layer

USB host shield - minor contributions - ongoing work....

FreqCount & FreqMeasure libraries written

Servo (MegaServo) porting, PWM Servo porting

Show and fix compiler warnings: issue 664, 208, 656, 657, 658, 567, 480, 498

ArduinoTestSuite - porting, fix bugs, add string tests, pulseIn test

issue 670

issue 691

issue 550

issue 700

issue 701

issue 586

issue 246 - input pullup

onewire - bug fixes, ended up becoming de-facto maintainer

encoder library

AltSoftSerial library

Convinced Apple to add composite device support (interface association descriptors) to their USB CDC driver. A special CDC+Mouse+Disk demo device was made and sent to Apple's driver developer. Here is a message on Apple's USB developer mail list regarding the Teensy-based demo device Apple used for testing their driver. This composite driver is the one used by Arduino Leonardo...

Attempt to get Microsoft to provide an INF file to load their own USBSER driver. TODO: links, summary of the behind-the-scenes conversation (ultimately unsuccessful, but apparently the Windows team did serious discuss it).

latency test and RXTX bug hunt http://forums.adafruit.com/viewtopic.php?f=47&t=29557&p=149307&hilit=teensy#p149307

Projects Using Teensy Code

UnoJoy uses Teensyduino's USB code to make Arduino Uno emulate a USB joystick. The code is in "ATmega8u2Code/usb_gamepad.c".

TODO: there are many more.... if you know of them, please email Paul with links.