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

Commit

Permalink
v1.2.1 to add support to Seeeduino nRF52
Browse files Browse the repository at this point in the history
### Releases v1.2.1

1. Add support to Seeeduino nRF52840-based boards such as **Seeed_XIAO_NRF52840 and Seeed_XIAO_NRF52840_SENSE**, etc. using Seeeduino `nRF52` core
2. Add astyle using `allman` style. Restyle the library
3. Update `Packages' Patches` to add Seeeduino `nRF52` core
  • Loading branch information
khoih-prog authored Oct 26, 2022
1 parent 473d2fe commit b954f20
Show file tree
Hide file tree
Showing 16 changed files with 276 additions and 141 deletions.
28 changes: 24 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
Please ensure to specify the following:

* Arduino IDE version (e.g. 1.8.19) or Platform.io version
* `NRF52` Core Version (e.g. Adafruit NRF52 core v1.3.0)
* `NRF52` Core Version (e.g. Adafruit NRF52 core v1.3.0, Seeed nRF52 core v1.0.0)
* Contextual information (e.g. what you were trying to achieve)
* Simplest possible steps to reproduce
* Anything that might be relevant in your opinion, such as:
Expand All @@ -27,12 +27,13 @@ Please ensure to specify the following:

```
Arduino IDE version: 1.8.19
Arduino NRF52 Core Version 1.3.0
Adafruit NRF52 Core Version 1.3.0
NRF52840_ITSYBITSY
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.13.0-40-generic #45~20.04.1-Ubuntu SMP Mon Apr 4 09:38:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Linux xy-Inspiron-3593 5.15.0-52-generic #58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Context:
I encountered a crash while trying to use the Timer Interrupt.
I encountered a crash while using this library
Steps to reproduce:
1. ...
Expand All @@ -41,13 +42,32 @@ Steps to reproduce:
4. ...
```

---

### Sending Feature Requests

Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.

There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/NRF52_ISR_Servo/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.

---

### Sending Pull Requests

Pull Requests with changes and fixes are also welcome!

Please use the `astyle` to reformat the updated library code as follows (demo for Ubuntu Linux)

1. Change directory to the library GitHub

```
xy@xy-Inspiron-3593:~$ cd Arduino/xy/NRF52_ISR_Servo_GitHub/
xy@xy-Inspiron-3593:~/Arduino/xy/NRF52_ISR_Servo_GitHub$
```

2. Issue astyle command

```
xy@xy-Inspiron-3593:~/Arduino/xy/NRF52_ISR_Servo_GitHub$ bash utils/restyle.sh
```

7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
## Table of Contents

