FSM-55

From Noisebridge
Jump to navigation Jump to search

1. Intro

Having fun with LED matrices!


2. Connecting your board

3. Creating your message

The fun of this exercise is to create your own message and convert it to a C program.

The program is organized in three threads:

  • LED thread (dynamic LED control)
  • Button thread (watchdog)
  • Application thread (text screen control)

The user does not need to change the low-level threads (LED and Button), only the Application thread. The data flows from Application -> (some sort of) Video RAM -> LED control

Messages are encoded in a 5 x 5 grid of LEDs. The 'led' thread loops through each column of 5x5 grid.

    -----
    -----
    -----
    -----
    -----

Each LED is addressed as such:

    - 0x00   * 0x00   * 0x00   * 0x00   * 0x00   * 0x00  
    -        -        *        *        *        *
    -        -        -        *        *        *
    -        -        -        -        *        *
    -        -        -        -        -        *

In other to present the message "Happy Hacking!" only the characters we use (including exclamation point and space) are described:

    { 3, 0 },                                             /* SPACE */
    { 4, DATA55V (0x1f, 0x04, 0x04, 0x1f, 0x00) },        /* H */
    { 3, DATA55V (0x17, 0x15, 0x0f, 0x00, 0x00) },        /* A */
    { 4, DATA55V (0x1f, 0x14, 0x14, 0x08, 0x00) },        /* P */
    { 4, DATA55V (0x19, 0x05, 0x05, 0x1e, 0x00) },        /* Y */
    { 4, DATA55V (0x0e, 0x11, 0x11, 0x0a, 0x00) },        /* C */
    { 4, DATA55V (0x1f, 0x04, 0x0c, 0x13, 0x00) },        /* K */
    { 3, DATA55V (0x11, 0x1f, 0x11, 0x00, 0x00) },        /* I */
    { 4, DATA55V (0x1f, 0x08, 0x06, 0x1f, 0x00) },        /* N */
    { 4, DATA55V (0x0e, 0x11, 0x15, 0x07, 0x00) },        /* G */
    { 2, DATA55V (0x1d, 0x1c, 0x00, 0x00, 0x00) },        /* ! */

The message is represented as a string:

    static uint8_t hh[] = {
         CHAR_H, CHAR_A, CHAR_P, CHAR_P, CHAR_Y,
         CHAR_SPC,
         CHAR_H, CHAR_A, CHAR_C, CHAR_K, CHAR_I, CHAR_N, CHAR_G,
         CHAR_EXC,
         CHAR_SPC, CHAR_SPC, CHAR_SPC,
    };

4. Uploading your code

5. References