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

Commit

Permalink
v1.1.1 to to add PWM_StepperControl example
Browse files Browse the repository at this point in the history
### Releases v1.1.1

1. Add example [PWM_StepperControl](https://github.com/khoih-prog/Teensy_PWM/examples/PWM_StepperControl) to demo how to control Stepper Motor using PWM.
  • Loading branch information
khoih-prog authored Jan 22, 2023
1 parent 81741ef commit d835c3a
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 63 deletions.
9 changes: 8 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ However, before reporting a bug please check through the following:

If you don't find anything, please [open a new issue](https://github.com/khoih-prog/Teensy_PWM/issues/new).

---

### How to submit a bug report

Please ensure to specify the following:
Expand All @@ -22,14 +24,17 @@ Please ensure to specify the following:
* Operating system (Windows, Ubuntu, etc.) and the output of `uname -a`
* Network configuration

Please be educated, civilized and constructive as you've always been. Disrespective posts against [GitHub Code of Conduct](https://docs.github.com/en/site-policy/github-terms/github-event-code-of-conduct) will be ignored and deleted.

---

### Example

```
Arduino IDE version: 1.8.19
Teensyduino Core Version 1.57
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.15.0-53-generic #59~20.04.1-Ubuntu SMP Thu Oct 20 15:10:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Linux xy-Inspiron-3593 5.15.0-58-generic #64~20.04.1-Ubuntu SMP Fri Jan 6 16:42:31 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Context:
I encountered a crash while using this library
Expand Down Expand Up @@ -68,4 +73,6 @@ xy@xy-Inspiron-3593:~/Arduino/xy/Teensy_PWM_GitHub$

```
xy@xy-Inspiron-3593:~/Arduino/xy/Teensy_PWM_GitHub$ bash utils/restyle.sh
```
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Donate to my libraries using BuyMeACoffee" style="height: 50px !important;width: 181px !important;" ></a>
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg?logo=buy-me-a-coffee&logoColor=FFDD00" style="height: 20px !important;width: 200px !important;" ></a>


---
---

Expand Down Expand Up @@ -39,6 +40,7 @@
* [ 5. PWM_Multi](examples/PWM_Multi)
* [ 6. PWM_MultiChannel](examples/PWM_MultiChannel)
* [ 7. PWM_Waveform](examples/PWM_Waveform)
* [ 8. PWM_StepperControl](examples/PWM_StepperControl) **New**
* [Example PWM_Multi](#example-PWM_Multi)
* [Debug Terminal Output Samples](#debug-terminal-output-samples)
* [1. PWM_DynamicDutyCycle using FlexTimers on Teensy 4.0](#1-PWM_DynamicDutyCycle-using-FlexTimers-on-Teensy-40)
Expand Down Expand Up @@ -136,7 +138,7 @@ Functions using normal software-based PWMs, relying on `loop()` and calling `mil
## Prerequisites

1. [`Arduino IDE 1.8.19+` for Arduino](https://github.com/arduino/Arduino). [![GitHub release](https://img.shields.io/github/release/arduino/Arduino.svg)](https://github.com/arduino/Arduino/releases/latest)
2. [`Teensy Core 1.57+`](https://www.pjrc.com/teensy/td_download.html) for Teensy.
2. [`Teensy core v1.57+`](https://github.com/PaulStoffregen/cores) for Teensy 4.1. [![GitHub release](https://img.shields.io/github/release/PaulStoffregen/cores.svg)](https://github.com/PaulStoffregen/cores/releases/latest)

---
---
Expand Down Expand Up @@ -295,6 +297,7 @@ PWM_Instance->setPWM_manual(PWM_Pins, new_level);
5. [PWM_Multi](examples/PWM_Multi)
6. [PWM_MultiChannel](examples/PWM_MultiChannel)
7. [PWM_Waveform](examples/PWM_Waveform)
8. [PWM_StepperControl](examples/PWM_StepperControl)


---
Expand All @@ -317,7 +320,7 @@ The following is the sample terminal output when running example [PWM_DynamicDut

```cpp
Starting PWM_DynamicDutyCycle using FlexTimers on Teensy 4.0
Teensy_PWM v1.1.0
Teensy_PWM v1.1.1
[PWM] setupPWM: Mapping dutycycle = 0 to newDC = 0 for _resolution = 16
[PWM] setupPWM: Using FlexTimer2 moduleIndex = 1 for PWM pin = 5
=====================================================================================
Expand Down Expand Up @@ -359,7 +362,7 @@ The following is the sample terminal output when running example [**PWM_Multi**]
```cpp
Starting PWM_Multi using QuadTimers on Teensy 4.0
Teensy_PWM v1.1.0
Teensy_PWM v1.1.1
[PWM] setupPWM: Mapping dutycycle = 6554 to newDC = 6554 for _resolution = 16
[PWM] setupPWM: Using QuadTimer1 moduleIndex = 0 for PWM pin = 10
[PWM] setPWM_Int: dutycycle = 6554 , frequency = 2000.00
Expand Down Expand Up @@ -405,7 +408,7 @@ The following is the sample terminal output when running example [**PWM_DynamicF

```cpp
Starting PWM_DynamicFreq using FlexTimers on Teensy 4.0
Teensy_PWM v1.1.0
Teensy_PWM v1.1.1
[PWM] setupPWM: Mapping dutycycle = 32768 to newDC = 32768 for _resolution = 16
[PWM] setupPWM: Using FlexTimer2 moduleIndex = 1 for PWM pin = 5
=====================================================================================
Expand Down Expand Up @@ -436,7 +439,7 @@ The following is the sample terminal output when running example [**PWM_Waveform
```cpp
Starting PWM_Waveform using FlexTimers on Teensy 4.0
Teensy_PWM v1.1.0
Teensy_PWM v1.1.1
[PWM] setupPWM: Mapping dutycycle = 0 to newDC = 0 for _resolution = 16
[PWM] setupPWM: Using FlexTimer2 moduleIndex = 1 for PWM pin = 5
[PWM] setPWM: _dutycycle = 0 , frequency = 2000.00
Expand Down Expand Up @@ -538,7 +541,7 @@ The following is the sample terminal output when running example [**PWM_Waveform

```cpp
Starting PWM_Waveform using QuadTimers on Teensy 4.0
Teensy_PWM v1.1.0
Teensy_PWM v1.1.1
[PWM] setupPWM: Mapping dutycycle = 0 to newDC = 0 for _resolution = 16
[PWM] setupPWM: Using QuadTimer3 moduleIndex = 3 for PWM pin = 15
[PWM] setPWM: _dutycycle = 0 , frequency = 2000.00
Expand Down Expand Up @@ -675,14 +678,24 @@ Submit issues to: [Teensy_PWM issues](https://github.com/khoih-prog/Teensy_PWM/i

1. Basic hardware PWM-channels for **Teensy 4.x boards, such as Teensy 4.0, Teensy 4.1, Teensy MicroMod, etc.**, using [Teensyduno core](https://www.pjrc.com/teensy/td_download.html).
2. Add support to **Teensy 3.x and Teensy LC**

3. Add example [PWM_StepperControl](https://github.com/khoih-prog/Teensy_PWM/examples/PWM_StepperControl) to demo how to control Stepper Motor using PWM

---
---

### Contributions and Thanks

Many thanks for everyone for bug reporting, new feature suggesting, testing and contributing to the development of this library.

1. Thanks to [Paul van Dinther](https://github.com/dinther) for proposing new way to use PWM to drive Stepper-Motor in [Using PWM to step a stepper driver #16](https://github.com/khoih-prog/RP2040_PWM/issues/16), leading to v2.0.3


<table>
<tr>
<td align="center"><a href="https://github.com/dinther"><img src="https://github.com/dinther.png" width="100px;" alt="dinther"/><br /><sub><b>Paul van Dinther</b></sub></a><br /></td>
</tr>
</table>


---

Expand Down
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Donate to my libraries using BuyMeACoffee" style="height: 50px !important;width: 181px !important;" ></a>
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg?logo=buy-me-a-coffee&logoColor=FFDD00" style="height: 20px !important;width: 200px !important;" ></a>


---
---

## Table of Contents

* [Changelog](#changelog)
* [Releases v1.1.1](#Releases-v111)
* [Releases v1.1.0](#Releases-v110)
* [Initial Releases v1.0.0](#Initial-Releases-v100)

Expand All @@ -24,6 +26,10 @@

## Changelog

### Releases v1.1.1

1. Add example [PWM_StepperControl](https://github.com/khoih-prog/Teensy_PWM/examples/PWM_StepperControl) to demo how to control Stepper Motor using PWM. Check [Using PWM to step a stepper driver #16](https://github.com/khoih-prog/RP2040_PWM/issues/16)

### Releases v1.1.0

1. Add support to **Teensy 3.x and Teensy LC**
Expand All @@ -32,3 +38,5 @@

1. Initial coding to support **Teensy 4.x boards, such as Teensy 4.0, Teensy 4.1, Teensy MicroMod, etc.**, using [Teensyduno core](https://www.pjrc.com/teensy/td_download.html). The support to **Teensy 2.x, Teensy LC and Teensy 3.x** will be added gradually.



2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Teensy_PWM",
"version": "1.1.0",
"version": "1.1.1",
"keywords": "timing, device, control, timer, interrupt, hardware, isr, isr-based, hardware-timer, mission-critical, accuracy, precise, non-blocking, teensy-2x, teensy-3x, teensy-lc, teensy-4x, teensy-41, teensy-40, teensy-micromod",
"description": "This library enables you to use Hardware-based PWM channels on Teensy boards, such as Teensy 2.x, Teensy LC, Teensy 3.x, Teensy 4.x, Teensy MicroMod, etc., to create and output PWM to pins. Using the same functions as other FastPWM libraries to enable you to port PWM code easily between platforms. The most important feature is they are purely hardware-based PWM channels, supporting very high PWM frequencies. Therefore, their executions are not blocked by bad-behaving functions or tasks. This important feature is absolutely necessary for mission-critical tasks. These hardware-based PWMs, still work even if other software functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software-based PWM using ISR, millis() or micros(). That is necessary if you need to control devices requiring high precision. New efficient setPWM_manual function to facilitate waveform creation using PWM",
"authors":
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Teensy_PWM
version=1.1.0
version=1.1.1
author=Khoi Hoang <[email protected]>
maintainer=Khoi Hoang <[email protected]>
sentence=This library enables you to use Hardware-based PWM channels on Teensy boards, such as Teensy 2.x, Teensy LC, Teensy 3.x, Teensy 4.x, Teensy MicroMod, etc., to create and output PWM to pins. Using the same functions as other FastPWM libraries to enable you to port PWM code easily between platforms.
Expand Down
3 changes: 2 additions & 1 deletion src/PWM_Generic_Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
Built by Khoi Hoang https://github.com/khoih-prog/Teensy_PWM
Licensed under MIT license
Version: 1.1.0
Version: 1.1.1
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 06/11/2022 Initial coding for Teensy 4.x, etc.
1.1.0 K.Hoang 06/11/2022 Add support to Teensy 3.x, Teensy LC
1.1.1 K.Hoang 21/01/2023 Add `PWM_StepperControl` example
*****************************************************************************************************************************/

#pragma once
Expand Down
Loading

0 comments on commit d835c3a

Please sign in to comment.