More buttonreader documentation

This commit is contained in:
Sebastian Lohff 2015-01-11 22:26:50 +01:00
parent 66ddb39bbe
commit 0c5d94d211
1 changed files with 27 additions and 0 deletions

View File

@ -106,6 +106,33 @@ device, baudrate (default 9600), parity (default N) and stop-bits (default 1).
As with the fifo, an ASCII-number for the player which pressed a button is As with the fifo, an ASCII-number for the player which pressed a button is
expected. All other characters are ignored. expected. All other characters are ignored.
*BeopardySerial* mimics the protocol used by the Beopary software. It reads
from a serial device and takes the same arguments as *Serial*, but in addition
to taking button presses from the serial it also gives feedback about the
current gamestate.
*Unix* opens up a unix domain socket on your local filesystem, first argument
being the path to where it should be created. To send a player button press,
send its ASCII number ('1'-'9' is supported). The board will send a 'O' if
the buzzers (buttons) are open and a 'C' when they are closed. To indicate
that it is a player's turn the board will send a "TX", where X is the current
player's number (e.g. "T3" for player 3).
Examples:
# use BeopardySerial
playerInput:
- Type: BeopardySerial
Args:
- /dev/ttyUSB0
- 19200
# use a unix domain socket
playerInput:
- Type: Unix
Args:
- /tmp/seopardy.sock
Writing an own class for player input should be fairly easy. Within its own Writing an own class for player input should be fairly easy. Within its own
thread the class can do whatever it wants (including blocking I/O). When it thread the class can do whatever it wants (including blocking I/O). When it
wants to signal a button was pressed it just needs to emit a ButtonEvent. wants to signal a button was pressed it just needs to emit a ButtonEvent.