Jump to content

Paul Stoffregen

Active Members
  • Posts

  • Joined

  • Last visited

Profile Information

  • Location
    Oregon, USA

Recent Profile Visitors

2,780 profile views

Paul Stoffregen's Achievements


Newbie (1/14)

  1. Hi, Paul here.... the guy who designed Teensy and wrote Teensyduino. Teensy is based on the Atmel AVR ATMEGA32U4 microcontroller, which has a fully generic (up to 7 endpoints) USB device controller built in. So in theory, you could program it to be virtually anything. In practice, writing the USB driver code is a LOT of work, starting with the 600 page USB spec and many other necessary USB documents (the 600 page spec is only the basic stuff, not how any particular device actually uses it...) Only about half a dozen people appear to have ever written such code for these AVR chips, and only 3 of these code bases in widespread use: Atmel's sample code written by some unrecognized author, my code, and Dean Camera's LUFA library. Atmel's code isn't worth considering (and Atmel has hired Dean recently). Dean and I have nearly opposite coding styles, where Dean uses lots of C structures and syntax and very modularized style, and attempts to craft interfaces that expose all possible options with maximum flexibility. That's ideal for large projects and experienced C programmers. My style involves minimal amount of code without lots of special syntax or abstractions, and simplified interfaces that expose only the most commonly needed functions. My style works well for Arduino, and I've gone to great lengths to give you the simplest, most Arduino-like experience possible, but without being limited to only serial COM ports as Arduino is. If you want access to a lot more features, Dean's code is the way to go. Or write you own! It could be said that Teensy is natively a HID device, because it appears as HID when you're programming it with the Teensy Loader program. However, it is not a HID keyboard or mouse, but rather a "vendor specific" HID device. The "documentation" is embedded within the open source code command line tools, which it at this page: http://www.pjrc.com/teensy/loader_cli.html But what matters is the type of device Teensy is when your code runs, and that's up to you. Most people program Teensy using Arduino, of course with the Teensyduino add-on package installed. The type of USB device Teensy will become depends on the setting you've selected in the Tools > USB Type menu. The current version of Teensyduino provides five choices: 1: Serial 2: Keyboard + Mouse + Joystick 3: Disk(Internal) + Keyboard 4: Disk(SD Card) + Keyboard 5: MIDI Really, it's 4 USB choices, since 3 and 4 are identical, except for which media is used to implement the disk. The menu defaults to Serial, because that's what Arduino is. The MIDI type, and Joystick in #2, are relatively new. If you're running an old version of Teensyduino, the latest gives you more options. :-) Over time, I'll probably add a few more choices to this menu. But that is a slow process. I've still got some unfinished business in the disk types, to facilitate sharing the media between the PC and your own code, which might want to read data the PC has stored, or write data for the PC to later see. If you use my C-based examples, there's also a Raw HID program, which is intended for building custom USB projects that work together with only your own custom written application. That too is on my to-do list to expand someday. But much of my coding time ends up going to porting various Arduino libraries. So much code to write... never enough time.... If you use Dean Camera's LUFA code, which is only C-based (doesn't work with Arduino), there are a few other choices, like a RNDIS-based network interface. So for the disk type, both Teensyduino and LUFA support USB disk types. To be perfectly honest, the disk type in Teensyduino is still under construction. 0.96(beta) adds an API for managing the PC's access to the media, but it isn't documented (other than the source code, which is in hardware/teensy/cores inside Arduino). It still has bugs, which is why I haven't documented it yet. I'll make it work well eventually. That API, and really everything about Teensyduino, is intended to facilitate building electronic projects. Examples might be a temperature logger, which records temperature data and the PC can later read it. Or perhaps a simple robotic machine controller, where the PC might write a file with instructions on how to move the motors. If you're building those sorts of things, I want to help you. If your aim is "security" related, especially techniques to analyze or compromise systems, I will neither help nor hinder. But I hope you'll carefully consider the legal and ethical ramifications of any such work, and always act responsibly. Hopefully this long-winded post at least helps clear up any questions about what type of USB device Teensy really is?
  2. Has anyone found a very compact off-the-shelf Mini-B to A adaptor? I get this question sometimes, and it'd be nice to know if are any readily available that are much smaller than the usual.
  3. Opps, yeah, I missed that one. I just added it and uploaded a new copy.
  4. Good to hear it's working. Thanks. It's really a huge help. It should also be able to type all those non-US characters which require AltGr or first pressing the deadkeys. Well, at least all of them on the German keyboard. Some keyboards like Finnish Multilingual have massive numbers of very special glyphs. So far, I've only coded unicode-to-keystroke for ASCII, Latin-1 and the Euro symbol.
  5. Thanks. I actually did quite a bit of experimentation and found code 100. Well, I hope anyway. If not, well, those characters normally from that key between the left shift and the Y key will be wrong. On keyboards made in the USA, they don't put a key there at all. The left shift is wider and the Z key is right next to it. Z and Y are swapped from US to German layouts, so imagine no key between your Y key and shift. That's how they are here, so that 1 extra key has been a real mystery. Well, also, every layout diagram shows a key directly above Enter on US layouts, but it's to the left of Enter on non-US keyboards. Hopefully it's the same code? If some characters from that key next to Enter are wrong, well, that's the one other place I had to do some guesswork. I configured a Windows XP test machine for German keyboard and got most characters correct typing into Notepad, so I think this code is pretty close. I created the entire layout mapping manually, so there's probably a key or two I might have done incorrectly....
  6. Here's an alpha test version with international keyboard support. It also has a MIDI USB type. Linux only so far. I'll port to Mac and Windows in a couple weeks. Of course, devices you create in Linux should work when plugged into PCs with Windows or Macs, but right now this alpha code only supports building them on Linux. http://www.pjrc.com/teensy/beta/teensyduino To change the keyboard type, look for the file hardware/teensy/cores/teensy/keylayouts.h. Just uncomment the one you want. So far, I've done US-English, US-Intl, German and Canadian French. More will be added soon. Eventually keyboard layout will be selected from a menu. edit: international keyboard only works on Keyboard+Mouse type. The Disk+Keyboard types still use the old code. This turned out to be not-so-simple, requiring a UTF8 parser and deadkey sequence layer, and so far I'm building the layout definitions manually which takes forever and probably has a few random errors. If you're in Germany or Quebec, please give this a try and let me know if it works or not.
  7. I am working on a keyboard layout layer, which will eventually be selected from a Tools > Keyboard Layout menu. I hope to make an alpha test release in about 1 week, which will not have the menu but you can change the layout by editing a file. So far, I've done US-English, US-International and German. None are tested yet. I could REALLY use your help now with one a little question. I need to know which codes are '<' and '#' when the German layout/locale is selected. For example, if you were to do: for (int i=4; i&lt;64; i++) { Keyboard.print(i); Keyboard.set_modifier(0); Keyboard.set_key1(i); Keyboard.send_now(); Keyboard.set_key1(0); Keyboard.send_now(); delay(2500); } My best guess is they might be 49 for '#' and 50 for '<', but I can't find any really solid documentation about these 2 keys. If you could run this test and report back for sure which 2 codes are those 2 keys, it would really help me now. In about a week I should have something new that might fix all this, and later it'll even be nicely selectable from a menu. I'm also working on some other new stuff... right now, adding USB MIDI type. :)
  8. I'd like to add a "Keyboard Layout" option in the next version of Teensyduino. It would appear in the Tools menu immediately below the "USB Type" and be enabled if you selected a USB type which includes Keyboard. I've found several pictures that show the various layouts, but nowhere have I been able to find solid specs on the actual key codes (in terms of HID usage tables, not legacy PC stuff) which different keyboard layouts actually send. Does anyone know where I might find these? Or is there somewhere (hopefully cheap) where I can buy various non-US keyboards from within the USA? Or does anyone have an extra USB keyboard they could send to me? Maybe I need to start a wish list for all the various layouts?
  9. I recently added a page about this. http://www.pjrc.com/teensy/external_power.html
  10. You can't use programs like Hyperterminal or Zterm that are designed to talk with serial ports, because it's not a serial device. In theory, you could write a terminal emulator that does HID communication, but that would be a LOT of work!!! The HID API is completely different on each operating system too. But I've already done the low-level part for you..... Inside your arduino directory (on a mac, use option-click and "show package contents"), there's a tiny program called teensy_gateway. It talks HID protocol to the teensy and makes that communication available on TCP port 28541. When you're using the Serial Monitor in Arduino with this mode, it runs the teensy_gateway and connects to port 28541. If that program is still running, you could just use: telnet 28541 If you can't connect, just open a command prompt and run teensy_gateway, and then telnet should be able to connect (as long as teensy_gateway remains running). Of course, the easiest thing to do is just click the "Serial Monitor" button inside Arduino. The new one in 0019 even has a button to turn scrolling on/off, but admittedly it's still feature-poor compared to most terminal emulators. If you have one that supports telnet in addition to serial connections, you can use that with teensy_gateway.
  11. Just click on the serial monitor button. Don't worry about selecting a serial port, because there isn't any in this mode. It will "just work" (because I implemented a communication channel with a custom HID interface and hacked the serial monitor to use it in this mode)
  12. Yes http://www.pjrc.com/teensy/td_libs_LiquidCrystal.html
  13. The main new features are USB Serial driver install in the main Teensyduino installer, and simulating the Arduino reset behavior when launching the serial monitor window. Some really broken stuff in 0016 was fixed.... since nobody's complained, maybe it's a good bet nobody's actually using 0016. http://www.pjrc.com/teensy/experimental.html
  14. Try compiling for a regular Arduino. Just select it from the Tools > Boards menu, and click verify. If that compiles, please let me know. In fact, if you can, just zip up your entire arduino directory and send it to me. That might be too big of a file? If you get the same error when compiling for Arduino, then it's probably a bug in the library or something messed up with your arduino install. You could download a fresh copy of the arduino software and try that.
  15. That's what it should do, exactly the same as a USB card reader when there's no media present.
  • Create New...