diff --git a/examples/ISR_8_PWMs_Array/ISR_8_PWMs_Array.ino b/examples/ISR_8_PWMs_Array/ISR_8_PWMs_Array.ino index 69af5cc..67e2a25 100644 --- a/examples/ISR_8_PWMs_Array/ISR_8_PWMs_Array.ino +++ b/examples/ISR_8_PWMs_Array/ISR_8_PWMs_Array.ino @@ -26,17 +26,23 @@ defined(ARDUINO_AVR_METRO) || defined(ARDUINO_AVR_PROTRINKET5) || defined(ARDUINO_AVR_PROTRINKET3) || defined(ARDUINO_AVR_PROTRINKET5FTDI) || \ defined(ARDUINO_AVR_PROTRINKET3FTDI) ) #define USE_TIMER_1 true - #warning Using Timer1 #else #define USE_TIMER_3 true - #warning Using Timer3 #endif -// These define's must be placed at the beginning before #include "ESP32_PWM.h" +// These define's must be placed at the beginning before #include "AVR_Slow_PWM.h" // _PWM_LOGLEVEL_ from 0 to 4 // Don't define _PWM_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system. #define _PWM_LOGLEVEL_ 3 +#if (_PWM_LOGLEVEL_ > 3) + #if USE_TIMER_1 + #warning Using Timer1 + #elif USE_TIMER_1 + #warning Using Timer3 + #endif +#endif + #define USING_MICROS_RESOLUTION true //false // Default is true, uncomment to false diff --git a/examples/ISR_8_PWMs_Array_Complex/ISR_8_PWMs_Array_Complex.ino b/examples/ISR_8_PWMs_Array_Complex/ISR_8_PWMs_Array_Complex.ino index cd271c8..340929b 100644 --- a/examples/ISR_8_PWMs_Array_Complex/ISR_8_PWMs_Array_Complex.ino +++ b/examples/ISR_8_PWMs_Array_Complex/ISR_8_PWMs_Array_Complex.ino @@ -26,17 +26,23 @@ defined(ARDUINO_AVR_METRO) || defined(ARDUINO_AVR_PROTRINKET5) || defined(ARDUINO_AVR_PROTRINKET3) || defined(ARDUINO_AVR_PROTRINKET5FTDI) || \ defined(ARDUINO_AVR_PROTRINKET3FTDI) ) #define USE_TIMER_1 true - #warning Using Timer1 #else #define USE_TIMER_3 true - #warning Using Timer3 #endif -// These define's must be placed at the beginning before #include "ESP32_PWM.h" +// These define's must be placed at the beginning before #include "AVR_Slow_PWM.h" // _PWM_LOGLEVEL_ from 0 to 4 // Don't define _PWM_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system. #define _PWM_LOGLEVEL_ 3 +#if (_PWM_LOGLEVEL_ > 3) + #if USE_TIMER_1 + #warning Using Timer1 + #elif USE_TIMER_1 + #warning Using Timer3 + #endif +#endif + #define USING_MICROS_RESOLUTION true //false // Default is true, uncomment to false diff --git a/examples/ISR_8_PWMs_Array_Simple/ISR_8_PWMs_Array_Simple.ino b/examples/ISR_8_PWMs_Array_Simple/ISR_8_PWMs_Array_Simple.ino index c450e43..e4b7e62 100644 --- a/examples/ISR_8_PWMs_Array_Simple/ISR_8_PWMs_Array_Simple.ino +++ b/examples/ISR_8_PWMs_Array_Simple/ISR_8_PWMs_Array_Simple.ino @@ -26,17 +26,23 @@ defined(ARDUINO_AVR_METRO) || defined(ARDUINO_AVR_PROTRINKET5) || defined(ARDUINO_AVR_PROTRINKET3) || defined(ARDUINO_AVR_PROTRINKET5FTDI) || \ defined(ARDUINO_AVR_PROTRINKET3FTDI) ) #define USE_TIMER_1 true - #warning Using Timer1 #else #define USE_TIMER_3 true - #warning Using Timer3 #endif -// These define's must be placed at the beginning before #include "ESP32_PWM.h" +// These define's must be placed at the beginning before #include "AVR_Slow_PWM.h" // _PWM_LOGLEVEL_ from 0 to 4 // Don't define _PWM_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system. #define _PWM_LOGLEVEL_ 3 +#if (_PWM_LOGLEVEL_ > 3) + #if USE_TIMER_1 + #warning Using Timer1 + #elif USE_TIMER_1 + #warning Using Timer3 + #endif +#endif + #define USING_MICROS_RESOLUTION true //false // Default is true, uncomment to false diff --git a/examples/ISR_Changing_PWM/ISR_Changing_PWM.ino b/examples/ISR_Changing_PWM/ISR_Changing_PWM.ino index e370b58..0510470 100644 --- a/examples/ISR_Changing_PWM/ISR_Changing_PWM.ino +++ b/examples/ISR_Changing_PWM/ISR_Changing_PWM.ino @@ -26,17 +26,23 @@ defined(ARDUINO_AVR_METRO) || defined(ARDUINO_AVR_PROTRINKET5) || defined(ARDUINO_AVR_PROTRINKET3) || defined(ARDUINO_AVR_PROTRINKET5FTDI) || \ defined(ARDUINO_AVR_PROTRINKET3FTDI) ) #define USE_TIMER_1 true - #warning Using Timer1 #else #define USE_TIMER_3 true - #warning Using Timer3 #endif -// These define's must be placed at the beginning before #include "ESP32_PWM.h" +// These define's must be placed at the beginning before #include "AVR_Slow_PWM.h" // _PWM_LOGLEVEL_ from 0 to 4 // Don't define _PWM_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system. #define _PWM_LOGLEVEL_ 3 +#if (_PWM_LOGLEVEL_ > 3) + #if USE_TIMER_1 + #warning Using Timer1 + #elif USE_TIMER_1 + #warning Using Timer3 + #endif +#endif + #define USING_MICROS_RESOLUTION true //false // Default is true, uncomment to false diff --git a/examples/ISR_Modify_PWM/ISR_Modify_PWM.ino b/examples/ISR_Modify_PWM/ISR_Modify_PWM.ino index c2119c2..c88ebd5 100644 --- a/examples/ISR_Modify_PWM/ISR_Modify_PWM.ino +++ b/examples/ISR_Modify_PWM/ISR_Modify_PWM.ino @@ -26,17 +26,23 @@ defined(ARDUINO_AVR_METRO) || defined(ARDUINO_AVR_PROTRINKET5) || defined(ARDUINO_AVR_PROTRINKET3) || defined(ARDUINO_AVR_PROTRINKET5FTDI) || \ defined(ARDUINO_AVR_PROTRINKET3FTDI) ) #define USE_TIMER_1 true - #warning Using Timer1 #else #define USE_TIMER_3 true - #warning Using Timer3 #endif -// These define's must be placed at the beginning before #include "ESP32_PWM.h" +// These define's must be placed at the beginning before #include "AVR_Slow_PWM.h" // _PWM_LOGLEVEL_ from 0 to 4 // Don't define _PWM_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system. #define _PWM_LOGLEVEL_ 3 +#if (_PWM_LOGLEVEL_ > 3) + #if USE_TIMER_1 + #warning Using Timer1 + #elif USE_TIMER_1 + #warning Using Timer3 + #endif +#endif + #define USING_MICROS_RESOLUTION true //false // Default is true, uncomment to false @@ -86,9 +92,9 @@ void TimerHandler() uint32_t PWM_Pin = LED_BUILTIN; // You can assign any interval for any timer here, in Hz -float PWM_Freq1 = 1.0f; +float PWM_Freq1 = 200.0f; //1.0f; // You can assign any interval for any timer here, in Hz -float PWM_Freq2 = 2.0f; +float PWM_Freq2 = 100.0f; //2.0f; // You can assign any interval for any timer here, in microseconds uint32_t PWM_Period1 = 1000000 / PWM_Freq1; @@ -96,9 +102,9 @@ uint32_t PWM_Period1 = 1000000 / PWM_Freq1; uint32_t PWM_Period2 = 1000000 / PWM_Freq2; // You can assign any duty_cycle for any PWM here, from 0-100 -float PWM_DutyCycle1 = 50.0; +float PWM_DutyCycle1 = 1.0f; //50.0f; // You can assign any duty_cycle for any PWM here, from 0-100 -float PWM_DutyCycle2 = 90.0; +float PWM_DutyCycle2 = 5.55f; //90.0f; // Channel number used to identify associated channel int channelNum; @@ -207,8 +213,8 @@ void changePWM() { static uint8_t count = 1; - double PWM_Freq; - uint32_t PWM_DutyCycle; + float PWM_Freq; + float PWM_DutyCycle; if (count++ % 2) { diff --git a/examples/multiFileProject/multiFileProject.ino b/examples/multiFileProject/multiFileProject.ino index bc3852b..20e71ff 100644 --- a/examples/multiFileProject/multiFileProject.ino +++ b/examples/multiFileProject/multiFileProject.ino @@ -17,14 +17,12 @@ defined(ARDUINO_AVR_METRO) || defined(ARDUINO_AVR_PROTRINKET5) || defined(ARDUINO_AVR_PROTRINKET3) || defined(ARDUINO_AVR_PROTRINKET5FTDI) || \ defined(ARDUINO_AVR_PROTRINKET3FTDI) ) #define USE_TIMER_1 true - #warning Using Timer1 #else #define USE_TIMER_3 true - #warning Using Timer3 #endif -#define AVR_SLOW_PWM_VERSION_MIN_TARGET F("AVR_Slow_PWM v1.2.2") -#define AVR_SLOW_PWM_VERSION_MIN 1002002 +#define AVR_SLOW_PWM_VERSION_MIN_TARGET F("AVR_Slow_PWM v1.2.3") +#define AVR_SLOW_PWM_VERSION_MIN 1002003 #include "multiFileProject.h"