Anonymous

Project:USB Disco Dance Floor/v1/firmware: Difference between revisions

From London Hackspace Wiki
Improved at-a-glance information about data transfer, currently only for first set of commands
(Fixes and style changes for colour spec examples)
(Improved at-a-glance information about data transfer, currently only for first set of commands)
Line 29: Line 29:
== Commands ==
== Commands ==


Commands start with a one-byte identifier, followed by zero or more data bytes. The number of data bytes is command-specific. The device should not output any data unless specified below.
Commands start with a one-byte identifier, followed by zero or more data bytes. The number of data bytes is command-specific. The device should not output any data unless specified below. Note that "data in" and "data out" are from the point of view of the device.


=== Status/Diagnostic Commands ===
=== Status/Diagnostic Commands ===
Line 35: Line 35:
{| class="wikitable" width="100%"
{| class="wikitable" width="100%"
!width="80"|Command
!width="80"|Command
!Action
!colspan="2"|Details
!width="100"|Min version
!width="100"|Min version
|-
|-
!rowspan="2"|00
!rowspan="3"|00
|'''Reset'''
|colspan="2"|'''Reset'''
|1.0
|rowspan="2"|1.0
|-
|-
|colspan="2"|Resets the board to an initial state, with all pixels off. The board sends four bytes representing its hardware and firmware versions (2 bytes each), followed by 2 bytes for hardware details. This command also resets the board ID to 0xFFFF (i.e. unset).
|width="42%"|'''Data in:''' ''None''
|width="42%"|'''Data out:''' 6 bytes: hardware version (2), firmware version (2), capabilities (2)
|-
|colspan="3"|Resets the board to an initial state, with all pixels off. The board sends four bytes representing its hardware and firmware versions (2 bytes each), followed by 2 bytes for hardware details. This command also resets the board ID to 0xFFFF (i.e. unset).


The high nybble of the first hardware info byte is the number of different colours supported (0x1, 0x3, or 0x4) and the low nybble is whether sensors are supported (0x1 for yes). The high nybble of the second byete specifies the number of bits needed to specify LED brightness. If this is different for different colours, the firmware will handle scaling. The low nybble does the same for sensor resolution. Note that, for the time being, resolutions should be a power of 2 (0x1, 0x2, 0x4, 0x8).
The high nybble of the first hardware info byte is the number of different colours supported (0x1, 0x3, or 0x4) and the low nybble is whether sensors are supported (0x1 for yes). The high nybble of the second byete specifies the number of bits needed to specify LED brightness. If this is different for different colours, the firmware will handle scaling. The low nybble does the same for sensor resolution. Note that, for the time being, resolutions should be a power of 2 (0x1, 0x2, 0x4, 0x8).
|-
|-
!rowspan="2"|01
!rowspan="3"|01
|'''Identify'''
|colspan="2"|'''Identify'''
|1.0
|rowspan="2"|1.0
|-
|'''Data in:''' 2 bytes: board ID
|'''Data out:''' 1 byte: 0x00
|-
|colspan="3"|Informs the board of its two-byte board ID for this session. Note that board IDs 0x0000 and 0xFFFF are reserved. The board will respond with 0x00 (success).
|-
!rowspan="3"|02
|colspan="2"|'''Ping'''
|rowspan="2"|1.0
|-
|-
|colspan="2"|Informs the board of its two-byte board ID for this session. Note that board IDs 0x0000 and 0xFFFF are reserved. The board will respond with 0x00 (success).
|'''Data in:''' ''None''
|'''Data out:''' 3 bytes: 0x00, board ID (2)
|-
|-
!rowspan="2"|02
|colspan="3"|Checks connectivity with the board. The board will respond with 0x00 (success) followed by its two-byte board ID.
|'''Ping'''
|1.0
|-
|-
|colspan="2"|Checks connectivity with the board. The board will respond with 0x00 (success) followed by its two-byte board ID.
!rowspan="3"|03
|colspan="2"|'''Query neighbours'''
|rowspan="2"|1.2?
|-
|-
!rowspan="2"|03
|'''Data in:''' ''None''
|'''Query neighbours'''
|'''Data out:''' 8 bytes: top neighbour ID, right ID, bottom ID, left ID
|1.2?
|-
|-
|colspan="2"|Asks the board to search for its immediate neighbours. The board will respond with 8 bytes representing the two-byte IDs of its neighbours, starting with its "top" connection and proceeding clockwise. If no neighbour is found in a given position, 0x0000 is returned. If a neighbour is found but it has not been given an identifier for this session, it will return 0xFFFF.
|colspan="3"|Asks the board to search for its immediate neighbours. The board will respond with 8 bytes representing the two-byte IDs of its neighbours, starting with its "top" connection and proceeding clockwise. If no neighbour is found in a given position, 0x0000 is returned. If a neighbour is found but it has not been given an identifier for this session, it will return 0xFFFF.


This should allow the controller software to automatically detect the layout of the floor.
This should allow the controller software to automatically detect the layout of the floor.
|-
|-
!rowspan="2"|0E
!rowspan="3"|0E
|'''Display static test pattern'''
|colspan="2"|'''Display static test pattern'''
|1.0
|rowspan="2"|1.0
|-
|-
|colspan="2"|A static test pattern will be displayed, as selected by the one-byte argument. A list of patterns is given below:
|'''Data in:''' 1 byte: pattern to display
|'''Data out:''' 1 byte: 0x00
|-
|colspan="3"|A static test pattern will be displayed, as selected by the one-byte argument. A list of patterns is given below:
*00 - All white
*00 - All white
*01 - All red
*01 - All red
Line 89: Line 104:
*10 - RGB fade, (0,0) = red; (3,0) = green; (0,3) = blue; (3,3) = magenta
*10 - RGB fade, (0,0) = red; (3,0) = green; (0,3) = blue; (3,3) = magenta
|-
|-
!rowspan="2"|0F
!rowspan="3"|0F
|'''Display animated test pattern'''
|colspan="2"|'''Display animated test pattern'''
|1.0
|rowspan="2"|1.0
|-
|'''Data in:''' 1 byte: pattern to display
|'''Data out:''' 1 byte: 0x00
|-
|-
|colspan="2"|An animated test pattern will be displayed, as selected by the one-byte argument. A list of patterns is given below:
|colspan="3"|An animated test pattern will be displayed, as selected by the one-byte argument. A list of patterns is given below:
*00 - clockwise spiral chase (white), starting at (0,0)
*00 - clockwise spiral chase (white), starting at (0,0)
*01 - clockwise spiral (white), starting at (0,0); then black spiral once complete
*01 - clockwise spiral (white), starting at (0,0); then black spiral once complete