-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathws_pwm.h
More file actions
49 lines (43 loc) · 1.12 KB
/
ws_pwm.h
File metadata and controls
49 lines (43 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*!
* @file ws_servo.h
*
* High-level interface for wippersnapper to manage servo objects
*
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
*
* Brent Rubell for Adafruit Industries 2022
*
*
* MIT license, all text here must be included in any redistribution.
*
*/
#ifndef WS_PWM
#define WS_PWM
#include "Wippersnapper.h"
#ifdef ARDUINO_ARCH_ESP32
#include "components/ledc/ws_ledc.h"
#endif
class Wippersnapper;
class ws_ledc;
/**************************************************************************/
/*!
@brief Interface for WipperSnapper PWM
*/
/**************************************************************************/
class ws_pwm {
public:
ws_pwm();
ws_pwm(ws_ledc *ledcManager);
~ws_pwm();
bool attach(uint8_t pin, double freq, uint8_t resolution);
void detach(uint8_t pin);
void writeDutyCycle(uint8_t pin, int dutyCycle);
void writeTone(uint8_t pin, uint32_t freq);
void noTone(uint8_t pin);
private:
ws_ledc *_ledcMgr = nullptr; ///< pointer to ws_ledc
};
#endif // WS_PWM