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

qeservo.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 _QESERVO_H
00017 #define _QESERVO_H
00018 
00019 #include "singleton.h"
00020 #include "9302hw.h"
00021 
00022 #define QES_DEFAULT_SERVOS       12
00023 
00024 #define QES_DEFAULT_DIVIDER      400  // divide 100mhz by 400->250khz, 4us 
00025 #define QES_DEFAULT_FREQ         4650 // 4650 * 4us = 18.6ms->53.76hz
00026 #define QES_DEFAULT_MIN          250  // 250*4us = 1ms
00027 #define QES_DEFAULT_MAX          500  // 500*4us = 2ms
00028 
00029 #define QES_DEFAULT_ADDR         0x400
00030 
00047 class CQEServo
00048 {
00049 public:
00053   SINGLETON(CQEServo);
00054 
00060   void Disable(unsigned int index);
00061 
00071   void SetCommand(unsigned int index, unsigned short val);
00072 
00081   unsigned short GetCommand(unsigned int index);
00082   
00088   void SetTiming(unsigned short min, unsigned short max);
00089 
00090 private:
00091   CQEServo();
00092   ~CQEServo();
00093 
00094   void SetSignal(bool set);
00095   
00096   static void SigHandler(int signum);
00097 
00098   unsigned short m_min;
00099   unsigned short m_max;
00100   unsigned int m_num;
00101 
00102   volatile unsigned short *m_divider;
00103   volatile unsigned short *m_freq;
00104   volatile unsigned short *m_up;
00105 
00106   C9302Hardware *m_p9302hw; 
00107 };
00108 
00109 #endif

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