|
26 | 26 | defined(ARDUINO_AVR_METRO) || defined(ARDUINO_AVR_PROTRINKET5) || defined(ARDUINO_AVR_PROTRINKET3) || defined(ARDUINO_AVR_PROTRINKET5FTDI) || \
|
27 | 27 | defined(ARDUINO_AVR_PROTRINKET3FTDI) )
|
28 | 28 | #define USE_TIMER_1 true
|
29 |
| - #warning Using Timer1 |
30 | 29 | #else
|
31 | 30 | #define USE_TIMER_3 true
|
32 |
| - #warning Using Timer3 |
33 | 31 | #endif
|
34 | 32 |
|
35 |
| -// These define's must be placed at the beginning before #include "ESP32_PWM.h" |
| 33 | +// These define's must be placed at the beginning before #include "AVR_Slow_PWM.h" |
36 | 34 | // _PWM_LOGLEVEL_ from 0 to 4
|
37 | 35 | // Don't define _PWM_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system.
|
38 | 36 | #define _PWM_LOGLEVEL_ 3
|
39 | 37 |
|
| 38 | +#if (_PWM_LOGLEVEL_ > 3) |
| 39 | + #if USE_TIMER_1 |
| 40 | + #warning Using Timer1 |
| 41 | + #elif USE_TIMER_1 |
| 42 | + #warning Using Timer3 |
| 43 | + #endif |
| 44 | +#endif |
| 45 | + |
40 | 46 | #define USING_MICROS_RESOLUTION true //false
|
41 | 47 |
|
42 | 48 | // Default is true, uncomment to false
|
@@ -86,19 +92,19 @@ void TimerHandler()
|
86 | 92 | uint32_t PWM_Pin = LED_BUILTIN;
|
87 | 93 |
|
88 | 94 | // You can assign any interval for any timer here, in Hz
|
89 |
| -float PWM_Freq1 = 1.0f; |
| 95 | +float PWM_Freq1 = 200.0f; //1.0f; |
90 | 96 | // You can assign any interval for any timer here, in Hz
|
91 |
| -float PWM_Freq2 = 2.0f; |
| 97 | +float PWM_Freq2 = 100.0f; //2.0f; |
92 | 98 |
|
93 | 99 | // You can assign any interval for any timer here, in microseconds
|
94 | 100 | uint32_t PWM_Period1 = 1000000 / PWM_Freq1;
|
95 | 101 | // You can assign any interval for any timer here, in microseconds
|
96 | 102 | uint32_t PWM_Period2 = 1000000 / PWM_Freq2;
|
97 | 103 |
|
98 | 104 | // You can assign any duty_cycle for any PWM here, from 0-100
|
99 |
| -float PWM_DutyCycle1 = 50.0; |
| 105 | +float PWM_DutyCycle1 = 1.0f; //50.0f; |
100 | 106 | // You can assign any duty_cycle for any PWM here, from 0-100
|
101 |
| -float PWM_DutyCycle2 = 90.0; |
| 107 | +float PWM_DutyCycle2 = 5.55f; //90.0f; |
102 | 108 |
|
103 | 109 | // Channel number used to identify associated channel
|
104 | 110 | int channelNum;
|
@@ -207,8 +213,8 @@ void changePWM()
|
207 | 213 | {
|
208 | 214 | static uint8_t count = 1;
|
209 | 215 |
|
210 |
| - double PWM_Freq; |
211 |
| - uint32_t PWM_DutyCycle; |
| 216 | + float PWM_Freq; |
| 217 | + float PWM_DutyCycle; |
212 | 218 |
|
213 | 219 | if (count++ % 2)
|
214 | 220 | {
|
|
0 commit comments