Skip to content

Commit

Permalink
Merge pull request #280 from gergelytakacs/mega_timers_fix
Browse files Browse the repository at this point in the history
noServo sampling for MEGA fix
  • Loading branch information
gergelytakacs authored Jul 13, 2021
2 parents 225e62f + 96eb129 commit 509d9b7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Sampling.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ SamplingNoServo::SamplingClass Sampling;
#include "sampling/SamplingUNO_ISR.h"

#elif ARDUINO_AVR_MEGA2560
#define MEGA_ISR_VECT TIMER5_COMPA_vect
#include "sampling/SamplingMEGA_ISR.h"

#elif (defined(ARDUINO_SAMD_ZERO) || defined(ADAFRUIT_METRO_M4_EXPRESS))
Expand Down
1 change: 1 addition & 0 deletions src/SamplingServo.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ SamplingServo::SamplingClass Sampling;
#include "sampling/SamplingUNO_ISR.h"

#elif ARDUINO_AVR_MEGA2560
#define MEGA_ISR_VECT TIMER2_COMPA_vect
#include "sampling/SamplingMEGA_ISR.h"

#elif (defined(ARDUINO_SAMD_ZERO) || defined(ADAFRUIT_METRO_M4_EXPRESS))
Expand Down
2 changes: 1 addition & 1 deletion src/sampling/SamplingMEGA_ISR.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifndef SAMPLINGMEGA_ISR_H
#define SAMPLINGMEGA_ISR_H

ISR(TIMER2_COMPA_vect)
ISR(MEGA_ISR_VECT)
{
if (!Sampling.fireFlag){ // If not over the maximal resolution of the counter
(Sampling.getInterruptCallback())(); // Start the interrupt callback
Expand Down

0 comments on commit 509d9b7

Please sign in to comment.