The next major step is to create a abstraction above the display drivers that gives us the two RGB displays and either the individual RG displays or bar graphs. Something to take us from "send these 6 bits to the TLC5916" to "Make indicator #2 turn orange." Before we get to that, though, we need to figure out what the comminications from the main board to the FP are going to look like.
After mulling things over, I decided on a 16-bit instruction from the interface module to the front panel. The first 8 bits form a command and the 2nd 8 bits some kind of data value, depending on the command.
The command byte consists of the command it self (what to do), as well as the display (RG or RGB) and which indicator within that display. Our commands are:
- Set value: Set the value of the indicator; the meaning of the value depends on the display, the indicator and the display's mode;
- Set mode: Our RG display can have two modes, "points" or a bar graph. The RGB display doesn't have modes (at the moment);
- Test mode: Do some kind of self test. For the moment, this turns all of the lights on in the display;
- Reset: Reset the display to a known state.
Four modes means two bits. Two displays are one bit. We've got a maximum of of 32 indicators so that's the remaining 5 bits in the byte. This gives us ccdiiiii for that byte.
The contents of the value byte depend on the command and the display and the display mode. For the set mode command, there is one mode bit and seven size bits -- the size bits determine the number of display units. For the RG display, the mode may be "points" or "bar" up to 16. The mode is a single bit and the size is the actual size-1, meaning that we support from 1-16 indicators. Examples:
- Set mode, RG display, points: 01100000 m000ssss
- Set mode, RG display, points, bar mode, 4 indicators: 01100000 10000011
For the set value command, for the RGB display and the RG display in the point mode, the value is the color of the indicator and a flag instructing the indicator to blink: b0000bgr. For the RG display in the bar mode, the value is the bar value (0-8, 4 bits) and the color: vvvv00gr. Examples:
- Set value, RG display, point mode, indicator #3 blinking red: 00100011 10000001
- Set value, RG display, bar mode, indicator #1, red, 6: 00100001 01100001
- Set value, RGB display, indicator #0, blinking, purple: 0000000 10000101