FIGKeys‎ > ‎

Use It

FIGkeys can be used to interface to a PS/2 keyboard in the normal way; it supports the main keys on a PS/2 keyboard, but not the numeric keypad and not the function keys or other special keys on a PS/2 keyboard. In addition you can change the keyboard layout to some degree with FIGkeys, just using your PS/2 keyboard. Finally you can upgrade the firmware on FIGkeys.

Normal Usage

To use FIGkeys:

  1. Connect your FIGnition to FIGkeys, taking care to align all the pins correctly.
  2. Plug the PS/2 cable into the PS/2 connector on FIGkeys - do this before plugging in FIGnition (FIGkey does not provide any power surge protection).
  3. Plug the USB power cable into your FIGnition, taking care not to press SW1 or SW2 while you do so.

FIGkeys supports the following PS/2 keyboard layout by default (it's a UK layout):

 Row\Col  A  B  C  D  E  F  G  H  I  J  K  L  M  N

 2  `  1    !
 2    "
 3    £
 4    $
 5 %
 6    ^
 7    &
 8    *
 9    (
 0     )
 -    _
 =    +
 3  TAB  Q  W  E  R  T  Y  U  I  O  P  [    {
 ]    }
 4  CAPS  A  S  D  F  G  H  J  K  L  ;    :
 '    @
 #    ~
 5  Shift    Z  X  C  V  B  N  M  ,    <  .    >  /    ?  Shift  
 6  Ctrl (Cmd)
   Alt      Space                

The following keys are special:
  • Alt+m = Mark.
  • Alt+c = Copy.
  • Shift+Return = <exe>
  • In the editor Ctrl = Cmd, so Ctrl+w = Write, Ctrl+z = zero, Ctrl+e = erase flash and Ctrl by itself updates the character count.
  • In the editor Shift+Space = <complete> which activates command completion (you also use Shift+Space to complete a command too).

Modifying The Keyboard Layout

FIGkeys is supplied only with a UK keyboard layout. However, you can reprogram (some) of the keyboard layout just using your FIGkeys and the numeric keypad on the PS/2 keyboard. For example, let's say you want the 'Q' key on a UK keyboard to display 'A':

  1. Press the key you want to reprogram. In this case you'd press the key marked 'Q' on a UK keyboard.
  2. Using the numeric keypad only, type the FIGgypad code you want to reprogram it with. Do not press the numlock key. In this case press the sequence 0 0 2 (the leading 0s are important).
  3. Press '.' on the numeric keypad.

The key you pressed in step 1 will be reprogrammed into FIGkeys non-volatile EEProm memory. The following PS/2 keys can be programmed in this way [UK key table, to be replaced by a proper diagram]:

 Row\Col  A  B  C  D  E  F  G  H  I  J  K  L  M  N
 1    F1  F2  F3  F4  F5  F6    F8  F9  F10    F12  
 2  `  1  2  3  4  5  6  7  8  9  0  -  =  
 3  TAB  Q  W  E  R  T  Y  U  I  O  P  [  ]  
 4  CAPS  A  S  D  F  G  H  J  K  L  ;  '  #  Return
 5  Shift    Z  X  C  V  B  N  M  ,  .  /  Shift  
 6  Ctrl    Alt      Space                

It doesn't matter if you overwrite one key with the same code as another because FIGkeys does the remapping based on the grid location of the key, not the character that's displayed. For example, after doing the above you'll end up with two keys that display 'a' when pressed. But you can change the key at B3 back to 'Q' by pressing the key at B3 then typing 0 5 3 on the numeric keypad, then pressing . on the numeric keypad.

FIGgypad Codes

FIGgypad codes can be easily worked out from the order you press keys on a FIGgypad. If a shift is pressed first then the first digit is 1, otherwise it's 0. Then follows your secondary keypress 0 for SW1 to 7 for SW8 and finally your primary keypress 0 for SW1 to 7 for SW8. If only a (optional shift+) primary key is needed, then the first digit is 1 if shift is needed followed by 0 for SW1 to 7 for SW8, which you then repeat.

However, the following tables will make this easier:

0 Row Col codes:

 Row\Col  0  1  2  3  4  5  6  7
 0  Left .
 1  1  Up  b  n  6  Mark  h  u
 2  2  ,  Right  o  7  /  s  v
 3  3  !  c  Delete  8  $  i  z
 4  Repeat  :  d  p    (  j  w
 5  4  Cmd  e  q  9  Down  k  x
 6  5  ;  s  r  0  )  Space  t
 7  -  "  f  z  +  =  l  Enter

1 Row Col codes:

 Row\Col  0  1  2  3  4  5  6  7
 0 Prev

 1 |

 2 @
 3 #

 5 4
 6 _
 7 ~

Note: A few keys are not properly mapped before firmware 0.9.8: these are, _, ~ and `. In addition PgUp and PgDn are not recognized by the editor, they are for use in user programs. Complete implements command completion in the 0.9.8 editor (and later) and is mapped to Shift+Space on a PS/2 keyboard.

Upgrading the FIGkeys firmware

From time to time, the FIGkeys firmware may be upgraded. FIGkeys contains an incredibly small 128b bootloader; which can program and verify Flash and EEProm as well as directly control the AVR hardware - for example, you can control the FIGkeys GPIOs from the bootloader or activate the timers etc from a bootloader programmer.

The first stage in upgrading the FIGkeys firmware involves downloading an alternative FIGnition firmware image to your FIGnition. This firmware image is dedicated to upgrading FIGkeys firmware. The same firmware image is used for AtMega168 and AtMega328 FIGnitions. When the process is finished, you will need to download your normal FIGnition firmware image back to your FIGnition.

  1. Connect your FIGnition to your FIGkeys shield
  2. Get your host computer (e.g. Mac or PC) ready to transfer the new firmware image. For example, If my FIGnition used an AtMega168 I would use avrdude in a terminal window and would type something like: avrdude -c usbasp -p m168 -u -U flash:w:FIGgyPadProg1_1_0PAL.hex (without pressing Return). If my FIGnition was using an AtMega328p I would type something like: avrdude -c usbasp -p m328p -u -U flash:w:FIGgyPadProg1_1_0PAL.hex
  3. Hold down SW1 on your FIGnition and plug in the USB connector. Your FIGnition's LED should light up (steady on an AtMega168 and flashing quickly on an AtMega328). Your FIGnition is now ready for a new firmware image.
  4. Start the transfer on the host computer (by pressing Return in a terminal window or Clicking on OK).
  5. Release SW1 when the transfer is complete.

When you release SW1 FIGnition will display:

Remove the USB connector; hold down SW2 and then plug in the USB connector. You should see the message:

When you release SW2 the upgrade should begin. The FIGgyPad programmer will read the page size; show each page as it's being programmed; verify the Flash image; program the EEProm and finally verify the EEProm:

If any step is faulty you'll see an appropriate message:

 If the ATtiny24's bootloader isn't running (or the bootloader is missing); then the FIGgypad programmer won't be able to read the target AVR flash page size.
 If there's a verification error in the flash, the FIGgypad programmer will stop and display the first location that failed to verify and why it failed.
 The Figgypad programmer reads the EEProm status on the ATtiny24. If it never returns 'ready' then EEProm programming will appear to hang.

 If there's a verification error in the EEProm, the FIGgypad programmer will stop and display the first location that failed to verify and why it failed.

Julian Skidmore,
24 Jan 2014, 06:39