1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-24 16:46:13 +01:00

doesn't work, gonna commit before i try a new path

This commit is contained in:
travis-farmer 2023-10-23 15:50:02 -04:00
parent bbca4379d2
commit 0a63befee9

View File

@ -47,6 +47,7 @@ INTERRUPT_CALLBACK interruptHandler=0;
//HardwareTimer* timerAux = NULL; //HardwareTimer* timerAux = NULL;
HardwareTimer timer(TIM2); HardwareTimer timer(TIM2);
HardwareTimer timerAux(TIM3); HardwareTimer timerAux(TIM3);
static bool tim2ModeHA = false; static bool tim2ModeHA = false;
static bool tim3ModeHA = false; static bool tim3ModeHA = false;
@ -166,9 +167,9 @@ int16_t ADCee::ADCmax()
} }
int ADCee::init(uint8_t pin) { int ADCee::init(uint8_t pin) {
analogReadResolution(12);
//DIAG(F("ADCee Init: current val:%d"),analogRead(pin));
return analogRead(pin); return 123; // random number, faked for now
} }
/* /*
@ -180,13 +181,13 @@ int ADCee::read(uint8_t pin, bool fromISR) {
//if (!fromISR) noInterrupts(); //if (!fromISR) noInterrupts();
//current = analogRead(pin); //current = analogRead(pin);
//if (!fromISR) interrupts(); //if (!fromISR) interrupts();
PinName name = analogPinToPinName(pin);
mbed::AnalogIn* adc = analogPinToAdcObj(pin); mbed::AnalogIn* adc = analogPinToAdcObj(pin);
if (adc == NULL) { if (adc == NULL) {
adc = new mbed::AnalogIn(name); adc = new mbed::AnalogIn(analogPinToPinName(pin));
analogPinToAdcObj(pin) = adc; analogPinToAdcObj(pin) = adc;
} }
return (adc->read_u16() >> (16 - 12)); return (int)(adc->read_u16() >> (16 - 10));
} }
/* /*