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

Commit

Permalink
v1.1.0 to convert to h-only library, etc
Browse files Browse the repository at this point in the history
### 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
  • Loading branch information
khoih-prog authored Mar 7, 2022
1 parent 8f8f550 commit 9dd199d
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 80 deletions.
14 changes: 1 addition & 13 deletions examples/ISR_MultiServos/ISR_MultiServos.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,6 @@
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
Licensed under MIT license
Based on SimpleTimer - A timer library for Arduino.
Author: [email protected]
Copyright (c) 2010 OTTOTECNICA Italy
Based on BlynkTimer.h
Author: Volodymyr Shymanskyy
Version: 1.0.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 15/08/2021 Initial coding for STM32F/L/H/G/WB/MP1
*****************************************************************************************************************************/

/****************************************************************************************************************************
Expand Down Expand Up @@ -61,6 +48,7 @@
#define TIMER_INTERRUPT_DEBUG 0
#define ISR_SERVO_DEBUG 1

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

// Default is TIMER_SERVO (TIM7 for many boards)
Expand Down
14 changes: 1 addition & 13 deletions examples/MultipleRandomServos/MultipleRandomServos.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,6 @@
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
Licensed under MIT license
Based on SimpleTimer - A timer library for Arduino.
Author: [email protected]
Copyright (c) 2010 OTTOTECNICA Italy
Based on BlynkTimer.h
Author: Volodymyr Shymanskyy
Version: 1.0.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 15/08/2021 Initial coding for STM32F/L/H/G/WB/MP1
*****************************************************************************************************************************/

/****************************************************************************************************************************
Expand Down Expand Up @@ -61,6 +48,7 @@
#define TIMER_INTERRUPT_DEBUG 0
#define ISR_SERVO_DEBUG 1

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

// Default is TIMER_SERVO (TIM7 for many boards)
Expand Down
14 changes: 1 addition & 13 deletions examples/MultipleServos/MultipleServos.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,6 @@
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
Licensed under MIT license
Based on SimpleTimer - A timer library for Arduino.
Author: [email protected]
Copyright (c) 2010 OTTOTECNICA Italy
Based on BlynkTimer.h
Author: Volodymyr Shymanskyy
Version: 1.0.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 15/08/2021 Initial coding for STM32F/L/H/G/WB/MP1
*****************************************************************************************************************************/

/****************************************************************************************************************************
Expand Down Expand Up @@ -61,6 +48,7 @@
#define TIMER_INTERRUPT_DEBUG 0
#define ISR_SERVO_DEBUG 1

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

// Default is TIMER_SERVO (TIM7 for many boards)
Expand Down
14 changes: 1 addition & 13 deletions examples/STM32_ISR_MultiServos/STM32_ISR_MultiServos.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,6 @@
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
Licensed under MIT license
Based on SimpleTimer - A timer library for Arduino.
Author: [email protected]
Copyright (c) 2010 OTTOTECNICA Italy
Based on BlynkTimer.h
Author: Volodymyr Shymanskyy
Version: 1.0.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 15/08/2021 Initial coding for STM32F/L/H/G/WB/MP1
*****************************************************************************************************************************/

/****************************************************************************************************************************
Expand Down Expand Up @@ -61,6 +48,7 @@
#define TIMER_INTERRUPT_DEBUG 0
#define ISR_SERVO_DEBUG 1

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

// Default is TIMER_SERVO (TIM7 for many boards)
Expand Down
18 changes: 3 additions & 15 deletions examples/STM32_MultipleRandomServos/STM32_MultipleRandomServos.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,6 @@
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
Licensed under MIT license
Based on SimpleTimer - A timer library for Arduino.
Author: [email protected]
Copyright (c) 2010 OTTOTECNICA Italy
Based on BlynkTimer.h
Author: Volodymyr Shymanskyy
Version: 1.0.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 15/08/2021 Initial coding for STM32F/L/H/G/WB/MP1
*****************************************************************************************************************************/
/****************************************************************************************************************************
From ESP32 Servo Example Using Arduino ESP32 Servo Library
Expand Down Expand Up @@ -60,6 +47,7 @@
#define TIMER_INTERRUPT_DEBUG 0
#define ISR_SERVO_DEBUG 1

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

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

#define SERVO_PIN_1 D1
#define SERVO_PIN_2 D2
#define SERVO_PIN_1 PA_0 //D1
#define SERVO_PIN_2 PA_1 //D2
#define SERVO_PIN_3 D3
#define SERVO_PIN_4 D4
#define SERVO_PIN_5 D5
Expand Down
14 changes: 1 addition & 13 deletions examples/STM32_MultipleServos/STM32_MultipleServos.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,6 @@
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
Licensed under MIT license
Based on SimpleTimer - A timer library for Arduino.
Author: [email protected]
Copyright (c) 2010 OTTOTECNICA Italy
Based on BlynkTimer.h
Author: Volodymyr Shymanskyy
Version: 1.0.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 15/08/2021 Initial coding for STM32F/L/H/G/WB/MP1
*****************************************************************************************************************************/

/****************************************************************************************************************************
Expand Down Expand Up @@ -61,6 +48,7 @@
#define TIMER_INTERRUPT_DEBUG 0
#define ISR_SERVO_DEBUG 1

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

// Default is TIMER_SERVO (TIM7 for many boards)
Expand Down
Binary file not shown.
12 changes: 12 additions & 0 deletions examples/multiFileProject/multiFileProject.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/****************************************************************************************************************************
multiFileProject.cpp
For STM32F/L/H/G/WB/MP1 boards with stm32duino Arduino_Core_STM32 core
Written by Khoi Hoang
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
Licensed under MIT license
*****************************************************************************************************************************/

// To demo how to include files in multi-file Projects

#include "multiFileProject.h"
15 changes: 15 additions & 0 deletions examples/multiFileProject/multiFileProject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/****************************************************************************************************************************
multiFileProject.h
For STM32F/L/H/G/WB/MP1 boards with stm32duino Arduino_Core_STM32 core
Written by Khoi Hoang
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
Licensed under MIT license
*****************************************************************************************************************************/

// To demo how to include files in multi-file Projects

#pragma once

// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
#include "STM32_ISR_Servo.hpp"
46 changes: 46 additions & 0 deletions examples/multiFileProject/multiFileProject.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/****************************************************************************************************************************
multiFileProject.ino
For STM32F/L/H/G/WB/MP1 boards with stm32duino Arduino_Core_STM32 core
Written by Khoi Hoang
Built by Khoi Hoang https://github.com/khoih-prog/STM32_ISR_Servo
Licensed under MIT license
*****************************************************************************************************************************/

// To demo how to include files in multi-file Projects

#if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
defined(STM32WB) || defined(STM32MP1) || defined(STM32L5))
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
#endif

#define STM32_ISR_SERVO_VERSION_MIN_TARGET "STM32_ISR_Servo v1.1.0"
#define STM32_ISR_SERVO_VERSION_MIN 1001000

#include "multiFileProject.h"

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

void setup()
{
Serial.begin(115200);
while (!Serial);

Serial.println("\nStart multiFileProject");
Serial.println(STM32_ISR_SERVO_VERSION);

#if defined(STM32_ISR_SERVO_VERSION_MIN)
if (STM32_ISR_SERVO_VERSION_INT < STM32_ISR_SERVO_VERSION_MIN)
{
Serial.print("Warning. Must use this example on Version equal or later than : ");
Serial.println(STM32_ISR_SERVO_VERSION_MIN_TARGET);
}
#endif
}

void loop()
{
// put your main code here, to run repeatedly:
}

0 comments on commit 9dd199d

Please sign in to comment.