From: [email-masked] (Tutor)
Date: Mon, 21 Oct 91 17:41:29 NZT

Commenting on Dave Stampe's suggestions for a standard PowerGlove
interface:

> I would like to define the minimum functionality as:

> - initialize with one call, which enters hi-res mode, sets up a timer
    interrupt every 4 mS, and initializes the code.
> - an interrupt handler which:
>        - polls the glove for $A0 start code, exits if not ready
>        - if the glove was not ready after 500 tries, resets the glove mode
>        - reads the 6-byte data packet, and 2 more throwaway bytes
>        - deglitches and denoises the X and Y data (deglitches Z???)
>        - stores the data int the glove_int_data buffer
>        - sets the glove_int_data.new flag
> - a glove_read routine which:
>        - disables interrupts
>        - copies the glove_int_data (including .new flag) to buffer
>        - clears the glove_int_data.new flag
>        - enables interrupts
> - a reset routine (onexit(?)) which resets the timer interrupt

> It is probably worthwhile to have a LORES and HIRES mode set on
> initialization, which means that only the .keys data field is valid.
> The timer interupt would happen less often, to reduce CPU interrupt
> load.  Total CPU load on a 386 looks to be about 3%.

> Proposed names for routines:

> int init_glove(int mode)
> #define LORES 0
> #define HIRES 1
> void reset_glove()
> int glove_read(glove_data *) /* returns 0 if old, 1 if new data */

> If we try to keep some interface stuff the same, everyone can develop
> code for their machine that meets the specs.  Then they can either be
> combined or distibuted seperatly.

I think this is a great idea. Here's my $0.02 worth:

1. Define what each function must do, not how to do it -- leave it as a
   black box. I intend to communicate with a glove-controller built here
   (when its done) via an RS-232 interface. In which case all this talk
   about interrupts is irrelevant.

2. I'd rather call change the name of reset_glove() to glove_quit() --
   reset implies to me get ready to start, not get ready to exit the
   program.

Frank.