Commits

Joseph Chiocchi committed e71d5bb

what is that still doing here

Comments (0)

Files changed (4)

YolkBox_Rainbowduino_Firmware_v3_0h/Rainbow.h

-#ifndef Rainbow_h
-#define Rainbow_h
-
-#define I2C_DEVICE_ADDRESS 0x10
-
-#define FRONT_BUFFER       bufFront
-#define BACK_BUFFER        bufBack
-
-#define MAX_AUX_BUFFERS    4
-#define MAX_GAMMA_SETS     3
-#define MAX_WIRE_CMD_LEN   20
-
-#define BLACK              0x0, 0x0, 0x0
-#define WHITE              0xF, 0xF, 0xF
-#define BLUE               0x0, 0x0, 0xF
-#define GREEN              0x0, 0xF, 0x0
-#define RED                0xF, 0x0, 0x0
-
-#define G                  0
-#define R                  1
-#define B                  2
-
-//=============================================
-//MBI5168
-#define SH_DIR_OE          DDRC
-#define SH_DIR_SDI         DDRC
-#define SH_DIR_CLK         DDRC
-#define SH_DIR_LE          DDRC
-
-#define SH_BIT_OE          0x08
-#define SH_BIT_SDI         0x01
-#define SH_BIT_CLK         0x02
-#define SH_BIT_LE          0x04
-
-#define SH_PORT_OE         PORTC
-#define SH_PORT_SDI        PORTC
-#define SH_PORT_CLK        PORTC
-#define SH_PORT_LE         PORTC
-//============================================
-#define clk_rising         {SH_PORT_CLK&=~SH_BIT_CLK;SH_PORT_CLK|=SH_BIT_CLK;}
-#define le_high            {SH_PORT_LE|=SH_BIT_LE;}
-#define le_low             {SH_PORT_LE&=~SH_BIT_LE;}
-#define enable_oe          {SH_PORT_OE&=~SH_BIT_OE;}
-#define disable_oe         {SH_PORT_OE|=SH_BIT_OE;}
-
-#define shift_data_1       {SH_PORT_SDI|=SH_BIT_SDI;}
-#define shift_data_0       {SH_PORT_SDI&=~SH_BIT_SDI;}
-
-//============================================
-#define close_all_line	   {PORTD&=~0xf8;PORTB&=~0x07;}
-
-//============================================
-#define CheckRequest       (g8Flag1&0x01)
-#define SetRequest         (g8Flag1|=0x01)
-#define ClrRequest         (g8Flag1&=~0x01)
-
-//==============================================
-#define waitingcmd         0x00
-#define processing         0x01
-#define checking           0x02
-
-#endif

YolkBox_Rainbowduino_Firmware_v3_0h/WireCommands.h

-/*
-
-  -0- -1- -2- -3- -.- -L-
-
-  'r' CMD [o] [o] ... 0x0     byte0: 'r' identify a Rainbowduino Firmware 3.0 command string
-                              byte1: CMD Hex code of the command
-                              byte2 to ...: [o] Optional parameters for the command CMD (as many byte up to MAX_WIRE_CMD_LEN)
-                              last byte:  0x0 the command string terminator
-                              
-  -CMD- -1- -2- -3-
-  
-  0x00                        RESET
-  
-> 0x10                        swapBuffers();
-> 0x11   X   Y                copyFrontBuffer(X, Y);
-> 0x12   N                    showAuxBuffer(N);
-  0x13   B   N                storeToAuxBuffer(B, N);
-  0x14   N                    getFromAuxBuffer(N);
-  0x19   G                    setGamma(G);    
-
-> 0x20   R   G   B            clearBuffer(R, G, B);
-> 0x21   R   G   B            setPaperColor(R, G, B);
-> 0x22   R   G   B            setInkColor(R, G, B);
-> 0x25                        clearPaper();
-> 0x26   X   Y                drawPixel(X, Y);
-> 0x27   SX  SY  EX  EY       drawLine(SX, SY, EX, EY);
-> 0x28   SX  SY  EX  EY       drawSquare(SX, SY, EX, EY);
-  0x29   OX  OY  RAD          drawCircle(OX, OY, RAD);
-> 0x2A   X   Y   C            printChar(X, Y, C);
-> 0x2B   RW  OFX M            drawRowMask(RW, OFX, M);
-  
-  0x40                        scrollLeft();
-  0x41                        scrollRight();
-  0x42                        scrollUp();
-  0x43                        scrollDown();
-  0x45   L                    insLineLeft(L);
-  0x46   L                    insLineRight(L);
-  0x47   L                    insLineUp(L);
-  0x48   L                    insLineDown(L);
-  
-  0x50                        clearStringBuffer();
-  0x51   C                    charToStringBuffer(C);    (includes termination with /0)
-  0x52   C   C   [...]   /0   wordToStringBuffer(W);    (W = C + C + C + ... + /0)
-  0x55   D                    scrollStringBuffer(D);
-  
-  0x60                        clearColorBuffer();
-  0x61   PR PG PB  IR IG IB   addToColorBuffer(PR, PG, PB, IR, IG, IB);
-  0x62   S                    setColorBufferIterationStep(S);
-  
-*/
-
-#ifndef WireCommands_h
-#define WireCommands_h
-
-#define CMD_NOP               0x00
-
-#define CMD_SWAP_BUF          0x10
-#define CMD_COPY_FRONT_BUF    0x11
-#define CMD_SHOW_AUX_BUF      0x12
-
-#define CMD_CLEAR_BUF         0x20
-#define CMD_SET_PAPER         0x21
-#define CMD_SET_INK           0x22
-#define CMD_CLEAR_PAPER       0x25
-#define CMD_DRAW_PIXEL        0x26
-#define CMD_DRAW_LINE         0x27
-#define CMD_DRAW_SQUARE       0x28
-#define CMD_PRINT_CHAR        0x2A
-#define CMD_DRAW_ROW_MASK     0x2B
-
-#endif

