Commit | Line | Data |
---|---|---|
1 | #ifndef _PWM_H | |
2 | #define _PWM_H | |
3 | ||
4 | #include <stdint.h> | |
5 | ||
6 | #include "Pin.h" | |
7 | #include "Module.h" | |
8 | ||
9 | class Pwm : public Module, public Pin { | |
10 | public: | |
11 | Pwm(); | |
12 | ||
13 | void on_module_load(void); | |
14 | uint32_t on_tick(uint32_t); | |
15 | ||
16 | Pwm* max_pwm(int); | |
17 | int max_pwm(void); | |
18 | ||
19 | void pwm(int); | |
20 | int get_pwm() const { return _pwm; } | |
21 | void set(bool); | |
22 | ||
23 | private: | |
24 | int _max; | |
25 | int _pwm; | |
26 | int _sd_accumulator; | |
27 | bool _sd_direction; | |
28 | }; | |
29 | ||
30 | #endif /* _PWM_H */ |