[Plib-devel] 32 bit integer button limit
Brought to you by:
sjbaker
From: Jim C. <j.c...@zy...> - 2007-01-02 17:08:01
|
Hi, The problem with only 32 bits in an integer so allowing only 32 buttons can be handled in a similiar fashion to the method used in standard unix libraries for handling file descriptors. This uses an "fd_set" data type which is a "descriptor set" (read button set!!) which can be reset,written to, read from and checked using the FD_ZERO,FD_SET,FD_ISSET,FD_CLR macros. File descriptors can be up to 1024 for example so this technique can handle many buttons.(see p396 etc of Stevens - Advanced Programming in the Unix Environment). Also one way to build a cockpit may be to cannibalise a standard joystick and use the buttons and rotaries accordingly.(This allows re-use of existing sware without having to write new "plib" bits to handle for example a USB interface such as a Velleman module with digital/analogue input and outputs). cheers Jim |