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

Commit 9e438a1

Browse files
authored
v1.0.0 for STM32F/L/H/G/WB/MP1 PWM
### 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.
1 parent addc12c commit 9e438a1

File tree

9 files changed

+822
-587
lines changed

9 files changed

+822
-587
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_Slow_PWM
1+
## Contributing to STM32_PWM
22

33
### Reporting Bugs
44

5-
Please report bugs in STM32_TimerInterrupt if you find them.
5+
Please report bugs in [STM32_PWM Issues](https://github.com/khoih-prog/STM32_PWM/issues) 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_TimerInterrupt/issues) - someone might have already encountered this.
9+
* [Existing Open Issues](https://github.com/khoih-prog/STM32_PWM/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_TimerInterrupt/issues/new).
11+
If you don't find anything, please [open a new issue](https://github.com/khoih-prog/STM32_PWM/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.19) or Platform.io version
18-
* `STM32` Core Version (e.g. STM32 core v2.2.0)
17+
* Arduino IDE version (e.g. 1.8.16) or Platform.io version
18+
* `STM32` Core Version (e.g. STM32 core v2.1.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.19
31-
STM32 Core Version 2.2.0
30+
Arduino IDE version: 1.8.16
31+
STM32 Core Version 2.1.0
3232
Nucleo-144 STM32H7 NUCLEO_H743ZI2
3333
OS: Ubuntu 20.04 LTS
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
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
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_Slow_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_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: 671 additions & 475 deletions
Large diffs are not rendered by default.

changelog.md

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

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)
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)
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_Slow_PWM.svg)](http://github.com/khoih-prog/STM32_Slow_PWM/issues)
7+
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/STM32_PWM.svg)](http://github.com/khoih-prog/STM32_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)
2015
* [Initial Releases v1.0.0](#Initial-Releases-v100)
2116

2217
---
2318
---
2419

2520
## Changelog
2621

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-
5622
### Initial Releases v1.0.0
5723

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

6128
---
6229
---

examples/PWM_Multi/PWM_Multi.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
1919
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
2020
defined(STM32WB) || defined(STM32MP1) || defined(STM32L5))
21-
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
21+
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
2222
#endif
2323

2424
// These define's must be placed at the beginning before #include "ESP32_PWM.h"
@@ -95,6 +95,7 @@ uint32_t pins[] = { pin0, pin4, pin10 };
9595
#warning Using NUCLEO_F767ZI pins
9696

9797
// For F767ZI => pins[] = pin0, pin3, pin9/10 ============>> TimerIndex = 1, 0, 3
98+
// Pin PA0 (D32), D3 and D9
9899
uint32_t pins[] = { pin0, pin3, pin9 };
99100

100101
#elif ( defined(STM32L5) && defined(ARDUINO_NUCLEO_L552ZE_Q) )
@@ -126,7 +127,8 @@ uint32_t pins[] = { pin0, pin3, pin9 };
126127

127128
TIM_TypeDef *TimerInstance[] = { TIM1, TIM2, TIM3 };
128129

129-
uint32_t freq[] = { 1, 2, 5 };
130+
//uint32_t freq[] = { 1, 2, 5 };
131+
uint32_t freq[] = { 1000, 2000, 5000 };
130132

131133
uint32_t dutyCycle[] = { 10, 20, 30 };
132134

examples/PWMs_Array_Complex/PWMs_Array_Complex.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ volatile uint64_t startMicros = 0;
9595
#warning Using NUCLEO_F767ZI pins
9696

9797
// For F767ZI => pins[] = pin0, pin3, pin9/10 ============>> TimerIndex = 1, 0, 3
98+
// Pin PA0 (D32), D3 and D9
9899
uint32_t pins[] = { pin0, pin3, pin9 };
99100

100101
#elif ( defined(STM32L5) && defined(ARDUINO_NUCLEO_L552ZE_Q) )

keywords.txt

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

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

1011
#######################################
1112
# Methods and Functions (KEYWORD2)
1213
#######################################
1314

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

18-
setFrequency KEYWORD2
19-
setInterval KEYWORD2
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
2036
attachInterrupt KEYWORD2
21-
attachInterruptInterval KEYWORD2
2237
detachInterrupt KEYWORD2
23-
disableTimer KEYWORD2
24-
reattachInterrupt KEYWORD2
25-
enableTimer KEYWORD2
26-
stopTimer KEYWORD2
27-
restartTimer 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+
###################################
2854

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

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
4963

5064
#######################################
5165
# Constants (LITERAL1)
5266
#######################################
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: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "STM32_Slow_PWM",
3-
"version": "1.2.3",
2+
"name": "STM32_PWM",
3+
"version": "1.0.0",
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 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",
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.",
66
"authors":
77
{
88
"name": "Khoi Hoang",
@@ -12,19 +12,18 @@
1212
"repository":
1313
{
1414
"type": "git",
15-
"url": "https://github.com/khoih-prog/STM32_Slow_PWM.git"
15+
"url": "https://github.com/khoih-prog/STM32_PWM"
1616
},
17-
"homepage": "https://github.com/khoih-prog/STM32_Slow_PWM",
17+
"homepage": "https://github.com/khoih-prog/STM32_PWM",
1818
"export": {
1919
"exclude": [
2020
"linux",
2121
"extras",
2222
"tests"
2323
]
2424
},
25-
"license": "MIT",
2625
"frameworks": "*",
2726
"platforms": "ststm32",
2827
"examples": "examples/*/*/*.ino",
29-
"headers": ["STM32_Slow_PWM.h", "STM32_Slow_PWM.hpp"]
28+
"license": "MIT"
3029
}

library.properties

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name=STM32_Slow_PWM
2-
version=1.2.3
1+
name=STM32_PWM
2+
version=1.0.0
33
author=Khoi Hoang <[email protected]>
44
maintainer=Khoi Hoang <[email protected]>
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
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.
77
category=Device Control
8-
url=https://github.com/khoih-prog/STM32_Slow_PWM
8+
url=https://github.com/khoih-prog/STM32_PWM
99
architectures=stm32
10-
repository=https://github.com/khoih-prog/STM32_Slow_PWM
10+
repository=https://github.com/khoih-prog/STM32_PWM
1111
license=MIT
12-
includes=STM32_Slow_PWM.h,STM32_Slow_PWM.hpp
12+
includes=STM32_PWM.h

src/PWM_Generic_Debug.h

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/****************************************************************************************************************************
2+
PWM_Generic_Debug.h
3+
For STM32F/L/H/G/WB/MP1 boards
4+
Written by Khoi Hoang
5+
6+
Built by Khoi Hoang https://github.com/khoih-prog/STM32_PWM
7+
Licensed under MIT license
8+
9+
Hardware-based multi-channel PWM wrapper library for STM32F/L/H/G/WB/MP1 boards
10+
11+
Version: 1.0.0
12+
13+
Version Modified By Date Comments
14+
------- ----------- ---------- -----------
15+
1.0.0 K.Hoang 30/09/2021 Initial coding for STM32F/L/H/G/WB/MP1 boards
16+
*****************************************************************************************************************************/
17+
18+
#pragma once
19+
20+
#ifndef PWM_GENERIC_DEBUG_H
21+
#define PWM_GENERIC_DEBUG_H
22+
23+
#ifdef PWM_GENERIC_DEBUG_PORT
24+
#define PWM_DBG_PORT PWM_GENERIC_DEBUG_PORT
25+
#else
26+
#define PWM_DBG_PORT Serial
27+
#endif
28+
29+
// Change _PWM_LOGLEVEL_ to set tracing and logging verbosity
30+
// 0: DISABLED: no logging
31+
// 1: ERROR: errors
32+
// 2: WARN: errors and warnings
33+
// 3: INFO: errors, warnings and informational (default)
34+
// 4: DEBUG: errors, warnings, informational and debug
35+
36+
#ifndef _PWM_LOGLEVEL_
37+
#define _PWM_LOGLEVEL_ 1
38+
#endif
39+
40+
#define PWM_LOGERROR(x) if(_PWM_LOGLEVEL_>0) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.println(x); }
41+
#define PWM_LOGERROR0(x) if(_PWM_LOGLEVEL_>0) { PWM_DBG_PORT.print(x); }
42+
#define PWM_LOGERRORLN0(x) if(_PWM_LOGLEVEL_>0) { PWM_DBG_PORT.println(x); }
43+
#define PWM_LOGERROR1(x,y) if(_PWM_LOGLEVEL_>0) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.print(x); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.println(y); }
44+
#define PWM_LOGERROR2(x,y,z) if(_PWM_LOGLEVEL_>0) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.print(x); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.print(y); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.println(z); }
45+
#define PWM_LOGERROR3(x,y,z,w) if(_PWM_LOGLEVEL_>0) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.print(x); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.print(y); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.print(z); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.println(w); }
46+
47+
#define PWM_LOGWARN(x) if(_PWM_LOGLEVEL_>1) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.println(x); }
48+
#define PWM_LOGWARN0(x) if(_PWM_LOGLEVEL_>1) { PWM_DBG_PORT.print(x); }
49+
#define PWM_LOGWARNLN0(x) if(_PWM_LOGLEVEL_>1) { PWM_DBG_PORT.println(x); }
50+
#define PWM_LOGWARN1(x,y) if(_PWM_LOGLEVEL_>1) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.print(x); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.println(y); }
51+
#define PWM_LOGWARN2(x,y,z) if(_PWM_LOGLEVEL_>1) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.print(x); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.print(y); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.println(z); }
52+
#define PWM_LOGWARN3(x,y,z,w) if(_PWM_LOGLEVEL_>1) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.print(x); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.print(y); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.print(z); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.println(w); }
53+
54+
#define PWM_LOGINFO(x) if(_PWM_LOGLEVEL_>2) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.println(x); }
55+
#define PWM_LOGINFO0(x) if(_PWM_LOGLEVEL_>2) { PWM_DBG_PORT.print(x); }
56+
#define PWM_LOGINFOLN0(x) if(_PWM_LOGLEVEL_>2) { PWM_DBG_PORT.println(x); }
57+
#define PWM_LOGINFO1(x,y) if(_PWM_LOGLEVEL_>2) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.print(x); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.println(y); }
58+
#define PWM_LOGINFO2(x,y,z) if(_PWM_LOGLEVEL_>2) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.print(x); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.print(y); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.println(z); }
59+
#define PWM_LOGINFO3(x,y,z,w) if(_PWM_LOGLEVEL_>2) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.print(x); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.print(y); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.print(z); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.println(w); }
60+
61+
#define PWM_LOGDEBUG(x) if(_PWM_LOGLEVEL_>3) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.println(x); }
62+
#define PWM_LOGDEBUG0(x) if(_PWM_LOGLEVEL_>3) { PWM_DBG_PORT.print(x); }
63+
#define PWM_LOGDEBUGLN0(x) if(_PWM_LOGLEVEL_>3) { PWM_DBG_PORT.println(x); }
64+
#define PWM_LOGDEBUG1(x,y) if(_PWM_LOGLEVEL_>3) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.print(x); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.println(y); }
65+
#define PWM_LOGDEBUG2(x,y,z) if(_PWM_LOGLEVEL_>3) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.print(x); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.print(y); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.println(z); }
66+
#define PWM_LOGDEBUG3(x,y,z,w) if(_PWM_LOGLEVEL_>3) { PWM_DBG_PORT.print("[PWM] "); PWM_DBG_PORT.print(x); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.print(y); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.print(z); PWM_DBG_PORT.print(" "); PWM_DBG_PORT.println(w); }
67+
68+
#endif //PWM_GENERIC_DEBUG_H

0 commit comments

Comments
 (0)