initial commit
[ETG_Helmet] / SOFTWARE / UTILS / fast-gpio / include / fastpwm.h
1 #ifndef _FAST_PWM_H_
2 #define _FAST_PWM_H_
3
4 #include <module.h>
5 #include <fastgpio.h>
6 #include <fastgpioomega.h>
7 #include <fastgpioomega2.h>
8 #include <unistd.h>
9
10
11 #define DEFAULT_FREQ                            200
12 #define DEFAULT_DUTY_CYCLE                      50
13
14
15 class FastPwm : public Module {
16 public:
17         FastPwm(void);
18         FastPwm(int freq, int duty, unsigned int cycles);
19         ~FastPwm(void);
20
21         void    Reset                   (void);
22
23         void    Pwm                             (int pinNum);
24         void    Pwm                             (int pinNum, int freq, int duty, unsigned int cycles);
25
26
27 private:
28         // private functions
29         void    _SetupPeriods   (int frequency, int duty, unsigned int cycles);
30         void    _Sleep                  (double length);
31
32         void    _Pwm                    (int pinNum);
33
34         // private members
35         // The way it was before
36         // FastGpio     gpio;
37
38         //Create a pointer to the base class
39         //Instantiate it in the constructor
40         FastGpio * gpio;
41
42         int             bSetup;
43         double          freq;
44         double          dutyCycle;
45
46         double          period;
47         double          periodLow;
48         double          periodHigh;
49
50         unsigned int    myCycles;
51 };
52
53
54 #endif  // _FAST_PWM_H_
Contact me: dev (at) shalnoff (dot) com
PGP fingerprint: A6B8 3B23 6013 F18A 0C71 198B 83D8 C64D 917A 5717