fignition‎ > ‎Documentation‎ > ‎

Use It


The Keypad

Fignition implements a complete keyboard in 8 keys without the user having to press more than 2 keys in most cases. The key layout is divided into primary keys which perform cursor movement and basic editing when you hit (press and release) them and the digits, lower-case letters and many symbols when you hold down a primary key and then hit another.

 Switch Numbers
 Primary Keys
 
 


Key Pairs Without Shift



Hitting the Shift key provides access to the remaining characters.

Key Pairs After Shift


There is some sense to the keypad layout; for example all the digits are obtained via the two left-hand primary keys and the letters follow a phone keypad layout via the primary keys: [SW3] (accesses abc, def) , [SW6] (accesses ghi, jkl), [SW4] (accesses mno, pqr), [SW8] (accesses tuv, wxy). Nevertheless it's hard to remember them at first. However if you hold down any primary key for about a second, the secondary characters are given as a prompt, e.g:



appears when you hold down the [up] key for a second.

The Command-Line Editor

From Firmware 0.9.7, FIGnition allows you to type in commands and programs directly from the keyboard using a ragged-line editor with full cursor control.

The FIGnition editor provides basic editing. Text is always inserted under the current cursor position; the cursor can be moved in all 4 directions and delete deletes the character to the left. Command lines can have up to 79 characters.

Cut and Paste isn't directly provided instead you use 'Mark' and 'Copy'. Pressing SW6+SW2 marks the position under the cursor for copying and pressing SW5+SW1 inserts the character under the mark location and then moves mark location on by one character. The reason for using this method is simple, FIGnition doesn't has little memory and this technique allows you to move and duplicate text without needing a clipboard.

Key repeats work in the editor, so you can typing repeated keys by simply holding them down and repeat cursor keys by holding down SW1+SW5. If the text exceeds the top or bottom of an edit window, the text will scroll to the current cursor location.

You run your command by pressing SW5, then releasing it, then pressing SW8 (i.e. Shift, then Enter).

Flash Block Editor

The Editor is also used for editing blocks of source code in Flash storage. FIGnition provides at least 384Kb of Flash storage, similar to an early 80s floppy disk. The storage is divided up into 768 * 512b blocks. In keeping with more typical Forth usage FIGnition doesn't provide a file system, instead you edit raw blocks by their block number and it's your job to remember which blocks are used for a particular purpose. The Flash storage is covered further in the Understand it section.

To edit a block, all you need to type is [number] edit. For example: 0 edit will edit block 0. An Editing window appears, utilizing the top 20 lines. Line 20 is the status line showing the block you're editing and the current character count. It works just like the command line editor and you quit it by pressing Shift, then Enter. It also supports extra editing commands:

Editor Commands

You type in editor commands by pressing SW2+SW6. 'Cmd?' is displayed on the status line. Typing a character enters the command and all commands are single characters and when the command finishes, the character count is updated. Non-existent commands are simply ignored.

Write

Write is command w: SW2+SW6 then SW8+SW5. It writes the current block back with all your changes and then exits the editor.

Zero

Zero is command z: SW2+SW6 then SW8+SW4. It clears the editor's text.

Erase

If the Flash storage gets in a real mess, or you just want to start again, command Ey (SW2+SW5, then SW4, then SW3+SW6, then SW8+SW7) will erase the entire flash! It requires quite a complex sequence so that you don't erase the Flash disk by accident.

Raw Characters

You can enter raw characters by typing Command, then a series of digits from 0..7 and then <enter>. It's a bit like Alt+num+num+num on a PC keyboard, entering a character according to the Octal number you entered. Octal numbers are calculated fairly simply: every time you type a digit, the value of the old character is multiplied by 8 and the new value added. So, typing: Cmd+3+6 means the number 3*8+6 =30 is entered and Cmd+2+3+7 would be ((2*8)+3)*8+7=159 is entered. If we were to calculate this in Forth it'd be:

3 8 *
6 + .  then

2
8 * ( calculating 16)
3 + ( calculating 19)
8 *  ( calculating 152)
7 +  ( calculating 159).

Upgrading

FIGnition supports firmware upgrading over USB using a command-line program called avrdude that you run from your host computer. The first step will be to download avrdude. Windows users should obtain Avrdude as part of the WinAVR development package (from here). Mac OS X users can get Avrdude as part of the CrossPack AVR development package (from here). Linux users can obtain AvrDude directly from here. Once installed, AvrDude is available from a command line prompt. You will also need the usbasp Windows driver, which can be found here.

