mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-02-21 08:16:04 +01:00
protect analogvals read from interrupt
This commit is contained in:
parent
9b04cd791b
commit
96f47bf44f
@ -169,9 +169,13 @@ int16_t ADCee::ADCmax() {
|
||||
int ADCee::read(uint8_t pin, bool fromISR) {
|
||||
(void)fromISR; // AVR does ignore this arg
|
||||
uint8_t id = pin - A0;
|
||||
int a;
|
||||
// we do not need to check (analogvals == NULL)
|
||||
// because usedpins would still be 0 in that case
|
||||
return analogvals[id];
|
||||
noInterrupts();
|
||||
a = analogvals[id];
|
||||
interrupts();
|
||||
return a;
|
||||
}
|
||||
/*
|
||||
* Scan function that is called from interrupt
|
||||
|
Loading…
Reference in New Issue
Block a user