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

maybe it all works

This commit is contained in:
travis-farmer 2023-10-24 10:11:55 -04:00
parent 84b6207988
commit 8bbe30e789

View File

@ -160,15 +160,16 @@ void DCCTimer::reset() {
//while(true) {}; //while(true) {};
} }
int * ADCee::analogvals = NULL;
int16_t ADCee::ADCmax() int16_t ADCee::ADCmax()
{ {
return 1023; return 1023;
} }
int retBuff[2];
AdvancedADC adc(A0, A1); AdvancedADC adc(A0, A1);
int ADCee::init(uint8_t pin) { int ADCee::init(uint8_t pin) {
adc.begin(AN_RESOLUTION_10, 16000, 1, 512);
adc.begin(AN_RESOLUTION_10, 16000, 1, 128);
return 123; return 123;
} }
@ -176,24 +177,13 @@ int ADCee::init(uint8_t pin) {
* Read function ADCee::read(pin) to get value instead of analogRead(pin) * Read function ADCee::read(pin) to get value instead of analogRead(pin)
*/ */
int ADCee::read(uint8_t pin, bool fromISR) { int ADCee::read(uint8_t pin, bool fromISR) {
int retVal = 0; static SampleBuffer buf = adc.read();
int retVal = -123;
if (adc.available()) { if (adc.available()) {
SampleBuffer buf = adc.read();
switch(pin){
case A0:
retVal = buf[0];
break;
case A1:
retVal = buf[1];
break;
default:
retVal = -1023;
break;
}
buf.release(); buf.release();
buf = adc.read();
} }
//DIAG(F("retVal: %d"),retVal); return (buf[pin - A0]);
return retVal;
} }
/* /*