1
0
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:
travis-farmer 2023-10-21 04:10:50 -04:00
parent 917fb569ba
commit 7259924466
4 changed files with 72 additions and 21 deletions

View File

@ -28,12 +28,10 @@
// ATTENTION: this file only compiles on a STM32 based boards // ATTENTION: this file only compiles on a STM32 based boards
// Please refer to DCCTimer.h for general comments about how this class works // Please refer to DCCTimer.h for general comments about how this class works
// This is to avoid repetition and duplication. // This is to avoid repetition and duplication.
#ifdef ARDUINO_GIGA #if defined(ARDUINO_GIGA)
#include "DCCTimer.h" #include "DCCTimer.h"
#ifdef DEBUG_ADC
#include "TrackManager.h"
#endif
#include "DIAG.h" #include "DIAG.h"
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
@ -196,6 +194,62 @@ void DCCTimer::reset() {
WDT.CTRLA=0x4; WDT.CTRLA=0x4;
while(true){} 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() int16_t ADCee::ADCmax()
{ {

View File

@ -510,7 +510,9 @@ void MotorDriver::getFastPin(const FSH* type,int pin, bool input, FASTPIN & res
#if defined(ARDUINO_GIGA) #if defined(ARDUINO_GIGA)
(void)type; (void)type;
(void)input; // no warnings please (void)input; // no warnings please
result = pin; result = pin;
#else #else
(void) type; // avoid compiler warning if diag not used above. (void) type; // avoid compiler warning if diag not used above.
#if defined(ARDUINO_ARCH_SAMD) #if defined(ARDUINO_ARCH_SAMD)

View File

@ -30,9 +30,8 @@
// use powers of two so we can do logical and/or on the track modes in if clauses. // 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, 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}; TRACK_MODE_DC = 8, TRACK_MODE_DCX = 16, TRACK_MODE_EXT = 32};
#ifdef ARDUINO_GIGA #if defined(ARDUINO_GIGA)
//#include <pinDefinitions.h>
//extern gpio_t digitalPinToGpio(int P);
#define setHIGH(fastpin) digitalWrite(fastpin,1) #define setHIGH(fastpin) digitalWrite(fastpin,1)
#define setLOW(fastpin) digitalWrite(fastpin,0) #define setLOW(fastpin) digitalWrite(fastpin,0)
#else #else
@ -40,8 +39,8 @@ enum TRACK_MODE : byte {TRACK_MODE_NONE = 1, TRACK_MODE_MAIN = 2, TRACK_MODE_PRO
#define setLOW(fastpin) *fastpin.inout &= fastpin.maskLOW #define setLOW(fastpin) *fastpin.inout &= fastpin.maskLOW
#endif #endif
#if defined(ARDUINO_GIGA) #if defined(ARDUINO_GIGA)
#define isHIGH(fastpin) (digitalRead(fastpin)==1) #define isHIGH(fastpin) ((PinStatus)digitalRead(fastpin)==1)
#define isLOW(fastpin) (digitalRead(fastpin)==0) #define isLOW(fastpin) ((PinStatus)digitalRead(fastpin)==0)
#else #else
#define isHIGH(fastpin) (*fastpin.inout & fastpin.maskHIGH) #define isHIGH(fastpin) (*fastpin.inout & fastpin.maskHIGH)
#define isLOW(fastpin) (!isHIGH(fastpin)) #define isLOW(fastpin) (!isHIGH(fastpin))
@ -128,7 +127,7 @@ typedef uint8_t portreg_t;
#endif #endif
#if defined(ARDUINO_GIGA) #if defined(ARDUINO_GIGA)
typedef pin_size_t FASTPIN; typedef int FASTPIN;
#else #else

View File

@ -148,17 +148,13 @@
// #define I2C_USE_WIRE // #define I2C_USE_WIRE
// #endif // #endif
#elif defined(ARDUINO_ARCH_MBED_GIGA) #elif defined(ARDUINO_ARCH_MBED_GIGA)
#define ARDUINO_TYPE "ARDUINO_GIGA" #define ARDUINO_TYPE "Giga"
#ifndef DISABLE_EEPROM #ifndef DISABLE_EEPROM
#define DISABLE_EEPROM #define DISABLE_EEPROM
#endif #endif
//#ifndef ENABLE_ETHERNET #if !defined(I2C_USE_WIRE)
//#define ENABLE_ETHERNET #define I2C_USE_WIRE
//#endif #endif
// STM32 support for native I2C is awaiting development
// #ifndef I2C_USE_WIRE
// #define I2C_USE_WIRE
// #endif
#define SDA I2C_SDA #define SDA I2C_SDA
#define SCL I2C_SCL #define SCL I2C_SCL