* [Changelog](#changelog)
* [Releases v1.2.1](#releases-v121)
* [Releases v1.2.0](#releases-v120)
* [Releases v1.1.0](#releases-v110)
* [Releases v1.0.0](#releases-v100)
Expand All @@ -22,6 +23,12 @@

## Changelog

### Releases v1.2.1

1. Add support to Seeeduino nRF52840-based boards such as **Seeed_XIAO_NRF52840 and Seeed_XIAO_NRF52840_SENSE**, etc. using Seeeduino `nRF52` core
2. Add astyle using `allman` style. Restyle the library
3. Update `Packages' Patches` to add Seeeduino `nRF52` core

### Releases v1.2.0

1. Permit using servos with different pulse ranges simultaneously. Check [Fix Bug #5 : Permit using servos with different pulse ranges simultaneously #4](https://github.com/khoih-prog/RP2040_ISR_Servo/pull/4)
Expand Down
4 changes: 2 additions & 2 deletions examples/multiFileProject/multiFileProject.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/****************************************************************************************************************************
multiFileProject.cpp
For :
- nRF52832-based boards such as AdaFruit Feather nRF52832,
- nRF52832-based boards such as AdaFruit Feather nRF52832,
- nRF52840-based boards such as Adafruit nRF52840 Express, Itsy-Bitsy nRF52840 Express, NINA_B302_ublox, etc.
Written by Khoi Hoang
Built by Khoi Hoang https://github.com/khoih-prog/NRF52_ISR_Servo
Expand Down
4 changes: 2 additions & 2 deletions examples/multiFileProject/multiFileProject.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/****************************************************************************************************************************
multiFileProject.h
For :
- nRF52832-based boards such as AdaFruit Feather nRF52832,
- nRF52832-based boards such as AdaFruit Feather nRF52832,
- nRF52840-based boards such as Adafruit nRF52840 Express, Itsy-Bitsy nRF52840 Express, NINA_B302_ublox, etc.
Written by Khoi Hoang
Built by Khoi Hoang https://github.com/khoih-prog/NRF52_ISR_Servo
Expand Down
28 changes: 12 additions & 16 deletions examples/multiFileProject/multiFileProject.ino
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/****************************************************************************************************************************
multiFileProject.ino
For :
- nRF52832-based boards such as AdaFruit Feather nRF52832,
- nRF52832-based boards such as AdaFruit Feather nRF52832,
- nRF52840-based boards such as Adafruit nRF52840 Express, Itsy-Bitsy nRF52840 Express, NINA_B302_ublox, etc.
Written by Khoi Hoang
Built by Khoi Hoang https://github.com/khoih-prog/NRF52_ISR_Servo
Expand All @@ -12,39 +12,35 @@

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

#if !(defined(NRF52840_FEATHER) || defined(NRF52832_FEATHER) || defined(NRF52_SERIES) || defined(ARDUINO_NRF52_ADAFRUIT) || \
defined(NRF52840_FEATHER_SENSE) || defined(NRF52840_ITSYBITSY) || defined(NRF52840_CIRCUITPLAY) || \
defined(NRF52840_CLUE) || defined(NRF52840_METRO) || defined(NRF52840_PCA10056) || defined(PARTICLE_XENON) || \
defined(MDBT50Q_RX) || defined(NINA_B302_ublox) || defined(NINA_B112_ublox) )
#error This code is designed to run on nRF52 platform! Please check your Tools->Board setting.
#endif

#define NRF52_ISR_SERVO_VERSION_MIN_TARGET "NRF52_ISR_Servo v1.1.0"
#define NRF52_ISR_SERVO_VERSION_MIN 1001000
#define NRF52_ISR_SERVO_VERSION_MIN_TARGET "NRF52_ISR_Servo v1.2.1"
#define NRF52_ISR_SERVO_VERSION_MIN 1002001

#include "multiFileProject.h"

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

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

Serial.println("\nStart multiFileProject");

while (!Serial && millis() < 5000);

Serial.println("\nStart multiFileProjects on "); Serial.println(BOARD_NAME);
Serial.println(NRF52_ISR_SERVO_VERSION);

#if defined(NRF52_ISR_SERVO_VERSION_MIN)

if (NRF52_ISR_SERVO_VERSION_INT < NRF52_ISR_SERVO_VERSION_MIN)
{
Serial.print("Warning. Must use this example on Version equal or later than : ");
Serial.println(NRF52_ISR_SERVO_VERSION_MIN_TARGET);
}

#endif
}

void loop()
void loop()
{
// put your main code here, to run repeatedly:
}
43 changes: 20 additions & 23 deletions examples/nRF52_MultipleRandomServos/nRF52_MultipleRandomServos.ino
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/****************************************************************************************************************************
NRF52_MultipleRandomServos.ino
For :
- nRF52832-based boards such as AdaFruit Feather nRF52832,
- nRF52832-based boards such as AdaFruit Feather nRF52832,
- nRF52840-based boards such as Adafruit nRF52840 Express, Itsy-Bitsy nRF52840 Express, NINA_B302_ublox, etc.
Written by Khoi Hoang
Built by Khoi Hoang https://github.com/khoih-prog/NRF52_ISR_Servo
Expand All @@ -30,7 +30,7 @@
considerable power, we will connect servo power to the VBat pin of the NRF52 (located
near the USB connector). THIS IS ONLY APPROPRIATE FOR SMALL SERVOS.
We could also connect servo power to a separate external power source (as long as we connect all of
We could also connect servo power to a separate external power source (as long as we connect all of
the grounds (NRF52, servo, and external power).
In this example, we just connect NRF52 ground to servo ground. The servo signal pins
connect to any available GPIO pins on the NRF52 (in this example, we use pins (D1-D6).
Expand All @@ -42,21 +42,14 @@
Experimentally, 800 and 2450 are pretty close to 0 and 180.
*****************************************************************************************************************************/

#if !(defined(NRF52840_FEATHER) || defined(NRF52832_FEATHER) || defined(NRF52_SERIES) || defined(ARDUINO_NRF52_ADAFRUIT) || \
defined(NRF52840_FEATHER_SENSE) || defined(NRF52840_ITSYBITSY) || defined(NRF52840_CIRCUITPLAY) || \
defined(NRF52840_CLUE) || defined(NRF52840_METRO) || defined(NRF52840_PCA10056) || defined(PARTICLE_XENON) || \
defined(MDBT50Q_RX) || defined(NINA_B302_ublox) || defined(NINA_B112_ublox) )
#error This code is designed to run on nRF52 platform! Please check your Tools->Board setting.
#endif

#define TIMER_INTERRUPT_DEBUG 4
#define ISR_SERVO_DEBUG 4

#include "NRF52_ISR_Servo.h"

// Published values for SG90 servos; adjust if needed
#define MIN_MICROS 800
#define MAX_MICROS 2450
#define MAX_MICROS 2450

#define SERVO_PIN_1 A0
#define SERVO_PIN_2 A1
Expand All @@ -80,9 +73,10 @@ ISR_servo_t ISR_servo[] =


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

while (!Serial && millis() < 5000);

delay(200);

Expand All @@ -95,12 +89,14 @@ void setup()

if (ISR_servo[index].servoIndex != -1)
{
Serial.print(F("Setup OK Servo index = ")); Serial.println(ISR_servo[index].servoIndex);
Serial.print(F("Setup OK Servo index = "));
Serial.println(ISR_servo[index].servoIndex);
NRF52_ISR_Servos.setPosition(ISR_servo[index].servoIndex, 0);
}
else
{
Serial.print(F("Setup Failed Servo index = ")); Serial.println(ISR_servo[index].servoIndex);
Serial.print(F("Setup Failed Servo index = "));
Serial.println(ISR_servo[index].servoIndex);
}
}
}
Expand All @@ -121,41 +117,42 @@ void loop()

position = 0;
Serial.println(F("Servos @ 0 degree"));

for (int index = 0; index < NUM_SERVOS; index++)
{
NRF52_ISR_Servos.setPosition(ISR_servo[index].servoIndex, position );
printServoInfo(index);
}

// waits 5s between test
delay(5000);

position = 90;
Serial.println(F("Servos @ 90 degree"));

for (int index = 0; index < NUM_SERVOS; index++)
{
NRF52_ISR_Servos.setPosition(ISR_servo[index].servoIndex, position );
printServoInfo(index);
}

// waits 5s between test
delay(5000);

position = 180;
Serial.println(F("Servos @ 180 degree"));

for (int index = 0; index < NUM_SERVOS; index++)
{
NRF52_ISR_Servos.setPosition(ISR_servo[index].servoIndex, position );
printServoInfo(index);
}

// waits 5s between test
delay(5000);

Serial.println(F("Servos sweeps from 0-180 degree"));

for (position = 0; position <= 180; position += 5)
{
// goes from 0 degrees to 180 degrees
Expand All @@ -164,11 +161,11 @@ void loop()
{
NRF52_ISR_Servos.setPosition(ISR_servo[index].servoIndex, position );
}

// waits 0.1s for the servo to reach the position
delay(100);
}

// waits 5s between test
delay(5000);
}
28 changes: 12 additions & 16 deletions examples/nRF52_MultipleServos/nRF52_MultipleServos.ino
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/****************************************************************************************************************************
NRF52_MultipleServos.ino
For :
- nRF52832-based boards such as AdaFruit Feather nRF52832,
- nRF52832-based boards such as AdaFruit Feather nRF52832,
- nRF52840-based boards such as Adafruit nRF52840 Express, Itsy-Bitsy nRF52840 Express, NINA_B302_ublox, etc.
Written by Khoi Hoang
Built by Khoi Hoang https://github.com/khoih-prog/NRF52_ISR_Servo
Expand All @@ -30,7 +30,7 @@
considerable power, we will connect servo power to the VBat pin of the NRF52 (located
near the USB connector). THIS IS ONLY APPROPRIATE FOR SMALL SERVOS.
We could also connect servo power to a separate external power source (as long as we connect all of
We could also connect servo power to a separate external power source (as long as we connect all of
the grounds (NRF52, servo, and external power).
In this example, we just connect NRF52 ground to servo ground. The servo signal pins
connect to any available GPIO pins on the NRF52 (in this example, we use pins (D1-D6).
Expand All @@ -42,13 +42,6 @@
Experimentally, 800 and 2450 are pretty close to 0 and 180.
*****************************************************************************************************************************/

#if !(defined(NRF52840_FEATHER) || defined(NRF52832_FEATHER) || defined(NRF52_SERIES) || defined(ARDUINO_NRF52_ADAFRUIT) || \
defined(NRF52840_FEATHER_SENSE) || defined(NRF52840_ITSYBITSY) || defined(NRF52840_CIRCUITPLAY) || \
defined(NRF52840_CLUE) || defined(NRF52840_METRO) || defined(NRF52840_PCA10056) || defined(PARTICLE_XENON) || \
defined(MDBT50Q_RX) || defined(NINA_B302_ublox) || defined(NINA_B112_ublox) )
#error This code is designed to run on nRF52 platform! Please check your Tools->Board setting.
#endif

#define TIMER_INTERRUPT_DEBUG 1
#define ISR_SERVO_DEBUG 1

Expand Down Expand Up @@ -79,27 +72,30 @@ ISR_servo_t ISR_servo[] =
};

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

