COSA
An Object-Oriented Platform for Arduino Programming
PWMPin.hh
Go to the documentation of this file.
1 
21 #ifndef COSA_PWM_PIN_HH
22 #define COSA_PWM_PIN_HH
23 
24 #include "Cosa/OutputPin.hh"
25 
29 class PWMPin : public OutputPin {
30 public:
36  PWMPin(Board::PWMPin pin, uint8_t duty = 0);
37 
41  void begin();
42 
47  void set(uint8_t duty);
48 
53  void write(uint8_t duty)
54  __attribute__((always_inline))
55  {
56  set(duty);
57  }
58 
64  PWMPin& operator=(uint8_t duty)
65  __attribute__((always_inline))
66  {
67  set(duty);
68  return (*this);
69  }
70 
79  void set(uint16_t value, uint16_t min, uint16_t max);
80 
89  void write(uint16_t value, uint16_t min, uint16_t max)
90  __attribute__((always_inline))
91  {
92  set(value, min, max);
93  }
94 
99  uint8_t duty();
100 };
101 
102 #endif
void write(uint8_t duty)
Definition: PWMPin.hh:53
void write(uint16_t value, uint16_t min, uint16_t max)
Definition: PWMPin.hh:89
uint8_t pin() const
Definition: Pin.hh:103
void begin()
PWMPin(Board::PWMPin pin, uint8_t duty=0)
Definition: PWMPin.hh:29
PWMPin & operator=(uint8_t duty)
Definition: PWMPin.hh:64
uint8_t duty()