/// <summary> /// Leaves sleep mode. /// </summary> /// <remarks> /// Clears the <see cref="Pca9685Register.Mode1"/> register <see cref="Pca9685Mode1Bits.Sleep"/> bit /// then waits for <see cref="ModeSwitchDelay"/> to allow the oscillator to start. /// </remarks> /// <returns> /// True when mode was changed, false when not sleeping. /// </returns> public bool Wake() { // Read sleep bit (do nothing when already sleeping) var sleeping = I2cExtensions.WriteReadBit(_hardware, (byte)Pca9685Register.Mode1, (byte)Pca9685Mode1Bits.Sleep); if (!sleeping) { return(false); } // Clear sleep bit I2cExtensions.WriteReadWriteBit(_hardware, (byte)Pca9685Register.Mode1, (byte)Pca9685Mode1Bits.Sleep, false); // Wait for completion Task.Delay(ModeSwitchDelay).Wait(); // Update related properties ReadMode1(); // Return changed return(true); }