Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
v1.2.1 to fix DutyCycle bug, etc.
Browse files Browse the repository at this point in the history
### Releases v1.2.1

1. Fix `DutyCycle` bug. Check [float precisison of DutyCycle only sometimes working #3](khoih-prog/SAMD_Slow_PWM#3)
2. Fix `New Period` display bug. Check [random dropouts #4](khoih-prog/SAMD_Slow_PWM#4)
3. Update examples
  • Loading branch information
khoih-prog committed Mar 5, 2022
1 parent 6e65eda commit cdd23d2
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 16 deletions.
5 changes: 4 additions & 1 deletion examples/ISR_8_PWMs_Array/ISR_8_PWMs_Array.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@
#error This code is designed to run on Teensy platform! Please check your Tools->Board setting.
#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 "Teensy_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

#define USING_MICROS_RESOLUTION true //false

// Default is true, uncomment to false
//#define CHANGING_PWM_END_OF_CYCLE false

// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include "Teensy_Slow_PWM.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@
#error This code is designed to run on Teensy platform! Please check your Tools->Board setting.
#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 "Teensy_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

#define USING_MICROS_RESOLUTION true //false

// Default is true, uncomment to false
//#define CHANGING_PWM_END_OF_CYCLE false

// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include "Teensy_Slow_PWM.h"

Expand Down
7 changes: 5 additions & 2 deletions examples/ISR_8_PWMs_Array_Simple/ISR_8_PWMs_Array_Simple.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@
#error This code is designed to run on Teensy platform! Please check your Tools->Board setting.
#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 "Teensy_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

#define USING_MICROS_RESOLUTION true //false
#define USING_MICROS_RESOLUTION true //false

// Default is true, uncomment to false
//#define CHANGING_PWM_END_OF_CYCLE false

// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include "Teensy_Slow_PWM.h"
Expand Down
7 changes: 5 additions & 2 deletions examples/ISR_Changing_PWM/ISR_Changing_PWM.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@
#error This code is designed to run on Teensy platform! Please check your Tools->Board setting.
#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 "Teensy_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

#define USING_MICROS_RESOLUTION true //false
#define USING_MICROS_RESOLUTION true //false

// Default is true, uncomment to false
//#define CHANGING_PWM_END_OF_CYCLE false

// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include "Teensy_Slow_PWM.h"
Expand Down
19 changes: 11 additions & 8 deletions examples/ISR_Modify_PWM/ISR_Modify_PWM.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@
#error This code is designed to run on Teensy platform! Please check your Tools->Board setting.
#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 "Teensy_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

#define USING_MICROS_RESOLUTION true //false
#define USING_MICROS_RESOLUTION true //false

// Default is true, uncomment to false
//#define CHANGING_PWM_END_OF_CYCLE false

// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include "Teensy_Slow_PWM.h"
Expand Down Expand Up @@ -87,19 +90,19 @@ 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;
// You can assign any interval for any timer here, in microseconds
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;
Expand Down Expand Up @@ -168,8 +171,8 @@ void changePWM()
{
static uint8_t count = 1;

double PWM_Freq;
uint32_t PWM_DutyCycle;
float PWM_Freq;
float PWM_DutyCycle;

if (count++ % 2)
{
Expand Down
4 changes: 2 additions & 2 deletions examples/multiFileProject/multiFileProject.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#error This code is designed to run on Teensy platform! Please check your Tools->Board setting.
#endif

#define TEENSY_SLOW_PWM_VERSION_MIN_TARGET F("Teensy_Slow_PWM v1.2.0")
#define TEENSY_SLOW_PWM_VERSION_MIN 1002000
#define TEENSY_SLOW_PWM_VERSION_MIN_TARGET F("Teensy_Slow_PWM v1.2.1")
#define TEENSY_SLOW_PWM_VERSION_MIN 1002001

#include "multiFileProject.h"

Expand Down

0 comments on commit cdd23d2

Please sign in to comment.