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

Commit 17eed70

Browse files
authored
v1.2.3 to fix DutyCycle bug, etc.
### Releases v1.2.3 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
1 parent 4e4a7fe commit 17eed70

12 files changed

+1548
-781
lines changed

CONTRIBUTING.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
## Contributing to STM32_PWM
1+
## Contributing to STM32_Slow_PWM
22

33
### Reporting Bugs
44

5-
Please report bugs in [STM32_PWM Issues](https://github.com/khoih-prog/STM32_PWM/issues) if you find them.
5+
Please report bugs in STM32_TimerInterrupt if you find them.
66

77
However, before reporting a bug please check through the following:
88

9-
* [Existing Open Issues](https://github.com/khoih-prog/STM32_PWM/issues) - someone might have already encountered this.
9+
* [Existing Open Issues](https://github.com/khoih-prog/STM32_TimerInterrupt/issues) - someone might have already encountered this.
1010

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

1313
### How to submit a bug report
1414

1515
Please ensure to specify the following:
1616

17-
* Arduino IDE version (e.g. 1.8.16) or Platform.io version
18-
* `STM32` Core Version (e.g. STM32 core v2.1.0)
17+
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
18+
* `STM32` Core Version (e.g. STM32 core v2.2.0)
1919
* Board type and relevant info
2020
* Contextual information (e.g. what you were trying to achieve)
2121
* Simplest possible steps to reproduce
@@ -27,11 +27,11 @@ Please ensure to specify the following:
2727
### Example
2828

2929
```
30-
Arduino IDE version: 1.8.16
31-
STM32 Core Version 2.1.0
30+
Arduino IDE version: 1.8.19
31+
STM32 Core Version 2.2.0
3232
Nucleo-144 STM32H7 NUCLEO_H743ZI2
3333
OS: Ubuntu 20.04 LTS
34-
Linux xy-Inspiron-3593 5.4.0-86-generic #97-Ubuntu SMP Fri Sep 17 19:19:40 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
34+
Linux xy-Inspiron-3593 5.4.0-100-generic #113-Ubuntu SMP Thu Feb 3 18:43:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
3535
3636
Context:
3737
I encountered a crash while using TimerInterrupt.
@@ -47,7 +47,7 @@ Steps to reproduce:
4747

4848
Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.
4949

50-
There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/STM32_PWM/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.
50+
There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/STM32_Slow_PWM/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.
5151

5252
### Sending Pull Requests
5353

README.md

Lines changed: 475 additions & 671 deletions
Large diffs are not rendered by default.

changelog.md

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,62 @@
1-
# STM32_PWM Library
1+
# STM32_Slow_PWM Library
22

3-
[![arduino-library-badge](https://www.ardu-badge.com/badge/STM32_PWM.svg?)](https://www.ardu-badge.com/STM32_PWM)
4-
[![GitHub release](https://img.shields.io/github/release/khoih-prog/STM32_PWM.svg)](https://github.com/khoih-prog/STM32_PWM/releases)
5-
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/khoih-prog/STM32_PWM/blob/master/LICENSE)
3+
[![arduino-library-badge](https://www.ardu-badge.com/badge/STM32_Slow_PWM.svg?)](https://www.ardu-badge.com/STM32_Slow_PWM)
4+
[![GitHub release](https://img.shields.io/github/release/khoih-prog/STM32_Slow_PWM.svg)](https://github.com/khoih-prog/STM32_Slow_PWM/releases)
5+
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/khoih-prog/STM32_Slow_PWM/blob/master/LICENSE)
66
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
7-
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/STM32_PWM.svg)](http://github.com/khoih-prog/STM32_PWM/issues)
7+
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/STM32_Slow_PWM.svg)](http://github.com/khoih-prog/STM32_Slow_PWM/issues)
88

99
---
1010
---
1111

1212
## Table of Contents
1313

1414
* [Changelog](#changelog)
15+
* [Releases v1.2.3](#releases-v123)
16+
* [Releases v1.2.2](#releases-v122)
17+
* [Releases v1.2.1](#releases-v121)
18+
* [Releases v1.2.0](#releases-v120)
19+
* [Releases v1.1.0](#releases-v110)
1520
* [Initial Releases v1.0.0](#Initial-Releases-v100)
1621

1722
---
1823
---
1924

2025
## Changelog
2126

27+
### Releases v1.2.3
28+
29+
1. Fix `DutyCycle` bug. Check [float precisison of DutyCycle only sometimes working #3](https://github.com/khoih-prog/SAMD_Slow_PWM/issues/3)
30+
2. Fix `New Period` display bug. Check [random dropouts #4](https://github.com/khoih-prog/SAMD_Slow_PWM/issues/4)
31+
3. Update examples
32+
33+
### Releases v1.2.2
34+
35+
1. Use `float` for `DutyCycle` and `Freq`, `uint32_t` for `period`.
36+
2. Optimize code by not calculation in ISR
37+
38+
### Releases v1.2.1
39+
40+
1. DutyCycle to be optionally updated at the end current PWM period instead of immediately. Check [DutyCycle to be updated at the end current PWM period #2](https://github.com/khoih-prog/ESP8266_PWM/issues/2)
41+
42+
### Releases v1.2.0
43+
44+
1. Fix `multiple-definitions` linker error. Drop `src_cpp` and `src_h` directories
45+
2. Add example [multiFileProject](examples/multiFileProject) to demo for multiple-file project
46+
3. Improve accuracy by using `double`, instead of `uint32_t` for `dutycycle`, `period`
47+
4. Optimize library code by using `reference-passing` instead of `value-passing`
48+
5. Fix reattachInterrupt() bug. Check [bugfix: reattachInterrupt() pass wrong frequency value to setFrequency() #19](https://github.com/khoih-prog/ESP8266TimerInterrupt/pull/19)
49+
6. Update examples accordingly
50+
51+
### Releases v1.1.0
52+
53+
1. Add functions to modify PWM settings on-the-fly
54+
2. Add example to demo how to modify PWM settings on-the-fly
55+
2256
### Initial Releases v1.0.0
2357

2458
1. Initial coding to support **STM32F/L/H/G/WB/MP1 boards** such as NUCLEO_H743ZI2, NUCLEO_L552ZE_Q, NUCLEO_F767ZI, BLUEPILL_F103CB, etc., using [`Arduino Core for STM32`](https://github.com/stm32duino/Arduino_Core_STM32)
25-
2. The hardware-based PWM channels can generate very high PWM frequencies up with high accuracy.
26-
59+
2. The hybrid ISR-based PWM channels can generate from very low (much less than 1Hz) to highest PWM frequencies up to 1000Hz with acceptable accuracy.
2760

2861
---
2962
---

keywords.txt

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,63 @@
22
# Datatypes (KEYWORD1)
33
#######################################
44

5-
HardwareTimer KEYWORD1
6-
callback_function_t KEYWORD1
7-
8-
timer_index_t KEYWORD1
9-
timerObj_t KEYWORD1
5+
STM32TimerInterrupt KEYWORD1
6+
STM32Timer KEYWORD1
7+
STM32_SLOW_PWM_ISR KEYWORD1
8+
STM32_Slow_PWM KEYWORD1
109

1110
#######################################
1211
# Methods and Functions (KEYWORD2)
1312
#######################################
1413

15-
###################################
16-
# Class HardwareTimer
17-
###################################
14+
##################################
15+
# class STM32TimerInterrupt
16+
##################################
1817

19-
pause KEYWORD2
20-
pauseChannel KEYWORD2
21-
resume KEYWORD2
22-
resumeChannel KEYWORD2
23-
setPrescaleFactor KEYWORD2
24-
getPrescaleFactor KEYWORD2
25-
setOverflow KEYWORD2
26-
getOverflow KEYWORD2
27-
setPWM KEYWORD2
28-
setCount KEYWORD2
29-
getCount KEYWORD2
30-
setMode KEYWORD2
31-
getMode KEYWORD2
32-
setPreloadEnable KEYWORD2
33-
getCaptureCompare KEYWORD2
34-
setCaptureCompare KEYWORD2
35-
setInterruptPriority KEYWORD2
18+
setFrequency KEYWORD2
19+
setInterval KEYWORD2
3620
attachInterrupt KEYWORD2
21+
attachInterruptInterval KEYWORD2
3722
detachInterrupt KEYWORD2
38-
hasInterrupt KEYWORD2
39-
timerHandleDeinit KEYWORD2
40-
refresh KEYWORD2
41-
getTimerClkFreq KEYWORD2
42-
captureCompareCallback KEYWORD2
43-
updateCallback KEYWORD2
44-
getHandle KEYWORD2
45-
getChannel KEYWORD2
46-
getLLChannel KEYWORD2
47-
getIT KEYWORD2
48-
getAssociatedChannel KEYWORD2
49-
isComplementaryChannel KEYWORD2
50-
51-
###################################
52-
# timer.h/c
53-
###################################
23+
disableTimer KEYWORD2
24+
reattachInterrupt KEYWORD2
25+
enableTimer KEYWORD2
26+
stopTimer KEYWORD2
27+
restartTimer KEYWORD2
5428

55-
get_timer_obj KEYWORD2
56-
enableTimerClock KEYWORD2
57-
disableTimerClock KEYWORD2
58-
getTimerIrq KEYWORD2
59-
getTimerClkSrc KEYWORD2
60-
getTimerUpIrq KEYWORD2
61-
getTimerCCIrq KEYWORD2
29+
#################################
30+
# class STM32_SLOW_PWM_ISR
31+
#################################
6232

33+
init KEYWORD2
34+
run KEYWORD2
35+
setPWM KEYWORD2
36+
setPWM_Period KEYWORD2
37+
modifyPWMChannel KEYWORD2
38+
modifyPWMChannel_Period KEYWORD2
39+
deleteChannel KEYWORD2
40+
restartChannel KEYWORD2
41+
isEnabled KEYWORD2
42+
enable KEYWORD2
43+
disable KEYWORD2
44+
enableAll KEYWORD2
45+
disableAll KEYWORD2
46+
toggle KEYWORD2
47+
getnumChannels KEYWORD2
48+
getNumAvailablePWMChannels KEYWORD2
6349

6450
#######################################
6551
# Constants (LITERAL1)
6652
#######################################
53+
54+
STM32_SLOW_PWM_VERSION LITERAL1
55+
STM32_SLOW_PWM_VERSION_MAJOR LITERAL1
56+
STM32_SLOW_PWM_VERSION_MINOR LITERAL1
57+
STM32_SLOW_PWM_VERSION_PATCH LITERAL1
58+
STM32_SLOW_PWM_VERSION_INT LITERAL1
59+
60+
INVALID_STM32_PIN LITERAL1
61+
62+
USING_MICROS_RESOLUTION LITERAL1
63+
CHANGING_PWM_END_OF_CYCLE LITERAL1
64+

library.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "STM32_PWM",
3-
"version": "1.0.0",
2+
"name": "STM32_Slow_PWM",
3+
"version": "1.2.3",
44
"keywords": "timing, device, control, timer, pwm, interrupt, isr, isr-based, hardware-timer, mission-critical, accuracy, non-blocking, stm32, stm32h7, stm32l5, stm32f1, stm32f4, stm32f7, stm32g4, precise, hardware",
5-
"description": "This wrapper library enables you to use Hardware-based PWM on STM32F/L/H/G/WB/MP1 boards to create and output PWM to pins. The most important feature is they're purely hardware-based PWM channels. Therefore, their executions are very precise and not blocked by bad-behaving functions or tasks. This important feature is absolutely necessary for mission-critical tasks. These hardware PWM channels still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other ISR-based or software-based PWM using millis() or micros(). That's necessary if you need to measure some data requiring very high frequency and much better accuracy. PWM feature can now be used.",
5+
"description": "This library enables you to use Hardware Timers on STM32F/L/H/G/WB/MP1 boards to create and output PWM to pins. The most important feature is they're purely hardware-based PWM channels. Therefore, their executions are not blocked by bad-behaving functions or tasks. This important feature is absolutely necessary for mission-critical tasks. These hardware timers, using interrupt, still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software timers using millis() or micros(). That's necessary if you need to measure some data requiring better accuracy. PWM feature can now be used. Max PWM frequency is limited at 1000Hz. Now you can change the PWM settings on-the-fly",
66
"authors":
77
{
88
"name": "Khoi Hoang",
@@ -12,18 +12,19 @@
1212
"repository":
1313
{
1414
"type": "git",
15-
"url": "https://github.com/khoih-prog/STM32_PWM"
15+
"url": "https://github.com/khoih-prog/STM32_Slow_PWM.git"
1616
},
17-
"homepage": "https://github.com/khoih-prog/STM32_PWM",
17+
"homepage": "https://github.com/khoih-prog/STM32_Slow_PWM",
1818
"export": {
1919
"exclude": [
2020
"linux",
2121
"extras",
2222
"tests"
2323
]
2424
},
25+
"license": "MIT",
2526
"frameworks": "*",
2627
"platforms": "ststm32",
2728
"examples": "examples/*/*/*.ino",
28-
"license": "MIT"
29+
"headers": ["STM32_Slow_PWM.h", "STM32_Slow_PWM.hpp"]
2930
}

library.properties

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name=STM32_PWM
2-
version=1.0.0
1+
name=STM32_Slow_PWM
2+
version=1.2.3
33
author=Khoi Hoang <[email protected]>
44
maintainer=Khoi Hoang <[email protected]>
5-
sentence=This wrapper library enables you to use Hardware-based PWM on STM32F/L/H/G/WB/MP1 boards to create and output PWM to pins.
6-
paragraph=The most important feature is they're purely hardware-based PWM channels. Therefore, their executions are very precise and not blocked by bad-behaving functions or tasks. This important feature is absolutely necessary for mission-critical tasks. These hardware PWM channels still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other ISR-based or software-based PWM using millis() or micros(). That's necessary if you need to measure some data requiring very high frequency and much better accuracy. PWM feature can now be used.
5+
sentence=This library enables you to use Hardware Timers on STM32F/L/H/G/WB/MP1 boards to create and output PWM to pins.
6+
paragraph=These PWM channels, using STM32 Hardware Timers, still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software timers using millis() or micros(). That is mandatory if you need to measure some data requiring better accuracy. It now supports 16 ISR-based Timers, while consuming only 1 Hardware Timer. Timers interval is very long (ulong millisecs). The most important feature is they are ISR-based Timers. Therefore, their executions are not blocked by bad-behaving functions or tasks. This important feature is absolutely necessary for mission-critical tasks. Max PWM frequency is limited at 1000Hz. Now you can change the PWM settings on-the-fly
77
category=Device Control
8-
url=https://github.com/khoih-prog/STM32_PWM
8+
url=https://github.com/khoih-prog/STM32_Slow_PWM
99
architectures=stm32
10-
repository=https://github.com/khoih-prog/STM32_PWM
10+
repository=https://github.com/khoih-prog/STM32_Slow_PWM
1111
license=MIT
12-
includes=STM32_PWM.h
12+
includes=STM32_Slow_PWM.h,STM32_Slow_PWM.hpp

0 commit comments

Comments
 (0)