Platform check on ADC interrupt. Fixes #59
This commit is contained in:
parent
6921107373
commit
6c8fbcf228
|
@ -2,6 +2,10 @@
|
||||||
#define GLOBALS_H
|
#define GLOBALS_H
|
||||||
#include <Arduino.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 ms_version = 20;
|
||||||
const byte signature = 20;
|
const byte signature = 20;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,9 @@
|
||||||
#define BARO_MIN 87
|
#define BARO_MIN 87
|
||||||
#define BARO_MAX 108
|
#define BARO_MAX 108
|
||||||
|
|
||||||
#define ANALOG_ISR
|
#if defined(CORE_AVR)
|
||||||
|
#define ANALOG_ISR
|
||||||
|
#endif
|
||||||
|
|
||||||
volatile byte flexCounter = 0;
|
volatile byte flexCounter = 0;
|
||||||
volatile int AnChannel[15];
|
volatile int AnChannel[15];
|
||||||
|
|
|
@ -16,7 +16,7 @@ Timers are typically low resolution (Compared to Schedulers), with maximum frequ
|
||||||
|
|
||||||
void initialiseTimers()
|
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.
|
//Configure Timer2 for our low-freq interrupt code.
|
||||||
TCCR2B = 0x00; //Disbale Timer2 while we set it up
|
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
|
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
|
||||||
|
|
Loading…
Reference in New Issue