Morse key USB keyboard - Software

Overview

The software is written in C++ using the Arduino environment. Whilst you can probably get the device working fully on a regular Arduino board, I have flashed the code directly to an ATMEGA168, bypassing the Arduino stack.

Aside from this, the code is 100% Arduino.

USB stack.

I used V-USB for the USB stack which emulates a keyboard. Specifically, I used a port of this designed to work with Arduino. See Rancidbacon for further details.

I enhanced the code further such that the UsbKeyboard class inherits from Print, which allows such conveniences as UsbKeyboard.println("Line to type");.

Morse decoder

I wrote the Morse code decoder module from scratch, as there wasn't really anything available that did the job. It is written as a standard Arduino library. Features of the module are:
  • Non-blocking (other code will run mid-symbol)
  • After initial learning, tracks tapping speed drift.
  • Inserts spaces, and also capitalise the first word of a sentence.
  • Side tone generator.
  • Menu to change settings, enter by tapping the SOS prosign.
  • Approx word-per-minute calculated.
  • One button speed learning function.

LED Displau

Really simple, the display code is 15 lines plus pin definitions. The code just sets the segment pins based on the current code, and enables the correct digit anode/cathode.
The code is configured for common cathode. If you have a common anode display, you should change the COMMON_ANODE/COMMON_CATHODE defines in the main sketch.

For downloads, see Downloads.

I can be reached at bb @ cactii . net

Copyright © 2010.