mirror of
https://github.com/wled/WLED.git
synced 2025-07-25 03:36:45 +00:00
remove getReadOnlyPins() function
This commit is contained in:
parent
9bb979f2e8
commit
d79d5dbadd
@ -267,26 +267,17 @@ bool PinManagerClass::isPinOk(byte gpio, bool output) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned *PinManagerClass::getReadOnlyPins()
|
|
||||||
{
|
|
||||||
#ifdef READ_ONLY_PINS
|
|
||||||
static unsigned readOnlyPins[] = {READ_ONLY_PINS};
|
|
||||||
#else
|
|
||||||
static unsigned readOnlyPins[] = {255};
|
|
||||||
#endif
|
|
||||||
return readOnlyPins;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PinManagerClass::isReadOnlyPin(byte gpio)
|
bool PinManagerClass::isReadOnlyPin(byte gpio)
|
||||||
{
|
{
|
||||||
const unsigned* pins = PinManagerClass::getReadOnlyPins();
|
#ifdef READ_ONLY_PINS
|
||||||
const unsigned numPins = (sizeof *pins) / (sizeof pins[0]);
|
const unsigned pins[] = {READ_ONLY_PINS};
|
||||||
|
const unsigned numPins = ((sizeof pins) / (sizeof pins[0]));
|
||||||
|
|
||||||
for (unsigned i = 0; i < numPins; i++) {
|
if (gpio <= WLED_NUM_PINS) {
|
||||||
if (pins[i] == gpio) {
|
for (unsigned i = 0; i < numPins; i++) if (gpio == pins[i]) return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,8 +111,7 @@ class PinManagerClass {
|
|||||||
bool isPinAllocated(byte gpio, PinOwner tag = PinOwner::None) const;
|
bool isPinAllocated(byte gpio, PinOwner tag = PinOwner::None) const;
|
||||||
// will return false for reserved pins
|
// will return false for reserved pins
|
||||||
bool isPinOk(byte gpio, bool output = true) const;
|
bool isPinOk(byte gpio, bool output = true) const;
|
||||||
|
|
||||||
static unsigned* getReadOnlyPins();
|
|
||||||
static bool isReadOnlyPin(byte gpio);
|
static bool isReadOnlyPin(byte gpio);
|
||||||
|
|
||||||
PinOwner getPinOwner(byte gpio) const;
|
PinOwner getPinOwner(byte gpio) const;
|
||||||
|
@ -191,14 +191,14 @@ void appendGPIOinfo() {
|
|||||||
|
|
||||||
// add info for read-only GPIO
|
// add info for read-only GPIO
|
||||||
oappend(SET_F("d.ro_gpio=["));
|
oappend(SET_F("d.ro_gpio=["));
|
||||||
const unsigned* readOnlyPins = pinManager.getReadOnlyPins();
|
bool firstPin = true;
|
||||||
const unsigned numReadOnlyPins = (sizeof *readOnlyPins) / (sizeof readOnlyPins[0]);
|
for (unsigned i = 0; i < WLED_NUM_PINS; i++) {
|
||||||
for (unsigned i = 0; i < numReadOnlyPins; i++) {
|
if (pinManager.isReadOnlyPin(i)) {
|
||||||
// Ignore 255
|
// No comma before the first pin
|
||||||
if (readOnlyPins[i] <= WLED_NUM_PINS) {
|
if (!firstPin) oappend(SET_F(","));
|
||||||
oappendi(readOnlyPins[i]);
|
oappendi(i);
|
||||||
if (i != numReadOnlyPins) oappend(SET_F(","));
|
firstPin = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
oappend(SET_F("];"));
|
oappend(SET_F("];"));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user