Skip to content

Commit

Permalink
fixed bug that prevented use of servo
Browse files Browse the repository at this point in the history
Had to chase down places where servo.h was tested
  • Loading branch information
biomurph committed Mar 4, 2024
1 parent 38f55fa commit 6aad52f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=PulseSensor Playground
version=2.1.0
version=2.1.1
author=Joel Murphy, Yury Gitman, Brad Needham
maintainer=Joel Murphy, Yury Gitman
sentence=Support at PulseSensor.com
Expand Down
12 changes: 6 additions & 6 deletions src/PulseSensorPlayground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ bool PulseSensorPlayground::setupInterrupt(){
#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)

// check to see if the Servo library is in use
#if defined Servo_h
#if __has_include (<Servo.h>)
// Initializes Timer2 to throw an interrupt every 2mS
// Interferes with PWM on pins 3 and 11
#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__)
Expand Down Expand Up @@ -396,7 +396,7 @@ bool PulseSensorPlayground::setupInterrupt(){
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)

// check to see if the Servo library is in use
#if defined Servo_h
#if __has_include (<Servo.h>)
// Initializes Timer1 to throw an interrupt every 2mS.
// Interferes with PWM on pins 9 and 10
TCCR1A = 0x00; // Disable PWM and go into CTC mode
Expand Down Expand Up @@ -519,7 +519,7 @@ bool PulseSensorPlayground::enableInterrupt(){
#if USE_HARDWARE_TIMER
#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)
// check to see if the Servo library is in use
#if defined Servo_h
#if __has_include (<Servo.h>)
#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__)
DISABLE_PULSE_SENSOR_INTERRUPTS;
TIMSK2 = 0x02; // Enable OCR2A match interrupt
Expand All @@ -541,7 +541,7 @@ bool PulseSensorPlayground::enableInterrupt(){

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
// check to see if the Servo library is in use
#if defined Servo_h
#if __has_include (<Servo.h>)
DISABLE_PULSE_SENSOR_INTERRUPTS;
TIMSK1 = 0x02; // Enable OCR1A match interrupt
ENABLE_PULSE_SENSOR_INTERRUPTS;
Expand Down Expand Up @@ -602,7 +602,7 @@ bool PulseSensorPlayground::disableInterrupt(){
#if USE_HARDWARE_TIMER
#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)
// check to see if the Servo library is in use
#if defined Servo_h
#if __has_include (<Servo.h>)
#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__)
DISABLE_PULSE_SENSOR_INTERRUPTS;
TIMSK2 = 0x00; // Disable OCR2A match interrupt
Expand All @@ -624,7 +624,7 @@ bool PulseSensorPlayground::disableInterrupt(){

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
// check to see if the Servo library is in use
#if defined Servo_h
#if __has_include (<Servo.h>)
DISABLE_PULSE_SENSOR_INTERRUPTS;
TIMSK1 = 0x00; // Disable OCR1A match interrupt
ENABLE_PULSE_SENSOR_INTERRUPTS;
Expand Down

0 comments on commit 6aad52f

Please sign in to comment.