The latest firmware is available from the main Fignition page. First you will need to download it.

LadyAda provides an extensive tutorial on using AvrDude, covering the major options. FIGnition only supports a single loading format and 'programmer' so the instructions are much more simple.

Windows

First you'll need to open a command line window by selecting 'Run' from the Start menu.


Then you type cmd into the text box.


You'll probably get a black window with a C:/> type prompt. First you need to type cd followed by the directory where you downloaded the upgrade. e.g. if it's downloaded to the desktop you'll type cd Desktop . Type dir *.hex to see if the firmware upgrade is there. Then continue from here.


Mac OS X

The easiest way to run the terminal is to open spotlight and typing Terminal in the text area:

Click on Applications: Terminal and a command prompt will open (a white window with a Mac OS X prompt). You'll need to cd to the folder where you downloaded the upgrade and to do this first type cd[space] and then you just use the Finder to navigate to the folder and then drag the enclosing folder to the command window: the entire path will appear.

Linux

I'll assume that if you have Linux you'll know how to open a command line window - it will vary though depending on your distribution. [Note: I'll cover Ubuntu in the near future].

Performing the Upgrade

Now you have a command prompt and you've cd'd to the right location you can upgrade FIGnition with the latest firmware. Some FIGnitions will be shipped with AtMega168 microcontrollers, the chips themselves will say ATMEGA168-20PU on them. Some FIGnitions are shipped with AtMega328 microcontrollers (which say ATMEGA328-20PU). The lettering on the chips is fairly faint. For these, you would type:

 ATMEGA168-20PU
 ATMEGA328-20PU
 avrdude -c usbasp -p m168 -u -U flash:w:FirmwareRevx_y_z.hex  avrdude -c usbasp -p m328p -u -U flash:w:FirmwareRevx_y_z.hex

(the actually name of the .hex file should be the one you downloaded, but don't press Return yet).

Make sure your USB cable is plugged into your computer. Now on your FIGnition, hold down the [Left] button and plug in the other end of the USB cable into FIGnition. The LED should light (or pulse fairly quickly).



Now, while keeping the button pressed switch back to the command window and finally press Return. FIGnition should be recognized as a usbasp device and should download a firmware upgrade. Windows users may find they have to wrestle with the notifications to say Windows has found an unknown device first.


When the upgrade has finished and AvrDude reports a successful upgrade, unplug the USB cable from FIGnition and plug it in again to reboot with the new firmware. FIGnition's Flash storage will not have been erased and you can carry on from where you left off.

Transferring Text To FIGnition Via AvrDude and USB

There's now a convoluted way to transfer text files to FIGnition via avrdude and USB using a FIGnition tool called T2E2.

T2E2 converts text files organised as 25x20 character screens into .hex files which can then be loaded one at a time into FIGnition by treating it as an upgrade, but using an avrdude command line such as:

 ATMEGA168-20PU
 ATMEGA328-20PU
 avrdude -c usbasp -p m168 -u -U eeprom:w:dstFilexx.hex  avrdude -c usbasp -p m328p -u -U eeprom:w:dstFilexx.hex

The procedure for lander.fth is:

./T2E2 lander.fth lander ( which produces a number of files)

Hold down the upgrade button (SW1) while pluging in the USB cable from a desktop computer to FIGnition. Then type:

 ATMEGA168-20PU
 ATMEGA328-20PU
 avrdude -c usbasp -p m168 -u -U eeprom:w:lander00.hex  avrdude -c usbasp -p m328p -u -U eeprom:w:lander00.hex

Release SW1 and FIGnition should boot. Type:

-n edit

to copy the eeprom screen into the edit area and write it out to screen n on exit.

-x list

to list the eeprom screen (x can be any number).

-x load

to load the eeprom screen.

The technique isn't very flexible, nor very convenient. It's there, because the only device FIGnition can support for free is usbasp, which happens to support downloading EEPROM .hex files onto an AVR. Any other device support would involve a licencing cost (per unit shipped) for FIGnition.

T2E2 contains the source code as a simple .c file and a binary for Mac OS X PowerPC (tested on Mac OS 10.4). T2E2 is GPLv3 licensed.

Č
ċ
ď
T2E2.zip
(20k)
Julian Skidmore,
8 Jun 2011 06:23
Comments