YolkBox_Rainbowduino_Firmware_v3_0h/YolkBox_Rainbowduino_Firmware_v3_0h.ino

-#include <Wire.h>
-#include <avr/pgmspace.h>
-
-#include "Rainbow.h"
-#include "WireCommands.h"
-
-extern unsigned char dots_color[6][3][8][4];    // define Two Buffs (one for Display ,the other for receive data)
-extern unsigned char GammaTab[3][16];           // define the Gamma value for correct the different LED matrix
-extern unsigned char ASCII_Char[62][8];         // ASCII character table (READ-ONLY, it's stored in PROGMEM space)
-
-unsigned char line, level;                      // used by the low-level rendering function
-unsigned char g8Flag1;                          // NO IDEA AT THE MOMENT (derived from original code)
-
-byte dispGamma;                                 // current gamma-ramp in use (index of GammaTab array)
-byte bufFront, bufBack, bufCurr;                // used for handling the buffers
-
-unsigned char RainbowCMD[MAX_WIRE_CMD_LEN];     // used to store command received via I2C protocol
-byte paperR, paperG, paperB;                    // stores paper (background) color; used by I2C command chains
-byte inkR, inkG, inkB;                          // stores ink (foreground) color; used by I2C command chains
-
-unsigned char State=0;                          // comes from original code
-
-void setup(void) {
-  _init();                // Initialize Ports, Timer and Interrupts
-}
-
-void loop(void) {
-  switch(State) {
-    case waitingcmd:
-    break;
-    
-    case processing:
-      processWireCommand();
-      State=checking;
-    break;
-    
-    case checking:
-      if(CheckRequest) {
-        State=waitingcmd;
-        ClrRequest;
-      }
-      break;
-      
-    default:
-      State=waitingcmd;
-      break;
-  }
-}
- 
-/*----------------------------------------------------------------------------*/
-/* DRAWING FUNCTIONS                                                          */
-/*----------------------------------------------------------------------------*/
-
-void _initGfx() { // Init the graphic side
-  dispGamma = 1;
-  bufFront = 0;
-  bufBack = 1;
-  bufCurr = 0;    
-}
-
-void setGamma(byte gamma) { // Change the gamma array pointer, used during display rendering
-  if ( gamma < MAX_GAMMA_SETS ) {
-    dispGamma = gamma;
-  }
-}
-
-void drawPixel(int x, int y, byte r, byte g, byte b) {
-  if ( (x>=0 && x<8) && (y>=0 && y<8) ) { // Check if it's in the display range
-    byte mask = 0xF0;
-    if ( !(x % 2) ) { // If x is unpair, shift each color component four bit left
-      r = (r << 4);
-      g = (g << 4);
-      b = (b << 4);
-      mask = 0x0F;
-    }
-  
-    x /= 2;
-    replace_dot(bufBack, x, y, bufBack, x, y, r, g, b, mask);
-  }
-}  
-
-void drawLine(int sx, int sy, int ex, int ey, byte r, byte g, byte b) {
-  int i, lx, ly;
-  
-  lx = abs(ex-sx);
-  ly = abs(ey-sy);
-  
-  if ( lx > ly) {
-    for(i=0; i<=lx; i++) {
-      drawPixel(map(i, 0, lx, sx, ex), map(i, 0, lx, sy, ey), r, g, b);
-    }
-  } else {
-    for(i=0; i<=ly; i++) {
-      drawPixel(map(i, 0, ly, sx, ex), map(i, 0, ly, sy, ey), r, g, b);
-    }
-  }
-}
-
-void drawSquare(int sx, int sy, int ex, int ey, byte r, byte g, byte b) {
-  int i, ly, rw;
-  
-  ly = abs(ey-sy);
-  
-  for(i=0; i<=ly; i++) {
-    rw = map(i, 0, ly, sy, ey);
-    drawLine(sx, rw, ex, rw, r, g, b);
-  }
-}
-
-void printChar(int x, int y, byte r, byte g, byte b, unsigned char ASCII) { // Print a char using array ASCII_Char as font source
-  unsigned char idx;
-  byte bitmask;
-  int row, col;
-  int l;
-
-  if((ASCII > 64) && (ASCII < 91)) idx=ASCII-55; // Convert from ASCII to index of character's array
-  else if((ASCII > 96) && (ASCII < 123)) idx=ASCII-61;
-  else if((ASCII >= '0') && (ASCII <= '9')) idx=ASCII-48;
-  
-  l = 0;  // Counter used to extract each line from the character map
-  for (row=(7+y); row>=y; row--) {    
-    if ( row < 8 && row >= 0 ) { // Check if row is within visible area
-      bitmask = pgm_read_byte(&(ASCII_Char[idx][l]));  // Extract the bitmask for each line of the character
-      drawRowMask(row, x, r, g, b, bitmask);
-     }
-    l++;
-  }
-}
-
-void drawRowMask(int row, int off, byte r, byte g, byte b, byte bitmask) {
-  byte col;
-  
-  if ( (abs(off) < 8) && (row < 8) && (row >= 0) ) {
-    if ( off > 0 ) bitmask = (bitmask << off);  // Shift the bitmask according to x-offset
-    else bitmask = (bitmask >> -off);
-  
-    for (col=0; col<4; col++) {     // Check the first bit of the bitmask
-      if ( bitmask & B00000001 ) {
-        replace_dot(bufBack, col, row, bufBack, col, row, (r << 4), (g << 4), (b << 4), 0x0F);
-      }
-      if ( bitmask & B00000010 ) {  // Check the second bit of the bitmask
-        replace_dot(bufBack, col, row, bufBack, col, row, r, g, b, 0xF0);
-      }
-      bitmask = (bitmask >> 2);     // Shift the bitmask two bits left
-    }
-  }
-}
-
-/* BUFFERS HANDLING */
-
-void swapBuffers() { // Swap Front with Back buffer
-  if ( bufFront > 1 ) { // If we're showing an Aux Buffer
-    bufFront = bufBack;
-    bufBack = !bufBack;
-  } else {
-    bufFront = !bufFront;
-    bufBack = !bufBack;
-  }
-  while(bufCurr != bufFront) {    // Wait for display to change.
-    delayMicroseconds(10);
-  }
-}
-
-void showAuxBuffer(byte n) { // Show an Auxiliary buffer
-  if (n < MAX_AUX_BUFFERS) {
-    bufFront = n+2;
-   while(bufCurr != bufFront) {  // Wait for display to change.
-      delayMicroseconds(10);
-    }
-  }
-}
-
-void storeToAuxBuffer(byte buf, byte n) { // Store the buffer to Aux Buffer #
-  byte x, y;
-  if (n < MAX_AUX_BUFFERS) {
-    n+=2;
-    for (y=0; y<8; y++) {
-      for (x=0; x<4; x++) {
-        dots_color[n][R][y][x]=dots_color[buf][R][y][x];
-        dots_color[n][G][y][x]=dots_color[buf][G][y][x];
-        dots_color[n][B][y][x]=dots_color[buf][B][y][x];
-      }
-    }
-  }
-}
-
-void getFromAuxBuffer(byte n) { // Retrieve Aux Buffer # to Back (not visibile) buffer;
-  byte x, y;
-  
-  if (n < MAX_AUX_BUFFERS) {
-    n+=2;
-    for (y=0; y<8; y++) {
-      for (x=0; x<4; x++) {
-        dots_color[bufBack][R][y][x]=dots_color[n][R][y][x];
-        dots_color[bufBack][G][y][x]=dots_color[n][G][y][x];
-        dots_color[bufBack][B][y][x]=dots_color[n][B][y][x];
-      }
-    }
-  }
-}
-
-void clearBuffer(byte r, byte g, byte b) {  // Clear the Back buffer and fill with selected color
-  byte x, y;
-  r = r | (r << 4);
-  g = g | (g << 4);
-  b = b | (b << 4);
-
-  for (y=0; y<8; y++) {
-    for (x=0; x<4; x++) {
-      dots_color[bufBack][G][y][x]=g;
-      dots_color[bufBack][R][y][x]=r;
-      dots_color[bufBack][B][y][x]=b;
-    }
-  }
-}
-
-void copyFrontBuffer(int x, int y) { // Copy the Front buffer to the Back one, offsetting it by x and y
-  int row, col;
-  int offy, offx;
-  byte t0, t1, t2;
-  for (row=0; row<8; row++) {
-    
-    offy = row-y;
-    if ( offy>=0 && offy<8 ) {
-      for (col=0; col<4; col++) {
-        
-        offx = col+(x/2);
-        if ( offx>=0 && offx<4 ) {
-          if ( !(x%2) ) { // if x-offset is pair, we just need to copy the byte by the offset
-            dots_color[bufBack][R][row][col]=dots_color[bufFront][R][offy][offx];
-            dots_color[bufBack][G][row][col]=dots_color[bufFront][G][offy][offx];
-            dots_color[bufBack][B][row][col]=dots_color[bufFront][B][offy][offx];
-          } else { // if x-offset is unpair, we need to shift each byte by four-bit in the offset direction
-            t0 = dots_color[bufFront][R][offy][offx];
-            t1 = dots_color[bufFront][G][offy][offx];
-            t2 = dots_color[bufFront][B][offy][offx];
-            
-            if ( x >= 0 ) { // if x-offset is positive (and unpair) shift four-bit to the right
-              replace_dot(bufBack, col, row, bufBack, col, row, (t0 >> 4), (t1 >> 4), (t2 >> 4), 0xF0);
-              offx = col+1; // NOTE: I reuse offx variable to avoid initializing a new one. This affect only the 2 lines below.
-              if ( offx < 4) // if it's not the right end side column
-                replace_dot(bufBack, offx, row, bufBack, offx, row, (t0 << 4), (t1 << 4), (t2 << 4), 0x0F);
-            } else { // if x-offset is negative (and unpair) shift four-bit to the left
-              replace_dot(bufBack, col, row, bufBack, col, row, (t0 << 4), (t1 << 4), (t2 << 4), 0x0F);
-              offx = col-1; // NOTE: I reuse offx variable to avoid initializing a new one. This affect only the 2 lines below.
-              if ( offx >= 0) // if it's not the left end side column
-                replace_dot(bufBack, offx, row, bufBack, offx, row, (t0 >> 4), (t1 >> 4), (t2 >> 4), 0xF0);
-            }
-            
-          }
-        }
-        
-      }
-    }
-    
-  }
-}
-
-void replace_dot(byte fromBuf, int fromX, int fromY, byte toBuf, int toX, int toY, byte vR, byte vG, byte vB, byte mask) {
-  // Replace a single dot ( 4 byte ) in toBuf buffer with the value from fromBuf buffer
-  dots_color[toBuf][0][toY][toX]=(vG | (dots_color[fromBuf][0][fromY][fromX] & mask));
-  dots_color[toBuf][1][toY][toX]=(vR | (dots_color[fromBuf][1][fromY][fromX] & mask));
-  dots_color[toBuf][2][toY][toX]=(vB | (dots_color[fromBuf][2][fromY][fromX] & mask));
-}
-
-/*----------------------------------------------------------------------------*/
-/* I2C EVENT HANDLING FUNCTIONS                                               */
-/*----------------------------------------------------------------------------*/
-
-void _initWire() {
-  int i;
-  for (i=0; i<MAX_WIRE_CMD_LEN; i++) {
-    RainbowCMD[i] = 0x00;         // Clear Command Buffer
-  }
-  paperR = 0x0; paperG = 0x0; paperB = 0x0;
-  inkR = 0xF; inkG = 0x0; inkB = 0x0;
-
-  Wire.begin(I2C_DEVICE_ADDRESS); // join I2C bus (address optional for master) 
-  Wire.onReceive(receiveEvent);   // define the receive function for receiving data from master
-  Wire.onRequest(requestEvent);   // define the request function for the request from master
-}
-
-#define CMD_ACKNOWLEDGED  {RainbowCMD[1] = CMD_NOP;}
-
-void processWireCommand() {
-  int x, y, ex, ey;
-  byte n;
-  byte r, g, b;
-  switch(RainbowCMD[1]) {
-    case CMD_SWAP_BUF:
-      CMD_ACKNOWLEDGED;
-      swapBuffers();
-      break;
-    case CMD_COPY_FRONT_BUF:
-      CMD_ACKNOWLEDGED;
-      x = toInt(RainbowCMD[2]); y = toInt(RainbowCMD[3]);
-      copyFrontBuffer(x, y);
-      break;
-    case CMD_SHOW_AUX_BUF:
-      CMD_ACKNOWLEDGED;
-      n = RainbowCMD[2];
-      showAuxBuffer(n);
-      break;
-    case CMD_CLEAR_BUF:
-      CMD_ACKNOWLEDGED;
-      r = RainbowCMD[2]; g = RainbowCMD[3]; b = RainbowCMD[4];
-      clearBuffer(r, g, b);
-      break;
-    case CMD_SET_PAPER:
-      CMD_ACKNOWLEDGED;
-      paperR = RainbowCMD[2]; paperG = RainbowCMD[3]; paperB = RainbowCMD[4];
-      break;
-    case CMD_SET_INK:
-      CMD_ACKNOWLEDGED;
-      inkR = RainbowCMD[2]; inkG = RainbowCMD[3]; inkB = RainbowCMD[4];
-      break;
-    case CMD_CLEAR_PAPER:
-      CMD_ACKNOWLEDGED;
-      clearBuffer(paperR, paperG, paperB);
-      break;
-    case CMD_DRAW_PIXEL:
-      CMD_ACKNOWLEDGED;
-      x = toInt(RainbowCMD[2]); y = toInt(RainbowCMD[3]);
-      drawPixel(x, y, inkR, inkG, inkB);
-      break;
-    case CMD_DRAW_LINE:
-      CMD_ACKNOWLEDGED;
-      x = toInt(RainbowCMD[2]); y = toInt(RainbowCMD[3]);
-      ex = toInt(RainbowCMD[4]); ey = toInt(RainbowCMD[5]);
-      drawLine(x, y, ex, ey, inkR, inkG, inkB);
-      break;
-    case CMD_DRAW_SQUARE:
-      CMD_ACKNOWLEDGED;
-      x = toInt(RainbowCMD[2]); y = toInt(RainbowCMD[3]);
-      ex = toInt(RainbowCMD[4]); ey = toInt(RainbowCMD[5]);
-      drawSquare(x, y, ex, ey, inkR, inkG, inkB);
-      break;
-    case CMD_PRINT_CHAR:
-      CMD_ACKNOWLEDGED;
-      x = toInt(RainbowCMD[2]); y = toInt(RainbowCMD[3]);
-      n = RainbowCMD[4];
-      printChar(x, y, inkR, inkG, inkB, n);
-      break;
-    case CMD_DRAW_ROW_MASK:
-      CMD_ACKNOWLEDGED;
-      y = toInt(RainbowCMD[2]); x = toInt(RainbowCMD[3]);
-      n = RainbowCMD[4];
-      drawRowMask(y, x, inkR, inkG, inkB, n);
-      break;
-  }
-}
-
-void requestEvent(void) { // While processing or checking previous directive, request other commands
-  Wire.write(State); 
-  if ((State==processing) || (State==checking)) SetRequest;
-}
-
-// Adapted from the original code (with minor changes)
-void receiveEvent(int howMany) {
-  unsigned char i=0;
-  while(Wire.available()>0) { 
-    RainbowCMD[i]=Wire.read();
-    if ( i < MAX_WIRE_CMD_LEN) i++;
-  }
-
-  if(RainbowCMD[0]=='r') State=processing;
-  else State=waitingcmd;
-
-}
-
-int toInt(byte b) {
-  return map(b, 0, 255, -128, 127);
-}
-
-/*----------------------------------------------------------------------------*/
-/* LED MATRIX DISPLAY HANDLING                                                */
-/*----------------------------------------------------------------------------*/
-
-void flash_next_line(unsigned char ln, unsigned char lvl) {  // Scan one line
-  disable_oe;
-  close_all_line;
-
-  if(ln < 3) {    // Open the line and close others
-    PORTB  = (PINB & ~0x07) | 0x04 >> ln;
-    PORTD  = (PIND & ~0xF8);
-  } else {
-    PORTB  = (PINB & ~0x07);
-    PORTD  = (PIND & ~0xF8) | 0x80 >> (ln - 3);
-  }
-  
-  shift_24_bit(ln, lvl);
-  enable_oe;
-}
-
-void shift_24_bit(unsigned char ln, unsigned char lvl) {   // Display one line by the color level in buff
-  unsigned char color=0,row=0;
-  unsigned char data0=0,data1=0;
-  
-  le_high;
-  for(color=0;color<3;color++) {   // The color order is G-B-R
-    for(row=0;row<4;row++) {
-      data1=dots_color[bufCurr][color][ln][row]&0x0f;
-      data0=dots_color[bufCurr][color][ln][row]>>4;
-
-      if(data0>lvl) {    //gray scale, 0x0f aways light (original comment, not sure what it means)
-        shift_data_1;
-        clk_rising;
-      } else {
-        shift_data_0;
-        clk_rising;
-      }
-      
-      if(data1>lvl) {
-        shift_data_1;
-        clk_rising;
-      } else {
-        shift_data_0;
-        clk_rising;
-      }
-    }
-  }
-  le_low;
-}
-
-
-/*----------------------------------------------------------------------------*/
-/* INIT TIMERS AND INTERRUPT FUNCTIONS                                        */
-/*----------------------------------------------------------------------------*/
-
-void _init(void) {  // define the pin mode
-  DDRD=0xff;        // Configure ports (see http://www.arduino.cc/en/Reference/PortManipulation): digital pins 0-7 as OUTPUT
-  DDRC=0xff;        // analog pins 0-5 as OUTPUT
-  DDRB=0xff;        // digital pins 8-13 as OUTPUT
-  PORTD=0;          // Configure ports data register (see link above): digital pins 0-7 as READ
-  PORTB=0;          // digital pins 8-13 as READ
-
-  level = 0;
-  line = 0;
-  
-  _initWire();      // init I2C communication protocol
-  _initGfx();       // init Graphic
-  
-  init_timer2();    // init the timer for flashing the LED matrix
-}
-
-void init_timer2(void) {                  // Initialize Timer2
-  TCCR2A |= (1 << WGM21) | (1 << WGM20);   
-  TCCR2B |= (1<<CS22);                    // by clk/64
-  TCCR2B &= ~((1<<CS21) | (1<<CS20));     // by clk/64
-  TCCR2B &= ~((1<<WGM21) | (1<<WGM20));   // Use normal mode
-  ASSR |= (0<<AS2);                       // Use internal clock - external clock not used in Arduino
-  TIMSK2 |= (1<<TOIE2) | (0<<OCIE2B);     //Timer2 Overflow Interrupt Enable
-  TCNT2 = GammaTab[dispGamma][0];
-  sei();   
-}
-
-ISR(TIMER2_OVF_vect) {  // Timer2 Service 
-  TCNT2 = GammaTab[dispGamma][level];  // Set the flashing time using gamma value table
-  flash_next_line(line,level);         // flash the next line in LED matrix for the current level.
-  line++;
-
-  if(line > 7) {                // After flashing all LED's lines, go back to line 0 and increase the level
-    line = 0;
-    level++;
-    if(level>15) {              // After flashng all levels, go back to level 0 and, eventually, swaps the buffers
-      level = 0;
-      bufCurr = bufFront;       // do the actual swapping, synced with display refresh.
-    }
-  }
-}
-

