This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.1.0 to convert to
h-only
style, etc.
### Releases v1.1.0 1. Convert to `h-only` style 2. Add example [multiFileProject](examples/multiFileProject) to demo for multiple-file project 3. Fix setPulseWidth() bug. Check [setPulseWidth - removed wrong map #2](#2) 4. Optimize code by using passing by `reference` instead of by `value`
- Loading branch information
1 parent
7495a44
commit 39e1604
Showing
5 changed files
with
98 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,13 +8,6 @@ | |
Built by Khoi Hoang https://github.com/khoih-prog/RP2040_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 | ||
*****************************************************************************************************************************/ | ||
|
||
/**************************************************************************************************************************** | ||
|
@@ -66,9 +59,9 @@ | |
#error This code is intended to run on the mbed / non-mbed RP2040 platform! Please check your Tools->Board setting. | ||
#endif | ||
|
||
#define TIMER_INTERRUPT_DEBUG 4 | ||
#define ISR_SERVO_DEBUG 4 | ||
|
||
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error | ||
#include "RP2040_ISR_Servo.h" | ||
|
||
// Published values for SG90 servos; adjust if needed | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,13 +8,6 @@ | |
Built by Khoi Hoang https://github.com/khoih-prog/RP2040_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 | ||
*****************************************************************************************************************************/ | ||
|
||
/**************************************************************************************************************************** | ||
|
@@ -66,9 +59,9 @@ | |
#error This code is intended to run on the mbed / non-mbed RP2040 platform! Please check your Tools->Board setting. | ||
#endif | ||
|
||
#define TIMER_INTERRUPT_DEBUG 4 | ||
#define ISR_SERVO_DEBUG 4 | ||
|
||
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error | ||
#include "RP2040_ISR_Servo.h" | ||
|
||
// Published values for SG90 servos; adjust if needed | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/**************************************************************************************************************************** | ||
multiFileProject.cpp | ||
RP2040_MultipleServos.ino | ||
For : | ||
- MBED RP2040-based boards such as Nano_RP2040_Connect, RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040. | ||
- RP2040-based boards such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040 using arduino_pico core | ||
Written by Khoi Hoang | ||
Built by Khoi Hoang https://github.com/khoih-prog/RP2040_ISR_Servo | ||
Licensed under MIT license | ||
*****************************************************************************************************************************/ | ||
|
||
// To demo how to include files in multi-file Projects | ||
|
||
#include "multiFileProject.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/**************************************************************************************************************************** | ||
multiFileProject.h | ||
RP2040_MultipleServos.ino | ||
For : | ||
- MBED RP2040-based boards such as Nano_RP2040_Connect, RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040. | ||
- RP2040-based boards such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040 using arduino_pico core | ||
Written by Khoi Hoang | ||
Built by Khoi Hoang https://github.com/khoih-prog/RP2040_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 "RP2040_ISR_Servo.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/**************************************************************************************************************************** | ||
multiFileProject.ino | ||
RP2040_MultipleServos.ino | ||
For : | ||
- MBED RP2040-based boards such as Nano_RP2040_Connect, RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040. | ||
- RP2040-based boards such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040 using arduino_pico core | ||
Written by Khoi Hoang | ||
Built by Khoi Hoang https://github.com/khoih-prog/RP2040_ISR_Servo | ||
Licensed under MIT license | ||
*****************************************************************************************************************************/ | ||
|
||
// To demo how to include files in multi-file Projects | ||
|
||
#if ( defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_ADAFRUIT_FEATHER_RP2040) || \ | ||
defined(ARDUINO_GENERIC_RP2040) ) && !defined(ARDUINO_ARCH_MBED) | ||
#if !defined(RP2040_ISR_SERVO_USING_MBED) | ||
#define RP2040_ISR_SERVO_USING_MBED false | ||
#endif | ||
|
||
#elif ( defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_ADAFRUIT_FEATHER_RP2040) || \ | ||
defined(ARDUINO_GENERIC_RP2040) ) && defined(ARDUINO_ARCH_MBED) | ||
|
||
#if !defined(RP2040_ISR_SERVO_USING_MBED) | ||
#define RP2040_ISR_SERVO_USING_MBED true | ||
#endif | ||
|
||
#else | ||
#error This code is intended to run on the mbed / non-mbed RP2040 platform! Please check your Tools->Board setting. | ||
#endif | ||
|
||
#define RP2040_ISR_SERVO_VERSION_MIN_TARGET "RP2040_ISR_Servo v1.1.0" | ||
#define RP2040_ISR_SERVO_VERSION_MIN 1001000 | ||
|
||
#include "multiFileProject.h" | ||
|
||
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error | ||
#include "RP2040_ISR_Servo.h" | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
while (!Serial); | ||
|
||
Serial.println("\nStart multiFileProject"); | ||
Serial.println(RP2040_ISR_SERVO_VERSION); | ||
|
||
#if defined(RP2040_ISR_SERVO_VERSION_MIN) | ||
if (RP2040_ISR_SERVO_VERSION_INT < RP2040_ISR_SERVO_VERSION_MIN) | ||
{ | ||
Serial.print("Warning. Must use this example on Version equal or later than : "); | ||
Serial.println(RP2040_ISR_SERVO_VERSION_MIN_TARGET); | ||
} | ||
#endif | ||
} | ||
|
||
void loop() | ||
{ | ||
// put your main code here, to run repeatedly: | ||
} |