Platform check on ADC interrupt. Fixes #59

This commit is contained in:
Josh Stewart 2016-11-21 16:45:21 +11:00
parent 6921107373
commit 6c8fbcf228
3 changed files with 8 additions and 2 deletions

View File

@ -2,6 +2,10 @@
#define GLOBALS_H
#include <Arduino.h>
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)
#define CORE_AVR
#endif
//const byte ms_version = 20;
const byte signature = 20;

View File

@ -12,7 +12,9 @@
#define BARO_MIN 87
#define BARO_MAX 108
#define ANALOG_ISR
#if defined(CORE_AVR)
#define ANALOG_ISR
#endif
volatile byte flexCounter = 0;
volatile int AnChannel[15];

View File

@ -16,7 +16,7 @@ Timers are typically low resolution (Compared to Schedulers), with maximum frequ
void initialiseTimers()
{
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //AVR chips use the ISR for this
#if defined(CORE_AVR) //AVR chips use the ISR for this
//Configure Timer2 for our low-freq interrupt code.
TCCR2B = 0x00; //Disbale Timer2 while we set it up
TCNT2 = 131; //Preload timer2 with 131 cycles, leaving 125 till overflow. As the timer runs at 125Khz, this causes overflow to occur at 1Khz = 1ms