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

Commit 9dd199d

Browse files
authored
v1.1.0 to convert to h-only library, etc
### Releases v1.1.0 1. Convert to h-only library. 2. Optimize library code by using `reference-passing` instead of `value-passing` 3. Improve accuracy by using `float`, instead of `uint32_t` for `position` in degrees 4. Add example [multiFileProject](examples/multiFileProject) to demo for multiple-file project
1 parent 8f8f550 commit 9dd199d

File tree

10 files changed

+81
-80
lines changed

10 files changed

+81
-80
lines changed

examples/ISR_MultiServos/ISR_MultiServos.ino

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,6 @@
55
66
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
77
Licensed under MIT license
8-
9-
Based on SimpleTimer - A timer library for Arduino.
10-
Author: mromani@ottotecnica.com
11-
Copyright (c) 2010 OTTOTECNICA Italy
12-
13-
Based on BlynkTimer.h
14-
Author: Volodymyr Shymanskyy
15-
16-
Version: 1.0.0
17-
18-
Version Modified By Date Comments
19-
------- ----------- ---------- -----------
20-
1.0.0 K Hoang 15/08/2021 Initial coding for STM32F/L/H/G/WB/MP1
218
*****************************************************************************************************************************/
229

2310
/****************************************************************************************************************************
@@ -61,6 +48,7 @@
6148
#define TIMER_INTERRUPT_DEBUG 0
6249
#define ISR_SERVO_DEBUG 1
6350

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

6654
// Default is TIMER_SERVO (TIM7 for many boards)

examples/MultipleRandomServos/MultipleRandomServos.ino

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,6 @@
55
66
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
77
Licensed under MIT license
8-
9-
Based on SimpleTimer - A timer library for Arduino.
10-
Author: mromani@ottotecnica.com
11-
Copyright (c) 2010 OTTOTECNICA Italy
12-
13-
Based on BlynkTimer.h
14-
Author: Volodymyr Shymanskyy
15-
16-
Version: 1.0.0
17-
18-
Version Modified By Date Comments
19-
------- ----------- ---------- -----------
20-
1.0.0 K Hoang 15/08/2021 Initial coding for STM32F/L/H/G/WB/MP1
218
*****************************************************************************************************************************/
229

2310
/****************************************************************************************************************************
@@ -61,6 +48,7 @@
6148
#define TIMER_INTERRUPT_DEBUG 0
6249
#define ISR_SERVO_DEBUG 1
6350

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

6654
// Default is TIMER_SERVO (TIM7 for many boards)

examples/MultipleServos/MultipleServos.ino

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,6 @@
55
66
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
77
Licensed under MIT license
8-
9-
Based on SimpleTimer - A timer library for Arduino.
10-
Author: mromani@ottotecnica.com
11-
Copyright (c) 2010 OTTOTECNICA Italy
12-
13-
Based on BlynkTimer.h
14-
Author: Volodymyr Shymanskyy
15-
16-
Version: 1.0.0
17-
18-
Version Modified By Date Comments
19-
------- ----------- ---------- -----------
20-
1.0.0 K Hoang 15/08/2021 Initial coding for STM32F/L/H/G/WB/MP1
218
*****************************************************************************************************************************/
229

2310
/****************************************************************************************************************************
@@ -61,6 +48,7 @@
6148
#define TIMER_INTERRUPT_DEBUG 0
6249
#define ISR_SERVO_DEBUG 1
6350

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

6654
// Default is TIMER_SERVO (TIM7 for many boards)

examples/STM32_ISR_MultiServos/STM32_ISR_MultiServos.ino

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,6 @@
55
66
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
77
Licensed under MIT license
8-
9-
Based on SimpleTimer - A timer library for Arduino.
10-
Author: mromani@ottotecnica.com
11-
Copyright (c) 2010 OTTOTECNICA Italy
12-
13-
Based on BlynkTimer.h
14-
Author: Volodymyr Shymanskyy
15-
16-
Version: 1.0.0
17-
18-
Version Modified By Date Comments
19-
------- ----------- ---------- -----------
20-
1.0.0 K Hoang 15/08/2021 Initial coding for STM32F/L/H/G/WB/MP1
218
*****************************************************************************************************************************/
229

