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

Commit

Permalink
v1.2.3 to fix DutyCycle bug, etc.
Browse files Browse the repository at this point in the history
### 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
  • Loading branch information
khoih-prog authored Mar 5, 2022
1 parent 4e4a7fe commit 17eed70
Show file tree
Hide file tree
Showing 12 changed files with 1,548 additions and 781 deletions.
20 changes: 10 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
## Contributing to STM32_PWM
## Contributing to STM32_Slow_PWM

### Reporting Bugs

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

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

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

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

### How to submit a bug report

Please ensure to specify the following:

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

```
Arduino IDE version: 1.8.16
STM32 Core Version 2.1.0
Arduino IDE version: 1.8.19
STM32 Core Version 2.2.0
Nucleo-144 STM32H7 NUCLEO_H743ZI2
OS: Ubuntu 20.04 LTS
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
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
Context:
I encountered a crash while using TimerInterrupt.
Expand All @@ -47,7 +47,7 @@ Steps to reproduce:

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

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.
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.

### Sending Pull Requests

Expand Down
1,146 changes: 475 additions & 671 deletions README.md

Large diffs are not rendered by default.

47 changes: 40 additions & 7 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,62 @@
# STM32_PWM Library
# STM32_Slow_PWM Library

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

---
---

## Table of Contents

* [Changelog](#changelog)
* [Releases v1.2.3](#releases-v123)
* [Releases v1.2.2](#releases-v122)
* [Releases v1.2.1](#releases-v121)
* [Releases v1.2.0](#releases-v120)
* [Releases v1.1.0](#releases-v110)
* [Initial Releases v1.0.0](#Initial-Releases-v100)

---
---

## Changelog

### Releases v1.2.3

1. Fix `DutyCycle` bug. Check [float precisison of DutyCycle only sometimes working #3](https://github.com/khoih-prog/SAMD_Slow_PWM/issues/3)
2. Fix `New Period` display bug. Check [random dropouts #4](https://github.com/khoih-prog/SAMD_Slow_PWM/issues/4)
3. Update examples

### Releases v1.2.2

1. Use `float` for `DutyCycle` and `Freq`, `uint32_t` for `period`.
2. Optimize code by not calculation in ISR

### Releases v1.2.1

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)

### Releases v1.2.0

1. Fix `multiple-definitions` linker error. Drop `src_cpp` and `src_h` directories
2. Add example [multiFileProject](examples/multiFileProject) to demo for multiple-file project
3. Improve accuracy by using `double`, instead of `uint32_t` for `dutycycle`, `period`
4. Optimize library code by using `reference-passing` instead of `value-passing`
5. Fix reattachInterrupt() bug. Check [bugfix: reattachInterrupt() pass wrong frequency value to setFrequency() #19](https://github.com/khoih-prog/ESP8266TimerInterrupt/pull/19)
6. Update examples accordingly

### Releases v1.1.0

1. Add functions to modify PWM settings on-the-fly
2. Add example to demo how to modify PWM settings on-the-fly

### Initial Releases v1.0.0

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)
2. The hardware-based PWM channels can generate very high PWM frequencies up with high accuracy.

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.

---
---
Expand Down
94 changes: 46 additions & 48 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,63 @@
# Datatypes (KEYWORD1)
#######################################

HardwareTimer KEYWORD1
callback_function_t KEYWORD1

timer_index_t KEYWORD1
timerObj_t KEYWORD1
STM32TimerInterrupt KEYWORD1
STM32Timer KEYWORD1
STM32_SLOW_PWM_ISR KEYWORD1
STM32_Slow_PWM KEYWORD1

#######################################
# Methods and Functions (KEYWORD2)
#######################################

###################################
# Class HardwareTimer
###################################
##################################
# class STM32TimerInterrupt
##################################

pause KEYWORD2
pauseChannel KEYWORD2
resume KEYWORD2
resumeChannel KEYWORD2
setPrescaleFactor KEYWORD2
getPrescaleFactor KEYWORD2
setOverflow KEYWORD2
getOverflow KEYWORD2
setPWM KEYWORD2
setCount KEYWORD2
getCount KEYWORD2
setMode KEYWORD2
getMode KEYWORD2
setPreloadEnable KEYWORD2
getCaptureCompare KEYWORD2
setCaptureCompare KEYWORD2
setInterruptPriority KEYWORD2
setFrequency KEYWORD2
setInterval KEYWORD2
attachInterrupt KEYWORD2
attachInterruptInterval KEYWORD2
detachInterrupt KEYWORD2
hasInterrupt KEYWORD2
timerHandleDeinit KEYWORD2
refresh KEYWORD2
getTimerClkFreq KEYWORD2
captureCompareCallback KEYWORD2
updateCallback KEYWORD2
getHandle KEYWORD2
getChannel KEYWORD2
getLLChannel KEYWORD2
getIT KEYWORD2
getAssociatedChannel KEYWORD2
isComplementaryChannel KEYWORD2

###################################
# timer.h/c
###################################
disableTimer KEYWORD2
reattachInterrupt KEYWORD2
enableTimer KEYWORD2
stopTimer KEYWORD2
restartTimer KEYWORD2

get_timer_obj KEYWORD2
enableTimerClock KEYWORD2
disableTimerClock KEYWORD2
getTimerIrq KEYWORD2
getTimerClkSrc KEYWORD2
getTimerUpIrq KEYWORD2
getTimerCCIrq KEYWORD2
#################################
# class STM32_SLOW_PWM_ISR
#################################

init KEYWORD2
run KEYWORD2
setPWM KEYWORD2
setPWM_Period KEYWORD2
modifyPWMChannel KEYWORD2
modifyPWMChannel_Period KEYWORD2
deleteChannel KEYWORD2
restartChannel KEYWORD2
isEnabled KEYWORD2
enable KEYWORD2
disable KEYWORD2
enableAll KEYWORD2
disableAll KEYWORD2
toggle KEYWORD2
getnumChannels KEYWORD2
getNumAvailablePWMChannels KEYWORD2

#######################################
# Constants (LITERAL1)
#######################################

STM32_SLOW_PWM_VERSION LITERAL1
STM32_SLOW_PWM_VERSION_MAJOR LITERAL1
STM32_SLOW_PWM_VERSION_MINOR LITERAL1
STM32_SLOW_PWM_VERSION_PATCH LITERAL1
STM32_SLOW_PWM_VERSION_INT LITERAL1

INVALID_STM32_PIN LITERAL1

USING_MICROS_RESOLUTION LITERAL1
CHANGING_PWM_END_OF_CYCLE LITERAL1

13 changes: 7 additions & 6 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "STM32_PWM",
"version": "1.0.0",
"name": "STM32_Slow_PWM",
"version": "1.2.3",
"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",
"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.",
"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",
"authors":
{
"name": "Khoi Hoang",
Expand All @@ -12,18 +12,19 @@
"repository":
{
"type": "git",
"url": "https://github.com/khoih-prog/STM32_PWM"
"url": "https://github.com/khoih-prog/STM32_Slow_PWM.git"
},
"homepage": "https://github.com/khoih-prog/STM32_PWM",
"homepage": "https://github.com/khoih-prog/STM32_Slow_PWM",
"export": {
"exclude": [
"linux",
"extras",
"tests"
]
},
"license": "MIT",
"frameworks": "*",
"platforms": "ststm32",
"examples": "examples/*/*/*.ino",
"license": "MIT"
"headers": ["STM32_Slow_PWM.h", "STM32_Slow_PWM.hpp"]
}
14 changes: 7 additions & 7 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name=STM32_PWM
version=1.0.0
name=STM32_Slow_PWM
version=1.2.3
author=Khoi Hoang <khoih.prog@gmail.com>
maintainer=Khoi Hoang <khoih.prog@gmail.com>
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.
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.
sentence=This library enables you to use Hardware Timers on STM32F/L/H/G/WB/MP1 boards to create and output PWM to pins.
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
category=Device Control
url=https://github.com/khoih-prog/STM32_PWM
url=https://github.com/khoih-prog/STM32_Slow_PWM
architectures=stm32
repository=https://github.com/khoih-prog/STM32_PWM
repository=https://github.com/khoih-prog/STM32_Slow_PWM
license=MIT
includes=STM32_PWM.h
includes=STM32_Slow_PWM.h,STM32_Slow_PWM.hpp
Loading

0 comments on commit 17eed70

Please sign in to comment.