mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-24 16:46:13 +01:00
It Compiles!
This commit is contained in:
parent
917fb569ba
commit
7259924466
|
@ -28,12 +28,10 @@
|
|||
// ATTENTION: this file only compiles on a STM32 based boards
|
||||
// Please refer to DCCTimer.h for general comments about how this class works
|
||||
// This is to avoid repetition and duplication.
|
||||
#ifdef ARDUINO_GIGA
|
||||
#if defined(ARDUINO_GIGA)
|
||||
|
||||
#include "DCCTimer.h"
|
||||
#ifdef DEBUG_ADC
|
||||
#include "TrackManager.h"
|
||||
#endif
|
||||
|
||||
#include "DIAG.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -196,6 +194,62 @@ void DCCTimer::reset() {
|
|||
WDT.CTRLA=0x4;
|
||||
while(true){}
|
||||
}*/
|
||||
INTERRUPT_CALLBACK interruptHandler=0;
|
||||
|
||||
|
||||
void DCCTimer::begin(INTERRUPT_CALLBACK callback) {
|
||||
interruptHandler=callback;
|
||||
noInterrupts();
|
||||
interrupts();
|
||||
}
|
||||
|
||||
bool DCCTimer::isPWMPin(byte pin) {
|
||||
(void) pin;
|
||||
return false; // TODO what are the relevant pins?
|
||||
}
|
||||
|
||||
void DCCTimer::setPWM(byte pin, bool high) {
|
||||
(void) pin;
|
||||
(void) high;
|
||||
// TODO what are the relevant pins?
|
||||
}
|
||||
|
||||
void DCCTimer::clearPWM() {
|
||||
// Do nothing unless we implent HA
|
||||
}
|
||||
|
||||
void DCCTimer::getSimulatedMacAddress(byte mac[6]) {
|
||||
volatile uint32_t *serno1 = (volatile uint32_t *)0x1FFF7A10;
|
||||
volatile uint32_t *serno2 = (volatile uint32_t *)0x1FFF7A14;
|
||||
// volatile uint32_t *serno3 = (volatile uint32_t *)0x1FFF7A18;
|
||||
|
||||
volatile uint32_t m1 = *serno1;
|
||||
volatile uint32_t m2 = *serno2;
|
||||
mac[0] = m1 >> 8;
|
||||
mac[1] = m1 >> 0;
|
||||
mac[2] = m2 >> 24;
|
||||
mac[3] = m2 >> 16;
|
||||
mac[4] = m2 >> 8;
|
||||
mac[5] = m2 >> 0;
|
||||
}
|
||||
volatile int DCCTimer::minimum_free_memory=__INT_MAX__;
|
||||
|
||||
// Return low memory value...
|
||||
int DCCTimer::getMinimumFreeMemory() {
|
||||
noInterrupts(); // Disable interrupts to get volatile value
|
||||
int retval = freeMemory();
|
||||
interrupts();
|
||||
return retval;
|
||||
}
|
||||
|
||||
int DCCTimer::freeMemory() {
|
||||
char top;
|
||||
return (int)(1024);
|
||||
}
|
||||
|
||||
void DCCTimer::reset() {
|
||||
// do nothing for now
|
||||
}
|
||||
|
||||
int16_t ADCee::ADCmax()
|
||||
{
|
||||
|
|
|
@ -510,7 +510,9 @@ void MotorDriver::getFastPin(const FSH* type,int pin, bool input, FASTPIN & res
|
|||
#if defined(ARDUINO_GIGA)
|
||||
(void)type;
|
||||
(void)input; // no warnings please
|
||||
|
||||
result = pin;
|
||||
|
||||
#else
|
||||
(void) type; // avoid compiler warning if diag not used above.
|
||||
#if defined(ARDUINO_ARCH_SAMD)
|
||||
|
|
|
@ -30,18 +30,17 @@
|
|||
// use powers of two so we can do logical and/or on the track modes in if clauses.
|
||||
enum TRACK_MODE : byte {TRACK_MODE_NONE = 1, TRACK_MODE_MAIN = 2, TRACK_MODE_PROG = 4,
|
||||
TRACK_MODE_DC = 8, TRACK_MODE_DCX = 16, TRACK_MODE_EXT = 32};
|
||||
#ifdef ARDUINO_GIGA
|
||||
//#include <pinDefinitions.h>
|
||||
//extern gpio_t digitalPinToGpio(int P);
|
||||
#define setHIGH(fastpin) digitalWrite(fastpin, 1)
|
||||
#define setLOW(fastpin) digitalWrite(fastpin, 0)
|
||||
#if defined(ARDUINO_GIGA)
|
||||
|
||||
#define setHIGH(fastpin) digitalWrite(fastpin,1)
|
||||
#define setLOW(fastpin) digitalWrite(fastpin,0)
|
||||
#else
|
||||
#define setHIGH(fastpin) *fastpin.inout |= fastpin.maskHIGH
|
||||
#define setLOW(fastpin) *fastpin.inout &= fastpin.maskLOW
|
||||
#endif
|
||||
#if defined(ARDUINO_GIGA)
|
||||
#define isHIGH(fastpin) (digitalRead(fastpin)==1)
|
||||
#define isLOW(fastpin) (digitalRead(fastpin)==0)
|
||||
#if defined(ARDUINO_GIGA)
|
||||
#define isHIGH(fastpin) ((PinStatus)digitalRead(fastpin)==1)
|
||||
#define isLOW(fastpin) ((PinStatus)digitalRead(fastpin)==0)
|
||||
#else
|
||||
#define isHIGH(fastpin) (*fastpin.inout & fastpin.maskHIGH)
|
||||
#define isLOW(fastpin) (!isHIGH(fastpin))
|
||||
|
@ -128,7 +127,7 @@ typedef uint8_t portreg_t;
|
|||
#endif
|
||||
|
||||
#if defined(ARDUINO_GIGA)
|
||||
typedef pin_size_t FASTPIN;
|
||||
typedef int FASTPIN;
|
||||
|
||||
|
||||
#else
|
||||
|
|
12
defines.h
12
defines.h
|
@ -148,17 +148,13 @@
|
|||
// #define I2C_USE_WIRE
|
||||
// #endif
|
||||
#elif defined(ARDUINO_ARCH_MBED_GIGA)
|
||||
#define ARDUINO_TYPE "ARDUINO_GIGA"
|
||||
#define ARDUINO_TYPE "Giga"
|
||||
#ifndef DISABLE_EEPROM
|
||||
#define DISABLE_EEPROM
|
||||
#endif
|
||||
//#ifndef ENABLE_ETHERNET
|
||||
//#define ENABLE_ETHERNET
|
||||
//#endif
|
||||
// STM32 support for native I2C is awaiting development
|
||||
// #ifndef I2C_USE_WIRE
|
||||
// #define I2C_USE_WIRE
|
||||
// #endif
|
||||
#if !defined(I2C_USE_WIRE)
|
||||
#define I2C_USE_WIRE
|
||||
#endif
|
||||
#define SDA I2C_SDA
|
||||
#define SCL I2C_SCL
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user