/* LICENSE:
  =========================================================================
    CMPack'04 Source Code Release for OPEN-R SDK 1.1.5-r2 for ERS7
    Copyright (C) 2004 Multirobot Lab [Project Head: Manuela Veloso]
    School of Computer Science, Carnegie Mellon University
    All rights reserved.
  ========================================================================= */

#ifndef __LED_INTERFACE_H__
#define __LED_INTERFACE_H__

#define USE_ONLY_LEGAL_LED_COLORS 1

namespace Motion{

#ifdef USE_ONLY_LEGAL_COLORS
enum LEDMode { MODE_A };
#else
enum LEDMode { MODE_A, MODE_B };
#endif

const int NUM_LEDS = 26;

struct LEDState{
  unsigned int cmd;
  int intensity[NUM_LEDS];
  int mode;
  int set;
};

 const int LED_BRIGHT = 255;
 const int LED_DIM    = 100;
 const int LED_OFF    = 0;

// ERS210
const int LED_NONE         = 0;
const int LED_LOWER_LEFT   = 1<<0;
const int LED_LOWER_RIGHT  = 1<<1;
const int LED_MIDDLE_LEFT  = 1<<2;
const int LED_MIDDLE_RIGHT = 1<<3;
const int LED_UPPER_LEFT   = 1<<4;
const int LED_UPPER_RIGHT  = 1<<5;
const int LED_TOP          = 1<<6; // New motion command packet recieved
const int LED_TAIL_RED     = 1<<7;
const int LED_TAIL_BLUE    = 1<<8;
const int LED_ALL          = (1<<9) - 1;

const int RED_FACE_LEDS = LED_LOWER_LEFT | LED_LOWER_RIGHT |
                          LED_UPPER_LEFT | LED_UPPER_RIGHT;

// ERS7

//binary LEDs on head
 const int LED_TOP_ORANGE = 1<<0;
 const int LED_TOP_WHITE  = 1<<1;
 const int LED_TINY        = 1<<5;

#ifdef USE_ONLY_LEGAL_LED_COLORS
 // illegal colors changed for robocup
 const int LED_EARS_RED           = 1<<2;
 const int LED_EARS_GREEN         = 1<<3;
 const int LED_EARS_BLUE          = LED_EARS_GREEN;
 const int LED_EARS_CYAN          = LED_EARS_GREEN;
 const int LED_EARS_PURPLE        = LED_EARS_GREEN;
 const int LED_EARS_YELLOW        = LED_EARS_GREEN;
 const int LED_EARS_WHITE         = 1<<2 | 1<<3 | 1<<4;
#else
 // the originals
 const int LED_EARS_RED           = 1<<2;
 const int LED_EARS_GREEN         = 1<<3;
 const int LED_EARS_BLUE          = 1<<4;
 const int LED_EARS_CYAN          = LED_EARS_GREEN|LED_EARS_BLUE;
 const int LED_EARS_PURPLE        = LED_EARS_RED|LED_EARS_BLUE;
 const int LED_EARS_YELLOW        = LED_EARS_RED|LED_EARS_GREEN;
 const int LED_EARS_WHITE         = LED_EARS_RED | LED_EARS_GREEN | LED_EARS_BLUE;
#endif

 const int LED_BACK_FRONT_COLOR   = 1<<20;
 const int LED_BACK_FRONT_WHITE   = 1<<21;
 const int LED_BACK_MIDDLE_COLOR  = 1<<22;
 const int LED_BACK_MIDDLE_WHITE  = 1<<23;
 const int LED_BACK_REAR_COLOR    = 1<<24;
 const int LED_BACK_REAR_WHITE    = 1<<25; 

 const int LED_A  		  = 1<<6;
 const int LED_B  		  = 1<<7;
 const int LED_C 	 	  = 1<<8;
 const int LED_D 		  = 1<<9;
 const int LED_E 		  = 1<<10;
 const int LED_F 		  = 1<<11;
 const int LED_G 		  = 1<<12;
 const int LED_H 		  = 1<<13;
 const int LED_I 		  = 1<<14;
 const int LED_J 		  = 1<<15;
 const int LED_K 		  = 1<<16;
 const int LED_L 		  = 1<<17;
 const int LED_M 		  = 1<<18;
 const int LED_N 		  = 1<<19;

 const int LED_VLINE_RIGHT        = LED_A | LED_C | LED_G;
 const int LED_VLINE_CENTER       = LED_K | LED_L;
 const int LED_VLINE_LEFT         = LED_B | LED_D | LED_H;

 const int LED_HLINE_HIGH         = LED_G | LED_I | LED_K | LED_J | LED_H;
 const int LED_HLINE_LOW          = LED_E | LED_L | LED_F;
 const int LED_ZIG_ZAG            = LED_G | LED_E | LED_K | LED_F | LED_H;

 const int LED_WHITE = LED_A | LED_B | LED_E | LED_F | 
   LED_G | LED_H | LED_I | LED_J | LED_K | LED_L;

 //mode A *ONLY*
 const int LED_RED_EYES_LOW       = 1<<18;
 const int LED_RED_EYES_HIGH      = 1<<19;

 //mode B *ONLY*
 const int LED_2PURPLE            = LED_N;
 const int LED_4PURPLE            = LED_N|LED_M;
 const int LED_GREEN              = LED_A|LED_B|LED_C|LED_D;
 const int LED_CYAN               = LED_M|LED_C|LED_D;

 const int LED_GREEN_EYE_LEFT     = LED_A;
 const int LED_GREEN_EYE_RIGHT    = LED_B;
 const int LED_GREEN_EYES         = LED_A|LED_B;

 const int LED_GREEN_PURPLE       = LED_D|LED_C|LED_N|LED_A|LED_B;
 const int LED_GREEN_CYAN         = LED_M|LED_A|LED_B|LED_C|LED_D;




} // namespace Motion

#endif
// __LED_INTERFACE_H__
