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 style, etc.
Browse files Browse the repository at this point in the history
### 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
khoih-prog authored Feb 28, 2022
1 parent 7495a44 commit 39e1604
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
*****************************************************************************************************************************/

/****************************************************************************************************************************
Expand Down Expand Up @@ -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
Expand Down
9 changes: 1 addition & 8 deletions examples/RP2040_MultipleServos/RP2040_MultipleServos.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
*****************************************************************************************************************************/

/****************************************************************************************************************************
Expand Down Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions examples/multiFileProject/multiFileProject.cpp
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"
19 changes: 19 additions & 0 deletions examples/multiFileProject/multiFileProject.h
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"
61 changes: 61 additions & 0 deletions examples/multiFileProject/multiFileProject.ino
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:
}

0 comments on commit 39e1604

Please sign in to comment.