Difference between revisions of "Fire Pong/Interfaces/Puffer Control"

From Nottinghack Wiki
Jump to navigation Jump to search
(Created page with "=== Purpose === This interface defines how the main game control unit signals other parts of the system to set off the various puffers in the system. * All puffers on a ser...")
 
Line 3: Line 3:
 
This interface defines how the main game control unit signals other parts of the system to set off the various puffers in the system.  
 
This interface defines how the main game control unit signals other parts of the system to set off the various puffers in the system.  
  
* All puffers on a serial bus, each with unique ID
+
 
 +
=== Requirements ===
 +
 
 +
* All puffers on a serial bus, each with ID mask (see below)
 
* Serial bus params TBD, but probably slowish with error correction if possible because interference from sparkers:
 
* Serial bus params TBD, but probably slowish with error correction if possible because interference from sparkers:
 
** RS232 because Mouse has a bunch of MAX3232 converters
 
** RS232 because Mouse has a bunch of MAX3232 converters
Line 12: Line 15:
 
** With duration argument
 
** With duration argument
 
** Multiple IDs in a single request?
 
** Multiple IDs in a single request?
 +
 +
=== IDs ===
 +
 +
* Each puffer has an '''ID mask''', which is:
 +
** a 32-bit unsigned integer (uint32_t from stdint.h)
 +
** little endian
 +
** mask with a single bit set, i.e. 0x00000001,  0x00000002, 0x00000004, 0x00000008, ..., 0x80000000
 +
* Requests include an '''ID set''', which is:
 +
** a 32-bit unsigned integer (uint32_t from stdint.h)
 +
** little endian
 +
** mask with one or more bits set e.g. 0x00003001, corresponding to ID masks 0x00000001, 0x00001000, and 0x00002000,
 +
 +
== Event Types ===
 +
* Enumerated event type:
 +
** 0: STOP (requires manual reset)
 +
** 1: Spark/ignite only
 +
** 2: Puff sequence
 +
** other: undefined (do nothing)
 +
* 8-bit unsigned integer (uint8_t from stdint.h)
 +
* little endian
 +
 +
=== Durations ===
 +
 +
* A time in milliseconds for a puffer solenoid valve to be open for
 +
* Typically 100 or 150 for small puffers
 +
* Between 100 and 2000ms for large puffers (?)
 +
* 16-bit unsigned integer (uint16_t from stdint.h)
 +
* little endian
 +
 +
=== Events ===
 +
* Events are sent in real time and processed immediately by all puffer controllers on the bus
 +
* An event consists of an '''ID set''', and '''Event Type''', a '''Duration''' and a check byte
 +
* No acknowledgement is required - this is a broadcast only protocol
 +
 +
==== Example C code ====
 +
 +
    struct PufferEvent {
 +
        uint32_t id_set;
 +
        uint8_t  type;
 +
        uint16_t duration;
 +
    }

Revision as of 13:55, 15 June 2016

Purpose

This interface defines how the main game control unit signals other parts of the system to set off the various puffers in the system.


Requirements

  • All puffers on a serial bus, each with ID mask (see below)
  • Serial bus params TBD, but probably slowish with error correction if possible because interference from sparkers:
    • RS232 because Mouse has a bunch of MAX3232 converters
    • parity & ECC
  • Only control box writes to bus
  • Puffer events are sent in real time
    • Addressed by puffer ID
    • With duration argument
    • Multiple IDs in a single request?

IDs

  • Each puffer has an ID mask, which is:
    • a 32-bit unsigned integer (uint32_t from stdint.h)
    • little endian
    • mask with a single bit set, i.e. 0x00000001, 0x00000002, 0x00000004, 0x00000008, ..., 0x80000000
  • Requests include an ID set, which is:
    • a 32-bit unsigned integer (uint32_t from stdint.h)
    • little endian
    • mask with one or more bits set e.g. 0x00003001, corresponding to ID masks 0x00000001, 0x00001000, and 0x00002000,

Event Types =

  • Enumerated event type:
    • 0: STOP (requires manual reset)
    • 1: Spark/ignite only
    • 2: Puff sequence
    • other: undefined (do nothing)
  • 8-bit unsigned integer (uint8_t from stdint.h)
  • little endian

Durations

  • A time in milliseconds for a puffer solenoid valve to be open for
  • Typically 100 or 150 for small puffers
  • Between 100 and 2000ms for large puffers (?)
  • 16-bit unsigned integer (uint16_t from stdint.h)
  • little endian

Events

  • Events are sent in real time and processed immediately by all puffer controllers on the bus
  • An event consists of an ID set, and Event Type, a Duration and a check byte
  • No acknowledgement is required - this is a broadcast only protocol

Example C code

   struct PufferEvent {
       uint32_t id_set;
       uint8_t  type;
       uint16_t duration;
   }