home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************************************
- Header for Macintosh - PowerGlove interface code
- Taken from:
- Jon Blossom (blossom@cs.yale.edu) 20 January, 1992
- ********************************************************************************/
-
- #ifndef _POWER_GLOVE_
- #define _POWER_GLOVE_
-
- #define CONT_FLAG -96
-
- #define A_BUTTON 0x0A /* Glove button codes */
- #define B_BUTTON 0x0B
- #define START_BUTTON 0x82
- #define SELECT_BUTTON 0x83
- #define CENTER_BUTTON 0x00
- #define UP_BUTTON 0x0D
- #define DOWN_BUTTON 0x0E
- #define LEFT_BUTTON 0x0C
- #define RIGHT_BUTTON 0x0F
-
- #define RING_MASK 0x03 /* Masks for reading finger data */
- #define MIDDLE_MASK 0x0C
- #define INDEX_MASK 0x30
- #define THUMB_MASK 0xC0
-
- #define CONTSTR "C" /* Character to put glove in continuous mode */
- #define REQUESTSTR "R" /* Character to put glove in request mode */
- #define QUERYSTR "?" /* Character to request a packet from glove */
- #define PACKETSIZE 6 /* Reading 6 byte packets from SCC */
-
-
- typedef struct glove {
- short x, y, z; /* x,y: 3mm precision, z: 14mm */
- short rot; /* rotation 0-11, in 30-40 degree incs */
- short thumb, index, middle, ring; /* bend in fingers 0-3, 3 = tight bend */
- short buttons;
- } GloveState;
-
- void delay(long ticks); /* Delays for number of mac ticks */
- void OpenGlove(int settings); /* Initialize the power glove */
- void CloseGlove(void); /* Close the serial port */
- void GetGlove(GloveState *s); /* Read the current glove state */
- void DisplayGlove(GloveState *s); /* Display current glove state to stdout */
-
- #endif _POWER_GLOVE_
-