Anonymous

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

From London Hackspace Wiki
Added information on data types
(Added basic status/diagnostic commands)
(Added information on data types)
Line 4: Line 4:


The firmware will be responsible for listening for serial commands, and then acting upon them. This will primarily involve changing the display.
The firmware will be responsible for listening for serial commands, and then acting upon them. This will primarily involve changing the display.
== Data types ==
=== Colour spec ===
The board reports the number of colours it supports at reset time. The colour(s) in a one-colour board will be referred to as '''R''', in a three-colour board as '''RGB''', and in a four-colour board as '''RGBU'''. This is because of the suggested LED choices of Red, Green, Blue, and Ultraviolet. The board also reports the number of bits (''n'') that it can use for setting the brightness of each colour LED.
A colour spec consists of ''n'' bits of '''R''', followed by ''n'' bits of '''G''', '''B''', and '''U''' (as appropriate). If the total number of bits is not a multiple of 8, it will be right-padded with zeroes.
Examples:
* 4 bpc (bits per channel) and 4 colours would lead to a bit pattern of: <tt>RRRRGGGG BBBBUUUU</tt>.
* 4 bpc and 3 colours would have a bit pattern of: <tt>RRRRGGGG BBBB0000</tt>
* 12bps and 3 colours would have a bit pattern of: <tt>RRRRRRRR RRRRGGGG GGGGGGGG BBBBBBBB BBBB0000</tt>
* 3bps and 3 colours would have a bit pattern of: <tt>RRRGGGBB B0000000</tt>
=== Co-ordinate ===
A co-ordinate consists of four two-bit values packed into a single byte, with the bit pattern: <tt>xxyywwhh</tt>. Co-ordinates of (0,0) are at the top-left of the module, and increase downwards and rightwards. Note that the <tt>ww</tt> and <tt>hh</tt> bits may be ignored.
=== Scroll spec ===
A scroll spec consists of two two-bit values and two one-bit values packed into a single byte, with the bit pattern: <tt>xxyy0w0h</tt>. The number of pixels to scroll along the X and Y axes is specified by <tt>xx</tt> and <tt>yy</tt>, and the direction is negative along the X/Y axis if <tt>w</tt> or <tt>h</tt> are set, respectively.


== Commands ==
== Commands ==