• Main Page
  • Classes
  • Files
  • File List
  • File Members

qeleds.h

Go to the documentation of this file.
00001 //
00002 // begin license header
00003 //  
00004 // This file is part of Terk and TerkOS.
00005 //
00006 // All Terk and TerkOS source code is provided under the terms of the 
00007 // GNU General Public License v2 (http://www.gnu.org/licenses/gpl-2.0.html).  
00008 // Those wishing to use Terk and TerkOS source code, software and/or
00009 // technologies under different licensing terms should contact us at 
00010 // [email protected]. Such licensing terms are available for
00011 // all portions of the Terk and TerkOS codebase presented here.
00012 //
00013 // end license header
00014 //
00015 
00016 #ifndef _QELEDS_H
00017 #define _QELEDS_H
00018 
00019 #include <sys/time.h>
00020 #include "9302hw.h"
00021 #include "singleton.h"
00022 
00023 // defines the number of LEDs
00024 #define QEL_NUM_LEDS             3
00025 #define QEL_NUM_COLORS           5
00026 
00027 #define QEL_DEFAULT_ADDR         0x4c0
00028 
00029 #define QEL_GREEN         0xff00
00030 #define QEL_RED           0x00ff
00031 #define QEL_YELLOW        0xff10
00032 #define QEL_ORANGE        0xff40
00033 
00037 typedef enum
00038   {
00039     LED_GAME = 0,
00040     LED_VEXNET,
00041     LED_ROBOT
00042   }
00043 ELEDIndex;
00044 
00048 typedef enum 
00049   {
00050     LED_COLOR_OFF = 0,
00051     LED_COLOR_RED ,
00052     LED_COLOR_GREEN,
00053     LED_COLOR_YELLOW,
00054     LED_COLOR_ORANGE
00055   } 
00056 ELEDColor;
00057 
00062 typedef enum
00063   {
00064     LED_SOLID,
00065     LED_SLOW_BLINK,
00066     LED_FAST_BLINK,
00067     LED_1BLIP,
00068     LED_2BLIP
00069   } 
00070 ELEDMode;
00071 
00087 class CQELEDController
00088 {
00089 public:
00093   SINGLETON(CQELEDController);
00094   
00100   void SetLED(ELEDIndex led, ELEDColor color);
00101 
00102 private:
00103   CQELEDController();
00104   ~CQELEDController();
00105 
00106   C9302Hardware *m_p9302hw; 
00107 
00108   volatile unsigned short *m_ledreg;
00109 
00110   pthread_t m_thread;
00111   bool m_threadRun;
00112   pthread_mutex_t m_mutex;
00113   pthread_cond_t m_cond;
00114 
00115   static void *LEDControllerThread(void *arg);
00116 };
00117 
00118 #endif
00119 

Generated on Mon Oct 3 2011 15:36:31 for libqwerk by  doxygen 1.7.1