while (!Serial && millis() < 5000);

delay(200);

Serial.print(F("\nStarting NRF52_MultipleServos on ")); Serial.println(BOARD_NAME);
Serial.println(NRF52_ISR_SERVO_VERSION);

for (int index = 0; index < NUM_SERVOS; index++)
{
ISR_servo[index].servoIndex = NRF52_ISR_Servos.setupServo(ISR_servo[index].servoPin, MIN_MICROS, MAX_MICROS);

if (ISR_servo[index].servoIndex != -1)
{
Serial.print(F("Setup OK, Servo index = ")); Serial.println(ISR_servo[index].servoIndex);
Serial.print(F("Setup OK, Servo index = "));
Serial.println(ISR_servo[index].servoIndex);
NRF52_ISR_Servos.setPosition(ISR_servo[index].servoIndex, 0);
}
else
{
Serial.print(F("Setup Failed, Servo index = ")); Serial.println(ISR_servo[index].servoIndex);
Serial.print(F("Setup Failed, Servo index = "));
Serial.println(ISR_servo[index].servoIndex);
}
}
}
Expand All @@ -116,7 +112,7 @@ void loop()
{
NRF52_ISR_Servos.setPosition(ISR_servo[index].servoIndex, position);
}

// waits 1s for the servo to reach the position
delay(1000);
}
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "NRF52_ISR_Servo",
"version": "1.2.0",
"version": "1.2.1",
"keywords": "timing, device, control, timer, interrupt, isr, pwm, servo, isr-servo, hardware-timer, mission-critical, accuracy, precise, non-blocking, nrf52, nrf52840, nrf52832, feather-nrf52840, sparkfun-nrf52840, itsybitsy-nrf52840",
"description": "This library enables you to use 1 Hardware PWM module on nRF52832/nRF52840-based board, such as AdaFruit Feather nRF52832, nRF52840 Express, Itsy-Bitsy nRF52840 Express, etc. to control up to 16 or more servo motors.",
"authors":
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=NRF52_ISR_Servo
version=1.2.0
version=1.2.1
author=Khoi Hoang
maintainer=Khoi Hoang <khoih.prog@gmail.com>
license=MIT
Expand Down
Loading

0 comments on commit b954f20

Please sign in to comment.