Removed 'new' from PinChangeInt library

As a consequence, only one pin is currently suppored.
AddPin will not really add a new pin, just replace the configuration
of the existing pin.

The motivation for this limitation is that 'new' costs a lot of
program memory.
This commit is contained in:
Patrick Fallberg
2015-03-16 23:15:55 +01:00
parent 6fd26880a2
commit 6fb7266752
+4 -2
View File
@@ -234,6 +234,7 @@ protected:
volatile uint8_t portFallingPins;
volatile uint8_t lastPinView;
PCintPin* firstPin;
PCintPin thePin;
};
#ifndef LIBCALL_PINCHANGEINT // LIBCALL_PINCHANGEINT ***********************************************
@@ -388,8 +389,9 @@ int8_t PCintPort::addPin(uint8_t arduinoPin, PCIntvoidFuncPtr userFunc, uint8_t
} while (true);
}
// Create pin p: fill in the data.
PCintPin* p=new PCintPin;
// Create pin p: fill in the data. NOTE: MySensors only support one pin due to size constraints
// TODO: Figure out a better way to solve this without relying on new/malloc
PCintPin* p = &thePin; //PCintPin* p=new PCintPin;
if (p == NULL) return(-1);
p->arduinoPin=arduinoPin;
p->mode = mode;