Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
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