YolkBox_Rainbowduino_Firmware_v3_0h/data.c

-#include <avr/pgmspace.h>
-
-// Gamma tables
-unsigned char GammaTab[3][16]= {
-    {0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7},    // Default linear gamma
-    {0xFF,0xFE,0xFD,0xFC,0xFB,0xF9,0xF7,0xF5,0xF3,0xF0,0xED,0xEA,0xE7,0xE4,0xE1,0xDD},    // Progressive gamma
-    {0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7}     // Undefined
-};
-
-// Display dot buffer
-unsigned char dots_color[6][3][8][4] = {
-//== 0 ================================================
-{
-  { {0x00,0x00,0x00,0x4b}, //green 
-    {0x00,0x00,0x04,0xbf},
-    {0x00,0x00,0x4b,0xff},
-    {0x00,0x04,0xbf,0xff},
-    {0x00,0x4b,0xff,0xff},
-    {0x04,0xbf,0xff,0xff},
-    {0x4b,0xff,0xff,0xff},
-    {0xbf,0xff,0xff,0xfd}
-  },
-  { {0xff,0xfd,0x71,0x00}, //red 
-    {0xff,0xd7,0x10,0x00},
-    {0xfd,0xf1,0x00,0x00},
-    {0xda,0x10,0x00,0x00},
-    {0x71,0x00,0x00,0x01},
-    {0x10,0x00,0x00,0x17},
-    {0x00,0x00,0x01,0x7e},
-    {0x00,0x00,0x17,0xef}
-  },
-  { {0x06,0xef,0xff,0xff}, //blue 
-    {0x6e,0xff,0xff,0xff},
-    {0xef,0xff,0xff,0xfa},
-    {0xff,0xff,0xff,0xa3},
-    {0xff,0xff,0xfa,0x30},
-    {0xff,0xfa,0xa3,0x00},
-    {0xff,0xfa,0x30,0x00},
-    {0xff,0xa3,0x00,0x00}
-  }
-},
-//== 1 =================================================
-{
-  { {0x00,0x00,0x00,0x4b}, //green
-    {0x00,0x00,0x04,0xbf},
-    {0x00,0x00,0x4b,0xff},
-    {0x00,0x04,0xbf,0xff},
-    {0x00,0x4b,0xff,0xff},
-    {0x04,0xbf,0xff,0xff},
-    {0x4b,0xff,0xff,0xff},
-    {0xbf,0xff,0xff,0xfd}
-  },
-  { {0xff,0xfd,0x71,0x00}, //red 
-    {0xff,0xd7,0x10,0x00},
-    {0xfd,0xf1,0x00,0x00},
-    {0xda,0x10,0x00,0x00},
-    {0x71,0x00,0x00,0x01},
-    {0x10,0x00,0x00,0x17},
-    {0x00,0x00,0x01,0x7e},
-    {0x00,0x00,0x17,0xef}
-  },
-  { {0x06,0xef,0xff,0xff}, //blue
-    {0x6e,0xff,0xff,0xff},
-    {0xef,0xff,0xff,0xfa},
-    {0xff,0xff,0xff,0xa3},
-    {0xff,0xff,0xfa,0x30},
-    {0xff,0xfa,0xa3,0x00},
-    {0xff,0xfa,0x30,0x00},
-    {0xff,0xa3,0x00,0x00}
-  }
- },
-//== 2 == AUX0 =========================================
- {
-  { {0xff,0xbf,0x00,0x00}, //green
-    {0xff,0xbf,0x00,0x00},
-    {0xff,0xbf,0x00,0x00},
-    {0xff,0xbf,0x00,0x00},
-    {0xff,0xbf,0x00,0x00},
-    {0xff,0xbf,0x00,0x00},
-    {0x01,0x23,0x45,0x67},
-    {0x89,0xab,0xcd,0xef}
-  },
-  { {0xff,0x00,0xff,0x00}, //red
-    {0xff,0x00,0xff,0x00},
-    {0xff,0x00,0xff,0x00},
-    {0xff,0x00,0xff,0x00},
-    {0xff,0x00,0xff,0x00},
-    {0xff,0x00,0xff,0x00},
-    {0x01,0x23,0x45,0x67},
-    {0x89,0xab,0xcd,0xef}
-  },
-  { {0xf0,0xf0,0xd0,0xf0}, //blue 
-    {0xf0,0xf0,0xd0,0xf0},
-    {0xf0,0xf0,0xd0,0xf0},
-    {0xf0,0xf0,0xd0,0xf0},
-    {0xf0,0xf0,0xd0,0xf0},
-    {0xf0,0xf0,0xd0,0xf0},
-    {0x01,0x23,0x45,0x67},
-    {0x89,0xab,0xcd,0xef}
-  }
- },
-//== 3 == AUX1 =========================================
- {
-  { {0x00,0x00,0x00,0x00}, //green 
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x12,0x34,0x57},
-    {0x89,0xAB,0xCD,0xEF},
-    {0x01,0x23,0x45,0x67},
-    {0x89,0xAB,0xCD,0xEF},
-  },
-  { {0x00,0x00,0x00,0x00}, //red
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x12,0x34,0x57},
-    {0x89,0xAB,0xCD,0xEF},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x01,0x23,0x45,0x67},
-    {0x89,0xAB,0xCD,0xEF},
-  },
-  { {0x00,0x12,0x34,0x57}, //blue
-    {0x89,0xAB,0xCD,0xEF},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x01,0x23,0x45,0x67},
-    {0x89,0xAB,0xCD,0xEF},
-  }
- },
-//== 4 == AUX2 =========================================
- {
-  { {0x00,0x00,0x00,0x4b}, //green
-    {0x00,0x00,0x04,0xbf},
-    {0x00,0x00,0x4b,0xff},
-    {0x00,0x04,0xbf,0xff},
-    {0x00,0x4b,0xff,0xff},
-    {0x04,0xbf,0xff,0xff},
-    {0x4b,0xff,0xff,0xff},
-    {0xbf,0xff,0xff,0xfd}
-  },
-  { {0xff,0xfd,0x71,0x00}, //red
-    {0xff,0xd7,0x10,0x00},
-    {0xfd,0xf1,0x00,0x00},
-    {0xda,0x10,0x00,0x00},
-    {0x71,0x00,0x00,0x01},
-    {0x10,0x00,0x00,0x17},
-    {0x00,0x00,0x01,0x7e},
-    {0x00,0x00,0x17,0xef}
-  },
-  { {0x06,0xef,0xff,0xff}, //blue
-    {0x6e,0xff,0xff,0xff},
-    {0xef,0xff,0xff,0xfa},
-    {0xff,0xff,0xff,0xa3},
-    {0xff,0xff,0xfa,0x30},
-    {0xff,0xfa,0xa3,0x00},
-    {0xff,0xfa,0x30,0x00},
-    {0xff,0xa3,0x00,0x00}
-  }
- },
-//== 5 == AUX3 =========================================
- {
-  { {0x00,0x00,0x00,0x00}, //green
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00}
-  },
-  { {0x0f,0xff,0xff,0xff}, //red
-    {0x0f,0xff,0xff,0xff},
-    {0x0f,0xff,0xff,0xff},
-    {0x0f,0xff,0xff,0xff},
-    {0x0f,0xff,0xff,0xff},
-    {0x0f,0xff,0xff,0xff},
-    {0x0f,0xff,0xff,0xff},
-    {0x0f,0xff,0xff,0xff}
-  },
-  { {0x00,0x00,0x00,0x00}, //blue
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00},
-    {0x00,0x00,0x00,0x00}
-  }
- }
-};
-
-// Internal Font (read-only)
-unsigned char ASCII_Char[62][8] PROGMEM = {
-    {0x0,0x38,0x44,0x4C,0x54,0x64,0x44,0x38},   // 0
-    {0x0,0x38,0x10,0x10,0x10,0x10,0x18,0x10},   // 1
-    {0x0,0x7C,0x8,0x10,0x20,0x40,0x44,0x38},    // 2
-    {0x0,0x38,0x44,0x40,0x20,0x10,0x20,0x7C},   // 3
-    {0x0,0x20,0x20,0x7C,0x24,0x28,0x30,0x20},   // 4
-    {0x0,0x38,0x44,0x40,0x40,0x3C,0x4,0x7C},    // 5
-    {0x0,0x38,0x44,0x44,0x3C,0x4,0x8,0x30},     // 6
-    {0x0,0x8,0x8,0x8,0x10,0x20,0x40,0x7C},      // 7
-    {0x0,0x38,0x44,0x44,0x38,0x44,0x44,0x38},   // 8
-    {0x0,0x18,0x20,0x40,0x78,0x44,0x44,0x38},   // 9
-
-    {0x0,0x44,0x44,0x7C,0x44,0x44,0x28,0x10},   // A
-    {0x0,0x3C,0x44,0x44,0x3C,0x44,0x44,0x3C},   // B   
-    {0x0,0x38,0x44,0x4,0x4,0x4,0x44,0x38},      // C   
-    {0x0,0x1C,0x24,0x44,0x44,0x44,0x24,0x1C},   // D  
-    {0x0,0x7C,0x4,0x4,0x3C,0x4,0x4,0x7C},       // E
-    {0x0,0x4,0x4,0x4,0x3C,0x4,0x4,0x7C},        // F
-    {0x0,0x78,0x44,0x44,0x74,0x4,0x44,0x38},    // G
-    {0x0,0x44,0x44,0x44,0x7C,0x44,0x44,0x44},   // H
-    {0x0,0x38,0x10,0x10,0x10,0x10,0x10,0x38},   // I
-    {0x0,0x18,0x24,0x20,0x20,0x20,0x20,0x70},   // J
-    {0x0,0x44,0x24,0x14,0xC,0x14,0x24,0x44},    // K
-    {0x0,0x7C,0x4,0x4,0x4,0x4,0x4,0x4},         // L
-    {0x0,0x44,0x44,0x44,0x54,0x54,0x6C,0x44},   // M
-    {0x0,0x44,0x44,0x64,0x54,0x4C,0x44,0x44},   // N
-    {0x0,0x38,0x44,0x44,0x44,0x44,0x44,0x38},   // O
-    {0x0,0x4,0x4,0x4,0x3C,0x44,0x44,0x3C},      // P
-    {0x0,0x58,0x24,0x54,0x44,0x44,0x44,0x38},   // Q
-    {0x0,0x44,0x24,0x14,0x3C,0x44,0x44,0x3C},   // R
-    {0x0,0x3C,0x40,0x40,0x38,0x4,0x4,0x78},     // S
-    {0x0,0x10,0x10,0x10,0x10,0x10,0x10,0x7C},   // T
-    {0x0,0x38,0x44,0x44,0x44,0x44,0x44,0x44},   // U   
-    {0x0,0x10,0x28,0x44,0x44,0x44,0x44,0x44},   // V     
-    {0x0,0x28,0x54,0x54,0x54,0x44,0x44,0x44},   // W    
-    {0x0,0x44,0x44,0x28,0x10,0x28,0x44,0x44},   // X   
-    {0x0,0x10,0x10,0x10,0x28,0x44,0x44,0x44},   // Y    
-    {0x0,0x7C,0x4,0x8,0x10,0x20,0x40,0x7C},     // Z
-    
-    {0x0,0x78,0x44,0x78,0x40,0x38,0x0,0x0},     // a   
-    {0x0,0x3C,0x44,0x44,0x4C,0x34,0x4,0x4},     // b    
-    {0x0,0x38,0x44,0x4,0x4,0x38,0x0,0x0},       // c    
-    {0x0,0x78,0x44,0x44,0x64,0x58,0x40,0x40},   // d    
-    {0x0,0x38,0x4,0x7C,0x44,0x38,0x0,0x0},      // e    
-    {0x0,0x8,0x8,0x8,0x1C,0x8,0x48,0x30},       // f    
-    {0x38,0x40,0x78,0x44,0x44,0x78,0x0,0x0},    // g    
-    {0x0,0x44,0x44,0x44,0x4C,0x34,0x4,0x4},     // h   
-    {0x0,0x38,0x10,0x10,0x10,0x18,0x0,0x10},    // i    
-    {0x18,0x24,0x20,0x20,0x20,0x30,0x0,0x20},   // j    
-    {0x0,0x24,0x14,0xC,0x14,0x24,0x4,0x4},      // k    
-    {0x0,0x38,0x10,0x10,0x10,0x10,0x10,0x18},   // l    
-    {0x0,0x44,0x44,0x54,0x54,0x2C,0x0,0x0},     // m   
-    {0x0,0x44,0x44,0x44,0x4C,0x34,0x0,0x0},     // n    
-    {0x0,0x38,0x44,0x44,0x44,0x38,0x0,0x0},     // o    
-    {0x4,0x4,0x3C,0x44,0x44,0x3C,0x0,0x0},      // p    
-    {0x40,0x40,0x58,0x64,0x64,0x58,0x0,0x0},    // q   
-    {0x0,0x4,0x4,0x4,0x4C,0x34,0x0,0x0},        // r    
-    {0x0,0x3C,0x40,0x38,0x4,0x38,0x0,0x0},      // s    
-    {0x0,0x30,0x48,0x8,0x8,0x1C,0x8,0x8},       // t   
-    {0x0,0x58,0x64,0x44,0x44,0x44,0x0,0x0},     // u    
-    {0x0,0x10,0x28,0x44,0x44,0x44,0x0,0x0},     // v   
-    {0x0,0x28,0x54,0x54,0x44,0x44,0x0,0x0},     // w    
-    {0x0,0x44,0x28,0x10,0x28,0x44,0x0,0x0},     // x   
-    {0x38,0x40,0x78,0x44,0x44,0x44,0x0,0x0},    // y   
-    {0x0,0x7C,0x8,0x10,0x20,0x7C,0x0,0x0}       // z
-};
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.