Sfoglia il codice sorgente

Straighten poweredCount logic for i2c

tags/v1.2.0
Bertrand Lemasle 6 anni fa
parent
commit
0ec46f7699
1 ha cambiato i file con 5 aggiunte e 4 eliminazioni
  1. +5
    -4
      Hardware.cpp

+ 5
- 4
Hardware.cpp Vedi File

@@ -120,9 +120,9 @@ namespace hardware {
pinMode(I2C_PWR, OUTPUT);

Wire.begin();
poweredCount = 1;
}

poweredCount++;
else poweredCount++;
}

void powerOff(bool forced = false) {
@@ -137,9 +137,10 @@ namespace hardware {
//disable i2c internal pull ups
digitalWrite(A4, LOW);
digitalWrite(A5, LOW);
}

poweredCount--;
poweredCount = 0;
}
else if(poweredCount > 1) poweredCount--; //avoid decrement if == 0
}
}
}

Caricamento…
Annulla
Salva