2310
/****************************************************************************************************************************
@@ -61,6 +48,7 @@
6148
#define TIMER_INTERRUPT_DEBUG 0
6249
#define ISR_SERVO_DEBUG 1
6350

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

6654
// Default is TIMER_SERVO (TIM7 for many boards)

examples/STM32_MultipleRandomServos/STM32_MultipleRandomServos.ino

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,6 @@
55
66
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
77
Licensed under MIT license
8-
9-
Based on SimpleTimer - A timer library for Arduino.
10-
Author: mromani@ottotecnica.com
11-
Copyright (c) 2010 OTTOTECNICA Italy
12-
13-
Based on BlynkTimer.h
14-
Author: Volodymyr Shymanskyy
15-
16-
Version: 1.0.0
17-
18-
Version Modified By Date Comments
19-
------- ----------- ---------- -----------
20-
1.0.0 K Hoang 15/08/2021 Initial coding for STM32F/L/H/G/WB/MP1
218
*****************************************************************************************************************************/
229
/****************************************************************************************************************************
2310
From ESP32 Servo Example Using Arduino ESP32 Servo Library
@@ -60,6 +47,7 @@
6047
#define TIMER_INTERRUPT_DEBUG 0
6148
#define ISR_SERVO_DEBUG 1
6249

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

6553
// Default is TIMER_SERVO (TIM7 for many boards)
@@ -69,8 +57,8 @@
6957
#define MIN_MICROS 800 //544
7058
#define MAX_MICROS 2450
7159

72-
#define SERVO_PIN_1 D1
73-
#define SERVO_PIN_2 D2
60+
#define SERVO_PIN_1 PA_0 //D1
61+
#define SERVO_PIN_2 PA_1 //D2
7462
#define SERVO_PIN_3 D3
7563
#define SERVO_PIN_4 D4
7664
#define SERVO_PIN_5 D5

examples/STM32_MultipleServos/STM32_MultipleServos.ino

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,6 @@
55
66
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
77
Licensed under MIT license
8-
9-
Based on SimpleTimer - A timer library for Arduino.
10-
Author: mromani@ottotecnica.com
11-
Copyright (c) 2010 OTTOTECNICA Italy
12-
13-
Based on BlynkTimer.h
14-
Author: Volodymyr Shymanskyy
15-
16-
Version: 1.0.0
17-
18-
Version Modified By Date Comments
19-
------- ----------- ---------- -----------
20-
1.0.0 K Hoang 15/08/2021 Initial coding for STM32F/L/H/G/WB/MP1
218
*****************************************************************************************************************************/
229

2310
/****************************************************************************************************************************
@@ -61,6 +48,7 @@
6148
#define TIMER_INTERRUPT_DEBUG 0
6249
#define ISR_SERVO_DEBUG 1
6350

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

6654
// Default is TIMER_SERVO (TIM7 for many boards)
Binary file not shown.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/****************************************************************************************************************************
2+
multiFileProject.cpp
3+
For STM32F/L/H/G/WB/MP1 boards with stm32duino Arduino_Core_STM32 core
4+
Written by Khoi Hoang
5+
6+
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
7+
Licensed under MIT license
8+
*****************************************************************************************************************************/
9+
10+
// To demo how to include files in multi-file Projects
11+
12+
#include "multiFileProject.h"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/****************************************************************************************************************************
2+
multiFileProject.h
3+
For STM32F/L/H/G/WB/MP1 boards with stm32duino Arduino_Core_STM32 core
4+
Written by Khoi Hoang
5+
6+
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
7+
Licensed under MIT license
8+
*****************************************************************************************************************************/
9+
10+
// To demo how to include files in multi-file Projects
11+
12+
#pragma once
13+
14+
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
15+
#include "STM32_ISR_Servo.hpp"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/****************************************************************************************************************************
2+
multiFileProject.ino
3+
For STM32F/L/H/G/WB/MP1 boards with stm32duino Arduino_Core_STM32 core
4+
Written by Khoi Hoang
5+
6+
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
7+
Licensed under MIT license
8+
*****************************************************************************************************************************/
9+
10+
// To demo how to include files in multi-file Projects
11+
12+
#if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
13+
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
14+
defined(STM32WB) || defined(STM32MP1) || defined(STM32L5))
15+
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
16+
#endif
17+
18+
#define STM32_ISR_SERVO_VERSION_MIN_TARGET "STM32_ISR_Servo v1.1.0"
19+
#define STM32_ISR_SERVO_VERSION_MIN 1001000
20+
21+
#include "multiFileProject.h"
22+
23+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
24+
#include "STM32_ISR_Servo.h"
25+
26+
void setup()
27+
{
28+
Serial.begin(115200);
29+
while (!Serial);
30+
31+
Serial.println("\nStart multiFileProject");
32+
Serial.println(STM32_ISR_SERVO_VERSION);
33+
34+
#if defined(STM32_ISR_SERVO_VERSION_MIN)
35+
if (STM32_ISR_SERVO_VERSION_INT < STM32_ISR_SERVO_VERSION_MIN)
36+
{
37+
Serial.print("Warning. Must use this example on Version equal or later than : ");
38+
Serial.println(STM32_ISR_SERVO_VERSION_MIN_TARGET);
39+
}
40+
#endif
41+
}
42+
43+
void loop()
44+
{
45+
// put your main code here, to run repeatedly:
46+
}

0 commit comments

Comments
 (0)