mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-23 16:16:13 +01:00
Fixes for compile arduino unowifi r2
This commit is contained in:
parent
d96c919fee
commit
b0388bfc67
|
@ -25,6 +25,17 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
int inline analogReadFast(uint8_t ADCpin);
|
int inline analogReadFast(uint8_t ADCpin);
|
||||||
|
#if defined(ARDUINO_AVR_UNO_WIFI_REV2)
|
||||||
|
|
||||||
|
int inline analogReadFast(uint8_t ADCpin)
|
||||||
|
{ byte ADC0CTRLCoriginal = ADC0.CTRLC;
|
||||||
|
ADC0.CTRLC = (ADC0CTRLCoriginal & 0b00110000) + 0b01000011;
|
||||||
|
int adc = analogRead(ADCpin);
|
||||||
|
ADC0.CTRLC = ADC0CTRLCoriginal;
|
||||||
|
return adc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
int inline analogReadFast(uint8_t ADCpin)
|
int inline analogReadFast(uint8_t ADCpin)
|
||||||
{ byte ADCSRAoriginal = ADCSRA;
|
{ byte ADCSRAoriginal = ADCSRA;
|
||||||
|
@ -33,5 +44,7 @@ int inline analogReadFast(uint8_t ADCpin)
|
||||||
ADCSRA = ADCSRAoriginal;
|
ADCSRA = ADCSRAoriginal;
|
||||||
return adc;
|
return adc;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // COMMANDSTATION_DCC_ANALOGREADFAST_H_
|
#endif
|
||||||
|
// COMMANDSTATION_DCC_ANALOGREADFAST_H_v
|
|
@ -11,7 +11,7 @@
|
||||||
#include "ATMEGA2560/Timer.h"
|
#include "ATMEGA2560/Timer.h"
|
||||||
#elif defined(ARDUINO_AVR_UNO)
|
#elif defined(ARDUINO_AVR_UNO)
|
||||||
#include "ATMEGA328/Timer.h"
|
#include "ATMEGA328/Timer.h"
|
||||||
#elif defined(ARDUINO_AVR_UNO_WIFI_DEV_ED)
|
#elif defined(ARDUINO_AVR_UNO_WIFI_REV2)
|
||||||
#include "ATMEGA4809/Timer.h"
|
#include "ATMEGA4809/Timer.h"
|
||||||
#else
|
#else
|
||||||
#error "Cannot compile - ArduinoTimers library does not support your board, or you are missing compatible build flags."
|
#error "Cannot compile - ArduinoTimers library does not support your board, or you are missing compatible build flags."
|
||||||
|
|
2
DCC.h
2
DCC.h
|
@ -155,7 +155,7 @@ private:
|
||||||
#define ARDUINO_TYPE "NANO"
|
#define ARDUINO_TYPE "NANO"
|
||||||
#elif defined(ARDUINO_AVR_MEGA2560)
|
#elif defined(ARDUINO_AVR_MEGA2560)
|
||||||
#define ARDUINO_TYPE "MEGA"
|
#define ARDUINO_TYPE "MEGA"
|
||||||
#elif defined(ARDUINO_AVR_UNO_WIFI_DEV_ED)
|
#elif defined(ARDUINO_AVR_UNO_WIFI_REV2)
|
||||||
#define ARDUINO_TYPE "UNOWIFIR2"
|
#define ARDUINO_TYPE "UNOWIFIR2"
|
||||||
#else
|
#else
|
||||||
#error CANNOT COMPILE - DCC++ EX ONLY WORKS WITH AN ARDUINO UNO, NANO 328, OR ARDUINO MEGA 1280/2560
|
#error CANNOT COMPILE - DCC++ EX ONLY WORKS WITH AN ARDUINO UNO, NANO 328, OR ARDUINO MEGA 1280/2560
|
||||||
|
|
|
@ -41,7 +41,7 @@ void DCCWaveform::begin(MotorDriver * mainDriver, MotorDriver * progDriver, byte
|
||||||
progTrack.setPowerMode(POWERMODE::OFF);
|
progTrack.setPowerMode(POWERMODE::OFF);
|
||||||
switch (timerNumber) {
|
switch (timerNumber) {
|
||||||
case 1: interruptTimer= &TimerA; break;
|
case 1: interruptTimer= &TimerA; break;
|
||||||
#ifndef ARDUINO_AVR_UNO_WIFI_DEV_ED
|
#ifndef ARDUINO_AVR_UNO_WIFI_REV2
|
||||||
case 2: interruptTimer= &TimerB; break;
|
case 2: interruptTimer= &TimerB; break;
|
||||||
#ifndef ARDUINO_AVR_UNO
|
#ifndef ARDUINO_AVR_UNO
|
||||||
case 3: interruptTimer= &TimerC; break;
|
case 3: interruptTimer= &TimerC; break;
|
||||||
|
|
12
Timer.cpp
12
Timer.cpp
|
@ -49,4 +49,14 @@ ISR(TIMER2_OVF_vect)
|
||||||
TimerB.isrCallback();
|
TimerB.isrCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#elif defined(ARDUINO_AVR_UNO_WIFI_REV2)
|
||||||
|
|
||||||
|
#include "ATMEGA4809/Timer.h"
|
||||||
|
|
||||||
|
Timer TimerA(0);
|
||||||
|
|
||||||
|
ISR(TCA0_OVF_vect) {
|
||||||
|
TimerA.isrCallback();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -65,6 +65,7 @@ lib_deps =
|
||||||
mathertel/LiquidCrystal_PCF8574
|
mathertel/LiquidCrystal_PCF8574
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
monitor_flags = --echo
|
monitor_flags = --echo
|
||||||
|
build_flags = "-DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO_WIFI_DEV_ED -DARDUINO_ARCH_AVR -DESP_CH_UART -DESP_CH_UART_BR=19200"g
|
||||||
|
|
||||||
[env:uno]
|
[env:uno]
|
||||||
platform = atmelavr
|
platform = atmelavr
|
||||||
|
|
Loading…
Reference in New Issue
Block a user