mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-24 08:36:14 +01:00
maybe it all works
This commit is contained in:
parent
84b6207988
commit
8bbe30e789
|
@ -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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user